diff --git a/DepotDownloader/AccountSettingsStore.cs b/DepotDownloader/AccountSettingsStore.cs index 2adb2ccb..4cf11548 100644 --- a/DepotDownloader/AccountSettingsStore.cs +++ b/DepotDownloader/AccountSettingsStore.cs @@ -1,12 +1,10 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; -using ProtoBuf; using System.IO; using System.IO.Compression; using System.IO.IsolatedStorage; -using System.Linq; -using SteamKit2; -using SteamKit2.Discovery; +using ProtoBuf; namespace DepotDownloader { @@ -17,17 +15,17 @@ namespace DepotDownloader public Dictionary SentryData { get; private set; } [ ProtoMember( 2, IsRequired = false ) ] - public System.Collections.Concurrent.ConcurrentDictionary ContentServerPenalty { get; private set; } + public ConcurrentDictionary ContentServerPenalty { get; private set; } [ ProtoMember( 3, IsRequired = false ) ] public Dictionary LoginKeys { get; private set; } - string FileName = null; + string FileName; AccountSettingsStore() { SentryData = new Dictionary(); - ContentServerPenalty = new System.Collections.Concurrent.ConcurrentDictionary(); + ContentServerPenalty = new ConcurrentDictionary(); LoginKeys = new Dictionary(); } @@ -36,7 +34,7 @@ namespace DepotDownloader get { return Instance != null; } } - public static AccountSettingsStore Instance = null; + public static AccountSettingsStore Instance; static readonly IsolatedStorageFile IsolatedStorage = IsolatedStorageFile.GetUserStoreForAssembly(); public static void LoadFromFile( string filename ) @@ -51,7 +49,7 @@ namespace DepotDownloader using ( var fs = IsolatedStorage.OpenFile( filename, FileMode.Open, FileAccess.Read ) ) using ( DeflateStream ds = new DeflateStream( fs, CompressionMode.Decompress ) ) { - Instance = ProtoBuf.Serializer.Deserialize( ds ); + Instance = Serializer.Deserialize( ds ); } } catch ( IOException ex ) @@ -78,7 +76,7 @@ namespace DepotDownloader using ( var fs = IsolatedStorage.OpenFile( Instance.FileName, FileMode.Create, FileAccess.Write ) ) using ( DeflateStream ds = new DeflateStream( fs, CompressionMode.Compress ) ) { - ProtoBuf.Serializer.Serialize( ds, Instance ); + Serializer.Serialize( ds, Instance ); } } catch ( IOException ex ) diff --git a/DepotDownloader/CDNClientPool.cs b/DepotDownloader/CDNClientPool.cs index 30225902..9f2e119b 100644 --- a/DepotDownloader/CDNClientPool.cs +++ b/DepotDownloader/CDNClientPool.cs @@ -1,11 +1,11 @@ -using SteamKit2; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Net; using System.Threading; using System.Threading.Tasks; +using SteamKit2; namespace DepotDownloader { @@ -165,10 +165,8 @@ namespace DepotDownloader var result = await authTokenCallbackPromise.Task; return result.Token; } - else - { - throw new Exception( $"Failed to retrieve CDN token for server {server.Host} depot {depotId}" ); - } + + throw new Exception( $"Failed to retrieve CDN token for server {server.Host} depot {depotId}" ); } public void ReturnConnection( CDNClient.Server server ) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 2f2a516e..ece33701 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -1,19 +1,17 @@ -using SteamKit2; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; -using System.Net.Http; -using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using SteamKit2; namespace DepotDownloader { - public class ContentDownloaderException : System.Exception + public class ContentDownloaderException : Exception { public ContentDownloaderException( String value ) : base( value ) { } } @@ -58,7 +56,7 @@ namespace DepotDownloader installDir = null; try { - if ( string.IsNullOrWhiteSpace( ContentDownloader.Config.InstallDirectory ) ) + if ( string.IsNullOrWhiteSpace( Config.InstallDirectory ) ) { Directory.CreateDirectory( DEFAULT_DOWNLOAD_DIR ); @@ -73,9 +71,9 @@ namespace DepotDownloader } else { - Directory.CreateDirectory( ContentDownloader.Config.InstallDirectory ); + Directory.CreateDirectory( Config.InstallDirectory ); - installDir = ContentDownloader.Config.InstallDirectory; + installDir = Config.InstallDirectory; Directory.CreateDirectory( Path.Combine( installDir, CONFIG_DIR ) ); Directory.CreateDirectory( Path.Combine( installDir, STAGING_DIR ) ); @@ -120,7 +118,7 @@ namespace DepotDownloader IEnumerable licenseQuery; if ( steam3.steamUser.SteamID.AccountType == EAccountType.AnonUser ) { - licenseQuery = new List() { 17906 }; + licenseQuery = new List { 17906 }; } else { @@ -189,7 +187,7 @@ namespace DepotDownloader return 0; - KeyValue depots = ContentDownloader.GetSteam3AppSection( appId, EAppInfoSection.Depots ); + KeyValue depots = GetSteam3AppSection( appId, EAppInfoSection.Depots ); KeyValue branches = depots[ "branches" ]; KeyValue node = branches[ branch ]; @@ -267,7 +265,8 @@ namespace DepotDownloader return BitConverter.ToUInt64( manifest_bytes, 0 ); } - else if ( encrypted_v2 != KeyValue.Invalid ) + + if ( encrypted_v2 != KeyValue.Invalid ) { // Submit the password to Steam now to get encryption keys steam3.CheckAppBetaPassword( appId, Config.BetaPassword ); @@ -292,11 +291,9 @@ namespace DepotDownloader return BitConverter.ToUInt64( manifest_bytes, 0 ); } - else - { - Console.WriteLine( "Unhandled depot encryption for depotId {0}", depotId ); - return INVALID_MANIFEST_ID; - } + + Console.WriteLine( "Unhandled depot encryption for depotId {0}", depotId ); + return INVALID_MANIFEST_ID; } return INVALID_MANIFEST_ID; @@ -319,20 +316,18 @@ namespace DepotDownloader return info[ "name" ].AsString(); } - else - { - KeyValue depots = GetSteam3AppSection( appId, EAppInfoSection.Depots ); - if ( depots == null ) - return String.Empty; + KeyValue depots = GetSteam3AppSection( appId, EAppInfoSection.Depots ); - KeyValue depotChild = depots[ depotId.ToString() ]; + if ( depots == null ) + return String.Empty; - if ( depotChild == null ) - return String.Empty; + KeyValue depotChild = depots[ depotId.ToString() ]; - return depotChild[ "name" ].AsString(); - } + if ( depotChild == null ) + return String.Empty; + + return depotChild[ "name" ].AsString(); } public static bool InitializeSteam3( string username, string password ) @@ -345,7 +340,7 @@ namespace DepotDownloader } steam3 = new Steam3Session( - new SteamUser.LogOnDetails() + new SteamUser.LogOnDetails { Username = username, Password = loginKey == null ? password : null, @@ -391,7 +386,7 @@ namespace DepotDownloader } else if ( details?.hcontent_file > 0 ) { - await DownloadAppAsync( appId, new List<(uint, ulong)>() { ( appId, details.hcontent_file ) }, DEFAULT_BRANCH, null, null, null, false, true ); + await DownloadAppAsync( appId, new List<(uint, ulong)> { ( appId, details.hcontent_file ) }, DEFAULT_BRANCH, null, null, null, false, true ); } else { @@ -418,7 +413,7 @@ namespace DepotDownloader } else { - await DownloadAppAsync( appId, new List<(uint, ulong)>() { ( appId, ugcId ) }, DEFAULT_BRANCH, null, null, null, false, true ); + await DownloadAppAsync( appId, new List<(uint, ulong)> { ( appId, ugcId ) }, DEFAULT_BRANCH, null, null, null, false, true ); } } @@ -459,7 +454,7 @@ namespace DepotDownloader cdnPool = new CDNClientPool( steam3, appId ); // Load our configuration data containing the depots currently installed - string configPath = ContentDownloader.Config.InstallDirectory; + string configPath = Config.InstallDirectory; if ( string.IsNullOrWhiteSpace( configPath ) ) { configPath = DEFAULT_DOWNLOAD_DIR; @@ -562,7 +557,7 @@ namespace DepotDownloader depotIdsFound.Add( id ); if ( !hasSpecificDepots ) - depotManifestIds.Add( ( id, ContentDownloader.INVALID_MANIFEST_ID ) ); + depotManifestIds.Add( ( id, INVALID_MANIFEST_ID ) ); } } @@ -570,7 +565,8 @@ namespace DepotDownloader { throw new ContentDownloaderException( String.Format( "Couldn't find any depots to download for app {0}", appId ) ); } - else if ( depotIdsFound.Count < depotIdsExpected.Count ) + + if ( depotIdsFound.Count < depotIdsExpected.Count ) { var remainingDepotIds = depotIdsExpected.Except( depotIdsFound ); throw new ContentDownloaderException( String.Format( "Depot {0} not listed for app {1}", string.Join( ", ", remainingDepotIds ), appId ) ); @@ -602,7 +598,7 @@ namespace DepotDownloader static DepotDownloadInfo GetDepotInfo( uint depotId, uint appId, ulong manifestId, string branch ) { if ( steam3 != null && appId != INVALID_APP_ID ) - steam3.RequestAppInfo( ( uint )appId ); + steam3.RequestAppInfo( appId ); string contentName = GetAppOrDepotName( depotId, appId ); @@ -722,7 +718,7 @@ namespace DepotDownloader // If we're about to write all the files to the same directory, we will need to first de-duplicate any files by path // This is in last-depot-wins order, from Steam or the list of depots supplied by the user - if ( !string.IsNullOrWhiteSpace( ContentDownloader.Config.InstallDirectory ) && depotsToDownload.Count > 0 ) + if ( !string.IsNullOrWhiteSpace( Config.InstallDirectory ) && depotsToDownload.Count > 0 ) { var claimedFileNames = new HashSet(); @@ -863,15 +859,14 @@ namespace DepotDownloader Console.WriteLine( "Encountered 401 for depot manifest {0} {1}. Aborting.", depot.id, depot.manifestId ); break; } - else if ( e.StatusCode == HttpStatusCode.NotFound ) + + if ( e.StatusCode == HttpStatusCode.NotFound ) { Console.WriteLine( "Encountered 404 for depot manifest {0} {1}. Aborting.", depot.id, depot.manifestId ); break; } - else - { - Console.WriteLine( "Encountered error downloading depot manifest {0} {1}: {2}", depot.id, depot.manifestId, e.StatusCode ); - } + + Console.WriteLine( "Encountered error downloading depot manifest {0} {1}: {2}", depot.id, depot.manifestId, e.StatusCode ); } catch ( OperationCanceledException ) { @@ -983,7 +978,7 @@ namespace DepotDownloader var previousFilteredFiles = depotFilesData.previousManifest.Files.AsParallel().Where( f => TestIsFileIncluded( f.FileName ) ).Select( f => f.FileName ).ToHashSet(); // Check if we are writing to a single output directory. If not, each depot folder is managed independently - if ( string.IsNullOrWhiteSpace( ContentDownloader.Config.InstallDirectory ) ) + if ( string.IsNullOrWhiteSpace( Config.InstallDirectory ) ) { // Of the list of files in the previous manifest, remove any file names that exist in the current set of all file names previousFilteredFiles.ExceptWith( depotFilesData.allFileNames ); @@ -1173,21 +1168,19 @@ namespace DepotDownloader { lock ( depotDownloadCounter ) { - depotDownloadCounter.SizeDownloaded += ( ulong )file.TotalSize; - Console.WriteLine( "{0,6:#00.00}% {1}", ( ( float )depotDownloadCounter.SizeDownloaded / ( float )depotDownloadCounter.CompleteDownloadSize ) * 100.0f, fileFinalPath ); + depotDownloadCounter.SizeDownloaded += file.TotalSize; + Console.WriteLine( "{0,6:#00.00}% {1}", ( depotDownloadCounter.SizeDownloaded / ( float )depotDownloadCounter.CompleteDownloadSize ) * 100.0f, fileFinalPath ); } if ( fs != null ) fs.Dispose(); return; } - else + + var sizeOnDisk = ( file.TotalSize - ( ulong )neededChunks.Select( x => ( long )x.UncompressedLength ).Sum() ); + lock ( depotDownloadCounter ) { - var sizeOnDisk = ( file.TotalSize - ( ulong )neededChunks.Select( x => ( long )x.UncompressedLength ).Sum() ); - lock ( depotDownloadCounter ) - { - depotDownloadCounter.SizeDownloaded += sizeOnDisk; - } + depotDownloadCounter.SizeDownloaded += sizeOnDisk; } } @@ -1260,10 +1253,8 @@ namespace DepotDownloader Console.WriteLine( "Encountered 401 for chunk {0}. Aborting.", chunkID ); break; } - else - { - Console.WriteLine( "Encountered error downloading chunk {0}: {1}", chunkID, e.StatusCode ); - } + + Console.WriteLine( "Encountered error downloading chunk {0}: {1}", chunkID, e.StatusCode ); } catch ( OperationCanceledException ) { @@ -1322,7 +1313,7 @@ namespace DepotDownloader if ( remainingChunks == 0 ) { var fileFinalPath = Path.Combine( depot.installDir, file.FileName ); - Console.WriteLine( "{0,6:#00.00}% {1}", ( ( float )sizeDownloaded / ( float )depotDownloadCounter.CompleteDownloadSize ) * 100.0f, fileFinalPath ); + Console.WriteLine( "{0,6:#00.00}% {1}", ( sizeDownloaded / ( float )depotDownloadCounter.CompleteDownloadSize ) * 100.0f, fileFinalPath ); } } diff --git a/DepotDownloader/DepotConfigStore.cs b/DepotDownloader/DepotConfigStore.cs index 11f29ba4..d74f4a5e 100644 --- a/DepotDownloader/DepotConfigStore.cs +++ b/DepotDownloader/DepotConfigStore.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; -using ProtoBuf; using System.IO; using System.IO.Compression; +using ProtoBuf; namespace DepotDownloader { @@ -12,7 +12,7 @@ namespace DepotDownloader [ ProtoMember( 1 ) ] public Dictionary InstalledManifestIDs { get; private set; } - string FileName = null; + string FileName; DepotConfigStore() { @@ -24,7 +24,7 @@ namespace DepotDownloader get { return Instance != null; } } - public static DepotConfigStore Instance = null; + public static DepotConfigStore Instance; public static void LoadFromFile( string filename ) { @@ -35,7 +35,7 @@ namespace DepotDownloader { using ( FileStream fs = File.Open( filename, FileMode.Open ) ) using ( DeflateStream ds = new DeflateStream( fs, CompressionMode.Decompress ) ) - Instance = ProtoBuf.Serializer.Deserialize( ds ); + Instance = Serializer.Deserialize( ds ); } else { @@ -52,7 +52,7 @@ namespace DepotDownloader using ( FileStream fs = File.Open( Instance.FileName, FileMode.Create ) ) using ( DeflateStream ds = new DeflateStream( fs, CompressionMode.Compress ) ) - ProtoBuf.Serializer.Serialize( ds, Instance ); + Serializer.Serialize( ds, Instance ); } } } diff --git a/DepotDownloader/HttpClientFactory.cs b/DepotDownloader/HttpClientFactory.cs index 2163d872..7953107a 100644 --- a/DepotDownloader/HttpClientFactory.cs +++ b/DepotDownloader/HttpClientFactory.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; +using System.IO; using System.Net.Http; using System.Net.Http.Headers; using System.Net.Sockets; -using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/DepotDownloader/Program.cs b/DepotDownloader/Program.cs index a1c65ba0..59cc897c 100644 --- a/DepotDownloader/Program.cs +++ b/DepotDownloader/Program.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; +using System.Linq; using System.Text.RegularExpressions; -using SteamKit2; -using System.ComponentModel; using System.Threading.Tasks; -using System.Linq; +using SteamKit2; namespace DepotDownloader { @@ -45,7 +45,7 @@ namespace DepotDownloader ContentDownloader.Config.DownloadManifestOnly = HasParameter( args, "-manifest-only" ); - int cellId = GetParameter( args, "-cellid", -1 ); + int cellId = GetParameter( args, "-cellid", -1 ); if ( cellId == -1 ) { cellId = 0; @@ -60,7 +60,7 @@ namespace DepotDownloader try { string fileListData = await File.ReadAllTextAsync( fileList ); - var files = fileListData.Split( new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries ); + var files = fileListData.Split( new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries ); ContentDownloader.Config.UsingFileList = true; ContentDownloader.Config.FilesToDownload = new HashSet( StringComparer.OrdinalIgnoreCase ); @@ -83,29 +83,29 @@ namespace DepotDownloader } catch ( Exception ex ) { - Console.WriteLine( "Warning: Unable to load filelist: {0}", ex.ToString() ); + Console.WriteLine( "Warning: Unable to load filelist: {0}", ex ); } } ContentDownloader.Config.InstallDirectory = GetParameter( args, "-dir" ); ContentDownloader.Config.VerifyAll = HasParameter( args, "-verify-all" ) || HasParameter( args, "-verify_all" ) || HasParameter( args, "-validate" ); - ContentDownloader.Config.MaxServers = GetParameter( args, "-max-servers", 20 ); - ContentDownloader.Config.MaxDownloads = GetParameter( args, "-max-downloads", 8 ); + ContentDownloader.Config.MaxServers = GetParameter( args, "-max-servers", 20 ); + ContentDownloader.Config.MaxDownloads = GetParameter( args, "-max-downloads", 8 ); ContentDownloader.Config.MaxServers = Math.Max( ContentDownloader.Config.MaxServers, ContentDownloader.Config.MaxDownloads ); - ContentDownloader.Config.LoginID = HasParameter( args, "-loginid" ) ? ( uint? )GetParameter( args, "-loginid" ) : null; + ContentDownloader.Config.LoginID = HasParameter( args, "-loginid" ) ? GetParameter( args, "-loginid" ) : null; #endregion - uint appId = GetParameter( args, "-app", ContentDownloader.INVALID_APP_ID ); + uint appId = GetParameter( args, "-app", ContentDownloader.INVALID_APP_ID ); if ( appId == ContentDownloader.INVALID_APP_ID ) { Console.WriteLine( "Error: -app not specified!" ); return 1; } - ulong pubFile = GetParameter( args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID ); - ulong ugcId = GetParameter( args, "-ugc", ContentDownloader.INVALID_MANIFEST_ID ); + ulong pubFile = GetParameter( args, "-pubfile", ContentDownloader.INVALID_MANIFEST_ID ); + ulong ugcId = GetParameter( args, "-ugc", ContentDownloader.INVALID_MANIFEST_ID ); if ( pubFile != ContentDownloader.INVALID_MANIFEST_ID ) { #region Pubfile Downloading @@ -184,7 +184,7 @@ namespace DepotDownloader ContentDownloader.Config.BetaPassword = GetParameter( args, "-betapassword" ); ContentDownloader.Config.DownloadAllPlatforms = HasParameter( args, "-all-platforms" ); - string os = GetParameter( args, "-os", null ); + string os = GetParameter( args, "-os" ); if ( ContentDownloader.Config.DownloadAllPlatforms && !String.IsNullOrEmpty( os ) ) { @@ -192,10 +192,10 @@ namespace DepotDownloader return 1; } - string arch = GetParameter( args, "-osarch", null ); + string arch = GetParameter( args, "-osarch" ); ContentDownloader.Config.DownloadAllLanguages = HasParameter( args, "-all-languages" ); - string language = GetParameter( args, "-language", null ); + string language = GetParameter( args, "-language" ); if ( ContentDownloader.Config.DownloadAllLanguages && !String.IsNullOrEmpty( language ) ) { diff --git a/DepotDownloader/ProtoManifest.cs b/DepotDownloader/ProtoManifest.cs index adf2c936..1af269d9 100644 --- a/DepotDownloader/ProtoManifest.cs +++ b/DepotDownloader/ProtoManifest.cs @@ -7,7 +7,7 @@ using SteamKit2; namespace DepotDownloader { - [ ProtoContract() ] + [ ProtoContract ] class ProtoManifest { // Proto ctor @@ -23,7 +23,7 @@ namespace DepotDownloader CreationTime = sourceManifest.CreationTime; } - [ ProtoContract() ] + [ ProtoContract ] public class FileData { // Proto ctor @@ -138,7 +138,7 @@ namespace DepotDownloader checksum = Util.SHAHash( ms.ToArray() ); ms.Seek( 0, SeekOrigin.Begin ); - return ProtoBuf.Serializer.Deserialize( ms ); + return Serializer.Deserialize( ms ); } } @@ -146,7 +146,7 @@ namespace DepotDownloader { using ( MemoryStream ms = new MemoryStream() ) { - ProtoBuf.Serializer.Serialize( ms, this ); + Serializer.Serialize( ms, this ); checksum = Util.SHAHash( ms.ToArray() ); diff --git a/DepotDownloader/Steam3Session.cs b/DepotDownloader/Steam3Session.cs index 1e4d771e..d13c4c95 100644 --- a/DepotDownloader/Steam3Session.cs +++ b/DepotDownloader/Steam3Session.cs @@ -1,6 +1,4 @@ -using SteamKit2; -using SteamKit2.Internal; -using System; +using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -8,6 +6,8 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using SteamKit2; +using SteamKit2.Internal; namespace DepotDownloader { @@ -175,7 +175,7 @@ namespace DepotDownloader return; bool completed = false; - Action cbMethodTokens = ( appTokens ) => + Action cbMethodTokens = appTokens => { completed = true; if ( appTokens.AppTokensDenied.Contains( appId ) ) @@ -191,11 +191,11 @@ namespace DepotDownloader WaitUntilCallback( () => { - callbacks.Subscribe( steamApps.PICSGetAccessTokens( new List() { appId }, new List() { } ), cbMethodTokens ); + callbacks.Subscribe( steamApps.PICSGetAccessTokens( new List { appId }, new List() ), cbMethodTokens ); }, () => { return completed; } ); completed = false; - Action cbMethod = ( appInfo ) => + Action cbMethod = appInfo => { completed = !appInfo.ResponsePending; @@ -222,7 +222,7 @@ namespace DepotDownloader WaitUntilCallback( () => { - callbacks.Subscribe( steamApps.PICSGetProductInfo( new List() { request }, new List() { } ), cbMethod ); + callbacks.Subscribe( steamApps.PICSGetProductInfo( new List { request }, new List() ), cbMethod ); }, () => { return completed; } ); } @@ -235,7 +235,7 @@ namespace DepotDownloader return; bool completed = false; - Action cbMethod = ( packageInfo ) => + Action cbMethod = packageInfo => { completed = !packageInfo.ResponsePending; @@ -276,7 +276,7 @@ namespace DepotDownloader { bool success = false; bool completed = false; - Action cbMethod = ( resultInfo ) => + Action cbMethod = resultInfo => { completed = true; success = resultInfo.GrantedApps.Contains( appId ); @@ -297,7 +297,7 @@ namespace DepotDownloader bool completed = false; - Action cbMethod = ( depotKey ) => + Action cbMethod = depotKey => { completed = true; Console.WriteLine( "Got depot key for {0} result: {1}", depotKey.DepotID, depotKey.Result ); @@ -324,7 +324,8 @@ namespace DepotDownloader { return "steampipe.steamcontent.com"; } - else if ( host.EndsWith( ".steamcontent.com" ) ) + + if ( host.EndsWith( ".steamcontent.com" ) ) { return "steamcontent.com"; } @@ -342,7 +343,7 @@ namespace DepotDownloader bool completed = false; var timeoutDate = DateTime.Now.AddSeconds( 10 ); - Action cbMethod = ( cdnAuth ) => + Action cbMethod = cdnAuth => { completed = true; Console.WriteLine( "Got CDN auth token for {0} result: {1} (expires {2})", host, cdnAuth.Result, cdnAuth.Expiration ); @@ -365,7 +366,7 @@ namespace DepotDownloader public void CheckAppBetaPassword( uint appid, string password ) { bool completed = false; - Action cbMethod = ( appPassword ) => + Action cbMethod = appPassword => { completed = true; @@ -385,7 +386,7 @@ namespace DepotDownloader public PublishedFileDetails GetPublishedFileDetails( uint appId, PublishedFileID pubFile ) { - var pubFileRequest = new CPublishedFile_GetDetails_Request() { appid = appId }; + var pubFileRequest = new CPublishedFile_GetDetails_Request { appid = appId }; pubFileRequest.publishedfileids.Add( pubFile ); bool completed = false; @@ -523,8 +524,6 @@ namespace DepotDownloader { Console.WriteLine( "Timeout connecting to Steam3." ); Abort(); - - return; } } @@ -631,7 +630,8 @@ namespace DepotDownloader return; } - else if ( loggedOn.Result == EResult.TryAnotherCM ) + + if ( loggedOn.Result == EResult.TryAnotherCM ) { Console.Write( "Retrying Steam3 connection (TryAnotherCM)..." ); @@ -639,14 +639,16 @@ namespace DepotDownloader return; } - else if ( loggedOn.Result == EResult.ServiceUnavailable ) + + if ( loggedOn.Result == EResult.ServiceUnavailable ) { Console.WriteLine( "Unable to login to Steam3: {0}", loggedOn.Result ); Abort( false ); return; } - else if ( loggedOn.Result != EResult.OK ) + + if ( loggedOn.Result != EResult.OK ) { Console.WriteLine( "Unable to login to Steam3: {0}", loggedOn.Result ); Abort(); diff --git a/DepotDownloader/Util.cs b/DepotDownloader/Util.cs index 4f3e36a6..2efdc3d3 100644 --- a/DepotDownloader/Util.cs +++ b/DepotDownloader/Util.cs @@ -17,11 +17,13 @@ namespace DepotDownloader { return "windows"; } - else if ( RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) ) + + if ( RuntimeInformation.IsOSPlatform( OSPlatform.OSX ) ) { return "macos"; } - else if ( RuntimeInformation.IsOSPlatform( OSPlatform.Linux ) ) + + if ( RuntimeInformation.IsOSPlatform( OSPlatform.Linux ) ) { return "linux"; }