mirror of
https://github.com/SteamAutoCracks/DepotDownloaderMod.git
synced 2026-02-09 03:21:18 +01:00
Upgraded DepotDownloader project to 2010, and made it support the new BlobLib.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DepotDownloader", "DepotDownloader\DepotDownloader.csproj", "{39159C47-ACD3-449F-96CA-4F30C8ED147A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamKit2", "..\..\SteamKit2\SteamKit2\SteamKit2.csproj", "{BEB5BF07-BB56-402A-97A3-A41C6444C6A5}"
|
||||
|
||||
@@ -8,11 +8,41 @@ using System.Net;
|
||||
|
||||
namespace DepotDownloader
|
||||
{
|
||||
class CDR
|
||||
{
|
||||
[BlobField( FieldKey = CDRFields.eFieldApplicationsRecord, Depth = 1, Complex = true )]
|
||||
public List<App> Apps { get; set; }
|
||||
}
|
||||
|
||||
class App
|
||||
{
|
||||
[BlobField( FieldKey = CDRAppRecordFields.eFieldName, Depth = 1 )]
|
||||
public string Name { get; set; }
|
||||
|
||||
[BlobField( FieldKey = CDRAppRecordFields.eFieldAppId, Depth = 1 )]
|
||||
public int AppID { get; set; }
|
||||
|
||||
[BlobField( FieldKey = CDRAppRecordFields.eFieldCurrentVersionId, Depth = 1 )]
|
||||
public int CurrentVersion { get; set; }
|
||||
|
||||
[BlobField( FieldKey = CDRAppRecordFields.eFieldFilesystemsRecord, Complex = true, Depth = 1 )]
|
||||
public List<FileSystem> FileSystems { get; set; }
|
||||
}
|
||||
|
||||
class FileSystem
|
||||
{
|
||||
[BlobField( FieldKey = CDRAppFilesystemFields.eFieldAppId )]
|
||||
public int AppID { get; set; }
|
||||
|
||||
[BlobField( FieldKey = CDRAppFilesystemFields.eFieldMountName )]
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
static class CDRManager
|
||||
{
|
||||
const string BLOB_FILENAME = "cdr.blob";
|
||||
|
||||
static Blob cdrBlob;
|
||||
static CDR cdrObj;
|
||||
|
||||
|
||||
public static void Update()
|
||||
@@ -54,71 +84,62 @@ namespace DepotDownloader
|
||||
return;
|
||||
}
|
||||
|
||||
cdrBlob = new Blob( cdr );
|
||||
|
||||
using ( var reader = BlobTypedReader<CDR>.Create( new MemoryStream( cdr ) ) )
|
||||
{
|
||||
reader.Process();
|
||||
|
||||
cdrObj = reader.Target;
|
||||
}
|
||||
|
||||
Console.WriteLine( " Done!" );
|
||||
}
|
||||
|
||||
static Blob GetAppBlob( int appID )
|
||||
static App GetAppBlob( int appID )
|
||||
{
|
||||
Blob appsBlob = cdrBlob[ CDRFields.eFieldApplicationsRecord ].GetChildBlob();
|
||||
|
||||
foreach ( var blobField in appsBlob.Fields )
|
||||
{
|
||||
Blob appBlob = blobField.GetChildBlob();
|
||||
int currentAppID = appBlob[ CDRAppRecordFields.eFieldAppId ].GetInt32Data();
|
||||
|
||||
if ( appID != currentAppID )
|
||||
continue;
|
||||
|
||||
return appBlob;
|
||||
}
|
||||
|
||||
return null;
|
||||
return cdrObj.Apps.Find( ( app ) => app.AppID == appID );
|
||||
}
|
||||
|
||||
public static string GetDepotName( int depotId )
|
||||
{
|
||||
Blob appBlob = GetAppBlob( depotId );
|
||||
App app = GetAppBlob( depotId );
|
||||
|
||||
if ( appBlob == null )
|
||||
if ( app == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return appBlob[ CDRAppRecordFields.eFieldName ].GetStringData();
|
||||
}
|
||||
|
||||
return app.Name;
|
||||
}
|
||||
|
||||
public static int GetLatestDepotVersion( int depotId )
|
||||
{
|
||||
Blob appBlob = GetAppBlob( depotId );
|
||||
App app = GetAppBlob( depotId );
|
||||
|
||||
if ( appBlob == null )
|
||||
if ( app == null )
|
||||
{
|
||||
return -1;
|
||||
} else {
|
||||
return appBlob[ CDRAppRecordFields.eFieldCurrentVersionId ].GetInt32Data();
|
||||
}
|
||||
|
||||
return app.CurrentVersion;
|
||||
}
|
||||
|
||||
public static List<int> GetDepotIDsForGameserver( string gameName )
|
||||
{
|
||||
List<int> appIDs = new List<int>();
|
||||
|
||||
Blob serverAppInfoBlob = GetAppBlob( 4 );
|
||||
Blob serverAppInfo = serverAppInfoBlob[ CDRAppRecordFields.eFieldFilesystemsRecord ].GetChildBlob();
|
||||
App serverAppInfoBlob = GetAppBlob( 4 );
|
||||
|
||||
foreach ( var blobField in serverAppInfo.Fields )
|
||||
foreach ( var blobField in serverAppInfoBlob.FileSystems )
|
||||
{
|
||||
Blob filesystemBlob = blobField.GetChildBlob();
|
||||
string mountName = filesystemBlob[CDRAppFilesystemFields.eFieldMountName].GetStringData();
|
||||
|
||||
if ( mountName.Equals( gameName, StringComparison.OrdinalIgnoreCase) ||
|
||||
mountName.Equals( gameName + "-win32", StringComparison.OrdinalIgnoreCase) ||
|
||||
mountName.Equals( gameName + "-linux", StringComparison.OrdinalIgnoreCase))
|
||||
string mountName = blobField.Name;
|
||||
|
||||
if ( mountName.Equals( gameName, StringComparison.OrdinalIgnoreCase ) ||
|
||||
mountName.Equals( gameName + "-win32", StringComparison.OrdinalIgnoreCase ) ||
|
||||
mountName.Equals( gameName + "-linux", StringComparison.OrdinalIgnoreCase ) )
|
||||
{
|
||||
appIDs.Add( filesystemBlob[ CDRAppFilesystemFields.eFieldAppId ].GetInt32Data() );
|
||||
appIDs.Add( blobField.AppID );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ namespace DepotDownloader
|
||||
|
||||
ClientTGT clientTgt;
|
||||
byte[] serverTgt;
|
||||
Blob accountRecord;
|
||||
AuthBlob accountRecord;
|
||||
|
||||
Console.Write( "Logging '{0}' into Steam2... ", username );
|
||||
AuthServerClient.LoginResult result = asClient.Login( username, password, out clientTgt, out serverTgt, out accountRecord );
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
@@ -12,6 +12,25 @@
|
||||
<AssemblyName>DepotDownloader</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation />
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -21,6 +40,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -29,6 +49,7 @@
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
@@ -58,6 +79,23 @@
|
||||
<Name>SteamKit2</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Reference in New Issue
Block a user