public void Parse(GffField fld) { if (fld.Type != GffType.CExoLocString) { throw new ApplicationException("Impossible de parser ce type " + Enum.GetName(typeof(GffType), fld.Type) + " en ExoLocString."); } var br = new LatinBinaryReader(new MemoryStream(fld.Bytes)); _strref = (int)br.ReadUInt32(); var strcount = br.ReadUInt32(); _dic = new Dictionary <int, string>((int)strcount); for (var i = 0; i < strcount; i++) { var id = br.ReadInt32(); var size = br.ReadInt32(); _dic.Add(id, new string(br.ReadChars(size))); } }
public readonly int OffsetToResourceList; //32 bit from beginning of file, see figure above //const int ReservedSize = 116; public ErfHeader(LatinBinaryReader br) { var pos = br.Stream.Position; br.Stream.Position = 0; var fileType = new string(br.ReadChars(TypeLength)); if (fileType == "ERF " || fileType == "MOD " || fileType == "SAV " || fileType == "HAK ") { //Version = new string(br.ReadChars(VersionLength)); br.ReadChars(VersionLength); LanguageCount = br.ReadInt32(); //LocalizedStringSize = br.ReadInt32(); br.ReadInt32(); EntryCount = br.ReadInt32(); OffsetToLocalizedString = br.ReadInt32(); OffsetToKeyList = br.ReadInt32(); OffsetToResourceList = br.ReadInt32(); //BuildYear = br.ReadInt32(); //BuildDay = br.ReadInt32(); //DescriptionStrRef = br.ReadInt32(); //Reserved = br.ReadBytes(ReservedSize); } else { throw new ApplicationException("Le fichier n'est pas un fichier ERF valide."); } br.Stream.Position = pos; }