public static string GetString(Stream input, int length) { using (var br = new BinaryReaderX(input, true)) { var encoding = new CustomEncoding(); return(encoding.GetString(br.ReadBytes(length))); } }
public static byte[] GetBytes(string text) { var encoding = new CustomEncoding(); var byteCount = encoding.GetByteCount(text); var bytes = encoding.GetBytes(text); bytes.ToList().RemoveRange(byteCount, bytes.Length - byteCount); return(bytes); }