-
Notifications
You must be signed in to change notification settings - Fork 4
Implement model, reader, wrapper for valve SKU sis files. #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mnadareski
merged 8 commits into
SabreTools:main
from
HeroponRikiBestest:steam-try-again
Jan 29, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
0fa2991
Try again
HeroponRikiBestest 199ab64
Fix import alphebetization
HeroponRikiBestest 9e4969a
Fixes.
HeroponRikiBestest 3047688
first part of first attempt at a model
HeroponRikiBestest 38484b0
Reimplement Sku Sis parsing
HeroponRikiBestest 64626b1
First round of fixes
HeroponRikiBestest 8995ab3
Make sure stream isn't closed
HeroponRikiBestest 7fe4cc9
Missed this newline
HeroponRikiBestest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| using System.IO; | ||
| using System.Linq; | ||
| using SabreTools.Serialization.Readers; | ||
| using Xunit; | ||
|
|
||
| namespace SabreTools.Serialization.Test.Readers | ||
| { | ||
| public class SkuSisTests | ||
| { | ||
| [Fact] | ||
| public void NullArray_Null() | ||
| { | ||
| byte[]? data = null; | ||
| int offset = 0; | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void EmptyArray_Null() | ||
| { | ||
| byte[]? data = []; | ||
| int offset = 0; | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidArray_Null() | ||
| { | ||
| byte[]? data = [.. Enumerable.Repeat<byte>(0xFF, 1024)]; | ||
| int offset = 0; | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void NullStream_Null() | ||
| { | ||
| Stream? data = null; | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void EmptyStream_Null() | ||
| { | ||
| Stream? data = new MemoryStream([]); | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidStream_Null() | ||
| { | ||
| Stream? data = new MemoryStream([.. Enumerable.Repeat<byte>(0xFF, 1024)]); | ||
| var deserializer = new SkuSis(); | ||
|
|
||
| var actual = deserializer.Deserialize(data); | ||
| Assert.Null(actual); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| using System.IO; | ||
| using System.Linq; | ||
| using SabreTools.Serialization.Wrappers; | ||
| using Xunit; | ||
|
|
||
| namespace SabreTools.Serialization.Test.Wrappers | ||
| { | ||
| public class SkuSisTests | ||
| { | ||
| [Fact] | ||
| public void NullArray_Null() | ||
| { | ||
| byte[]? data = null; | ||
| int offset = 0; | ||
| var actual = SkuSis.Create(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void EmptyArray_Null() | ||
| { | ||
| byte[]? data = []; | ||
| int offset = 0; | ||
| var actual = SkuSis.Create(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidArray_Null() | ||
| { | ||
| byte[]? data = [.. Enumerable.Repeat<byte>(0xFF, 1024)]; | ||
| int offset = 0; | ||
| var actual = SkuSis.Create(data, offset); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void NullStream_Null() | ||
| { | ||
| Stream? data = null; | ||
| var actual = SkuSis.Create(data); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void EmptyStream_Null() | ||
| { | ||
| Stream? data = new MemoryStream([]); | ||
| var actual = SkuSis.Create(data); | ||
| Assert.Null(actual); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void InvalidStream_Null() | ||
| { | ||
| Stream? data = new MemoryStream([.. Enumerable.Repeat<byte>(0xFF, 1024)]); | ||
| var actual = SkuSis.Create(data); | ||
| Assert.Null(actual); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| namespace SabreTools.Data.Models.VDF | ||
| { | ||
| public static class Constants | ||
| { | ||
| /// <summary> | ||
| /// Top-level item (and thus also first 5 bytes) of Steam2 (sis/sim/sid) retail installers | ||
| /// </summary> | ||
| public static readonly byte[] SteamSimSidSisSignatureBytes = [0x22, 0x53, 0x4B, 0x55, 0x22]; // "SKU" | ||
|
|
||
| public static readonly string SteamSimSidSisSignatureString = "\"SKU\""; | ||
|
|
||
| /// <summary> | ||
| /// Top-level item (and thus also first 5 bytes) of Steam3 (sis/csm/csd) retail installers | ||
| /// </summary> | ||
| public static readonly byte[] SteamCsmCsdSisSignatureBytes = [0x22, 0x73, 0x6B, 0x75, 0x22]; // "sku" | ||
|
|
||
| public static readonly string SteamCsmCsdSisSignatureString = "\"sku\""; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,158 @@ | ||
| using System.Collections.Generic; | ||
| using Newtonsoft.Json; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace SabreTools.Data.Models.VDF | ||
| { | ||
| /// <summary> | ||
| /// Contains metadata information about retail Steam discs | ||
| /// Stored in a VDF file on the disc | ||
| /// </summary> | ||
| /// <remarks>Stored in the order it appears in the sku sis file, as it is always the same order.</remarks> | ||
| [JsonObject] | ||
| public class Sku | ||
| { | ||
| // At the moment, the only keys that matter for anything in SabreTools are sku, apps, depots, and manifests | ||
| // TODO: check case sensitivity | ||
| #region Non-Arrays | ||
|
|
||
| /// <summary> | ||
| /// "name" | ||
| /// Name of the disc/app | ||
| /// Known values: Arbitrary string | ||
| /// </summary> | ||
| [JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)] | ||
| public string? Name { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "productname" | ||
| /// productname of the retail installer | ||
| /// Known values: Arbitrary string | ||
| /// </summary> | ||
| /// <remarks>sim/sid only</remarks> | ||
| [JsonProperty("productname", NullValueHandling = NullValueHandling.Ignore)] | ||
| public string? ProductName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "subscriptionID" | ||
| /// subscriptionID of the retail installer | ||
| /// Known values: Arbitrary number | ||
| /// </summary> | ||
| /// <remarks>sim/sid only</remarks> | ||
| [JsonProperty("subscriptionID", NullValueHandling = NullValueHandling.Ignore)] | ||
| public long? SubscriptionId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "appID" | ||
| /// AppID of the retail installer | ||
| /// Known values: Arbitrary number | ||
| /// </summary> | ||
| /// <remarks>sim/sid only. Both appID and AppID seem to be used in practice.</remarks> | ||
| [JsonProperty("appID", NullValueHandling = NullValueHandling.Ignore)] | ||
| public long? AppId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "disks" | ||
| /// Number of discs of the retail installer set | ||
| /// Known values: 1-5? 10? Unsure what the most discs in a steam retail installer is currently known to be | ||
| /// </summary> | ||
| [JsonProperty("disks", NullValueHandling = NullValueHandling.Ignore)] | ||
| public uint? Disks { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "language" | ||
| /// language of the retail installer | ||
| /// Known values: english, russian | ||
| /// </summary> | ||
| /// <remarks>sim/sid only</remarks> | ||
| [JsonProperty("language", NullValueHandling = NullValueHandling.Ignore)] | ||
| public string? Language { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "disk" | ||
| /// Numbered disk of the retail installer set | ||
| /// Known values: 1-5? 10? Unsure what the most discs in a steam retail installer is currently known to be | ||
| /// </summary> | ||
| /// <remarks>csm/csd only</remarks> | ||
| [JsonProperty("disk", NullValueHandling = NullValueHandling.Ignore)] | ||
| public uint? Disk { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "backup" | ||
| /// Unknown. This is probably a boolean? | ||
| /// Known values: 0 | ||
| /// </summary> | ||
| [JsonProperty("backup", NullValueHandling = NullValueHandling.Ignore)] | ||
| public uint? Backup { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "contenttype" | ||
| /// Unknown. | ||
| /// Known values: 3 | ||
| /// </summary> | ||
| [JsonProperty("contenttype", NullValueHandling = NullValueHandling.Ignore)] | ||
| public uint? ContentType { get; set; } | ||
|
|
||
| #endregion | ||
|
|
||
| // When VDF has an array, they represent it like this, with the left numbers being indexes: | ||
| /// "1" "1056577072" | ||
| /// "2" "1056702256" | ||
| /// "3" "1056203136" | ||
| /// etc. | ||
| /// The following format is also used like this, although this isn't one that needs to be parsed right now. | ||
| /// Currently unsure what the first number means. Maybe this is a two dimensional array? | ||
| /// "1 0" "1493324560" | ||
| /// "1 1" "1492884912" | ||
| /// "1 2" "1492755784" | ||
| /// "1 3" "28749920" | ||
| #region Arrays | ||
|
|
||
| /// <summary> | ||
| /// "apps" | ||
| /// AppIDs contained on the disc. | ||
| /// Known values: arbitrary | ||
| /// </summary> | ||
| /// <remarks>On csm/csd discs, both are used interchangeably, but never at the same time. It's usually still lowercase though. | ||
| /// It always seems to be lowercase on sim/sid discs</remarks> | ||
| [JsonProperty("apps", NullValueHandling = NullValueHandling.Ignore)] | ||
| public Dictionary<long, long>? Apps { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "depots" | ||
| /// DepotIDs contained on the disc. | ||
| /// Known values: arbitrary | ||
| /// </summary> | ||
| [JsonProperty("depots", NullValueHandling = NullValueHandling.Ignore)] | ||
| public Dictionary<long, long>? Depots { get; set; } | ||
|
|
||
| // The "packages" property should go here, but it uses the second array format mentioned above, so it's more | ||
| // difficult to adapt. Since it's not needed at the moment anyways, it's left out for now. | ||
|
|
||
| /// <summary> | ||
| /// "manifests" | ||
| /// DepotIDs contained on the disc. | ||
| /// Known values: arbitrary pairs of DepotID - Manifest | ||
| /// </summary> | ||
| [JsonProperty("manifests", NullValueHandling = NullValueHandling.Ignore)] | ||
| public Dictionary<long, long>? Manifests { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// "chunkstores" | ||
| /// chunkstores contained on the disc. | ||
| /// Known values: DepotIDs containing arrays of chunkstores. | ||
| /// </summary> | ||
| /// <remarks>These are indexed from 1 instead of 0 for some reason.</remarks> | ||
| /// TODO: not that it really matters, but will this parse the internal values recursively properly? | ||
| [JsonProperty("chunkstores", NullValueHandling = NullValueHandling.Ignore)] | ||
| public Dictionary<long, Dictionary<long, long>?>? Chunkstores { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// All remaining data not matched above. | ||
| /// </summary> | ||
| [JsonExtensionData] | ||
| public IDictionary<string, JToken>? EverythingElse { get; set; } | ||
|
|
||
| #endregion | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| using System.Collections.Generic; | ||
| using Newtonsoft.Json; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace SabreTools.Data.Models.VDF | ||
| { | ||
| /// <summary> | ||
| /// Contains metadata information about retail Steam discs | ||
| /// Stored in a VDF file on the disc | ||
| /// </summary> | ||
| /// <remarks>Stored in the order it appears in the sku sis file, as it is always the same order.</remarks> | ||
| [JsonObject] | ||
| public class SkuSis | ||
| { | ||
| // At the moment, the only keys that matter for anything in SabreTools are sku, apps, depots, and manifests | ||
| // TODO: check case sensitivity | ||
| #region Non-Arrays | ||
|
|
||
| /// <summary> | ||
| /// "sku" | ||
| /// Top-level value for sku.sis files. | ||
| /// Known values: the entire sku.sis object | ||
| /// </summary> | ||
| /// <remarks>capital SKU on sim/sid, lowercase sku on csm/csd</remarks> | ||
| [JsonProperty("sku", NullValueHandling = NullValueHandling.Ignore)] | ||
| public Sku? Sku { get; set; } | ||
|
|
||
| #endregion | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.