60 lines
1.6 KiB
C#
60 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
using System.Runtime.Serialization;
|
|
using System.Runtime.Serialization.Formatters.Binary;
|
|
using System.IO;
|
|
|
|
namespace Matomat
|
|
{
|
|
class Helper
|
|
{
|
|
|
|
}
|
|
public static class String
|
|
{
|
|
public static byte[] ToCharArray(this string str, string search, byte[] replace)
|
|
{
|
|
byte[] ret = new byte[str.Length];
|
|
for (int i = 0; i < str.Length; i++)
|
|
{
|
|
if (search.IndexOf(str.Substring(i, 1)) != -1)
|
|
{
|
|
ret[i] = replace[search.IndexOf(str.Substring(i, 1))];
|
|
}
|
|
else
|
|
{
|
|
ret[i] = Convert.ToByte(Convert.ToChar(str.Substring(i, 1)));
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
}
|
|
public static class Array
|
|
{
|
|
public static byte[] Substring(this byte[] b, int start, int length)
|
|
{
|
|
byte[] ret = new byte[b.Length - start];
|
|
for (int i = start; (i < b.Length && i < start + length); i++)
|
|
{
|
|
ret[i - start] = b[i];
|
|
}
|
|
return ret;
|
|
}
|
|
public static byte[] Substring(this byte[] b, int start)
|
|
{
|
|
return b.Substring(start, b.Length);
|
|
}
|
|
}
|
|
public static class Double
|
|
{
|
|
public static string ToString(this double d, int f)
|
|
{
|
|
return "1.00";
|
|
}
|
|
}
|
|
|
|
}
|