Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private ushort ReadUShort(FileStream FST, bool revers)
- {
- byte[] buf = ReadBytes(FST, 2);
- if (buf == null) return 0;
- if (revers) Array.Reverse(buf);
- return BitConverter.ToUInt16(buf,0);
- }
- private uint ReadUInt(FileStream FST, bool revers)
- {
- byte[] buf = ReadBytes(FST, 4);
- if (buf == null) return 0;
- if (revers) Array.Reverse(buf);
- return BitConverter.ToUInt32(buf, 0);
- }
- private string BytesToString(byte[] bytes)
- {
- //Преобразует массив байт в однобайтовую строку
- // (1251, но для данных целей кодировка не важна)
- if (bytes == null) return null;
- return Encoding.GetEncoding(1251).GetString(bytes);
- }
- private DateTime UnixTimeToDateTime(ulong UnixTime)
- {
- DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0);
- return origin.AddSeconds(UnixTime);
- }
- private string GetVersion(byte ver)
- {
- string v = ver.ToString();
- if (ver < 10) return v;
- v = v.Insert(v.Length - 1, ".");
- return v;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement