mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-09-20 06:22:13 +00:00
Address Rider EAP inspections/cleanup
This commit is contained in:
parent
f160a25fb0
commit
d479eb9f97
44 changed files with 1251 additions and 1237 deletions
|
@ -50,7 +50,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
|
|||
throw new InvalidOperationException(nameof(response.Content.Link));
|
||||
}
|
||||
|
||||
return Uri.EscapeUriString(response.Content!.Link!);
|
||||
return Uri.EscapeUriString(response.Content.Link);
|
||||
}
|
||||
|
||||
#pragma warning disable CA1812 // False positive, the class is used during json deserialization
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
|
|
|
@ -1,65 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
|
||||
xmlns="">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
@ -112,10 +54,14 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="PluginDisabledMissingBuildToken" xml:space="preserve">
|
||||
<value>{0} has been disabled due to a missing build token</value>
|
||||
|
|
|
@ -169,7 +169,7 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
|||
}
|
||||
|
||||
SemaphoreSlim refreshSemaphore = new(1, 1);
|
||||
Timer refreshTimer = new(async _ => await Refresh(bot).ConfigureAwait(false));
|
||||
Timer refreshTimer = new(OnBotRefreshTimer, bot, Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
|
||||
|
||||
if (!BotSynchronizations.TryAdd(bot, (refreshSemaphore, refreshTimer))) {
|
||||
refreshSemaphore.Dispose();
|
||||
|
@ -246,6 +246,14 @@ namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
|||
GlobalCache.OnPICSChangesRestart(currentChangeNumber);
|
||||
}
|
||||
|
||||
private static async void OnBotRefreshTimer(object? state) {
|
||||
if (state is not Bot bot) {
|
||||
throw new InvalidOperationException(nameof(state));
|
||||
}
|
||||
|
||||
await Refresh(bot).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async void OnLicenseList(Bot bot, SteamApps.LicenseListCallback callback) {
|
||||
if (bot == null) {
|
||||
throw new ArgumentNullException(nameof(bot));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/CodeEditing/TypingAssist/Asp/FormatOnClosingTag/@EntryValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/CodeEditing/TypingAssist/Asp/FormatOnEnter/@EntryValue">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeEditing/TypingAssist/FormatOnPaste/@EntryValue">FullFormat</s:String>
|
||||
|
@ -41,6 +41,7 @@
|
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTrailingCommaInSinglelineLists/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeModifiers/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AsyncVoidMethod/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=BadAttributeBracketsSpaces/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=BadBracesSpaces/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=BadChildStatementIndent/@EntryIndexedValue">WARNING</s:String>
|
||||
|
@ -221,10 +222,12 @@
|
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingIndent/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingLinebreak/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingSpace/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MoveToExistingPositionalDeconstructionPattern/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleSpaces/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleStatementsOnOneLine/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleTypeMembersOnOneLine/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotOverriddenInSpecificCulture/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NullableWarningSuppressionIsUsed/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002EAttributeProducesTooManyTests/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002EMethodWithParametersAndTestAttribute/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NUnit_002ENonPublicMethodWithTestAttribute/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
|
@ -269,6 +272,7 @@
|
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StringStartsWithIsCultureSpecific/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=StructMemberCanBeMadeReadOnly/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestBaseTypeForParameter/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestBaseTypeForParameterInConstructor/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestDiscardDeclarationVarStyle/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FBuiltInTypes/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FDeconstructionDeclarations/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
|
@ -285,6 +289,7 @@
|
|||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnnecessaryWhitespace/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseDeconstruction/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseDeconstructionOnParameter/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseNameofExpressionForPartOfTheString/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseNegatedPatternInIsExpression/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseNegatedPatternMatching/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseNullPropagation/@EntryIndexedValue">SUGGESTION</s:String>
|
||||
|
|
|
@ -231,7 +231,7 @@ namespace ArchiSteamFarm.Core {
|
|||
return null;
|
||||
}
|
||||
|
||||
Version newVersion = new(releaseResponse.Tag!);
|
||||
Version newVersion = new(releaseResponse.Tag);
|
||||
|
||||
ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.UpdateVersionInfo, SharedInfo.Version, newVersion));
|
||||
|
||||
|
@ -400,6 +400,7 @@ namespace ArchiSteamFarm.Core {
|
|||
if (!string.IsNullOrEmpty(Program.NetworkGroup)) {
|
||||
using SHA256 hashingAlgorithm = SHA256.Create();
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
networkGroupText = "-" + BitConverter.ToString(hashingAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(Program.NetworkGroup!))).Replace("-", "", StringComparison.Ordinal);
|
||||
} else if (!string.IsNullOrEmpty(GlobalConfig.WebProxyText)) {
|
||||
using SHA256 hashingAlgorithm = SHA256.Create();
|
||||
|
@ -429,6 +430,8 @@ namespace ArchiSteamFarm.Core {
|
|||
|
||||
if (loadedAssembliesNames == null) {
|
||||
Assembly[] loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
loadedAssembliesNames = loadedAssemblies.Select(loadedAssembly => loadedAssembly.FullName).Where(name => !string.IsNullOrEmpty(name)).ToHashSet()!;
|
||||
}
|
||||
|
||||
|
@ -439,6 +442,8 @@ namespace ArchiSteamFarm.Core {
|
|||
}
|
||||
}
|
||||
|
||||
private static async void OnAutoUpdatesTimer(object? state) => await UpdateAndRestart().ConfigureAwait(false);
|
||||
|
||||
private static async void OnChanged(object sender, FileSystemEventArgs e) {
|
||||
if (sender == null) {
|
||||
throw new ArgumentNullException(nameof(sender));
|
||||
|
@ -882,7 +887,7 @@ namespace ArchiSteamFarm.Core {
|
|||
TimeSpan autoUpdatePeriod = TimeSpan.FromHours(GlobalConfig.UpdatePeriod);
|
||||
|
||||
AutoUpdatesTimer = new Timer(
|
||||
async _ => await UpdateAndRestart().ConfigureAwait(false),
|
||||
OnAutoUpdatesTimer,
|
||||
null,
|
||||
autoUpdatePeriod, // Delay
|
||||
autoUpdatePeriod // Period
|
||||
|
@ -1016,7 +1021,7 @@ namespace ArchiSteamFarm.Core {
|
|||
}
|
||||
|
||||
if (!Directory.Exists(directory)) {
|
||||
Directory.CreateDirectory(directory!);
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
// We're not interested in extracting placeholder files (but we still want directories created for them, done above)
|
||||
|
|
|
@ -228,6 +228,8 @@ namespace ArchiSteamFarm.Core {
|
|||
{ "MatchEverything", Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything) ? "1" : "0" },
|
||||
{ "Nickname", nickname ?? "" },
|
||||
{ "SteamID", Bot.SteamID.ToString(CultureInfo.InvariantCulture) },
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "TradeToken", tradeToken! }
|
||||
};
|
||||
|
||||
|
|
|
@ -161,13 +161,13 @@ namespace ArchiSteamFarm.Helpers {
|
|||
}
|
||||
|
||||
if (!Directory.Exists(directoryPath)) {
|
||||
Directory.CreateDirectory(directoryPath!);
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
||||
DirectoryInfo directoryInfo = new(directoryPath!);
|
||||
DirectoryInfo directoryInfo = new(directoryPath);
|
||||
|
||||
try {
|
||||
DirectorySecurity directorySecurity = new(directoryPath!, AccessControlSections.All);
|
||||
DirectorySecurity directorySecurity = new(directoryPath, AccessControlSections.All);
|
||||
|
||||
directoryInfo.SetAccessControl(directorySecurity);
|
||||
} catch (PrivilegeNotHeldException e) {
|
||||
|
@ -179,7 +179,7 @@ namespace ArchiSteamFarm.Helpers {
|
|||
#else
|
||||
} else if (RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
|
||||
#endif
|
||||
OS.UnixSetFileAccess(directoryPath!, OS.EUnixPermission.Combined777);
|
||||
OS.UnixSetFileAccess(directoryPath, OS.EUnixPermission.Combined777);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
// limitations under the License.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ArchiSteamFarm.Compatibility;
|
||||
using ArchiSteamFarm.Core;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
@ -85,20 +85,20 @@ namespace ArchiSteamFarm.Helpers {
|
|||
// We always want to write entire content to temporary file first, in order to never load corrupted data, also when target file doesn't exist
|
||||
string newFilePath = FilePath + ".new";
|
||||
|
||||
if (System.IO.File.Exists(FilePath)) {
|
||||
string currentJson = await File.ReadAllTextAsync(FilePath!).ConfigureAwait(false);
|
||||
if (File.Exists(FilePath)) {
|
||||
string currentJson = await Compatibility.File.ReadAllTextAsync(FilePath!).ConfigureAwait(false);
|
||||
|
||||
if (json == currentJson) {
|
||||
return;
|
||||
}
|
||||
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
await Compatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
System.IO.File.Replace(newFilePath, FilePath, null);
|
||||
File.Replace(newFilePath, FilePath!, null);
|
||||
} else {
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
await Compatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
System.IO.File.Move(newFilePath, FilePath);
|
||||
File.Move(newFilePath, FilePath!);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
|
@ -140,20 +140,20 @@ namespace ArchiSteamFarm.Helpers {
|
|||
|
||||
try {
|
||||
// We always want to write entire content to temporary file first, in order to never load corrupted data, also when target file doesn't exist
|
||||
if (System.IO.File.Exists(filePath)) {
|
||||
string currentJson = await File.ReadAllTextAsync(filePath).ConfigureAwait(false);
|
||||
if (File.Exists(filePath)) {
|
||||
string currentJson = await Compatibility.File.ReadAllTextAsync(filePath).ConfigureAwait(false);
|
||||
|
||||
if (json == currentJson) {
|
||||
return true;
|
||||
}
|
||||
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
await Compatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
System.IO.File.Replace(newFilePath, filePath, null);
|
||||
File.Replace(newFilePath, filePath, null);
|
||||
} else {
|
||||
await File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
await Compatibility.File.WriteAllTextAsync(newFilePath, json).ConfigureAwait(false);
|
||||
|
||||
System.IO.File.Move(newFilePath, filePath);
|
||||
File.Move(newFilePath, filePath);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.StringToEncrypt))));
|
||||
}
|
||||
|
||||
string? encryptedString = Actions.Encrypt(request.CryptoMethod, request.StringToEncrypt!);
|
||||
string? encryptedString = Actions.Encrypt(request.CryptoMethod, request.StringToEncrypt);
|
||||
|
||||
return Ok(new GenericResponse<string>(encryptedString));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(request.StringToHash))));
|
||||
}
|
||||
|
||||
string hash = Actions.Hash(request.HashingMethod, request.StringToHash!);
|
||||
string hash = Actions.Hash(request.HashingMethod, request.StringToHash);
|
||||
|
||||
return Ok(new GenericResponse<string>(hash));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(bots))));
|
||||
}
|
||||
|
||||
return Ok(new GenericResponse<IReadOnlyDictionary<string, Bot>>(bots.Where(bot => !string.IsNullOrEmpty(bot.BotName)).ToDictionary(bot => bot.BotName, bot => bot, Bot.BotsComparer)!));
|
||||
return Ok(new GenericResponse<IReadOnlyDictionary<string, Bot>>(bots.Where(bot => !string.IsNullOrEmpty(bot.BotName)).ToDictionary(bot => bot.BotName, bot => bot, Bot.BotsComparer)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -280,7 +280,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botNames)));
|
||||
}
|
||||
|
||||
IList<bool> results = await Utilities.InParallel(bots.Select(bot => Task.Run(() => bot.SetUserInput(request.Type, request.Value!)))).ConfigureAwait(false);
|
||||
IList<bool> results = await Utilities.InParallel(bots.Select(bot => Task.Run(() => bot.SetUserInput(request.Type, request.Value)))).ConfigureAwait(false);
|
||||
|
||||
return Ok(results.All(result => result) ? new GenericResponse(true) : new GenericResponse(false, Strings.WarningFailed));
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
throw new InvalidOperationException(nameof(Bot.Bots));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.NewName) || !ASF.IsValidBotName(request.NewName!) || Bot.Bots.ContainsKey(request.NewName!)) {
|
||||
if (string.IsNullOrEmpty(request.NewName) || !ASF.IsValidBotName(request.NewName) || Bot.Bots.ContainsKey(request.NewName)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(request.NewName))));
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.BotNotFound, botName)));
|
||||
}
|
||||
|
||||
bool result = await bot.Rename(request.NewName!).ConfigureAwait(false);
|
||||
bool result = await bot.Rename(request.NewName).ConfigureAwait(false);
|
||||
|
||||
return Ok(new GenericResponse(result));
|
||||
}
|
||||
|
|
|
@ -67,16 +67,18 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
return BadRequest(new GenericResponse(false, Strings.ErrorNoBotsDefined));
|
||||
}
|
||||
|
||||
string command = request.Command!;
|
||||
string command = request.Command;
|
||||
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!string.IsNullOrEmpty(commandPrefix) && command.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (command.Length == commandPrefix!.Length) {
|
||||
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
|
||||
return BadRequest(new GenericResponse(false, string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsEmpty, nameof(command))));
|
||||
}
|
||||
|
||||
command = command[commandPrefix!.Length..];
|
||||
command = command[commandPrefix.Length..];
|
||||
}
|
||||
|
||||
string? response = await targetBot.Commands.Response(steamOwnerID, command).ConfigureAwait(false);
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
string? unifiedName = field.FieldType.GetUnifiedName();
|
||||
|
||||
if (!string.IsNullOrEmpty(unifiedName)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[jsonProperty.PropertyName ?? field.Name] = unifiedName!;
|
||||
}
|
||||
}
|
||||
|
@ -80,6 +81,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
string? unifiedName = property.PropertyType.GetUnifiedName();
|
||||
|
||||
if (!string.IsNullOrEmpty(unifiedName)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[jsonProperty.PropertyName ?? property.Name] = unifiedName!;
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +105,10 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
continue;
|
||||
}
|
||||
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
body[valueText!] = valueObjText!;
|
||||
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace ArchiSteamFarm.IPC.Integration {
|
|||
|
||||
ArchiCryptoHelper.EHashingMethod ipcPasswordFormat = ASF.GlobalConfig != null ? ASF.GlobalConfig.IPCPasswordFormat : GlobalConfig.DefaultIPCPasswordFormat;
|
||||
|
||||
string inputHash = ArchiCryptoHelper.Hash(ipcPasswordFormat, inputPassword!);
|
||||
string inputHash = ArchiCryptoHelper.Hash(ipcPasswordFormat, inputPassword);
|
||||
|
||||
bool authorized = ipcPassword == inputHash;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace ArchiSteamFarm.IPC.Integration {
|
|||
throw new InvalidOperationException(nameof(enumValue));
|
||||
}
|
||||
|
||||
definition.Add(enumName!, enumObject);
|
||||
definition.Add(enumName, enumObject);
|
||||
}
|
||||
|
||||
schema.AddExtension("x-definition", definition);
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace ArchiSteamFarm.IPC.Responses {
|
|||
public GenericResponse(bool success, string? message = null) {
|
||||
Success = success;
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
Message = !string.IsNullOrEmpty(message) ? message! : success ? "OK" : Strings.WarningFailed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using JetBrains.Annotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ArchiSteamFarm.IPC.Responses {
|
||||
|
@ -46,7 +45,7 @@ namespace ArchiSteamFarm.IPC.Responses {
|
|||
[Required]
|
||||
public TypeProperties Properties { get; private set; }
|
||||
|
||||
internal TypeResponse([NotNull] Dictionary<string, string> body, [NotNull] TypeProperties properties) {
|
||||
internal TypeResponse(Dictionary<string, string> body, TypeProperties properties) {
|
||||
Body = body ?? throw new ArgumentNullException(nameof(body));
|
||||
Properties = properties ?? throw new ArgumentNullException(nameof(properties));
|
||||
}
|
||||
|
|
|
@ -1,65 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
|
||||
xmlns="">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
|
@ -112,10 +54,14 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="AcceptingTrade" xml:space="preserve">
|
||||
<value>Accepting trade: {0}</value>
|
||||
|
|
|
@ -149,12 +149,15 @@ namespace ArchiSteamFarm.NLog {
|
|||
loggedMessage.Append(steamID);
|
||||
}
|
||||
|
||||
LogEventInfo logEventInfo = new(LogLevel.Trace, Logger.Name, loggedMessage.ToString());
|
||||
logEventInfo.Properties["Echo"] = echo;
|
||||
logEventInfo.Properties["Message"] = message;
|
||||
logEventInfo.Properties["ChatGroupID"] = chatGroupID;
|
||||
logEventInfo.Properties["ChatID"] = chatID;
|
||||
logEventInfo.Properties["SteamID"] = steamID;
|
||||
LogEventInfo logEventInfo = new(LogLevel.Trace, Logger.Name, loggedMessage.ToString()) {
|
||||
Properties = {
|
||||
["Echo"] = echo,
|
||||
["Message"] = message,
|
||||
["ChatGroupID"] = chatGroupID,
|
||||
["ChatID"] = chatID,
|
||||
["SteamID"] = steamID
|
||||
}
|
||||
};
|
||||
|
||||
Logger.Log(logEventInfo);
|
||||
}
|
||||
|
@ -220,11 +223,13 @@ namespace ArchiSteamFarm.NLog {
|
|||
|
||||
string loggedMessage = previousMethodName + "() " + steamID.AccountType + " " + steamID64 + (handled.HasValue ? " = " + handled.Value : "");
|
||||
|
||||
LogEventInfo logEventInfo = new(LogLevel.Trace, Logger.Name, loggedMessage);
|
||||
|
||||
logEventInfo.Properties["AccountType"] = steamID.AccountType;
|
||||
logEventInfo.Properties["Handled"] = handled;
|
||||
logEventInfo.Properties["SteamID"] = steamID64;
|
||||
LogEventInfo logEventInfo = new(LogLevel.Trace, Logger.Name, loggedMessage) {
|
||||
Properties = {
|
||||
["AccountType"] = steamID.AccountType,
|
||||
["Handled"] = handled,
|
||||
["SteamID"] = steamID64
|
||||
}
|
||||
};
|
||||
|
||||
Logger.Log(logEventInfo);
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ namespace ArchiSteamFarm.NLog {
|
|||
ConsoleSemaphore.Release();
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
return !string.IsNullOrEmpty(result) ? result!.Trim() : null;
|
||||
}
|
||||
|
||||
|
@ -330,13 +331,17 @@ namespace ArchiSteamFarm.NLog {
|
|||
|
||||
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
|
||||
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!string.IsNullOrEmpty(commandPrefix) && command!.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (command.Length == commandPrefix!.Length) {
|
||||
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
|
||||
continue;
|
||||
}
|
||||
|
||||
command = command[commandPrefix!.Length..];
|
||||
command = command[commandPrefix.Length..];
|
||||
}
|
||||
|
||||
Bot? targetBot = Bot.Bots?.OrderBy(bot => bot.Key, Bot.BotsComparer).Select(bot => bot.Value).FirstOrDefault();
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace ArchiSteamFarm.NLog.Targets {
|
|||
string? botName = BotName?.Render(logEvent);
|
||||
|
||||
if (!string.IsNullOrEmpty(botName)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
bot = Bot.GetBot(botName!);
|
||||
|
||||
if (bot?.IsConnectedAndLoggedOn != true) {
|
||||
|
|
|
@ -202,6 +202,7 @@ namespace ArchiSteamFarm {
|
|||
string? copyright = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright;
|
||||
|
||||
if (!string.IsNullOrEmpty(copyright)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
ASF.ArchiLogger.LogGenericInfo(copyright!);
|
||||
}
|
||||
|
||||
|
@ -277,7 +278,10 @@ namespace ArchiSteamFarm {
|
|||
|
||||
if (!string.IsNullOrEmpty(latestJson)) {
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.AutomaticFileMigration, globalConfigFile));
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
await SerializableFile.Write(globalConfigFile, latestJson!).ConfigureAwait(false);
|
||||
|
||||
ASF.ArchiLogger.LogGenericInfo(Strings.Done);
|
||||
}
|
||||
|
||||
|
@ -475,19 +479,19 @@ namespace ArchiSteamFarm {
|
|||
string? envCryptKey = Environment.GetEnvironmentVariable(SharedInfo.EnvironmentVariableCryptKey);
|
||||
|
||||
if (!string.IsNullOrEmpty(envCryptKey)) {
|
||||
HandleCryptKeyArgument(envCryptKey!);
|
||||
HandleCryptKeyArgument(envCryptKey);
|
||||
}
|
||||
|
||||
string? envNetworkGroup = Environment.GetEnvironmentVariable(SharedInfo.EnvironmentVariableNetworkGroup);
|
||||
|
||||
if (!string.IsNullOrEmpty(envNetworkGroup)) {
|
||||
HandleNetworkGroupArgument(envNetworkGroup!);
|
||||
HandleNetworkGroupArgument(envNetworkGroup);
|
||||
}
|
||||
|
||||
string? envPath = Environment.GetEnvironmentVariable(SharedInfo.EnvironmentVariablePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(envPath)) {
|
||||
HandlePathArgument(envPath!);
|
||||
HandlePathArgument(envPath);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
|
|
|
@ -68,6 +68,7 @@ namespace ArchiSteamFarm {
|
|||
internal static string HomeDirectory {
|
||||
get {
|
||||
if (!string.IsNullOrEmpty(CachedHomeDirectory)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
return CachedHomeDirectory!;
|
||||
}
|
||||
|
||||
|
|
|
@ -1058,6 +1058,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
if (!string.IsNullOrEmpty(releaseState)) {
|
||||
// We must convert this to uppercase, since Valve doesn't stick to any convention and we can have a case mismatch
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
switch (releaseState!.ToUpperInvariant()) {
|
||||
case "RELEASED":
|
||||
break;
|
||||
|
@ -1078,6 +1079,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
}
|
||||
|
||||
// We must convert this to uppercase, since Valve doesn't stick to any convention and we can have a case mismatch
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
switch (type!.ToUpperInvariant()) {
|
||||
case "APPLICATION":
|
||||
case "EPISODE":
|
||||
|
@ -1113,6 +1115,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
return (appID, DateTime.MinValue, true);
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
string[] dlcAppIDsTexts = listOfDlc!.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach (string dlcAppIDsText in dlcAppIDsTexts) {
|
||||
|
@ -1477,7 +1480,10 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
if (!string.IsNullOrEmpty(latestJson)) {
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.AutomaticFileMigration, configFilePath));
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
await SerializableFile.Write(configFilePath, latestJson!).ConfigureAwait(false);
|
||||
|
||||
ASF.ArchiLogger.LogGenericInfo(Strings.Done);
|
||||
}
|
||||
|
||||
|
@ -1669,6 +1675,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? key = game.Key as string;
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(key)) {
|
||||
invalid = true;
|
||||
ASF.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(key)));
|
||||
|
@ -1959,6 +1966,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? steamLogin = await Logging.GetUserInput(ASF.EUserInputType.Login, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(steamLogin) || !SetUserInput(ASF.EUserInputType.Login, steamLogin!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(steamLogin)));
|
||||
|
||||
|
@ -1971,6 +1979,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? steamPassword = await Logging.GetUserInput(ASF.EUserInputType.Password, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(steamPassword) || !SetUserInput(ASF.EUserInputType.Password, steamPassword!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(steamPassword)));
|
||||
|
||||
|
@ -2003,7 +2012,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
if ((BotConfig.SendTradePeriod > 0) && (BotConfig.LootableTypes.Count > 0) && BotConfig.SteamUserPermissions.Values.Any(permission => permission >= BotConfig.EAccess.Master)) {
|
||||
SendItemsTimer = new Timer(
|
||||
async _ => await Actions.SendInventory(filterFunction: item => BotConfig.LootableTypes.Contains(item.Type)).ConfigureAwait(false),
|
||||
OnSendItemsTimer,
|
||||
null,
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) + TimeSpan.FromSeconds(ASF.LoadBalancingDelay * Bots.Count), // Delay
|
||||
TimeSpan.FromHours(BotConfig.SendTradePeriod) // Period
|
||||
|
@ -2187,6 +2196,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
loginKey = BotDatabase.LoginKey;
|
||||
|
||||
// Decrypt login key if needed
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!string.IsNullOrEmpty(loginKey) && (loginKey!.Length > 19) && (BotConfig.PasswordFormat != ArchiCryptoHelper.ECryptoMethod.PlainText)) {
|
||||
loginKey = ArchiCryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey);
|
||||
}
|
||||
|
@ -2221,6 +2231,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
string? password = BotConfig.DecryptedSteamPassword;
|
||||
|
||||
if (!string.IsNullOrEmpty(password)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
password = Regex.Replace(password!, nonAsciiPattern, "", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase);
|
||||
|
||||
if (string.IsNullOrEmpty(password)) {
|
||||
|
@ -2658,6 +2669,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? authCode = await Logging.GetUserInput(ASF.EUserInputType.SteamGuard, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(authCode) || !SetUserInput(ASF.EUserInputType.SteamGuard, authCode!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(authCode)));
|
||||
|
||||
|
@ -2671,6 +2683,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? twoFactorCode = await Logging.GetUserInput(ASF.EUserInputType.TwoFactorAuthentication, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(twoFactorCode) || !SetUserInput(ASF.EUserInputType.TwoFactorAuthentication, twoFactorCode!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(twoFactorCode)));
|
||||
|
||||
|
@ -2722,6 +2735,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
if (!string.IsNullOrEmpty(steamParentalCode)) {
|
||||
if (BotConfig.SteamParentalCode != steamParentalCode) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!SetUserInput(ASF.EUserInputType.SteamParentalCode, steamParentalCode!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(steamParentalCode)));
|
||||
|
||||
|
@ -2735,6 +2749,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
steamParentalCode = await Logging.GetUserInput(ASF.EUserInputType.SteamParentalCode, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(steamParentalCode) || !SetUserInput(ASF.EUserInputType.SteamParentalCode, steamParentalCode!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(steamParentalCode)));
|
||||
|
||||
|
@ -2751,6 +2766,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
string? steamParentalCode = await Logging.GetUserInput(ASF.EUserInputType.SteamParentalCode, BotName).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (string.IsNullOrEmpty(steamParentalCode) || !SetUserInput(ASF.EUserInputType.SteamParentalCode, steamParentalCode!)) {
|
||||
ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(steamParentalCode)));
|
||||
|
||||
|
@ -2983,6 +2999,8 @@ namespace ArchiSteamFarm.Steam {
|
|||
await CheckOccupationStatus().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async void OnSendItemsTimer(object? state) => await Actions.SendInventory(filterFunction: item => BotConfig.LootableTypes.Contains(item.Type)).ConfigureAwait(false);
|
||||
|
||||
private async void OnServiceMethod(SteamUnifiedMessages.ServiceMethodNotification notification) {
|
||||
if (notification == null) {
|
||||
throw new ArgumentNullException(nameof(notification));
|
||||
|
@ -3118,6 +3136,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
break;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
PurchaseResponseCallback? result = await Actions.RedeemKey(key!).ConfigureAwait(false);
|
||||
|
||||
if (result == null) {
|
||||
|
@ -3126,6 +3145,7 @@ namespace ArchiSteamFarm.Steam {
|
|||
|
||||
if (((result.PurchaseResultDetail == EPurchaseResultDetail.CannotRedeemCodeFromClient) || ((result.PurchaseResultDetail == EPurchaseResultDetail.BadActivationCode) && assumeWalletKeyOnBadActivationCode)) && (WalletCurrency != ECurrencyCode.Invalid)) {
|
||||
// If it's a wallet code, we try to redeem it first, then handle the inner result as our primary one
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
(EResult Result, EPurchaseResultDetail? PurchaseResult)? walletResult = await ArchiWebHandler.RedeemWalletKey(key!).ConfigureAwait(false);
|
||||
|
||||
if (walletResult != null) {
|
||||
|
@ -3170,9 +3190,11 @@ namespace ArchiSteamFarm.Steam {
|
|||
break;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
BotDatabase.RemoveGameToRedeemInBackground(key!);
|
||||
|
||||
// If user omitted the name or intentionally provided the same name as key, replace it with the Steam result
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (name!.Equals(key, StringComparison.OrdinalIgnoreCase) && (result.Items?.Count > 0)) {
|
||||
name = string.Join(", ", result.Items.Values);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace ArchiSteamFarm.Steam.Data {
|
|||
foreach (Tag tag in Tags) {
|
||||
switch (tag.Identifier) {
|
||||
case "Game":
|
||||
if (string.IsNullOrEmpty(tag.Value) || (tag.Value!.Length <= 4) || !tag.Value.StartsWith("app_", StringComparison.Ordinal)) {
|
||||
if (string.IsNullOrEmpty(tag.Value) || (tag.Value.Length <= 4) || !tag.Value.StartsWith("app_", StringComparison.Ordinal)) {
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(tag.Value), tag.Value));
|
||||
|
||||
break;
|
||||
|
|
|
@ -324,7 +324,10 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
// Extra entry for format
|
||||
Dictionary<string, object> arguments = new(5, StringComparer.Ordinal) {
|
||||
{ "include_appinfo", 1 },
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "key", steamApiKey! },
|
||||
|
||||
{ "skip_unvetted_apps", "0" },
|
||||
{ "steamid", steamID }
|
||||
};
|
||||
|
@ -378,6 +381,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
return null;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
result[appID] = gameName!;
|
||||
}
|
||||
|
||||
|
@ -394,7 +398,9 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
// Extra entry for format
|
||||
Dictionary<string, object> arguments = new(3, StringComparer.Ordinal) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "access_token", accessToken! },
|
||||
|
||||
{ "steamid", Bot.SteamID }
|
||||
};
|
||||
|
||||
|
@ -547,7 +553,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
}
|
||||
|
||||
// This is actually client error with a reason, so it doesn't make sense to retry
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, response.Content!.ErrorText));
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, response.Content.ErrorText));
|
||||
|
||||
return (false, mobileTradeOfferIDs);
|
||||
}
|
||||
|
@ -950,8 +956,10 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
};
|
||||
|
||||
if (data != null) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data[sessionName] = sessionID!;
|
||||
} else {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data = new Dictionary<string, string>(1, StringComparer.Ordinal) { { sessionName, sessionID! } };
|
||||
}
|
||||
}
|
||||
|
@ -1054,8 +1062,10 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
};
|
||||
|
||||
if (data != null) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data[sessionName] = sessionID!;
|
||||
} else {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data = new Dictionary<string, string>(1, StringComparer.Ordinal) { { sessionName, sessionID! } };
|
||||
}
|
||||
}
|
||||
|
@ -1157,6 +1167,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
_ => throw new ArgumentOutOfRangeException(nameof(session))
|
||||
};
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
KeyValuePair<string, string> sessionValue = new(sessionName, sessionID!);
|
||||
|
||||
if (data != null) {
|
||||
|
@ -1265,8 +1276,10 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
};
|
||||
|
||||
if (data != null) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data[sessionName] = sessionID!;
|
||||
} else {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
data = new Dictionary<string, string>(1, StringComparer.Ordinal) { { sessionName, sessionID! } };
|
||||
}
|
||||
}
|
||||
|
@ -1410,7 +1423,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
}
|
||||
|
||||
// This is actually client error with a reason, so it doesn't make sense to retry
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, response.Content!.ErrorText));
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, response.Content.ErrorText));
|
||||
|
||||
return (false, false);
|
||||
}
|
||||
|
@ -1499,7 +1512,9 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
// Extra entry for format
|
||||
Dictionary<string, object> arguments = new(3, StringComparer.Ordinal) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "key", steamApiKey! },
|
||||
|
||||
{ "tradeofferid", tradeID }
|
||||
};
|
||||
|
||||
|
@ -1559,7 +1574,10 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
{ "active_only", 1 },
|
||||
{ "get_descriptions", 1 },
|
||||
{ "get_received_offers", 1 },
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "key", steamApiKey! },
|
||||
|
||||
{ "time_historical_cutoff", uint.MaxValue }
|
||||
};
|
||||
|
||||
|
@ -1649,7 +1667,8 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
return null;
|
||||
}
|
||||
|
||||
parsedTags.Add(new Tag(identifier!, value!));
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
parsedTags.Add(new Tag(identifier!, value));
|
||||
}
|
||||
|
||||
parsedDescription.Tags = parsedTags.ToImmutableHashSet();
|
||||
|
@ -2044,11 +2063,14 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
// Extra entry for format
|
||||
Dictionary<string, object> arguments = new(!string.IsNullOrEmpty(tradeToken) ? 4 : 3, StringComparer.Ordinal) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "key", steamApiKey! },
|
||||
|
||||
{ "steamid_target", steamID }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(tradeToken)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
arguments["trade_offer_access_token"] = tradeToken!;
|
||||
}
|
||||
|
||||
|
@ -2456,7 +2478,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
return (ESteamApiKeyState.AccessDenied, null);
|
||||
}
|
||||
|
||||
IElement? htmlNode = response!.Content!.SelectSingleNode("//div[@id='bodyContents_ex']/p");
|
||||
IElement? htmlNode = response.Content.SelectSingleNode("//div[@id='bodyContents_ex']/p");
|
||||
|
||||
if (htmlNode == null) {
|
||||
Bot.ArchiLogger.LogNullError(nameof(htmlNode));
|
||||
|
@ -2709,6 +2731,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
ObjectResponse<AccessTokenResponse>? response = await UrlGetToJsonObjectWithSession<AccessTokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
return !string.IsNullOrEmpty(response?.Content.Data.WebAPIToken) ? (true, response!.Content.Data.WebAPIToken) : (false, null);
|
||||
}
|
||||
|
||||
|
@ -2810,6 +2833,8 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
Dictionary<string, string> data = new(2, StringComparer.Ordinal) {
|
||||
{ "pin", parentalCode },
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
{ "sessionid", sessionID! }
|
||||
};
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ namespace ArchiSteamFarm.Steam.Integration {
|
|||
|
||||
if (!string.IsNullOrEmpty(steamMessagePrefix)) {
|
||||
// We must escape our message prefix if needed
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
steamMessagePrefix = Escape(steamMessagePrefix!);
|
||||
|
||||
prefixBytes = GetMessagePrefixBytes(steamMessagePrefix);
|
||||
|
|
|
@ -500,7 +500,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
internal void OnDisconnected() => HandledGifts.Clear();
|
||||
|
||||
private ulong GetFirstSteamMasterID() {
|
||||
ulong steamMasterID = Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key > 0) && (kv.Key != Bot.SteamID) && new SteamID(kv.Key).IsIndividualAccount && (kv.Value == BotConfig.EAccess.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault()!;
|
||||
ulong steamMasterID = Bot.BotConfig.SteamUserPermissions.Where(kv => (kv.Key > 0) && (kv.Key != Bot.SteamID) && new SteamID(kv.Key).IsIndividualAccount && (kv.Value == BotConfig.EAccess.Master)).Select(kv => kv.Key).OrderBy(steamID => steamID).FirstOrDefault();
|
||||
|
||||
if (steamMasterID > 0) {
|
||||
return steamMasterID;
|
||||
|
|
|
@ -333,10 +333,12 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
|
||||
|
||||
if (!string.IsNullOrEmpty(commandPrefix)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!message.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
|
||||
string? pluginsResponse = await PluginsCore.OnBotMessage(Bot, steamID, message).ConfigureAwait(false);
|
||||
|
||||
if (!string.IsNullOrEmpty(pluginsResponse)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!await Bot.SendMessage(steamID, pluginsResponse!).ConfigureAwait(false)) {
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(Bot.SendMessage)));
|
||||
Bot.ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.Content, pluginsResponse));
|
||||
|
@ -346,6 +348,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
return;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (message.Length == commandPrefix!.Length) {
|
||||
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
|
||||
return;
|
||||
|
@ -381,6 +384,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
response = FormatBotResponse(Strings.UnknownCommand);
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!await Bot.SendMessage(steamID, response!).ConfigureAwait(false)) {
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(Bot.SendMessage)));
|
||||
Bot.ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.Content, response));
|
||||
|
@ -407,10 +411,12 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
string? commandPrefix = ASF.GlobalConfig != null ? ASF.GlobalConfig.CommandPrefix : GlobalConfig.DefaultCommandPrefix;
|
||||
|
||||
if (!string.IsNullOrEmpty(commandPrefix)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!message.StartsWith(commandPrefix!, StringComparison.Ordinal)) {
|
||||
string? pluginsResponse = await PluginsCore.OnBotMessage(Bot, steamID, message).ConfigureAwait(false);
|
||||
|
||||
if (!string.IsNullOrEmpty(pluginsResponse)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!await Bot.SendMessage(chatGroupID, chatID, pluginsResponse!).ConfigureAwait(false)) {
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(Bot.SendMessage)));
|
||||
Bot.ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.Content, pluginsResponse));
|
||||
|
@ -420,6 +426,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
return;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (message.Length == commandPrefix!.Length) {
|
||||
// If the message starts with command prefix and is of the same length as command prefix, then it's just empty command trigger, useless
|
||||
return;
|
||||
|
@ -457,6 +464,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
response = FormatBotResponse(Strings.UnknownCommand);
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (!await Bot.SendMessage(chatGroupID, chatID, response!).ConfigureAwait(false)) {
|
||||
Bot.ArchiLogger.LogGenericWarning(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, nameof(Bot.SendMessage)));
|
||||
Bot.ArchiLogger.LogGenericDebug(string.Format(CultureInfo.CurrentCulture, Strings.Content, response));
|
||||
|
@ -2659,6 +2667,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
string? previousKey = key;
|
||||
|
||||
while (!string.IsNullOrEmpty(key)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
string startingKey = key!;
|
||||
|
||||
using (IEnumerator<Bot> botsEnumerator = Bot.Bots.Where(bot => (bot.Value != Bot) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.HasAccess(steamID, BotConfig.EAccess.Operator)).OrderByDescending(bot => Bot.BotsComparer?.Compare(bot.Key, Bot.BotName) > 0).ThenBy(bot => bot.Key, Bot.BotsComparer).Select(bot => bot.Value).GetEnumerator()) {
|
||||
|
@ -2670,6 +2679,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
previousKey = key;
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
if (redeemFlags.HasFlag(ERedeemFlags.Validate) && !Utilities.IsValidCdKey(key!)) {
|
||||
// Next key
|
||||
key = keysEnumerator.MoveNext() ? keysEnumerator.Current : null;
|
||||
|
@ -2684,6 +2694,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
} else {
|
||||
bool skipRequest = triedBots.Contains(currentBot) || rateLimitedBots.Contains(currentBot);
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
PurchaseResponseCallback? result = skipRequest ? new PurchaseResponseCallback(EResult.Fail, EPurchaseResultDetail.CancelledByUser) : await currentBot.Actions.RedeemKey(key!).ConfigureAwait(false);
|
||||
|
||||
if (result == null) {
|
||||
|
@ -2697,6 +2708,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
if ((result.PurchaseResultDetail == EPurchaseResultDetail.CannotRedeemCodeFromClient) || ((result.PurchaseResultDetail == EPurchaseResultDetail.BadActivationCode) && assumeWalletKeyOnBadActivationCode)) {
|
||||
if (Bot.WalletCurrency != ECurrencyCode.Invalid) {
|
||||
// If it's a wallet code, we try to redeem it first, then handle the inner result as our primary one
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
(EResult Result, EPurchaseResultDetail? PurchaseResult)? walletResult = await currentBot.ArchiWebHandler.RedeemWalletKey(key!).ConfigureAwait(false);
|
||||
|
||||
if (walletResult != null) {
|
||||
|
@ -2725,6 +2737,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
case EPurchaseResultDetail.NoDetail: // OK
|
||||
case EPurchaseResultDetail.Timeout:
|
||||
if ((result.Result != EResult.Timeout) && (result.PurchaseResultDetail != EPurchaseResultDetail.Timeout)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
unusedKeys.Remove(key!);
|
||||
}
|
||||
|
||||
|
@ -2761,6 +2774,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
bool alreadyHandled = false;
|
||||
|
||||
foreach (Bot innerBot in Bot.Bots.Where(bot => (bot.Value != currentBot) && (!redeemFlags.HasFlag(ERedeemFlags.SkipInitial) || (bot.Value != Bot)) && !triedBots.Contains(bot.Value) && !rateLimitedBots.Contains(bot.Value) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.HasAccess(steamID, BotConfig.EAccess.Operator) && ((items.Count == 0) || items.Keys.Any(packageID => !bot.Value.OwnedPackageIDs.ContainsKey(packageID)))).OrderBy(bot => bot.Key, Bot.BotsComparer).Select(bot => bot.Value)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
PurchaseResponseCallback? otherResult = await innerBot.Actions.RedeemKey(key!).ConfigureAwait(false);
|
||||
|
||||
if (otherResult == null) {
|
||||
|
@ -2777,6 +2791,8 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
case EPurchaseResultDetail.NoDetail: // OK
|
||||
// This key is already handled, as we either redeemed it or we're sure it's dupe/invalid
|
||||
alreadyHandled = true;
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
unusedKeys.Remove(key!);
|
||||
|
||||
break;
|
||||
|
@ -2813,6 +2829,7 @@ namespace ArchiSteamFarm.Steam.Interaction {
|
|||
default:
|
||||
ASF.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.WarningUnknownValuePleaseReport, nameof(result.PurchaseResultDetail), result.PurchaseResultDetail));
|
||||
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
unusedKeys.Remove(key!);
|
||||
|
||||
// Next key
|
||||
|
|
|
@ -111,8 +111,11 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
|
||||
await LimitConfirmationsRequestsAsync().ConfigureAwait(false);
|
||||
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
using IDocument? htmlDocument = await Bot.ArchiWebHandler.GetConfirmationsPage(deviceID!, confirmationHash!, time).ConfigureAwait(false);
|
||||
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
|
||||
if (htmlDocument == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -221,8 +224,11 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
return false;
|
||||
}
|
||||
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
bool? result = await Bot.ArchiWebHandler.HandleConfirmations(deviceID!, confirmationHash!, time, confirmations, accept).ConfigureAwait(false);
|
||||
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
|
||||
if (!result.HasValue) {
|
||||
// Request timed out
|
||||
return false;
|
||||
|
@ -237,8 +243,11 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
// In this case, we'll accept all pending confirmations one-by-one, synchronously (as Steam can't handle them in parallel)
|
||||
// We totally ignore actual result returned by those calls, abort only if request timed out
|
||||
foreach (Confirmation confirmation in confirmations) {
|
||||
// ReSharper disable RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
bool? confirmationResult = await Bot.ArchiWebHandler.HandleConfirmation(deviceID!, confirmationHash!, time, confirmation.ID, confirmation.Key, accept).ConfigureAwait(false);
|
||||
|
||||
// ReSharper restore RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
|
||||
if (!confirmationResult.HasValue) {
|
||||
return false;
|
||||
}
|
||||
|
@ -287,7 +296,7 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
byte[] identitySecret;
|
||||
|
||||
try {
|
||||
identitySecret = Convert.FromBase64String(IdentitySecret!);
|
||||
identitySecret = Convert.FromBase64String(IdentitySecret);
|
||||
} catch (FormatException e) {
|
||||
Bot.ArchiLogger.LogGenericException(e);
|
||||
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(IdentitySecret)));
|
||||
|
@ -298,6 +307,7 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
byte bufferSize = 8;
|
||||
|
||||
if (!string.IsNullOrEmpty(tag)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
bufferSize += (byte) Math.Min(32, tag!.Length);
|
||||
}
|
||||
|
||||
|
@ -312,6 +322,7 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
Array.Copy(timeArray, buffer, 8);
|
||||
|
||||
if (!string.IsNullOrEmpty(tag)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
Array.Copy(Encoding.UTF8.GetBytes(tag!), 0, buffer, 8, bufferSize - 8);
|
||||
}
|
||||
|
||||
|
@ -342,7 +353,7 @@ namespace ArchiSteamFarm.Steam.Security {
|
|||
byte[] sharedSecret;
|
||||
|
||||
try {
|
||||
sharedSecret = Convert.FromBase64String(SharedSecret!);
|
||||
sharedSecret = Convert.FromBase64String(SharedSecret);
|
||||
} catch (FormatException e) {
|
||||
Bot.ArchiLogger.LogGenericException(e);
|
||||
Bot.ArchiLogger.LogGenericError(string.Format(CultureInfo.CurrentCulture, Strings.ErrorIsInvalid, nameof(SharedSecret)));
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace ArchiSteamFarm.Steam.SteamKit2 {
|
|||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
private readonly ConcurrentHashSet<ServerRecordEndPoint> ServerRecords = new();
|
||||
|
||||
public Task<IEnumerable<ServerRecord>> FetchServerListAsync() => Task.FromResult(ServerRecords.Where(server => !string.IsNullOrEmpty(server.Host) && (server.Port > 0) && (server.ProtocolTypes > 0)).Select(server => ServerRecord.CreateServer(server.Host!, server.Port, server.ProtocolTypes)));
|
||||
public Task<IEnumerable<ServerRecord>> FetchServerListAsync() => Task.FromResult(ServerRecords.Where(server => !string.IsNullOrEmpty(server.Host) && (server.Port > 0) && (server.ProtocolTypes > 0)).Select(server => ServerRecord.CreateServer(server.Host, server.Port, server.ProtocolTypes)));
|
||||
|
||||
public Task UpdateServerListAsync(IEnumerable<ServerRecord> endpoints) {
|
||||
if (endpoints == null) {
|
||||
|
|
|
@ -301,6 +301,7 @@ namespace ArchiSteamFarm.Steam.Storage {
|
|||
|
||||
set {
|
||||
if (!string.IsNullOrEmpty(value) && (PasswordFormat != ArchiCryptoHelper.ECryptoMethod.PlainText)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
value = ArchiCryptoHelper.Encrypt(PasswordFormat, value!);
|
||||
}
|
||||
|
||||
|
@ -496,6 +497,7 @@ namespace ArchiSteamFarm.Steam.Storage {
|
|||
|
||||
if (!valid) {
|
||||
if (!string.IsNullOrEmpty(errorMessage)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
ASF.ArchiLogger.LogGenericError(errorMessage!);
|
||||
}
|
||||
|
||||
|
|
|
@ -393,6 +393,7 @@ namespace ArchiSteamFarm.Storage {
|
|||
|
||||
if (!valid) {
|
||||
if (!string.IsNullOrEmpty(errorMessage)) {
|
||||
// ReSharper disable once RedundantSuppressNullableWarningExpression - required for .NET Framework
|
||||
ASF.ArchiLogger.LogGenericError(errorMessage!);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>ASF Changelog</title>
|
||||
<meta http-equiv="refresh" content="0; url=https://github.com/JustArchiNET/ArchiSteamFarm/commits/main">
|
||||
<meta content="0; url=https://github.com/JustArchiNET/ArchiSteamFarm/commits/main" http-equiv="refresh">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>ASF Config Generator</title>
|
||||
<meta http-equiv="refresh" content="0; url=https://justarchinet.github.io/ASF-WebConfigGenerator">
|
||||
<meta content="0; url=https://justarchinet.github.io/ASF-WebConfigGenerator" http-equiv="refresh">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>ASF Manual</title>
|
||||
<meta http-equiv="refresh" content="0; url=https://github.com/JustArchiNET/ArchiSteamFarm/wiki">
|
||||
<meta content="0; url=https://github.com/JustArchiNET/ArchiSteamFarm/wiki" http-equiv="refresh">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>ASF UI</title>
|
||||
<meta http-equiv="refresh" content="0; url=http://localhost:1242">
|
||||
<meta content="0; url=http://localhost:1242" http-equiv="refresh">
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
Loading…
Reference in a new issue