public static string ReadStringFromFile(ref RWStream file) { if (file.Length - file.Position < 4) { return(""); } int strLength = file.ReadInt32(); return(strLength == -1 || strLength == 0 ? "" : file.ReadString(StringType.Ascii, strLength).TrimEnd(new[] { '\0' })); }
private void DeserlizeFile() { RawFile._index = -1; RawFile.ReadString();//magic number Name = RawFile.ReadString(); Style = RawFile.ReadByte(); Size = (short)RawFile.ReadInt32(); CharsCount = RawFile.ReadInt32(); for (int i = 0; i < CharsCount; i++) { Char.Add((char)RawFile.ReadByte()); Width.Add(RawFile.ReadByte()); Height.Add(RawFile.ReadByte()); var l = RawFile.ReadInt32(); var data = new List <byte>(); for (int dat = 0; dat < l; dat++) { data.Add(RawFile.ReadByte()); } Data.Add(data.ToArray()); } }