public static SteamPackageInfoDataFile Read(string steamShortcutFilePath) { using (FileStream stream = File.OpenRead(steamShortcutFilePath)) using (BinaryReader reader = new BinaryReader(stream)) { List <SteamPackageInfoDataFileChunk> Chunks = new List <SteamPackageInfoDataFileChunk>(); byte Version1 = reader.ReadByte(); UInt16 Type = reader.ReadUInt16(); byte Version2 = reader.ReadByte(); UInt32 Version3 = reader.ReadUInt32(); //while(reader.BaseStream.Position < reader.BaseStream.Length) for (;;) { UInt32 PackageID = reader.ReadUInt32(); if (PackageID == 0xffffffff) { break; } byte[] Checksum = reader.ReadBytes(20); UInt32 LastChangeNumber = reader.ReadUInt32(); BVPropertyCollection Data = BVdfFile.ReadPropertyArray(reader); SteamPackageInfoDataFileChunk Chunk = new SteamPackageInfoDataFileChunk(PackageID, Checksum, LastChangeNumber, Data); Chunks.Add(Chunk); } return(new SteamPackageInfoDataFile(Version1, Type, Version2, Version3, Chunks)); } }
public static BVPropertyCollection Read(string steamShortcutFilePath) { using (FileStream stream = File.OpenRead(steamShortcutFilePath)) using (BinaryReader reader = new BinaryReader(stream)) { return(BVdfFile.ReadPropertyArray(reader)); } }
public static SteamAppInfoDataFile Read(string steamShortcutFilePath) { using (FileStream stream = File.OpenRead(steamShortcutFilePath)) using (BinaryReader reader = new BinaryReader(stream)) { List <SteamAppInfoDataFileChunk> Chunks = new List <SteamAppInfoDataFileChunk>(); byte Version1 = reader.ReadByte(); UInt16 Type = reader.ReadUInt16(); byte Version2 = reader.ReadByte(); UInt32 Version3 = reader.ReadUInt32(); //while(reader.BaseStream.Position < reader.BaseStream.Length) for (;;) { UInt32 AppID = reader.ReadUInt32(); if (AppID == 0) { break; } UInt32 DataSize = reader.ReadUInt32(); long startPos = reader.BaseStream.Position; //Console.WriteLine($"Expected End Position: {(startPos + DataSize):X8}"); UInt32 State = reader.ReadUInt32(); UInt32 LastUpdate = reader.ReadUInt32(); UInt64 AccessToken = reader.ReadUInt64(); byte[] Checksum = reader.ReadBytes(20); UInt32 LastChangeNumber = reader.ReadUInt32(); BVPropertyCollection Data = BVdfFile.ReadPropertyArray(reader); //long endPos = reader.BaseStream.Position; if (reader.BaseStream.Position != (startPos + DataSize)) { Console.WriteLine("appinfo.vdf chunk data size wrong, adjusting stream position"); reader.BaseStream.Seek(startPos + DataSize, SeekOrigin.Begin); } //Console.WriteLine($"*Expected End Position: {(startPos + DataSize):X8}"); //Console.WriteLine($"End Position: {(endPos):X8}"); SteamAppInfoDataFileChunk Chunk = new SteamAppInfoDataFileChunk(AppID, State, LastUpdate, AccessToken, Checksum, LastChangeNumber, Data); Chunks.Add(Chunk); } return(new SteamAppInfoDataFile(Version1, Type, Version2, Version3, Chunks)); } }