void DatabaseWrite() { DatagridDB db = new DatagridDB(); db.UserProfileStatus = false; db.UserFriendCount = 0; db.SteamID = ""; this.DataGrid.SelectedObject = db; }
private void DoSteamJob(ChromeDriver c, string id, string pw) { try { Console.WriteLine("TryLogin"); c.Navigate().GoToUrl("https://steamcommunity.com/login"); Thread.Sleep(1000); c.FindElementByName("username").Click(); Thread.Sleep(500); TypingRandomly(c.FindElementByName("username"), id); Thread.Sleep(500); c.FindElementByName("password").Click(); Thread.Sleep(500); TypingRandomly(c.FindElementByName("password"), pw); Thread.Sleep(500); c.FindElementById("SteamLogin").Click(); Thread.Sleep(1000); } catch (Exception ex) { Console.ResetColor(); Console.BackgroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.DarkRed; Console.WriteLine(ex.Message); Console.ResetColor(); MessageBox.Show(ex.Message); c.Quit(); return; } Console.WriteLine("You Need To Steam Login Veirfy and Click Continue Button"); Console.WriteLine("You Need Your Profile Make Public too !"); Continue.Enabled = true; autoEvent.WaitOne(); Thread.Sleep(2000); button1.Text = "LoginSucess"; c.Navigate().GoToUrl("http://steamcommunity.com/my"); Thread.Sleep(1000); HtmlAgilityPack.HtmlDocument doc1 = new HtmlAgilityPack.HtmlDocument(); doc1.LoadHtml(c.PageSource); HtmlNode node1 = doc1.DocumentNode.SelectSingleNode("//div[@class=\"responsive_menu_user_persona persona online\"]//div[@class=\"playerAvatar online\"]//a"); Regex r = new Regex("http://steamcommunity.com/profiles/(.*?)/"); Match m = r.Match(node1.Attributes["href"].Value); SteamID = m.Groups[1].Value; DatagridDB db = new DatagridDB(); using (WebClient web = new WebClient()) { web.Encoding = Encoding.UTF8; string dl = web.DownloadString(SteamAPI.API_AdvancePlayer(SteamID)); SteamAdvance adv = JsonConvert.DeserializeObject <SteamAdvance>(dl); bool chk = false; foreach (var item in adv.response.players) { if (item.communityvisibilitystate != 3) { button1.Enabled = true; button1.Text = "Login"; chk = true; c.Quit(); break; } } if (chk) { MessageBox.Show("Profile Status Not Public", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } } //using (WebClient web = new WebClient()) //{ // web.Encoding = Encoding.UTF8; // string dl = web.DownloadString("http://steamcommunity.com/groups/steamcommentbot/memberslistxml/?xml=1"); // HtmlAgilityPack.HtmlDocument dldoc = new HtmlAgilityPack.HtmlDocument(); // if (!dl.Contains("<steamID64>" + SteamID + "</steamID64>")) // { // c.Quit(); // System.Diagnostics.Process.Start("http://steamcommunity.com/groups/steamcommentbot"); // MessageBox.Show("You Are Not In Group", "Error", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); // return; // } //} Console.WriteLine("Auth Passed!"); Tabpageadd(); string dl2 = ""; using (WebClient web = new WebClient()) { web.Encoding = Encoding.UTF8; dl2 = web.DownloadString(SteamAPI.API_GetFriend(SteamID)); } SteamFriendAdvance sfv = JsonConvert.DeserializeObject <SteamFriendAdvance>(dl2); foreach (var item in sfv.friendslist.friends) { ListViewItem itema = new ListViewItem(); using (WebClient web = new WebClient()) { web.Encoding = Encoding.UTF8; string tempdl = web.DownloadString(SteamAPI.API_AdvancePlayer(item.steamid)); SteamAdvance tempadv = JsonConvert.DeserializeObject <SteamAdvance>(tempdl); string personname = ""; foreach (var tempitem in tempadv.response.players) { if (tempitem.communityvisibilitystate == 3) { if (tempitem.commentpermission != 2) { itema.Text = "ok"; } else { itema.Text = "no"; itema.BackColor = Color.Red; } } else { itema.BackColor = Color.Gray; } personname = tempitem.personaname; } itema.SubItems.Add(personname); itema.SubItems.Add(item.steamid); this.Invoke(new MethodInvoker(delegate() { FriendList.Items.Add(itema); })); } } db.SteamID = SteamID; db.UserFriendCount = sfv.friendslist.friends.Count; db.UserProfileStatus = true; Console.WriteLine("UserSteamidParsing"); DataGrid.SelectedObject = db; Thread.Sleep(1000); this.Text = "Steam Comment Bot [ " + SteamID + " ]"; }