Compare commits

...

12 Commits

Author SHA1 Message Date
JustArchi
e337bd3856 Derp 2016-03-27 23:38:49 +02:00
JustArchi
cc47c0a764 Add new property to config generator 2016-03-27 23:27:02 +02:00
JustArchi
22e4c0cd40 Misc 2016-03-27 23:18:01 +02:00
JustArchi
20b47e1787 Correct config property 2016-03-27 23:09:17 +02:00
JustArchi
941da0658d Misc 2016-03-27 23:07:37 +02:00
JustArchi
8048d4a7aa Add a feature of accepting steam gifts, closes #18 2016-03-27 23:07:00 +02:00
JustArchi
2554794daa Code review 2016-03-27 15:08:43 +02:00
JustArchi
4fcee90b99 Code review 2016-03-26 22:51:19 +01:00
JustArchi
761d73eb90 Remove old converter, closes #153
Decided to remove it faster
2016-03-26 22:23:35 +01:00
JustArchi
c163e5e2f3 Bump 2016-03-26 22:13:24 +01:00
JustArchi
8fd41cc587 Fix broken bot databases 2016-03-26 22:12:55 +01:00
JustArchi
f195563ba5 Misc 2016-03-26 19:39:46 +01:00
23 changed files with 154 additions and 297 deletions

View File

@@ -90,10 +90,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>

View File

@@ -44,6 +44,8 @@ namespace ArchiSteamFarm {
private readonly Bot Bot;
private readonly Dictionary<string, string> Cookie = new Dictionary<string, string>(4);
internal bool IsInitialized { get; private set; }
private ulong SteamID;
internal static void Init() {
@@ -59,8 +61,12 @@ namespace ArchiSteamFarm {
Bot = bot;
}
internal void OnDisconnected() {
IsInitialized = false;
}
internal async Task<bool> Init(SteamClient steamClient, string webAPIUserNonce, string parentalPin) {
if (steamClient == null || steamClient.SteamID == null || string.IsNullOrEmpty(webAPIUserNonce)) {
if (steamClient == null || steamClient.SteamID == null || string.IsNullOrEmpty(webAPIUserNonce) || IsInitialized) {
return false;
}
@@ -122,6 +128,8 @@ namespace ArchiSteamFarm {
Cookie["webTradeEligibility"] = "{\"allowed\":0,\"reason\":0,\"allowed_at_time\":0,\"steamguard_required_days\":0,\"sales_this_year\":0,\"max_sales_per_year\":0,\"forms_requested\":0}";
await UnlockParentalAccount(parentalPin).ConfigureAwait(false);
IsInitialized = true;
return true;
}
@@ -494,6 +502,34 @@ namespace ArchiSteamFarm {
return true;
}
internal async Task<bool> AcceptGift(ulong gid) {
if (gid == 0) {
return false;
}
string sessionID;
if (!Cookie.TryGetValue("sessionid", out sessionID)) {
return false;
}
string request = SteamCommunityURL + "/gifts/" + gid + "/acceptunpack";
Dictionary<string, string> data = new Dictionary<string, string>(1) {
{ "sessionid", sessionID }
};
HttpResponseMessage response = null;
for (byte i = 0; i < WebBrowser.MaxRetries && response == null; i++) {
response = await WebBrowser.UrlPost(request, data, Cookie).ConfigureAwait(false);
}
if (response == null) {
Logging.LogGenericWTF("Request failed even after " + WebBrowser.MaxRetries + " tries", Bot.BotName);
return false;
}
return true;
}
private async Task UnlockParentalAccount(string parentalPin) {
if (string.IsNullOrEmpty(parentalPin) || parentalPin.Equals("0")) {
return;

View File

@@ -60,7 +60,7 @@ namespace ArchiSteamFarm {
private readonly SteamUser SteamUser;
private readonly Trading Trading;
internal bool KeepRunning { get; private set; } = false;
internal bool KeepRunning { get; private set; }
private bool InvalidPassword, LoggedInElsewhere;
private string AuthCode, TwoFactorAuth;
@@ -113,55 +113,22 @@ namespace ArchiSteamFarm {
string botPath = Path.Combine(Program.ConfigDirectory, botName);
// CONVERSION START
if (File.Exists(botPath + ".xml")) {
BotConfig = BotConfig.LoadOldFormat(botPath + ".xml");
if (BotConfig == null) {
return;
}
if (BotConfig.Convert(botPath + ".json")) {
try {
File.Delete(botPath + ".xml");
} catch (Exception e) {
Logging.LogGenericException(e, botName);
return;
}
}
}
// CONVERSION END
BotConfig = BotConfig.Load(botPath + ".json");
if (BotConfig == null) {
Logging.LogGenericError("Your config for this bot instance is invalid, it won't run!", botName);
Logging.LogGenericError("Your bot config is invalid, refusing to start this bot instance!", botName);
return;
}
// CONVERSION START
if (File.Exists(botPath + ".key")) {
BotDatabase = BotDatabase.Load(botPath + ".db");
try {
BotDatabase.LoginKey = File.ReadAllText(botPath + ".key");
File.Delete(botPath + ".key");
} catch (Exception e) {
Logging.LogGenericException(e, BotName);
}
}
if (File.Exists(botPath + ".auth")) {
BotDatabase = BotDatabase.Load(botPath + ".db");
try {
BotDatabase.SteamGuardAccount = JsonConvert.DeserializeObject<SteamGuardAccount>(File.ReadAllText(botPath + ".auth"));
File.Delete(botPath + ".auth");
} catch (Exception e) {
Logging.LogGenericException(e, BotName);
}
}
// CONVERSION END
if (!BotConfig.Enabled) {
return;
}
BotDatabase = BotDatabase.Load(botPath + ".db");
if (BotDatabase == null) {
Logging.LogGenericError("Bot database could not be loaded, refusing to start this bot instance!", botName);
return;
}
bool alreadyExists;
lock (Bots) {
alreadyExists = Bots.ContainsKey(botName);
@@ -174,7 +141,6 @@ namespace ArchiSteamFarm {
return;
}
BotDatabase = BotDatabase.Load(botPath + ".db");
SentryFile = botPath + ".bin";
if (BotDatabase.SteamGuardAccount == null) {
@@ -206,6 +172,7 @@ namespace ArchiSteamFarm {
SteamApps = SteamClient.GetHandler<SteamApps>();
CallbackManager.Subscribe<SteamApps.FreeLicenseCallback>(OnFreeLicense);
CallbackManager.Subscribe<SteamApps.GuestPassListCallback>(OnGuestPassList);
SteamFriends = SteamClient.GetHandler<SteamFriends>();
CallbackManager.Subscribe<SteamFriends.ChatInviteCallback>(OnChatInvite);
@@ -283,7 +250,6 @@ namespace ArchiSteamFarm {
Logging.LogGenericWarning("If issue persists, consider removing and readding ASF 2FA", BotName);
} catch (Exception e) {
Logging.LogGenericException(e, BotName);
return;
}
}
@@ -573,7 +539,7 @@ namespace ArchiSteamFarm {
}
}
result.Append("There are " + runningBotsCount + "/" + Bots.Count + "bots running.");
result.Append("There are " + runningBotsCount + "/" + Bots.Count + " bots running.");
return result.ToString();
}
@@ -1334,6 +1300,7 @@ namespace ArchiSteamFarm {
}
Logging.LogGenericInfo("Disconnected from Steam!", BotName);
ArchiWebHandler.OnDisconnected();
CardsFarmer.StopFarming().Forget();
// If we initiated disconnect, do not attempt to reconnect
@@ -1382,6 +1349,41 @@ namespace ArchiSteamFarm {
}
}
private async void OnGuestPassList(SteamApps.GuestPassListCallback callback) {
if (callback == null || callback.Result != EResult.OK || callback.CountGuestPassesToRedeem == 0 || callback.GuestPasses.Count == 0 || !BotConfig.AcceptGifts) {
return;
}
for (byte i = 0; i < WebBrowser.MaxRetries && !ArchiWebHandler.IsInitialized; i++) {
await Utilities.SleepAsync(1000).ConfigureAwait(false);
}
if (!ArchiWebHandler.IsInitialized) {
Logging.LogGenericWarning("Reached timeout while waiting for ArchiWebHandler to initialize!");
return;
}
bool acceptedSomething = false;
foreach (KeyValue guestPass in callback.GuestPasses) {
ulong gid = guestPass["gid"].AsUnsignedLong();
if (gid == 0) {
continue;
}
Logging.LogGenericInfo("Accepting gift: " + gid + "...", BotName);
if (await ArchiWebHandler.AcceptGift(gid).ConfigureAwait(false)) {
acceptedSomething = true;
Logging.LogGenericInfo("Success!", BotName);
} else {
Logging.LogGenericInfo("Failed!", BotName);
}
}
if (acceptedSomething) {
CardsFarmer.RestartFarming().Forget();
}
}
private void OnChatInvite(SteamFriends.ChatInviteCallback callback) {
if (callback == null || !IsMaster(callback.PatronID)) {
return;

View File

@@ -26,7 +26,6 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
namespace ArchiSteamFarm {
internal sealed class BotConfig {
@@ -66,6 +65,9 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)]
internal bool HandleOfflineMessages { get; private set; } = false;
[JsonProperty(Required = Required.DisallowNull)]
internal bool AcceptGifts { get; private set; } = false;
[JsonProperty(Required = Required.DisallowNull)]
internal bool ForwardKeysToOtherBots { get; private set; } = false;
@@ -98,7 +100,7 @@ namespace ArchiSteamFarm {
internal static BotConfig Load(string path) {
if (!File.Exists(path)) {
if (string.IsNullOrEmpty(path) || !File.Exists(path)) {
return null;
}
@@ -113,146 +115,7 @@ namespace ArchiSteamFarm {
return botConfig;
}
// TODO: This should be removed soon
internal static BotConfig LoadOldFormat(string path) {
if (!File.Exists(path)) {
return null;
}
BotConfig botConfig = new BotConfig();
try {
using (XmlReader reader = XmlReader.Create(path)) {
while (reader.Read()) {
if (reader.NodeType != XmlNodeType.Element) {
continue;
}
string key = reader.Name;
if (string.IsNullOrEmpty(key)) {
continue;
}
string value = reader.GetAttribute("value");
if (string.IsNullOrEmpty(value)) {
continue;
}
switch (key) {
case "Enabled":
botConfig.Enabled = bool.Parse(value);
break;
case "SteamLogin":
botConfig.SteamLogin = value;
break;
case "SteamPassword":
botConfig.SteamPassword = value;
break;
case "SteamApiKey":
botConfig.SteamApiKey = value;
break;
case "SteamTradeToken":
botConfig.SteamTradeToken = value;
break;
case "SteamParentalPIN":
botConfig.SteamParentalPIN = value;
break;
case "SteamMasterID":
botConfig.SteamMasterID = ulong.Parse(value);
break;
case "SteamMasterClanID":
botConfig.SteamMasterClanID = ulong.Parse(value);
break;
case "StartOnLaunch":
botConfig.StartOnLaunch = bool.Parse(value);
break;
case "UseAsfAsMobileAuthenticator":
botConfig.UseAsfAsMobileAuthenticator = bool.Parse(value);
break;
case "CardDropsRestricted":
botConfig.CardDropsRestricted = bool.Parse(value);
break;
case "FarmOffline":
botConfig.FarmOffline = bool.Parse(value);
break;
case "HandleOfflineMessages":
botConfig.HandleOfflineMessages = bool.Parse(value);
break;
case "ForwardKeysToOtherBots":
botConfig.ForwardKeysToOtherBots = bool.Parse(value);
break;
case "DistributeKeys":
botConfig.DistributeKeys = bool.Parse(value);
break;
case "ShutdownOnFarmingFinished":
botConfig.ShutdownOnFarmingFinished = bool.Parse(value);
break;
case "SendOnFarmingFinished":
botConfig.SendOnFarmingFinished = bool.Parse(value);
break;
case "SendTradePeriod":
botConfig.SendTradePeriod = byte.Parse(value);
break;
case "GamesPlayedWhileIdle":
botConfig.GamesPlayedWhileIdle.Clear();
foreach (string appID in value.Split(',')) {
botConfig.GamesPlayedWhileIdle.Add(uint.Parse(appID));
}
break;
case "Statistics":
case "Blacklist":
case "SteamNickname":
break;
default:
Logging.LogGenericWarning("Unrecognized config value: " + key + "=" + value);
break;
}
}
}
} catch (Exception e) {
Logging.LogGenericException(e);
Logging.LogGenericError("Your config for this bot instance is invalid, it won't run!");
return null;
}
// Fixups for new format
if (botConfig.SteamLogin != null && botConfig.SteamLogin.Equals("null")) {
botConfig.SteamLogin = null;
}
if (botConfig.SteamPassword != null && botConfig.SteamPassword.Equals("null")) {
botConfig.SteamPassword = null;
}
if (botConfig.SteamApiKey != null && botConfig.SteamApiKey.Equals("null")) {
botConfig.SteamApiKey = null;
}
if (botConfig.SteamParentalPIN != null && botConfig.SteamParentalPIN.Equals("null")) {
botConfig.SteamParentalPIN = null;
}
if (botConfig.SteamTradeToken != null && botConfig.SteamTradeToken.Equals("null")) {
botConfig.SteamTradeToken = null;
}
return botConfig;
}
// This constructor is used only by deserializer
private BotConfig() { }
// TODO: This should be removed soon
internal bool Convert(string path) {
try {
File.WriteAllText(path, JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented));
} catch (Exception e) {
Logging.LogGenericException(e);
return false;
}
Logging.LogGenericWarning("Your config was converted to new ASF V2.0 format");
return true;
}
}
}

View File

@@ -66,6 +66,10 @@ namespace ArchiSteamFarm {
private string FilePath;
internal static BotDatabase Load(string filePath) {
if (string.IsNullOrEmpty(filePath)) {
return null;
}
if (!File.Exists(filePath)) {
return new BotDatabase(filePath);
}
@@ -78,6 +82,10 @@ namespace ArchiSteamFarm {
return null;
}
if (botDatabase == null) {
return null;
}
botDatabase.FilePath = filePath;
return botDatabase;
}

View File

@@ -236,19 +236,17 @@ namespace ArchiSteamFarm {
GamesToFarm.Clear();
// Find APPIDs we need to farm
Logging.LogGenericInfo("Checking other pages...", Bot.BotName);
CheckPage(htmlDocument);
List<Task> tasks = new List<Task>(maxPages - 1);
for (byte page = 1; page <= maxPages; page++) {
if (page == 1) {
CheckPage(htmlDocument); // Because we fetched page number 1 already
} else {
if (maxPages > 1) {
Logging.LogGenericInfo("Checking other pages...", Bot.BotName);
List<Task> tasks = new List<Task>(maxPages - 1);
for (byte page = 2; page <= maxPages; page++) {
byte currentPage = page; // We need a copy of variable being passed when in for loops
tasks.Add(CheckPage(currentPage));
}
await Task.WhenAll(tasks).ConfigureAwait(false);
}
await Task.WhenAll(tasks).ConfigureAwait(false);
if (GamesToFarm.Count == 0) {
return false;
@@ -279,7 +277,26 @@ namespace ArchiSteamFarm {
continue;
}
uint appID = (uint) Utilities.OnlyNumbers(steamLink);
int index = steamLink.LastIndexOf('/');
if (index < 0) {
Logging.LogNullError("index", Bot.BotName);
continue;
}
index++;
if (steamLink.Length <= index) {
Logging.LogNullError("length", Bot.BotName);
continue;
}
steamLink = steamLink.Substring(index);
uint appID;
if (!uint.TryParse(steamLink, out appID)) {
Logging.LogNullError("appID", Bot.BotName);
continue;
}
if (appID == 0) {
Logging.LogNullError("appID", Bot.BotName);
continue;
@@ -301,13 +318,11 @@ namespace ArchiSteamFarm {
continue;
}
hoursString = Regex.Match(hoursString, @"[0-9\.,]+").Value;
float hours = 0;
float hours;
if (string.IsNullOrEmpty(hoursString)) {
hours = 0;
} else {
hours = float.Parse(hoursString, CultureInfo.InvariantCulture);
Match match = Regex.Match(hoursString, @"[0-9\.,]+");
if (match.Success) {
float.TryParse(match.Value, NumberStyles.Number, CultureInfo.InvariantCulture, out hours);
}
GamesToFarm[appID] = hours;

View File

@@ -40,8 +40,7 @@ namespace ArchiSteamFarm {
private const byte DefaultFarmingDelay = 5;
private const byte DefaultHttpTimeout = 60;
private const ushort DefaultWCFPort = 1242;
private static readonly ProtocolType DefaultSteamProtocol = ProtocolType.Tcp;
private const ProtocolType DefaultSteamProtocol = ProtocolType.Tcp;
// This is hardcoded blacklist which should not be possible to change
internal static readonly HashSet<uint> GlobalBlacklist = new HashSet<uint> { 267420, 303700, 335590, 368020, 425280 };

View File

@@ -45,7 +45,7 @@ namespace ArchiSteamFarm {
}
[JsonProperty(Required = Required.DisallowNull)]
private uint _CellID = 0;
private uint _CellID;
internal static GlobalDatabase Load() {
if (!File.Exists(FilePath)) {

View File

@@ -31,7 +31,7 @@ namespace ArchiSteamFarm {
internal static class Logging {
private static readonly object FileLock = new object();
private static bool LogToFile = false;
private static bool LogToFile;
internal static void Init() {
LogToFile = Program.GlobalConfig.LogToFile;

View File

@@ -481,19 +481,6 @@ namespace ArchiSteamFarm {
}
}
// CONVERSION START
foreach (var configFile in Directory.EnumerateFiles(ConfigDirectory, "*.xml")) {
string botName = Path.GetFileNameWithoutExtension(configFile);
Logging.LogGenericWarning("Found legacy " + botName + ".xml config file, it will now be converted to new ASF V2.0 format!");
Bot bot = new Bot(botName);
if (bot.BotConfig != null && bot.BotConfig.Enabled) {
isRunning = true;
} else {
Logging.LogGenericInfo("Not starting this instance because it's disabled in config file", botName);
}
}
// CONVERSION END
// Check if we got any bots running
if (!isRunning) {
OnBotShutdown();

View File

@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]
[assembly: AssemblyVersion("2.0.2.1")]
[assembly: AssemblyFileVersion("2.0.2.1")]

View File

@@ -37,7 +37,7 @@ namespace ArchiSteamFarm {
private readonly Bot Bot;
private readonly SemaphoreSlim TradesSemaphore = new SemaphoreSlim(1);
private byte ParsingTasks = 0;
private byte ParsingTasks;
internal static async Task LimitInventoryRequestsAsync() {
await InventorySemaphore.WaitAsync().ConfigureAwait(false);

View File

@@ -22,7 +22,6 @@
*/
using System.Text.RegularExpressions;
using System.Threading.Tasks;
namespace ArchiSteamFarm {
@@ -33,32 +32,6 @@ namespace ArchiSteamFarm {
await Task.Delay(miliseconds).ConfigureAwait(false);
}
internal static ulong OnlyNumbers(string inputString) {
if (string.IsNullOrEmpty(inputString)) {
return 0;
}
string resultString = OnlyNumbersString(inputString);
if (string.IsNullOrEmpty(resultString)) {
return 0;
}
ulong result;
if (!ulong.TryParse(resultString, out result)) {
return 0;
}
return result;
}
internal static string OnlyNumbersString(string text) {
if (string.IsNullOrEmpty(text)) {
return null;
}
return Regex.Replace(text, @"[^\d]", "");
}
internal static uint GetCharCountInString(string s, char c) {
if (string.IsNullOrEmpty(s)) {
return 0;

View File

@@ -219,10 +219,10 @@ namespace ArchiSteamFarm {
}
if (!responseMessage.IsSuccessStatusCode) {
if (Program.GlobalConfig.Debug) {
if (Debugging.IsDebugBuild || Program.GlobalConfig.Debug) {
Logging.LogGenericError("Request: " + request + "failed!");
Logging.LogGenericError("Status code: " + responseMessage.StatusCode);
Logging.LogGenericError("Content: " + await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false));
Logging.LogGenericError("Content: " + Environment.NewLine + await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false));
}
return null;
}

View File

@@ -11,6 +11,7 @@
"DismissInventoryNotifications": true,
"FarmOffline": false,
"HandleOfflineMessages": false,
"AcceptGifts": false,
"ForwardKeysToOtherBots": false,
"DistributeKeys": false,
"UseAsfAsMobileAuthenticator": false,

View File

@@ -29,7 +29,7 @@ using System.IO;
namespace ConfigGenerator {
internal class ASFConfig {
internal static HashSet<ASFConfig> ASFConfigs = new HashSet<ASFConfig>();
internal static readonly HashSet<ASFConfig> ASFConfigs = new HashSet<ASFConfig>();
internal string FilePath { get; set; }

View File

@@ -65,6 +65,9 @@ namespace ConfigGenerator {
[JsonProperty(Required = Required.DisallowNull)]
public bool HandleOfflineMessages { get; set; } = false;
[JsonProperty(Required = Required.DisallowNull)]
public bool AcceptGifts { get; set; } = false;
[JsonProperty(Required = Required.DisallowNull)]
public bool ForwardKeysToOtherBots { get; set; } = false;
@@ -119,7 +122,7 @@ namespace ConfigGenerator {
}
// This constructor is used only by deserializer
private BotConfig() : base() { }
private BotConfig() { }
private BotConfig(string filePath) : base(filePath) {
FilePath = filePath;

View File

@@ -44,14 +44,8 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ASFConfig.cs" />

View File

@@ -27,12 +27,9 @@ using System.Windows.Forms;
namespace ConfigGenerator {
internal class ConfigPage : TabPage {
internal readonly ASFConfig ASFConfig;
private EnhancedPropertyGrid EnhancedPropertyGrid;
internal ConfigPage(ASFConfig config) : base() {
internal ConfigPage(ASFConfig config) {
if (config == null) {
return;
}
@@ -41,17 +38,12 @@ namespace ConfigGenerator {
RefreshText();
EnhancedPropertyGrid = new EnhancedPropertyGrid(config);
Controls.Add(EnhancedPropertyGrid);
EnhancedPropertyGrid enhancedPropertyGrid = new EnhancedPropertyGrid(config);
Controls.Add(enhancedPropertyGrid);
}
internal void RefreshText() {
Text = Path.GetFileNameWithoutExtension(ASFConfig.FilePath);
}
private void InitializeComponent() {
SuspendLayout();
ResumeLayout(false);
}
}
}

View File

@@ -26,9 +26,9 @@ using System.Windows.Forms;
namespace ConfigGenerator {
internal sealed class EnhancedPropertyGrid : PropertyGrid {
private ASFConfig ASFConfig;
private readonly ASFConfig ASFConfig;
internal EnhancedPropertyGrid(ASFConfig config) : base() {
internal EnhancedPropertyGrid(ASFConfig config) {
if (config == null) {
return;
}
@@ -66,7 +66,6 @@ namespace ConfigGenerator {
if (globalConfig.SteamOwnerID != 0) {
Tutorial.OnAction(Tutorial.EPhase.GlobalConfigReady);
}
return;
}
}
}

View File

@@ -40,8 +40,7 @@ namespace ConfigGenerator {
private const byte DefaultFarmingDelay = 5;
private const byte DefaultHttpTimeout = 60;
private const ushort DefaultWCFPort = 1242;
private static readonly ProtocolType DefaultSteamProtocol = ProtocolType.Tcp;
private const ProtocolType DefaultSteamProtocol = ProtocolType.Tcp;
// This is hardcoded blacklist which should not be possible to change
internal static readonly HashSet<uint> GlobalBlacklist = new HashSet<uint> { 267420, 303700, 335590, 368020, 425280 };
@@ -161,7 +160,7 @@ namespace ConfigGenerator {
}
// This constructor is used only by deserializer
private GlobalConfig() : base() { }
private GlobalConfig() { }
private GlobalConfig(string filePath) : base(filePath) {
FilePath = filePath;

View File

@@ -23,6 +23,7 @@
*/
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
@@ -31,20 +32,11 @@ namespace ConfigGenerator {
public partial class MainForm : Form {
private const byte ReservedTabs = 3;
private readonly TabPage NewTab = new TabPage { Text = "+" };
private readonly TabPage RemoveTab = new TabPage { Text = "-" };
private readonly TabPage RenameTab = new TabPage { Text = "~" };
private ConfigPage ASFTab;
private TabPage RemoveTab = new TabPage() {
Text = "-",
};
private TabPage RenameTab = new TabPage() {
Text = "~",
};
private TabPage NewTab = new TabPage() {
Text = "+",
};
private TabPage OldTab;
public MainForm() {
@@ -73,7 +65,7 @@ namespace ConfigGenerator {
Tutorial.Enabled = false;
}
MainTab.TabPages.AddRange(new TabPage[] { RemoveTab, RenameTab, NewTab });
MainTab.TabPages.AddRange(new[] { RemoveTab, RenameTab, NewTab });
Tutorial.OnAction(Tutorial.EPhase.Start);
}
@@ -186,7 +178,7 @@ namespace ConfigGenerator {
Tutorial.OnAction(Tutorial.EPhase.Shown);
}
private void MainForm_HelpButtonClicked(object sender, System.ComponentModel.CancelEventArgs e) {
private void MainForm_HelpButtonClicked(object sender, CancelEventArgs e) {
if (sender == null || e == null) {
return;
}

View File

@@ -36,10 +36,7 @@ namespace ConfigGenerator {
private const string ASFDirectory = "ArchiSteamFarm";
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
private static readonly string ExecutableFile = Assembly.Location;
private static readonly string ExecutableName = Path.GetFileName(ExecutableFile);
private static readonly string ExecutableDirectory = Path.GetDirectoryName(ExecutableFile);
private static readonly string ExecutableDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
/// <summary>
/// The main entry point for the application.