-
Notifications
You must be signed in to change notification settings - Fork 53
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
Index files from Steam #2385
Index files from Steam #2385
Changes from all commits
47595e6
669d794
f52f6a9
c6d7703
49b3d9c
c90d121
eb32afd
ed8f39f
d64c215
f734e43
b58d349
05e5f85
0c20eb3
fd26dc2
869a959
752486b
6815ce4
f6e59ce
782c74f
a5dd382
6cca217
71c769a
f2b3e6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using NexusMods.Abstractions.Steam.Values; | ||
|
||
namespace NexusMods.Abstractions.Steam.DTOs; | ||
|
||
/// <summary> | ||
/// Information about a depot on Steam. | ||
/// </summary> | ||
public class Depot | ||
{ | ||
/// <summary> | ||
/// The OSes that the depot is available on. | ||
/// </summary> | ||
public required string[] OsList { get; init; } | ||
|
||
/// <summary> | ||
/// The id of the depot. | ||
/// </summary> | ||
public required DepotId DepotId { get; init; } | ||
|
||
/// <summary> | ||
/// The manifests associated with the depot, with a key for each available branch | ||
/// </summary> | ||
public required Dictionary<string, ManifestInfo> Manifests { get; init; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
using NexusMods.Abstractions.Hashes; | ||
using NexusMods.Abstractions.Steam.Values; | ||
using NexusMods.Paths; | ||
|
||
namespace NexusMods.Abstractions.Steam.DTOs; | ||
|
||
/// <summary> | ||
/// A full, detailed manifest for a specific manifest id | ||
/// </summary> | ||
public class Manifest | ||
{ | ||
/// <summary> | ||
/// The gid of the manifest | ||
/// </summary> | ||
public required ManifestId ManifestId { get; init; } | ||
|
||
/// <summary> | ||
/// The files in the manifest | ||
/// </summary> | ||
public required FileData[] Files { get; init; } | ||
|
||
/// <summary> | ||
/// The depot id of the manifest | ||
/// </summary> | ||
public required DepotId DepotId { get; init; } | ||
|
||
/// <summary> | ||
/// The time the manifest was created | ||
/// </summary> | ||
public required DateTimeOffset CreationTime { get; init; } | ||
|
||
/// <summary> | ||
/// The size of all files in the manifest, compressed | ||
/// </summary> | ||
public required Size TotalCompressedSize { get; init; } | ||
|
||
/// <summary> | ||
/// The size of all files in the manifest, uncompressed | ||
/// </summary> | ||
public required Size TotalUncompressedSize { get; init; } | ||
|
||
public class FileData | ||
{ | ||
/// <summary> | ||
/// The name of the file | ||
/// </summary> | ||
public RelativePath Path { get; init; } | ||
|
||
/// <summary> | ||
/// The size of the file, compressed | ||
/// </summary> | ||
public Size Size { get; init; } | ||
Comment on lines
+49
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other types have both compressed and decompressed sizes, for consistency this should be named There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm matching what SteamKit provides here, I don't mind changing it, but then we'd be out-of-sync with the "official" source There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd be happy if we have something that is consistent internally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See the comment on the other section |
||
|
||
/// <summary> | ||
/// The Sha1 hash of the file | ||
/// </summary> | ||
public required Sha1 Hash { get; init; } | ||
|
||
/// <summary> | ||
/// The chunks of the file | ||
/// </summary> | ||
public required Chunk[] Chunks { get; init; } | ||
} | ||
|
||
public class Chunk | ||
{ | ||
/// <summary> | ||
/// The id of the chunk | ||
/// </summary> | ||
public required Sha1 ChunkId { get; init; } | ||
|
||
/// <summary> | ||
/// The crc32 checksum of the chunk | ||
/// </summary> | ||
public required Crc32 Checksum { get; init; } | ||
|
||
/// <summary> | ||
/// The offset of the chunk in the resulting file | ||
/// </summary> | ||
public required ulong Offset { get; init; } | ||
|
||
/// <summary> | ||
/// The size of the chunk, compressed | ||
/// </summary> | ||
public required Size CompressedSize { get; init; } | ||
|
||
/// <summary> | ||
/// The size of the chunk, uncompressed | ||
/// </summary> | ||
public required Size UncompressedSize { get; init; } | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using NexusMods.Abstractions.Steam.Values; | ||
using NexusMods.Paths; | ||
|
||
namespace NexusMods.Abstractions.Steam.DTOs; | ||
|
||
/// <summary> | ||
/// Meta information about a manifest, not the actual contents, just the id | ||
/// and the size of the files in aggregate. | ||
/// </summary> | ||
public class ManifestInfo | ||
{ | ||
/// <summary> | ||
/// The globally unique identifier of the manifest. | ||
/// </summary> | ||
public required ManifestId ManifestId { get; init; } | ||
|
||
/// <summary> | ||
/// The size of the downloaded files, decompressed | ||
/// </summary> | ||
public required Size Size { get; init; } | ||
|
||
/// <summary> | ||
/// The size of the files, compressed | ||
/// </summary> | ||
public required Size DownloadSize { get; init; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using NexusMods.Abstractions.Steam.Values; | ||
|
||
namespace NexusMods.Abstractions.Steam.DTOs; | ||
|
||
/// <summary> | ||
/// Information about a product (a game) on Steam. | ||
/// </summary> | ||
public class ProductInfo | ||
{ | ||
/// <summary> | ||
/// The revision number of this product info. | ||
/// </summary> | ||
public required uint ChangeNumber { get; init; } | ||
|
||
/// <summary> | ||
/// The app id of the product. | ||
/// </summary> | ||
public required AppId AppId { get; init; } | ||
|
||
/// <summary> | ||
/// The depots of the product. | ||
/// </summary> | ||
public required Depot[] Depots { get; init; } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace NexusMods.Abstractions.Steam; | ||
|
||
/// <summary> | ||
/// A user intervention handler that can be used to request authorization information from the user. | ||
/// </summary> | ||
public interface IAuthInterventionHandler | ||
{ | ||
/// <summary> | ||
/// Display a QR code to the user for the given uri. When the token is cancelled, the QR code should be hidden. | ||
/// </summary> | ||
public void ShowQRCode(Uri uri, CancellationToken token); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace NexusMods.Abstractions.Steam; | ||
|
||
/// <summary> | ||
/// Interface for abstracting away the storage of Steam authentication data. | ||
/// </summary> | ||
public interface IAuthStorage | ||
{ | ||
/// <summary> | ||
/// Tries to load the authentication data, if it does not exist or fails to load, returns false. | ||
/// </summary> | ||
public Task<(bool Success, byte[] Data)> TryLoad(); | ||
|
||
/// <summary> | ||
/// Saves the authentication data. | ||
/// </summary> | ||
public Task SaveAsync(byte[] data); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using NexusMods.Abstractions.Steam.DTOs; | ||
using NexusMods.Abstractions.Steam.Values; | ||
using NexusMods.Paths; | ||
|
||
namespace NexusMods.Abstractions.Steam; | ||
|
||
/// <summary> | ||
/// An abstraction for a Steam session. | ||
/// </summary> | ||
public interface ISteamSession | ||
{ | ||
/// <summary> | ||
/// Get the product info for the specified app ID | ||
/// </summary> | ||
public Task<ProductInfo> GetProductInfoAsync(AppId appId, CancellationToken cancellationToken = default); | ||
|
||
/// <summary> | ||
/// Get the manifest data for a specific manifest | ||
/// </summary> | ||
public Task<Manifest> GetManifestContents(AppId appId, DepotId depotId, ManifestId manifestId, string branch, CancellationToken token = default); | ||
|
||
/// <summary> | ||
/// Get a readable, seekable, stream for the specified file in the specified manifest | ||
/// </summary> | ||
public Stream GetFileStream(AppId appId, Manifest manifest, RelativePath file); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<Import Project="$([MSBuild]::GetPathOfFileAbove('NuGet.Build.props', '$(MSBuildThisFileDirectory)../'))" /> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="NexusMods.Paths" /> | ||
<PackageReference Include="TransparentValueObjects" PrivateAssets="all" OutputItemType="Analyzer" ReferenceOutputAssembly="false" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Abstractions\NexusMods.Abstractions.Hashes\NexusMods.Abstractions.Hashes.csproj" /> | ||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using TransparentValueObjects; | ||
|
||
namespace NexusMods.Abstractions.Steam.Values; | ||
|
||
/// <summary> | ||
/// A globally unique identifier for an application on Steam. | ||
/// </summary> | ||
[ValueObject<uint>] | ||
public readonly partial struct AppId : IAugmentWith<JsonAugment> | ||
{ | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using TransparentValueObjects; | ||
|
||
namespace NexusMods.Abstractions.Steam.Values; | ||
|
||
/// <summary> | ||
/// A globally unique identifier for a depot, a reference to a collection of files on the Steam CDN. | ||
/// </summary> | ||
[ValueObject<uint>] | ||
public readonly partial struct DepotId : IAugmentWith<JsonAugment> | ||
{ | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using TransparentValueObjects; | ||
|
||
namespace NexusMods.Abstractions.Steam.Values; | ||
|
||
/// <summary> | ||
/// A global unique identifier for a manifest, a specific collection of files that can be downloaded | ||
/// </summary> | ||
[ValueObject<ulong>] | ||
public readonly partial struct ManifestId : IAugmentWith<JsonAugment> | ||
{ | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have the OS list, we could also get the languages of a depot.