mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-21 16:58:37 +00:00
Improve readability of some specific segments
This commit is contained in:
@@ -97,7 +97,7 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INVOCABLE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INVOCABLE_DECLARATION_BRACES/@EntryValue">END_OF_LINE</s:String>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_USER_LINEBREAKS/@EntryValue">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/OTHER_BRACES/@EntryValue">END_OF_LINE</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/OTHER_BRACES/@EntryValue">END_OF_LINE</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CATCH_ON_NEW_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CATCH_ON_NEW_LINE/@EntryValue">False</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ELSE_ON_NEW_LINE/@EntryValue">False</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ELSE_ON_NEW_LINE/@EntryValue">False</s:Boolean>
|
||||||
|
|||||||
@@ -233,7 +233,9 @@ namespace ArchiSteamFarm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemWatcher = new FileSystemWatcher(SharedInfo.ConfigDirectory, "*.json") { NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite };
|
FileSystemWatcher = new FileSystemWatcher(SharedInfo.ConfigDirectory, "*.json") {
|
||||||
|
NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite
|
||||||
|
};
|
||||||
|
|
||||||
FileSystemWatcher.Changed += OnChanged;
|
FileSystemWatcher.Changed += OnChanged;
|
||||||
FileSystemWatcher.Created += OnCreated;
|
FileSystemWatcher.Created += OnCreated;
|
||||||
|
|||||||
@@ -170,7 +170,9 @@ namespace ArchiSteamFarm {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientMsgProtobuf<CMsgClientRedeemGuestPass> request = new ClientMsgProtobuf<CMsgClientRedeemGuestPass>(EMsg.ClientRedeemGuestPass) { SourceJobID = Client.GetNextJobID() };
|
ClientMsgProtobuf<CMsgClientRedeemGuestPass> request = new ClientMsgProtobuf<CMsgClientRedeemGuestPass>(EMsg.ClientRedeemGuestPass) {
|
||||||
|
SourceJobID = Client.GetNextJobID()
|
||||||
|
};
|
||||||
|
|
||||||
request.Body.guest_pass_id = guestPassID;
|
request.Body.guest_pass_id = guestPassID;
|
||||||
|
|
||||||
@@ -194,7 +196,9 @@ namespace ArchiSteamFarm {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientMsgProtobuf<CMsgClientRegisterKey> request = new ClientMsgProtobuf<CMsgClientRegisterKey>(EMsg.ClientRegisterKey) { SourceJobID = Client.GetNextJobID() };
|
ClientMsgProtobuf<CMsgClientRegisterKey> request = new ClientMsgProtobuf<CMsgClientRegisterKey>(EMsg.ClientRegisterKey) {
|
||||||
|
SourceJobID = Client.GetNextJobID()
|
||||||
|
};
|
||||||
|
|
||||||
request.Body.key = key;
|
request.Body.key = key;
|
||||||
|
|
||||||
@@ -303,7 +307,9 @@ namespace ArchiSteamFarm {
|
|||||||
JobID = jobID;
|
JobID = jobID;
|
||||||
|
|
||||||
if (msg.count_new_items > 0) {
|
if (msg.count_new_items > 0) {
|
||||||
Notifications = new HashSet<ENotification> { ENotification.Items };
|
Notifications = new HashSet<ENotification> {
|
||||||
|
ENotification.Items
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,10 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
serviceInstaller.Installers.Clear();
|
serviceInstaller.Installers.Clear();
|
||||||
|
|
||||||
EventLogInstaller logInstaller = new EventLogInstaller { Log = SharedInfo.EventLog, Source = SharedInfo.EventLogSource };
|
EventLogInstaller logInstaller = new EventLogInstaller {
|
||||||
|
Log = SharedInfo.EventLog,
|
||||||
|
Source = SharedInfo.EventLogSource
|
||||||
|
};
|
||||||
|
|
||||||
Installers.Add(serviceInstaller);
|
Installers.Add(serviceInstaller);
|
||||||
Installers.Add(serviceProcessInstaller);
|
Installers.Add(serviceProcessInstaller);
|
||||||
|
|||||||
@@ -86,7 +86,11 @@ namespace ArchiSteamFarm {
|
|||||||
string referer = SteamCommunityURL + "/tradeoffer/" + tradeID;
|
string referer = SteamCommunityURL + "/tradeoffer/" + tradeID;
|
||||||
string request = referer + "/accept";
|
string request = referer + "/accept";
|
||||||
|
|
||||||
Dictionary<string, string> data = new Dictionary<string, string>(3) { { "sessionid", sessionID }, { "serverid", "1" }, { "tradeofferid", tradeID.ToString() } };
|
Dictionary<string, string> data = new Dictionary<string, string>(3) {
|
||||||
|
{ "sessionid", sessionID },
|
||||||
|
{ "serverid", "1" },
|
||||||
|
{ "tradeofferid", tradeID.ToString() }
|
||||||
|
};
|
||||||
|
|
||||||
await WebBrowser.UrlPostRetry(request, data, referer).ConfigureAwait(false);
|
await WebBrowser.UrlPostRetry(request, data, referer).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@@ -108,7 +112,11 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string request = SteamStoreURL + "/checkout/addfreelicense";
|
string request = SteamStoreURL + "/checkout/addfreelicense";
|
||||||
Dictionary<string, string> data = new Dictionary<string, string>(3) { { "sessionid", sessionID }, { "subid", subID.ToString() }, { "action", "add_to_cart" } };
|
Dictionary<string, string> data = new Dictionary<string, string>(3) {
|
||||||
|
{ "sessionid", sessionID },
|
||||||
|
{ "subid", subID.ToString() },
|
||||||
|
{ "action", "add_to_cart" }
|
||||||
|
};
|
||||||
|
|
||||||
HtmlDocument htmlDocument = await WebBrowser.UrlPostToHtmlDocumentRetry(request, data).ConfigureAwait(false);
|
HtmlDocument htmlDocument = await WebBrowser.UrlPostToHtmlDocumentRetry(request, data).ConfigureAwait(false);
|
||||||
return htmlDocument?.DocumentNode.SelectSingleNode("//div[@class='add_free_content_success_area']") != null;
|
return htmlDocument?.DocumentNode.SelectSingleNode("//div[@class='add_free_content_success_area']") != null;
|
||||||
@@ -635,7 +643,15 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
string request = SteamCommunityURL + "/mobileconf/multiajaxop";
|
string request = SteamCommunityURL + "/mobileconf/multiajaxop";
|
||||||
|
|
||||||
List<KeyValuePair<string, string>> data = new List<KeyValuePair<string, string>>(7 + confirmations.Count*2) { new KeyValuePair<string, string>("op", accept ? "allow" : "cancel"), new KeyValuePair<string, string>("p", deviceID), new KeyValuePair<string, string>("a", SteamID.ToString()), new KeyValuePair<string, string>("k", confirmationHash), new KeyValuePair<string, string>("t", time.ToString()), new KeyValuePair<string, string>("m", "android"), new KeyValuePair<string, string>("tag", "conf") };
|
List<KeyValuePair<string, string>> data = new List<KeyValuePair<string, string>>(7 + confirmations.Count*2) {
|
||||||
|
new KeyValuePair<string, string>("op", accept ? "allow" : "cancel"),
|
||||||
|
new KeyValuePair<string, string>("p", deviceID),
|
||||||
|
new KeyValuePair<string, string>("a", SteamID.ToString()),
|
||||||
|
new KeyValuePair<string, string>("k", confirmationHash),
|
||||||
|
new KeyValuePair<string, string>("t", time.ToString()),
|
||||||
|
new KeyValuePair<string, string>("m", "android"),
|
||||||
|
new KeyValuePair<string, string>("tag", "conf")
|
||||||
|
};
|
||||||
|
|
||||||
foreach (MobileAuthenticator.Confirmation confirmation in confirmations) {
|
foreach (MobileAuthenticator.Confirmation confirmation in confirmations) {
|
||||||
data.Add(new KeyValuePair<string, string>("cid[]", confirmation.ID.ToString()));
|
data.Add(new KeyValuePair<string, string>("cid[]", confirmation.ID.ToString()));
|
||||||
@@ -750,7 +766,10 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string request = SteamCommunityURL + "/gid/" + groupID;
|
string request = SteamCommunityURL + "/gid/" + groupID;
|
||||||
Dictionary<string, string> data = new Dictionary<string, string>(2) { { "sessionID", sessionID }, { "action", "join" } };
|
Dictionary<string, string> data = new Dictionary<string, string>(2) {
|
||||||
|
{ "sessionID", sessionID },
|
||||||
|
{ "action", "join" }
|
||||||
|
};
|
||||||
|
|
||||||
return await WebBrowser.UrlPostRetry(request, data).ConfigureAwait(false);
|
return await WebBrowser.UrlPostRetry(request, data).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
@@ -777,7 +796,9 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
string request = SteamStoreURL + "/account/validatewalletcode";
|
string request = SteamStoreURL + "/account/validatewalletcode";
|
||||||
Dictionary<string, string> data = new Dictionary<string, string>(1) { { "wallet_code", key } };
|
Dictionary<string, string> data = new Dictionary<string, string>(1) {
|
||||||
|
{ "wallet_code", key }
|
||||||
|
};
|
||||||
|
|
||||||
Steam.RedeemWalletResponse response = await WebBrowser.UrlPostToJsonResultRetry<Steam.RedeemWalletResponse>(request, data).ConfigureAwait(false);
|
Steam.RedeemWalletResponse response = await WebBrowser.UrlPostToJsonResultRetry<Steam.RedeemWalletResponse>(request, data).ConfigureAwait(false);
|
||||||
return response?.PurchaseResult ?? ArchiHandler.PurchaseResponseCallback.EPurchaseResult.Timeout;
|
return response?.PurchaseResult ?? ArchiHandler.PurchaseResponseCallback.EPurchaseResult.Timeout;
|
||||||
@@ -966,7 +987,9 @@ namespace ArchiSteamFarm {
|
|||||||
Bot.ArchiLogger.LogGenericInfo("Unlocking parental account...");
|
Bot.ArchiLogger.LogGenericInfo("Unlocking parental account...");
|
||||||
|
|
||||||
string request = SteamCommunityURL + "/parental/ajaxunlock";
|
string request = SteamCommunityURL + "/parental/ajaxunlock";
|
||||||
Dictionary<string, string> data = new Dictionary<string, string>(1) { { "pin", parentalPin } };
|
Dictionary<string, string> data = new Dictionary<string, string>(1) {
|
||||||
|
{ "pin", parentalPin }
|
||||||
|
};
|
||||||
|
|
||||||
bool result = await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false);
|
bool result = await WebBrowser.UrlPostRetry(request, data, SteamCommunityURL).ConfigureAwait(false);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
|||||||
@@ -906,7 +906,17 @@ namespace ArchiSteamFarm {
|
|||||||
loginKey = CryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey);
|
loginKey = CryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails { Username = BotConfig.SteamLogin, Password = password, AuthCode = AuthCode, CellID = Program.GlobalDatabase.CellID, LoginID = LoginID, LoginKey = loginKey, TwoFactorCode = TwoFactorCode, SentryFileHash = sentryFileHash, ShouldRememberPassword = true };
|
SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails {
|
||||||
|
Username = BotConfig.SteamLogin,
|
||||||
|
Password = password,
|
||||||
|
AuthCode = AuthCode,
|
||||||
|
CellID = Program.GlobalDatabase.CellID,
|
||||||
|
LoginID = LoginID,
|
||||||
|
LoginKey = loginKey,
|
||||||
|
TwoFactorCode = TwoFactorCode,
|
||||||
|
SentryFileHash = sentryFileHash,
|
||||||
|
ShouldRememberPassword = true
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SteamUser.LogOn(logOnDetails);
|
SteamUser.LogOn(logOnDetails);
|
||||||
|
|||||||
@@ -30,7 +30,12 @@ using Newtonsoft.Json;
|
|||||||
|
|
||||||
namespace ArchiSteamFarm {
|
namespace ArchiSteamFarm {
|
||||||
internal sealed class GlobalDatabase : IDisposable {
|
internal sealed class GlobalDatabase : IDisposable {
|
||||||
private static readonly JsonSerializerSettings CustomSerializerSettings = new JsonSerializerSettings { Converters = new List<JsonConverter>(2) { new IPAddressConverter(), new IPEndPointConverter() } };
|
private static readonly JsonSerializerSettings CustomSerializerSettings = new JsonSerializerSettings {
|
||||||
|
Converters = new List<JsonConverter>(2) {
|
||||||
|
new IPAddressConverter(),
|
||||||
|
new IPEndPointConverter()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal readonly InMemoryServerListProvider ServerListProvider = new InMemoryServerListProvider();
|
internal readonly InMemoryServerListProvider ServerListProvider = new InMemoryServerListProvider();
|
||||||
|
|||||||
@@ -47,18 +47,29 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
LoggingConfiguration config = new LoggingConfiguration();
|
LoggingConfiguration config = new LoggingConfiguration();
|
||||||
|
|
||||||
ColoredConsoleTarget coloredConsoleTarget = new ColoredConsoleTarget("ColoredConsole") { DetectConsoleAvailable = false, Layout = GeneralLayout };
|
ColoredConsoleTarget coloredConsoleTarget = new ColoredConsoleTarget("ColoredConsole") {
|
||||||
|
DetectConsoleAvailable = false,
|
||||||
|
Layout = GeneralLayout
|
||||||
|
};
|
||||||
|
|
||||||
config.AddTarget(coloredConsoleTarget);
|
config.AddTarget(coloredConsoleTarget);
|
||||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, coloredConsoleTarget));
|
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, coloredConsoleTarget));
|
||||||
|
|
||||||
if (Program.IsRunningAsService) {
|
if (Program.IsRunningAsService) {
|
||||||
EventLogTarget eventLogTarget = new EventLogTarget("EventLog") { Layout = EventLogLayout, Log = SharedInfo.EventLog, Source = SharedInfo.EventLogSource };
|
EventLogTarget eventLogTarget = new EventLogTarget("EventLog") {
|
||||||
|
Layout = EventLogLayout,
|
||||||
|
Log = SharedInfo.EventLog,
|
||||||
|
Source = SharedInfo.EventLogSource
|
||||||
|
};
|
||||||
|
|
||||||
config.AddTarget(eventLogTarget);
|
config.AddTarget(eventLogTarget);
|
||||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, eventLogTarget));
|
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, eventLogTarget));
|
||||||
} else if (!Program.Mode.HasFlag(Program.EMode.Client) || Program.Mode.HasFlag(Program.EMode.Server)) {
|
} else if (!Program.Mode.HasFlag(Program.EMode.Client) || Program.Mode.HasFlag(Program.EMode.Server)) {
|
||||||
FileTarget fileTarget = new FileTarget("File") { DeleteOldFileOnStartup = true, FileName = SharedInfo.LogFile, Layout = GeneralLayout };
|
FileTarget fileTarget = new FileTarget("File") {
|
||||||
|
DeleteOldFileOnStartup = true,
|
||||||
|
FileName = SharedInfo.LogFile,
|
||||||
|
Layout = GeneralLayout
|
||||||
|
};
|
||||||
|
|
||||||
config.AddTarget(fileTarget);
|
config.AddTarget(fileTarget);
|
||||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
||||||
|
|||||||
@@ -51,9 +51,14 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
ArchiLogger = archiLogger;
|
ArchiLogger = archiLogger;
|
||||||
|
|
||||||
HttpClientHandler httpClientHandler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip, CookieContainer = CookieContainer };
|
HttpClientHandler httpClientHandler = new HttpClientHandler {
|
||||||
|
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
|
||||||
|
CookieContainer = CookieContainer
|
||||||
|
};
|
||||||
|
|
||||||
HttpClient = new HttpClient(httpClientHandler) { Timeout = TimeSpan.FromSeconds(Program.GlobalConfig.HttpTimeout) };
|
HttpClient = new HttpClient(httpClientHandler) {
|
||||||
|
Timeout = TimeSpan.FromSeconds(Program.GlobalConfig.HttpTimeout)
|
||||||
|
};
|
||||||
|
|
||||||
// Most web services expect that UserAgent is set, so we declare it globally
|
// Most web services expect that UserAgent is set, so we declare it globally
|
||||||
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd("ArchiSteamFarm/" + SharedInfo.Version);
|
HttpClient.DefaultRequestHeaders.UserAgent.ParseAdd("ArchiSteamFarm/" + SharedInfo.Version);
|
||||||
|
|||||||
@@ -36,11 +36,43 @@ namespace ConfigGenerator {
|
|||||||
return DialogResult.Abort;
|
return DialogResult.Abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextBox textBox = new TextBox { Anchor = AnchorStyles.Right, Bounds = new Rectangle(12, 36, 372, 20), Width = 1000 };
|
TextBox textBox = new TextBox {
|
||||||
Button buttonOk = new Button { Anchor = AnchorStyles.Bottom | AnchorStyles.Right, Bounds = new Rectangle(228, 72, 75, 23), DialogResult = DialogResult.OK, Text = Resources.OK };
|
Anchor = AnchorStyles.Right,
|
||||||
Button buttonCancel = new Button { Anchor = AnchorStyles.Bottom | AnchorStyles.Right, Bounds = new Rectangle(309, 72, 75, 23), DialogResult = DialogResult.Cancel, Text = Resources.Cancel };
|
Bounds = new Rectangle(12, 36, 372, 20),
|
||||||
Label label = new Label { AutoSize = true, Bounds = new Rectangle(9, 20, 372, 13), Text = promptText };
|
Width = 1000
|
||||||
Form form = new Form { AcceptButton = buttonOk, CancelButton = buttonCancel, ClientSize = new Size(Math.Max(300, label.Right + 10), 107), Controls = { label, textBox, buttonOk, buttonCancel }, FormBorderStyle = FormBorderStyle.FixedDialog, MinimizeBox = false, MaximizeBox = false, StartPosition = FormStartPosition.CenterScreen, Text = title };
|
};
|
||||||
|
|
||||||
|
Button buttonOk = new Button {
|
||||||
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
|
||||||
|
Bounds = new Rectangle(228, 72, 75, 23),
|
||||||
|
DialogResult = DialogResult.OK,
|
||||||
|
Text = Resources.OK
|
||||||
|
};
|
||||||
|
|
||||||
|
Button buttonCancel = new Button {
|
||||||
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
|
||||||
|
Bounds = new Rectangle(309, 72, 75, 23),
|
||||||
|
DialogResult = DialogResult.Cancel,
|
||||||
|
Text = Resources.Cancel
|
||||||
|
};
|
||||||
|
|
||||||
|
Label label = new Label {
|
||||||
|
AutoSize = true,
|
||||||
|
Bounds = new Rectangle(9, 20, 372, 13),
|
||||||
|
Text = promptText
|
||||||
|
};
|
||||||
|
|
||||||
|
Form form = new Form {
|
||||||
|
AcceptButton = buttonOk,
|
||||||
|
CancelButton = buttonCancel,
|
||||||
|
ClientSize = new Size(Math.Max(300, label.Right + 10), 107),
|
||||||
|
Controls = { label, textBox, buttonOk, buttonCancel },
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||||
|
MinimizeBox = false,
|
||||||
|
MaximizeBox = false,
|
||||||
|
StartPosition = FormStartPosition.CenterScreen,
|
||||||
|
Text = title
|
||||||
|
};
|
||||||
|
|
||||||
DialogResult dialogResult = form.ShowDialog();
|
DialogResult dialogResult = form.ShowDialog();
|
||||||
value = textBox.Text;
|
value = textBox.Text;
|
||||||
@@ -53,10 +85,37 @@ namespace ConfigGenerator {
|
|||||||
return DialogResult.Abort;
|
return DialogResult.Abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
Button buttonYes = new Button { Anchor = AnchorStyles.Bottom | AnchorStyles.Right, Bounds = new Rectangle(228, 72, 75, 23), DialogResult = DialogResult.Yes, Text = Resources.Yes };
|
Button buttonYes = new Button {
|
||||||
Button buttonNo = new Button { Anchor = AnchorStyles.Bottom | AnchorStyles.Right, Bounds = new Rectangle(309, 72, 75, 23), DialogResult = DialogResult.No, Text = Resources.No };
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
|
||||||
Label label = new Label { AutoSize = true, Bounds = new Rectangle(9, 20, 372, 13), Text = promptText };
|
Bounds = new Rectangle(228, 72, 75, 23),
|
||||||
Form form = new Form { AcceptButton = buttonYes, CancelButton = buttonNo, ClientSize = new Size(Math.Max(300, label.Right + 10), 107), Controls = { label, buttonYes, buttonNo }, FormBorderStyle = FormBorderStyle.FixedDialog, MinimizeBox = false, MaximizeBox = false, StartPosition = FormStartPosition.CenterScreen, Text = title };
|
DialogResult = DialogResult.Yes,
|
||||||
|
Text = Resources.Yes
|
||||||
|
};
|
||||||
|
|
||||||
|
Button buttonNo = new Button {
|
||||||
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Right,
|
||||||
|
Bounds = new Rectangle(309, 72, 75, 23),
|
||||||
|
DialogResult = DialogResult.No,
|
||||||
|
Text = Resources.No
|
||||||
|
};
|
||||||
|
|
||||||
|
Label label = new Label {
|
||||||
|
AutoSize = true,
|
||||||
|
Bounds = new Rectangle(9, 20, 372, 13),
|
||||||
|
Text = promptText
|
||||||
|
};
|
||||||
|
|
||||||
|
Form form = new Form {
|
||||||
|
AcceptButton = buttonYes,
|
||||||
|
CancelButton = buttonNo,
|
||||||
|
ClientSize = new Size(Math.Max(300, label.Right + 10), 107),
|
||||||
|
Controls = { label, buttonYes, buttonNo },
|
||||||
|
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||||
|
MinimizeBox = false,
|
||||||
|
MaximizeBox = false,
|
||||||
|
StartPosition = FormStartPosition.CenterScreen,
|
||||||
|
Text = title
|
||||||
|
};
|
||||||
|
|
||||||
DialogResult dialogResult = form.ShowDialog();
|
DialogResult dialogResult = form.ShowDialog();
|
||||||
return dialogResult;
|
return dialogResult;
|
||||||
|
|||||||
@@ -47,7 +47,10 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBoxTarget messageBoxTarget = new MessageBoxTarget { Name = "MessageBox", Layout = GeneralLayout };
|
MessageBoxTarget messageBoxTarget = new MessageBoxTarget {
|
||||||
|
Name = "MessageBox",
|
||||||
|
Layout = GeneralLayout
|
||||||
|
};
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget(messageBoxTarget);
|
LogManager.Configuration.AddTarget(messageBoxTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Fatal, messageBoxTarget));
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Fatal, messageBoxTarget));
|
||||||
@@ -59,7 +62,11 @@ namespace ArchiSteamFarm {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileTarget fileTarget = new FileTarget("File") { DeleteOldFileOnStartup = true, FileName = SharedInfo.LogFile, Layout = GeneralLayout };
|
FileTarget fileTarget = new FileTarget("File") {
|
||||||
|
DeleteOldFileOnStartup = true,
|
||||||
|
FileName = SharedInfo.LogFile,
|
||||||
|
Layout = GeneralLayout
|
||||||
|
};
|
||||||
|
|
||||||
LogManager.Configuration.AddTarget(fileTarget);
|
LogManager.Configuration.AddTarget(fileTarget);
|
||||||
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
LogManager.Configuration.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
||||||
@@ -68,7 +75,14 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal static void InitFormLogger() {
|
internal static void InitFormLogger() {
|
||||||
RichTextBoxTarget formControlTarget = new RichTextBoxTarget { AutoScroll = true, ControlName = "LogTextBox", FormName = "MainForm", Layout = GeneralLayout, MaxLines = byte.MaxValue, Name = "RichTextBox" };
|
RichTextBoxTarget formControlTarget = new RichTextBoxTarget {
|
||||||
|
AutoScroll = true,
|
||||||
|
ControlName = "LogTextBox",
|
||||||
|
FormName = "MainForm",
|
||||||
|
Layout = GeneralLayout,
|
||||||
|
MaxLines = byte.MaxValue,
|
||||||
|
Name = "RichTextBox"
|
||||||
|
};
|
||||||
|
|
||||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Error", "Red", "Black"));
|
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Error", "Red", "Black"));
|
||||||
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Warn", "Yellow", "Black"));
|
formControlTarget.RowColoringRules.Add(new RichTextBoxRowColoringRule("level >= LogLevel.Warn", "Yellow", "Black"));
|
||||||
|
|||||||
@@ -100,7 +100,10 @@ namespace GUI {
|
|||||||
botStatusForm.TopLevel = false;
|
botStatusForm.TopLevel = false;
|
||||||
BotStatusPanel.Controls.Add(botStatusForm);
|
BotStatusPanel.Controls.Add(botStatusForm);
|
||||||
|
|
||||||
ListViewItem botListViewItem = new ListViewItem { ImageIndex = BotIndexes[botName], Text = botName };
|
ListViewItem botListViewItem = new ListViewItem {
|
||||||
|
ImageIndex = BotIndexes[botName],
|
||||||
|
Text = botName
|
||||||
|
};
|
||||||
|
|
||||||
BotListView.Items.Add(botListViewItem);
|
BotListView.Items.Add(botListViewItem);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user