public SkyrimSavegame Read(String label, FileStream fileStream) { br = new SkyrimBinaryReader(fileStream); char[] magic = br.ReadChars(13); UInt32 headerSize = br.ReadUInt32(); Print("magic", new string(magic)); Print("headerSize", headerSize); Header header = ReadHeader(); header.Print(); ReadScreenshot(header); byte formVersion = br.ReadByte(); //uint8 UInt32 pluginInfoSize = br.ReadUInt32(); Print("formVersion", formVersion); Print("pluginInfoSize", pluginInfoSize); //PluginInfo pluginInfo = ReadPluginInfo(); //skip pluginInfo br.ReadBytes((int)pluginInfoSize); FileLocationTable fileLocationTable = ReadFileLocationTable(); fileLocationTable.Print(); GlobalDataType[] globalDataTable1 = ReadGlobalDataTable(9); //Types 0 to 8. //GlobalDataType[] globalDataTable2 = ReadGlobalDataTable(15); //Types 100 to 114. SkyrimSavegame savegame = new SkyrimSavegame(label); savegame.header = header; savegame.formVersion = formVersion; savegame.fileLocationTable = fileLocationTable; savegame.globalDataTable1 = globalDataTable1; //savegame.globalDataTable2 = globalDataTable2; foreach (var ms in savegame.GetMiscStats().OrderBy(p => p.category).ThenBy(n => n.name)) { Print("stats", "cat({0}).{1} = {2}", ms.category, ms.name, ms.value); } return(savegame); }
private FileLocationTable ReadFileLocationTable() { FileLocationTable flt = new FileLocationTable(); flt.formIDArrayCount = br.ReadUInt32(); flt.unknownTable3Offset = br.ReadUInt32(); flt.globalDataTable1Offset = br.ReadUInt32(); flt.globalDataTable2Offset = br.ReadUInt32(); flt.changedFormsOffset = br.ReadUInt32(); flt.globalDataTable3Offset = br.ReadUInt32(); flt.globalDataTable1Count = br.ReadUInt32(); flt.globalDataTable2Count = br.ReadUInt32(); flt.globalDataTable3Count = br.ReadUInt32(); flt.changedFormCount = br.ReadUInt32(); flt.unused = new uint[15]; for (int i = 0; i < flt.unused.Length; i++) { flt.unused[i] = br.ReadUInt32(); } return(flt); }