Use string indices

This commit is contained in:
JustArchi
2020-04-18 18:28:15 +02:00
parent b23f634c9b
commit 5d4e2eaf64
4 changed files with 5 additions and 4 deletions

View File

@@ -78,6 +78,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net48'"> <ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="IndexRange" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.HttpOverrides" Version="2.2.0" />

View File

@@ -929,7 +929,7 @@ namespace ArchiSteamFarm {
} }
string name = parsedArgs[0]; string name = parsedArgs[0];
string key = parsedArgs[parsedArgs.Length - 1]; string key = parsedArgs[^1];
gamesToRedeemInBackground[key] = name; gamesToRedeemInBackground[key] = name;
} }
@@ -1634,7 +1634,7 @@ namespace ArchiSteamFarm {
continue; continue;
} }
string key = parsedArgs[parsedArgs.Length - 1]; string key = parsedArgs[^1];
if (!Utilities.IsValidCdKey(key)) { if (!Utilities.IsValidCdKey(key)) {
ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorIsInvalid, key)); ArchiLogger.LogGenericWarning(string.Format(Strings.ErrorIsInvalid, key));

View File

@@ -387,7 +387,7 @@ namespace ArchiSteamFarm {
} }
// The last 4 bits of the mac say where the code starts // The last 4 bits of the mac say where the code starts
int start = hash[hash.Length - 1] & 0x0f; int start = hash[^1] & 0x0f;
// Extract those 4 bytes // Extract those 4 bytes
byte[] bytes = new byte[4]; byte[] bytes = new byte[4];

View File

@@ -59,7 +59,7 @@ namespace ArchiSteamFarm {
string[] args = text.Split((char[]) null, argsToSkip + 1, StringSplitOptions.RemoveEmptyEntries); string[] args = text.Split((char[]) null, argsToSkip + 1, StringSplitOptions.RemoveEmptyEntries);
return args[args.Length - 1]; return args[^1];
} }
[PublicAPI] [PublicAPI]