Skip to content

Commit

Permalink
Waiting unban test feature
Browse files Browse the repository at this point in the history
Avatar regex fix
  • Loading branch information
Maxx53 committed Nov 16, 2015
1 parent b9d6701 commit d54c671
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 17 deletions.
18 changes: 15 additions & 3 deletions scr/SCMBot/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.IO;
using System.Text.RegularExpressions;
using System.Net.NetworkInformation;
using System.Timers;


// Внимание! Данная наработка - всего-лишь грубая реализация идеи.
Expand Down Expand Up @@ -68,6 +69,9 @@ public partial class Main : Form
public static string CurrCode = "0";
public static string CurrName = string.Empty;

public static System.Timers.Timer banTimer = new System.Timers.Timer(120000);


public Main()
{

Expand All @@ -83,13 +87,20 @@ public Main()
recentListView.SmallImageList = StatImgLst;

steam_srch.delegMessage += new eventDelegate(Event_Message);


// Only raise the event the first time Interval elapses.
banTimer.AutoReset = false;
banTimer.Enabled = false;


//Some WebRequest optimizations
ServicePointManager.Expect100Continue = false;
ServicePointManager.UseNagleAlgorithm = false;
ServicePointManager.DefaultConnectionLimit = 50;
}




private void Main_Load(object sender, EventArgs e)
{
Expand Down Expand Up @@ -266,6 +277,8 @@ private void LoadSettings(bool loadtabs)
lastFrmPos = this.Location;
lastFrmSize = this.Size;

banTimer.Interval = settings.UnBanInterval;

if (settings.formParams == null)
{
settings.formParams = new MainFormParams(this.Size, this.Location, this.WindowState,
Expand Down Expand Up @@ -2787,8 +2800,6 @@ private void scanListView_ColumnClick(object sender, ColumnClickEventArgs e)
}




private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
try
Expand Down Expand Up @@ -2817,5 +2828,6 @@ private void textBox3_KeyUp(object sender, KeyEventArgs e)
}



}
}
4 changes: 2 additions & 2 deletions scr/SCMBot/Main.resx
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@
<value>123</value>
</data>
<metadata name="contextMenuStrip3.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>12, 58</value>
<value>407, 45</value>
</metadata>
<data name="deleteMenuItem.Size" type="System.Drawing.Size, System.Drawing">
<value>145, 22</value>
Expand Down Expand Up @@ -2350,7 +2350,7 @@
<value>Exit</value>
</data>
<data name="contextMenuStrip2.Size" type="System.Drawing.Size, System.Drawing">
<value>171, 158</value>
<value>171, 136</value>
</data>
<data name="&gt;&gt;contextMenuStrip2.Name" xml:space="preserve">
<value>contextMenuStrip2</value>
Expand Down
14 changes: 12 additions & 2 deletions scr/SCMBot/MainUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System.Media;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Globalization;

namespace SCMBot
{
Expand Down Expand Up @@ -428,6 +427,9 @@ public static string SendPostRequest(string req, string url, string refer, Cooki

public static string GetRequest(string url, CookieContainer cookie, bool UseHost)
{
if (banTimer.Enabled)
return "B";

string content = string.Empty;

int hostNum = 0;
Expand Down Expand Up @@ -457,7 +459,6 @@ public static string GetRequest(string url, CookieContainer cookie, bool UseHost
request.KeepAlive = true;
request.AutomaticDecompression = DecompressionMethods.GZip;


request.Host = SteamSite._host;
request.Referer = SteamSite._market;
request.UserAgent = steamUA;
Expand Down Expand Up @@ -514,6 +515,13 @@ public static string GetRequest(string url, CookieContainer cookie, bool UseHost
hostList[hostNum].InUsing = false;
}


if (content.Contains("error_ctn"))
{
banTimer.Enabled = true;
return "B";
}

return content;

}
Expand Down Expand Up @@ -615,6 +623,8 @@ private string GetScanErrMess(string message)
break;
case "8": mess = "Move along...";
break;
case "9": mess = "Got Banned! Waiting for UnBan...";
break;
default: mess = "Unknown error";
break;
}
Expand Down
16 changes: 16 additions & 0 deletions scr/SCMBot/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 18 additions & 6 deletions scr/SCMBot/SteamSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,25 @@ public bool fillLotList(string link, bool full, bool ismain)
doMessage(flag.Error_scan, scanID, ret.ToString(), ismain);
goto start;
}
else
if (ret == 9)
{
doMessage(flag.Error_scan, scanID, ret.ToString(), ismain);

if (ret != 7)
{
doMessage(flag.Error_scan, scanID, ret.ToString(), ismain);
return false;
}
else return true;
while (Main.banTimer.Enabled)
{
Sem.WaitOne(1000);
}

goto start;
}
else
if (ret != 7)
{
doMessage(flag.Error_scan, scanID, ret.ToString(), ismain);
return false;
}
else return true;
}
}

Expand Down
14 changes: 10 additions & 4 deletions scr/SCMBot/SteamUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,11 @@ public StrParam GetNameBalance(CookieContainer cock)
//Set profileId for old Url format
myUserId = Regex.Match(markpage, "(?<=g_steamID = \")(.*)(?=\";)").ToString();


//avatarIcon"><img src="

//30.05.14 Update
string parseImg = Regex.Match(markpage, "(?<=headerUserAvatarIcon\" src=\")(.*?)(?=\" alt=\"\"></a>)", RegexOptions.Singleline).ToString();
string parseImg = Regex.Match(markpage, "(?<=avatarIcon\">"+@"\r\n\s+"+"<img src=\")(.*?)(?=\" srcset=\")", RegexOptions.Singleline).ToString();

string parseAmount = Regex.Match(markpage, "(?<=marketWalletBalanceAmount\">)(.*)(?=</span>)").ToString();

Expand Down Expand Up @@ -711,7 +714,10 @@ public byte ParseLotList(string content, List<ScanItem> lst, bool full, bool ism
{
lst.Clear();


if (content == "B")
//Got Ban
return 9;


//Smart ass!
//Lol, fix.
Expand All @@ -733,7 +739,7 @@ public byte ParseLotList(string content, List<ScanItem> lst, bool full, bool ism
{
//Content empty
return 0;
}
}
else if (content == "403")
{
//403 Forbidden
Expand All @@ -753,7 +759,7 @@ public byte ParseLotList(string content, List<ScanItem> lst, bool full, bool ism

try
{
//"success":false

if (content.Substring(11, 1) == "f")
return 1;

Expand Down

0 comments on commit d54c671

Please sign in to comment.