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);
        }
        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 Header ReadHeader()
        {
            Header h = new Header();

            h.version            = br.ReadUInt32();
            h.saveNumber         = br.ReadUInt32();
            h.playerName         = br.ReadWString();
            h.playerLevel        = br.ReadUInt32();
            h.playerLocation     = br.ReadWString();
            h.gameDate           = br.ReadWString();
            h.playerRaceEditorID = br.ReadWString();

            h.unknown1        = br.ReadUInt16();
            h.unknown2float32 = br.ReadBytes(4);
            h.unknown3float32 = br.ReadBytes(4);

            h.filetime = new FILETIME();
            h.filetime.dwLowDateTime  = br.ReadInt32();
            h.filetime.dwHighDateTime = br.ReadInt32();

            h.shotWidth  = br.ReadUInt32();
            h.shotHeight = br.ReadUInt32();

            return(h);
        }