mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-18 07:20:30 +00:00
Code review
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
@@ -249,7 +249,6 @@ namespace ArchiSteamFarm {
|
||||
Logging.LogGenericWarning("If issue persists, consider removing and readding ASF 2FA", BotName);
|
||||
} catch (Exception e) {
|
||||
Logging.LogGenericException(e, BotName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace ConfigGenerator {
|
||||
}
|
||||
|
||||
// This constructor is used only by deserializer
|
||||
private BotConfig() : base() { }
|
||||
private BotConfig() { }
|
||||
|
||||
private BotConfig(string filePath) : base(filePath) {
|
||||
FilePath = filePath;
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user