From 38f48841bdafab827c643b89ff2f5a8704859846 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 19 Jun 2016 05:57:29 +0200 Subject: [PATCH] Time to break things, closes #169 --- ArchiSteamFarm.sln | 8 +-- ArchiSteamFarm/App.config | 2 +- ArchiSteamFarm/ArchiSteamFarm.csproj | 9 +-- ArchiSteamFarm/ArchiWebHandler.cs | 15 ++--- ArchiSteamFarm/Bot.cs | 3 +- ArchiSteamFarm/BotDatabase.cs | 5 +- ArchiSteamFarm/MobileAuthenticator.cs | 19 ++---- .../ObsoleteSteamGuardAccount.cs | 6 +- ArchiSteamFarm/Trading.cs | 1 - ConfigGenerator/App.config | 6 +- ConfigGenerator/ConfigGenerator.csproj | 3 +- .../Properties/Settings.Designer.cs | 28 ++++----- GUI/App.config | 2 +- GUI/GUI.csproj | 2 +- SteamAuth/LICENSE | 21 ------- SteamAuth/Properties/AssemblyInfo.cs | 36 ----------- SteamAuth/SteamAuth.csproj | 63 ------------------- SteamAuth/SteamAuth.sln | 28 --------- SteamAuth/packages.config | 4 -- 19 files changed, 42 insertions(+), 219 deletions(-) rename SteamAuth/SteamGuardAccount.cs => ArchiSteamFarm/ObsoleteSteamGuardAccount.cs (88%) delete mode 100644 SteamAuth/LICENSE delete mode 100644 SteamAuth/Properties/AssemblyInfo.cs delete mode 100644 SteamAuth/SteamAuth.csproj delete mode 100644 SteamAuth/SteamAuth.sln delete mode 100644 SteamAuth/packages.config diff --git a/ArchiSteamFarm.sln b/ArchiSteamFarm.sln index 49bc4e250..43c8e4c2c 100644 --- a/ArchiSteamFarm.sln +++ b/ArchiSteamFarm.sln @@ -1,12 +1,10 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +VisualStudioVersion = 14.0.25123.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ArchiSteamFarm", "ArchiSteamFarm\ArchiSteamFarm.csproj", "{35AF7887-08B9-40E8-A5EA-797D8B60B30C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamAuth", "SteamAuth\SteamAuth.csproj", "{5AD0934E-F6C4-4AE5-83AF-C788313B2A87}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConfigGenerator", "ConfigGenerator\ConfigGenerator.csproj", "{C3F6FE68-5E75-415E-BEA1-1E7C16D6A433}" ProjectSection(ProjectDependencies) = postProject {35AF7887-08B9-40E8-A5EA-797D8B60B30C} = {35AF7887-08B9-40E8-A5EA-797D8B60B30C} @@ -27,10 +25,6 @@ Global {35AF7887-08B9-40E8-A5EA-797D8B60B30C}.Debug|Any CPU.Build.0 = Debug|Any CPU {35AF7887-08B9-40E8-A5EA-797D8B60B30C}.Release|Any CPU.ActiveCfg = Release|Any CPU {35AF7887-08B9-40E8-A5EA-797D8B60B30C}.Release|Any CPU.Build.0 = Release|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Release|Any CPU.Build.0 = Release|Any CPU {C3F6FE68-5E75-415E-BEA1-1E7C16D6A433}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C3F6FE68-5E75-415E-BEA1-1E7C16D6A433}.Debug|Any CPU.Build.0 = Debug|Any CPU {C3F6FE68-5E75-415E-BEA1-1E7C16D6A433}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/ArchiSteamFarm/App.config b/ArchiSteamFarm/App.config index f9eaf8b53..fd9961fb2 100644 --- a/ArchiSteamFarm/App.config +++ b/ArchiSteamFarm/App.config @@ -1,6 +1,6 @@ - + diff --git a/ArchiSteamFarm/ArchiSteamFarm.csproj b/ArchiSteamFarm/ArchiSteamFarm.csproj index 9d1aa8e7c..67a5b7c9d 100644 --- a/ArchiSteamFarm/ArchiSteamFarm.csproj +++ b/ArchiSteamFarm/ArchiSteamFarm.csproj @@ -9,7 +9,7 @@ Properties ArchiSteamFarm ArchiSteamFarm - v4.5.1 + v4.6.1 512 false @@ -111,6 +111,7 @@ + @@ -146,12 +147,6 @@ - - - {5ad0934e-f6c4-4ae5-83af-c788313b2a87} - SteamAuth - - diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index f0b5313ff..da5124e1f 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -27,7 +27,6 @@ using HtmlAgilityPack; using SteamKit2; using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Net; using System.Text; @@ -172,7 +171,7 @@ namespace ArchiSteamFarm { Logging.LogGenericInfo("Success!", Bot.BotName); - WebBrowser.CookieContainer.Add(new Cookie("steamid", SteamID.ToString(), "/", "." + SteamCommunityHost)); // TODO: Check if needed + WebBrowser.CookieContainer.Add(new Cookie("steamid", SteamID.ToString(), "/", "." + SteamCommunityHost)); // TODO: Check if needed for mobile auth WebBrowser.CookieContainer.Add(new Cookie("sessionid", sessionID, "/", "." + SteamCommunityHost)); string steamLogin = authResult["token"].Value; @@ -357,9 +356,7 @@ namespace ArchiSteamFarm { internal Dictionary GetOwnedGames(ulong steamID) { if ((steamID == 0) || string.IsNullOrEmpty(Bot.BotConfig.SteamApiKey)) { - // TODO: Correct this when Mono 4.4+ will be a latest stable one | https://bugzilla.xamarin.com/show_bug.cgi?id=39455 - Logging.LogNullError("steamID || SteamApiKey", Bot.BotName); - //Logging.LogNullError(nameof(steamID) + " || " + nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); + Logging.LogNullError(nameof(steamID) + " || " + nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); return null; } @@ -477,9 +474,7 @@ namespace ArchiSteamFarm { internal HashSet GetTradeOffers() { if (string.IsNullOrEmpty(Bot.BotConfig.SteamApiKey)) { - // TODO: Correct this when Mono 4.4+ will be a latest stable one | https://bugzilla.xamarin.com/show_bug.cgi?id=39455 - Logging.LogNullError("SteamApiKey", Bot.BotName); - //Logging.LogNullError(nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); + Logging.LogNullError(nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); return null; } @@ -616,9 +611,7 @@ namespace ArchiSteamFarm { internal bool DeclineTradeOffer(ulong tradeID) { if ((tradeID == 0) || string.IsNullOrEmpty(Bot.BotConfig.SteamApiKey)) { - // TODO: Correct this when Mono 4.4+ will be a latest stable one | https://bugzilla.xamarin.com/show_bug.cgi?id=39455 - Logging.LogNullError("tradeID || SteamApiKey", Bot.BotName); - //Logging.LogNullError(nameof(tradeID) + " || " + nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); + Logging.LogNullError(nameof(tradeID) + " || " + nameof(Bot.BotConfig.SteamApiKey), Bot.BotName); return false; } diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index cd91e1ade..4cc65561b 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -153,8 +153,9 @@ namespace ArchiSteamFarm { if (BotDatabase.SteamGuardAccount != null) { Logging.LogGenericWarning("Converting old ASF 2FA V2.0 format into new ASF 2FA V2.1 format..."); BotDatabase.MobileAuthenticator = MobileAuthenticator.LoadFromSteamGuardAccount(BotDatabase.SteamGuardAccount); + Logging.LogGenericInfo("Done! If you didn't make a copy of your revocation code yet, then it's a good moment to do so: " + BotDatabase.SteamGuardAccount.RevocationCode); + Logging.LogGenericWarning("ASF will not keep this code anymore!"); BotDatabase.SteamGuardAccount = null; - Logging.LogGenericInfo("Done!"); } if (BotDatabase.MobileAuthenticator != null) { diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index 2f7a79ed3..09b48c1ab 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -23,7 +23,6 @@ */ using Newtonsoft.Json; -using SteamAuth; using System; using System.Diagnostics.CodeAnalysis; using System.IO; @@ -66,9 +65,9 @@ namespace ArchiSteamFarm { // TODO: Converter code will be removed soon [JsonProperty] - private SteamGuardAccount _SteamGuardAccount; + private ObsoleteSteamGuardAccount _SteamGuardAccount; - internal SteamGuardAccount SteamGuardAccount { + internal ObsoleteSteamGuardAccount SteamGuardAccount { get { return _SteamGuardAccount; } diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 053776a27..796930198 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using ArchiSteamFarm.JSON; using HtmlAgilityPack; using Newtonsoft.Json; -using SteamAuth; namespace ArchiSteamFarm { internal sealed class MobileAuthenticator { @@ -25,8 +24,6 @@ namespace ArchiSteamFarm { } } - private const byte TokenDigits = 5; - private static readonly byte[] TokenCharacters = { 50, 51, 52, 53, 54, 55, 56, 57, 66, 67, 68, 70, 71, 72, 74, 75, 77, 78, 80, 81, 82, 84, 86, 87, 88, 89 }; private static readonly SemaphoreSlim TimeSemaphore = new SemaphoreSlim(1); @@ -37,9 +34,6 @@ namespace ArchiSteamFarm { [JsonProperty(PropertyName = "shared_secret", Required = Required.DisallowNull)] private string SharedSecret; - [JsonProperty(PropertyName = "revocation_code", Required = Required.DisallowNull)] - private string RevocationCode; - [JsonProperty(PropertyName = "identity_secret", Required = Required.DisallowNull)] private string IdentitySecret; @@ -48,11 +42,10 @@ namespace ArchiSteamFarm { private Bot Bot; - internal static MobileAuthenticator LoadFromSteamGuardAccount(SteamGuardAccount sga) { + internal static MobileAuthenticator LoadFromSteamGuardAccount(ObsoleteSteamGuardAccount sga) { if (sga != null) { return new MobileAuthenticator { SharedSecret = sga.SharedSecret, - RevocationCode = sga.RevocationCode, IdentitySecret = sga.IdentitySecret, DeviceID = sga.DeviceID }; @@ -138,7 +131,7 @@ namespace ArchiSteamFarm { internal async Task> GetConfirmations() { uint time = await GetSteamTime().ConfigureAwait(false); if (time == 0) { - Logging.LogNullError(nameof(time)); + Logging.LogNullError(nameof(time), Bot.BotName); return null; } @@ -162,25 +155,25 @@ namespace ArchiSteamFarm { foreach (HtmlNode confirmation in confirmations) { string idString = confirmation.GetAttributeValue("data-confid", null); if (string.IsNullOrEmpty(idString)) { - Logging.LogNullError(nameof(idString)); + Logging.LogNullError(nameof(idString), Bot.BotName); continue; } uint id; if (!uint.TryParse(idString, out id) || (id == 0)) { - Logging.LogNullError(nameof(id)); + Logging.LogNullError(nameof(id), Bot.BotName); continue; } string keyString = confirmation.GetAttributeValue("data-key", null); if (string.IsNullOrEmpty(keyString)) { - Logging.LogNullError(nameof(keyString)); + Logging.LogNullError(nameof(keyString), Bot.BotName); continue; } ulong key; if (!ulong.TryParse(keyString, out key) || (key == 0)) { - Logging.LogNullError(nameof(key)); + Logging.LogNullError(nameof(key), Bot.BotName); continue; } diff --git a/SteamAuth/SteamGuardAccount.cs b/ArchiSteamFarm/ObsoleteSteamGuardAccount.cs similarity index 88% rename from SteamAuth/SteamGuardAccount.cs rename to ArchiSteamFarm/ObsoleteSteamGuardAccount.cs index 6d1019964..0415d9c18 100644 --- a/SteamAuth/SteamGuardAccount.cs +++ b/ArchiSteamFarm/ObsoleteSteamGuardAccount.cs @@ -1,8 +1,8 @@ using Newtonsoft.Json; -namespace SteamAuth { - // TODO: Converter code will be removed soon - public class SteamGuardAccount { +namespace ArchiSteamFarm { + // TODO: This will be completely removed soon + public class ObsoleteSteamGuardAccount { [JsonProperty("shared_secret")] public string SharedSecret { get; set; } diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs index dfc84d455..e9da06782 100644 --- a/ArchiSteamFarm/Trading.cs +++ b/ArchiSteamFarm/Trading.cs @@ -22,7 +22,6 @@ */ -using SteamAuth; using System; using System.Collections.Generic; using System.Linq; diff --git a/ConfigGenerator/App.config b/ConfigGenerator/App.config index 9c05822ff..bae5d6d81 100644 --- a/ConfigGenerator/App.config +++ b/ConfigGenerator/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + diff --git a/ConfigGenerator/ConfigGenerator.csproj b/ConfigGenerator/ConfigGenerator.csproj index a729f2871..3ca46925b 100644 --- a/ConfigGenerator/ConfigGenerator.csproj +++ b/ConfigGenerator/ConfigGenerator.csproj @@ -9,9 +9,10 @@ Properties ConfigGenerator ConfigGenerator - v4.5.1 + v4.6.1 512 true + AnyCPU diff --git a/ConfigGenerator/Properties/Settings.Designer.cs b/ConfigGenerator/Properties/Settings.Designer.cs index 2f1862a55..86c661b49 100644 --- a/ConfigGenerator/Properties/Settings.Designer.cs +++ b/ConfigGenerator/Properties/Settings.Designer.cs @@ -9,18 +9,18 @@ //------------------------------------------------------------------------------ namespace ConfigGenerator.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings) (global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } } diff --git a/GUI/App.config b/GUI/App.config index d0feca6f7..bae5d6d81 100644 --- a/GUI/App.config +++ b/GUI/App.config @@ -1,6 +1,6 @@ - + diff --git a/GUI/GUI.csproj b/GUI/GUI.csproj index a621446bd..706f894cf 100644 --- a/GUI/GUI.csproj +++ b/GUI/GUI.csproj @@ -9,7 +9,7 @@ Properties GUI GUI - v4.5.1 + v4.6.1 512 publish\ true diff --git a/SteamAuth/LICENSE b/SteamAuth/LICENSE deleted file mode 100644 index 1db49c875..000000000 --- a/SteamAuth/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Joshua Coffey - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/SteamAuth/Properties/AssemblyInfo.cs b/SteamAuth/Properties/AssemblyInfo.cs deleted file mode 100644 index 603107ccd..000000000 --- a/SteamAuth/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SteamAuth")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SteamAuth")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5ad0934e-f6c4-4ae5-83af-c788313b2a87")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SteamAuth/SteamAuth.csproj b/SteamAuth/SteamAuth.csproj deleted file mode 100644 index d0124244c..000000000 --- a/SteamAuth/SteamAuth.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Debug - AnyCPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87} - Library - Properties - SteamAuth - SteamAuth - v4.5.1 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - none - true - bin\Release\ - - - prompt - 4 - - - - ..\packages\Newtonsoft.Json.9.0.1-beta1\lib\net45\Newtonsoft.Json.dll - True - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/SteamAuth/SteamAuth.sln b/SteamAuth/SteamAuth.sln deleted file mode 100644 index b132b1343..000000000 --- a/SteamAuth/SteamAuth.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.23107.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SteamAuth", "SteamAuth.csproj", "{5AD0934E-F6C4-4AE5-83AF-C788313B2A87}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestBed", "..\TestBed\TestBed.csproj", "{8A732227-C090-4011-9F0A-51180CFE6271}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5AD0934E-F6C4-4AE5-83AF-C788313B2A87}.Release|Any CPU.Build.0 = Release|Any CPU - {8A732227-C090-4011-9F0A-51180CFE6271}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A732227-C090-4011-9F0A-51180CFE6271}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A732227-C090-4011-9F0A-51180CFE6271}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A732227-C090-4011-9F0A-51180CFE6271}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/SteamAuth/packages.config b/SteamAuth/packages.config deleted file mode 100644 index 24a98118f..000000000 --- a/SteamAuth/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file