Hello Jessecar96. I want to Express my gratitude to you for making such a great app. Please add this code if possible. It makes it very easy to sell items. I added it in 1.0.10 and tested it successfully. Now there are not many items in the inventory so the screenshot is only 1 item, but I assure you it works!
I just pressed 1 button and immediately highlighted 150 items and then sent them to be sold.
This is code:
Sorry I didn't find the spoiler.
ConfirmationFormWeb.cs
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using CefSharp;
using CefSharp.WinForms;
using SteamAuth;
namespace Steam_Desktop_Authenticator
{
public partial class ConfirmationFormWeb : Form
{
private readonly ChromiumWebBrowser browser;
private string steamCookies;
private SteamGuardAccount steamAccount;
private string tradeID;
public ConfirmationFormWeb(SteamGuardAccount steamAccount)
{
InitializeComponent();
this.steamAccount = steamAccount;
this.Text = String.Format("Trade Confirmations - {0}", steamAccount.AccountName);
CefSettings settings = new CefSettings();
settings.PersistSessionCookies = false;
settings.Locale = "en-US";
settings.UserAgent = "Mozilla/5.0 (Linux; Android 6.0; Nexus 6P Build/XXXXX; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/47.0.2526.68 Mobile Safari/537.36";
steamCookies = String.Format("mobileClientVersion=0 (2.1.3); mobileClient=android; steamid={0}; steamLogin={1}; steamLoginSecure={2}; Steam_Language=english; dob=;", steamAccount.Session.SteamID.ToString(), steamAccount.Session.SteamLogin, steamAccount.Session.SteamLoginSecure);
if (!Cef.IsInitialized)
{
Cef.Initialize(settings);
}
browser = new ChromiumWebBrowser(steamAccount.GenerateConfirmationURL())
{
Dock = DockStyle.Fill,
};
this.splitContainer1.Panel2.Controls.Add(browser);
BrowserRequestHandler handler = new BrowserRequestHandler();
handler.Cookies = steamCookies;
browser.RequestHandler = handler;
browser.AddressChanged += Browser_AddressChanged;
browser.LoadingStateChanged += Browser_LoadingStateChanged;
}
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
{
// This looks really ugly, but it's easier than implementing steam's steammobile:// protocol using CefSharp
// We override the page's GetValueFromLocalURL() to pass in the keys for sending ajax requests
Debug.WriteLine("IsLoading: " + e.IsLoading);
if (e.IsLoading == false)
{
// Generate url for details
string urlParams = steamAccount.GenerateConfirmationQueryParams("details" + tradeID);
var script = string.Format(@"window.GetValueFromLocalURL =
function(url, timeout, success, error, fatal) {{
console.log(url);
if(url.indexOf('steammobile://steamguard?op=conftag&arg1=allow') !== -1) {{
// send confirmation (allow)
success('{0}');
}} else if(url.indexOf('steammobile://steamguard?op=conftag&arg1=cancel') !== -1) {{
// send confirmation (cancel)
success('{1}');
}} else if(url.indexOf('steammobile://steamguard?op=conftag&arg1=details') !== -1) {{
// get details
success('{2}');
}}
}}", steamAccount.GenerateConfirmationQueryParams("allow"), steamAccount.GenerateConfirmationQueryParams("cancel"), urlParams);
try
{
browser.ExecuteScriptAsync(script);
}
catch (Exception)
{
Debug.WriteLine("Failed to execute script");
}
}
if (!e.IsLoading) { btnSelectAll.Invoke((MethodInvoker)delegate { btnSelectAll.Enabled = true; }); }
}
private void Browser_AddressChanged(object sender, AddressChangedEventArgs e)
{
string[] urlparts = browser.Address.Split('#');
if (urlparts.Length > 1)
{
tradeID = urlparts[1].Replace("conf_", "");
}
}
private void btnRefresh_Click(object sender, EventArgs e)
{
browser.Load(steamAccount.GenerateConfirmationURL());
}
int selected = 0;
private void btnSelectAll_Click(object sender, EventArgs e)
{
if (selected == 0)
{
browser.ExecuteScriptAsync("for(i = 0; i < document.getElementsByTagName('input').length; i++) document.getElementsByTagName('input')[i].click();");
btnSelectAll.Text = "Unselect All";
selected = 1;
}
else
{
browser.ExecuteScriptAsync("for(i = 0; i < document.getElementsByTagName('input').length; i++) document.getElementsByTagName('input')[i].click();");
btnSelectAll.Text = "Select All";
selected = 0;
}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
bool bHandled = false;
switch (keyData)
{
case Keys.F5:
browser.Load(steamAccount.GenerateConfirmationURL());
bHandled = true;
break;
case Keys.F1:
browser.ShowDevTools();
bHandled = true;
break;
}
return bHandled;
}
}
}
ConfirmationFormWeb.Designer.cs
namespace Steam_Desktop_Authenticator
{
partial class ConfirmationFormWeb
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfirmationFormWeb));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnSelectAll = new System.Windows.Forms.Button();
this.btnRefresh = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.IsSplitterFixed = true;
this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1";
this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.btnSelectAll);
this.splitContainer1.Panel1.Controls.Add(this.btnRefresh);
this.splitContainer1.Size = new System.Drawing.Size(431, 641);
this.splitContainer1.SplitterDistance = 30;
this.splitContainer1.SplitterWidth = 1;
this.splitContainer1.TabIndex = 0;
//
// btnSelectAll
//
this.btnSelectAll.Enabled = false;
this.btnSelectAll.Location = new System.Drawing.Point(215, 0);
this.btnSelectAll.Name = "btnSelectAll";
this.btnSelectAll.Size = new System.Drawing.Size(215, 30);
this.btnSelectAll.TabIndex = 1;
this.btnSelectAll.Text = "Select All";
this.btnSelectAll.UseVisualStyleBackColor = true;
this.btnSelectAll.Click += new System.EventHandler(this.btnSelectAll_Click);
//
// btnRefresh
//
this.btnRefresh.Location = new System.Drawing.Point(0, 0);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(216, 30);
this.btnRefresh.TabIndex = 0;
this.btnRefresh.Text = "Refresh";
this.btnRefresh.UseVisualStyleBackColor = true;
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
//
// ConfirmationFormWeb
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(431, 641);
this.Controls.Add(this.splitContainer1);
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ConfirmationFormWeb";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Trade Confirmations";
this.splitContainer1.Panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button btnRefresh;
private System.Windows.Forms.Button btnSelectAll;
}
}
I hope you will add this feature in the next update. Thank you very much.
Just in case, I will leave a ready-made mod and sources.
Hello Jessecar96. I want to Express my gratitude to you for making such a great app. Please add this code if possible. It makes it very easy to sell items. I added it in 1.0.10 and tested it successfully. Now there are not many items in the inventory so the screenshot is only 1 item, but I assure you it works! I just pressed 1 button and immediately highlighted 150 items and then sent them to be sold.
This is code: Sorry I didn't find the spoiler. ConfirmationFormWeb.cs
ConfirmationFormWeb.Designer.cs
I hope you will add this feature in the next update. Thank you very much. Just in case, I will leave a ready-made mod and sources.
Mod Source - https://yadi.sk/d/y9aBcyadcDqS3w Mod Realese - https://yadi.sk/d/nemBv759P3MnHw
PS Goggle Translate