Added --trade to list all trade confirmations
This commit is contained in:
parent
0dfd595820
commit
0a6843e46a
2 changed files with 64 additions and 1 deletions
60
Program.cs
60
Program.cs
|
@ -39,6 +39,8 @@ public static class Program
|
||||||
Console.WriteLine("--generate-code Generate a Steam Guard code and exit. (default)");
|
Console.WriteLine("--generate-code Generate a Steam Guard code and exit. (default)");
|
||||||
Console.WriteLine("--encrypt Encrypt your maFiles or change your encryption passkey.");
|
Console.WriteLine("--encrypt Encrypt your maFiles or change your encryption passkey.");
|
||||||
Console.WriteLine("--decrypt Remove encryption from your maFiles.");
|
Console.WriteLine("--decrypt Remove encryption from your maFiles.");
|
||||||
|
Console.WriteLine("--trade List all trade confirmations across all accounts, or of the user\n" +
|
||||||
|
" specified with --user");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Verbose = args.Contains("-v") || args.Contains("--verbose");
|
Verbose = args.Contains("-v") || args.Contains("--verbose");
|
||||||
|
@ -58,6 +60,10 @@ public static class Program
|
||||||
else if (args.Contains("--setup"))
|
else if (args.Contains("--setup"))
|
||||||
{
|
{
|
||||||
action = "setup";
|
action = "setup";
|
||||||
|
}
|
||||||
|
else if (args.Contains("--trade"))
|
||||||
|
{
|
||||||
|
action = "trade";
|
||||||
}
|
}
|
||||||
// Misc
|
// Misc
|
||||||
if (args.Contains("--user") || args.Contains("-u"))
|
if (args.Contains("--user") || args.Contains("-u"))
|
||||||
|
@ -112,6 +118,9 @@ public static class Program
|
||||||
case "setup":
|
case "setup":
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
break;
|
break;
|
||||||
|
case "trade":
|
||||||
|
TradeList(user);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Console.WriteLine("error: Unknown action: {0}", action);
|
Console.WriteLine("error: Unknown action: {0}", action);
|
||||||
return;
|
return;
|
||||||
|
@ -220,4 +229,55 @@ public static class Program
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void TradeList(string user = "")
|
||||||
|
{
|
||||||
|
if (Verbose) Console.WriteLine("Opening manifest...");
|
||||||
|
Manifest = Manifest.GetManifest(true);
|
||||||
|
if (Verbose) Console.WriteLine("Reading accounts from manifest...");
|
||||||
|
if (Manifest.Encrypted)
|
||||||
|
{
|
||||||
|
string passkey = Manifest.PromptForPassKey();
|
||||||
|
SteamGuardAccounts = Manifest.GetAllAccounts(passkey);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SteamGuardAccounts = Manifest.GetAllAccounts();
|
||||||
|
}
|
||||||
|
if (SteamGuardAccounts.Length == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("error: No accounts read.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < SteamGuardAccounts.Length; i++)
|
||||||
|
{
|
||||||
|
SteamGuardAccount account = SteamGuardAccounts[i];
|
||||||
|
if (user != "")
|
||||||
|
{
|
||||||
|
if (account.AccountName.ToLower() == user.ToLower())
|
||||||
|
{
|
||||||
|
showTradeConfirmations(account);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showTradeConfirmations(account);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showTradeConfirmations(SteamGuardAccount account)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Checking trade confirmations for {account.AccountName}...");
|
||||||
|
if (Verbose) Console.WriteLine("Refeshing Session...");
|
||||||
|
account.RefreshSession();
|
||||||
|
|
||||||
|
Confirmation[] trades = account.FetchConfirmations();
|
||||||
|
foreach (var trade in trades)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ID: {trade.ID} Key: {trade.Key} Description: {trade.Description}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,9 @@
|
||||||
<Reference Include="SteamAuth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
<Reference Include="SteamAuth, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
|
||||||
<HintPath>.\build\SteamAuth.dll</HintPath>
|
<HintPath>.\build\SteamAuth.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||||
|
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\System.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
Loading…
Reference in a new issue