Skip to content
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

Make DepotManifest constructor public #841

Merged
merged 1 commit into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions SteamKit2/SteamKit2/Types/DepotManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,16 @@ internal FileData(string filename, EDepotFileFlag flag, ulong size, byte[] hash,

internal DepotManifest(byte[] data)
{
Deserialize(data);
InternalDeserialize(data);
}

/// <summary>
/// Initializes a new instance of the <see cref="DepotManifest"/> class.
/// Depot manifests may come from the Steam CDN or from Steam/depotcache/ manifest files.
/// </summary>
/// <param name="data">Raw depot manifest data to deserialize.</param>
/// <exception cref="InvalidDataException">Thrown if the given data is not something recognizable.</exception>
public static DepotManifest Deserialize(byte[] data) => new DepotManifest(data);

/// <summary>
/// Attempts to decrypts file names with the given encryption key.
Expand Down Expand Up @@ -191,7 +198,7 @@ public bool DecryptFilenames(byte[] encryptionKey)
return true;
}

void Deserialize(byte[] data)
void InternalDeserialize(byte[] data)
{
ContentManifestPayload? payload = null;
ContentManifestMetadata? metadata = null;
Expand Down Expand Up @@ -241,7 +248,7 @@ void Deserialize(byte[] data)
break;

default:
throw new NotImplementedException( string.Format( "Unrecognized magic value {0:X} in depot manifest.", magic ) );
throw new InvalidDataException( $"Unrecognized magic value {magic:X} in depot manifest." );
}
}
}
Expand Down