Ejemplo n.º 1
0
        public void RefreshProgress(object state)
        {
            object[] parameters = state as object[];

            SteamLibrary.InventItem item = (SteamLibrary.InventItem)parameters[0];
            int index = (int)parameters[1];

            string[] split = item.PageLink.Split('/');

            SteamLibrary.StrParam priceOver = SteamParseSite.ParseItemPrice(split[7], split[6], cookieCont);

            item.MedianPrice = priceOver.P2;

            if (item.BuyPrice == "0")
            {
                item.BuyPrice = SteamLibrary.GetSweetPrice(item.MedianPrice);
            }

            doMessage(flag.InvPrice, index, item, true);
        }
Ejemplo n.º 2
0
        public void Event_Message(object sender, object data, int searchId, flag myflag, bool isMain)
        {
            if (data == null)
            {
                return;
            }

            string message = data.ToString();

            switch (myflag)
            {
            case flag.Already_logged:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                SteamLibrary.AddtoLog("Already logged");
                GetAccInfo((SteamLibrary.StrParam)data);
                break;

            case flag.Login_success:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                SteamLibrary.AddtoLog("Login succesful");
                GetAccInfo((SteamLibrary.StrParam)data);
                break;

            case flag.Login_cancel:

                MessageBox.Show("Error logging in! " + message + "!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                StatusPB.Image    = null;
                StatusLabel1.Text = message;
                break;

            case flag.Logout_:

                StatusLabel1.Text = "Ready";
                StatusPB.Image    = null;
                LoginB.Text       = "Login";
                break;

            case flag.Search_success:

                ScanLV.Enabled   = true;
                button15.Enabled = true;

                if (SteamAutoFunction.sppos.CurrentPos == 1)
                {
                    int found = Convert.ToInt32(message);
                    SteamAutoFunction.sppos.PageCount = found / SteamAutoFunction.SearchResCount;
                    if (found % SteamAutoFunction.SearchResCount != 0)
                    {
                        SteamAutoFunction.sppos.PageCount++;
                    }
                }

                label5.Text = string.Format("{0}/{1}", SteamAutoFunction.sppos.CurrentPos.ToString(),
                                            SteamAutoFunction.sppos.PageCount.ToString());

                if (SteamAutoFunction.sppos.PageCount > 1)
                {
                    prepageBT.Visible  = true;
                    nextpageBT.Visible = true;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }
                else
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }

                ScanLV.Items.Clear();

                for (int i = 0; i < SteamAutoFunction.SearchList.Count; i++)
                {
                    var ourItem = SteamAutoFunction.SearchList[i];

                    string[] row = { ourItem.Game,     ourItem.Name,                                                  SteamParsing.Currencies.GetName() + " " + ourItem.StartPrice,
                                     ourItem.Quantity, SteamParsing.Currencies.GetName() + " " + ourItem.MedianPrice, ourItem.Hashname };
                    var      lstItem = new ListViewItem(row);
                    ScanLV.Items.Add(lstItem);
                }

                button2.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";

                break;

            case flag.Advance_search_success:

                ScanLV.Enabled               = true;
                button15.Enabled             = true;
                SteamAutoFunction.searchDone = true;

                if (SteamAutoFunction.sppos.CurrentPos == 1)
                {
                    int found = Convert.ToInt32(message);
                    SteamAutoFunction.sppos.PageCount = found / SteamAutoFunction.SearchResCount;
                    if (found % SteamAutoFunction.SearchResCount != 0)
                    {
                        SteamAutoFunction.sppos.PageCount++;
                    }
                }

                label5.Text = string.Format("{0}/{1}", SteamAutoFunction.sppos.CurrentPos.ToString(),
                                            SteamAutoFunction.sppos.PageCount.ToString());

                if (SteamAutoFunction.sppos.PageCount > 1)
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = true;
                    button17.Visible   = true;
                }
                else
                {
                    prepageBT.Visible  = false;
                    nextpageBT.Visible = false;
                    button16.Visible   = false;
                    button17.Visible   = false;
                }

                ScanLV.Items.Clear();

                for (int i = 0; i < SteamAutoFunction.SearchList.Count; i++)
                {
                    var ourItem = SteamAutoFunction.SearchList[i];

                    string[] row = { ourItem.Game,     ourItem.Name,                                                  SteamParsing.Currencies.GetName() + " " + ourItem.StartPrice,
                                     ourItem.Quantity, SteamParsing.Currencies.GetName() + " " + ourItem.MedianPrice, ourItem.Hashname };
                    var      lstItem = new ListViewItem(row);
                    ScanLV.Items.Add(lstItem);
                }

                button2.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";

                break;

            case flag.Add_track:

                SteamLibrary.TrackingItem item = (SteamLibrary.TrackingItem)data;

                string lp = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item.StartPrice);
                string mp = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item.MedianPrice);

                string[] row1 = { item.Game,                   item.Name, lp,        mp, "", "",            item.BuyPercent.ToString(),
                                  item.SellPercent.ToString(), "",        item.Link, "", "", item.hashname, "" };
                var      lst1 = new ListViewItem(row1);
                TraItemLV.Items.Add(lst1);

                break;

            case flag.Track_progress:

                SteamLibrary.TrackingItem item1 = (SteamLibrary.TrackingItem)data;

                string lp1 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item1.StartPrice);
                string mp1 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", item1.MedianPrice);

                TraItemLV.Items[item1.index].SubItems[2].Text  = lp1;
                TraItemLV.Items[item1.index].SubItems[3].Text  = mp1;
                TraItemLV.Items[item1.index].SubItems[13].Text = searchId.ToString();

                break;

            /*case flag.Error_scan:
             *
             *  string mess = GetScanErrMess(message);
             *  button12.Enabled = true;
             *  button3.Enabled = true;
             *  break;*/

            case flag.Success_buy:

                string[] price = message.Split(';');

                double itemcost = Math.Round(Convert.ToSingle(WalletL.Text.Remove(0, 2)) - Convert.ToSingle(price[0]), 2);

                FlashWindow.Flash(this);

                WalletL.Text     = SteamParsing.Currencies.GetName() + " " + price[0];
                button3.Enabled  = true;
                button12.Enabled = true;

                for (int i = 0; i < SteamAutoFunction.TrackingList.Count; i++)
                {
                    if (SteamAutoFunction.TrackingList[i].Name.Equals(price[1]))
                    {
                        SteamAutoFunction.TrackingList[i].Purchased = true;
                        TraItemLV.Items[i].SubItems[8].Text         = "x";
                        TraItemLV.Items[i].SubItems[10].Text        = SteamParsing.Currencies.GetName() + " " + itemcost;
                        TraItemLV.Items[i].SubItems[11].Text        = DateTime.Today.AddDays(7).ToString();
                        if (SteamAutoFunction.TrackingList[i].Buy == true)
                        {
                            SteamAutoFunction.TrackingList[i].Buy = false;
                            TraItemLV.Items[i].SubItems[4].Text   = "";
                        }
                        if (SteamAutoFunction.TrackingList[i].Buying == true)
                        {
                            SteamAutoFunction.TrackingList[i].Buying = false;
                        }
                        SteamAutoFunction.TrackingList[i].Refresh.Stop();
                        break;
                    }
                }

                break;

            case flag.Error_buy:

                button3.Enabled = true;
                break;


            case flag.Load_progress:

                for (int a = 0; a < SteamAutoFunction.TrackingList.Count; a++)
                {
                    SteamAutoFunction.TrackingList[a].index = a;

                    string lp2 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].StartPrice);
                    string mp2 = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].MedianPrice);

                    string buy = ""; string sell = ""; string pured = ""; string pp = "";

                    if (SteamAutoFunction.TrackingList[a].Buy)
                    {
                        buy = "x";
                    }
                    if (SteamAutoFunction.TrackingList[a].Sell)
                    {
                        sell = "x";
                    }
                    if (SteamAutoFunction.TrackingList[a].Purchased)
                    {
                        pured = "x";
                        pp    = SteamParsing.Currencies.GetName() + " " + string.Format("{0:N2}", SteamAutoFunction.TrackingList[a].PurchasePrice);
                    }

                    string[] row2 = { SteamAutoFunction.TrackingList[a].Game,
                                      SteamAutoFunction.TrackingList[a].Name,                  lp2,                                             mp2,                                    buy, sell,
                                      SteamAutoFunction.TrackingList[a].BuyPercent.ToString(),
                                      SteamAutoFunction.TrackingList[a].SellPercent.ToString(),pured,                                           SteamAutoFunction.TrackingList[a].Link,
                                      pp,                                                      SteamAutoFunction.TrackingList[a].purchasedate,
                                      SteamAutoFunction.TrackingList[a].hashname,              "" };
                    var      lst2 = new ListViewItem(row2);
                    TraItemLV.Items.Add(lst2);
                }

                break;

            case flag.Inventory_Loaded:

                button9.Enabled   = true;
                InvenLV.Enabled   = true;
                StatusPB.Image    = null;
                StatusLabel1.Text = "Ready";
                //SetInvFilter();

                //label4.Text = filteredInvList.Count.ToString();
                button1.Enabled = true;
                if (searchId == 0)
                {
                    FillInventoryList();

                    button7.Enabled = true;
                    if (comboBox1.SelectedIndex != 8)
                    {
                        button10.Enabled = true;
                    }
                    else
                    {
                        button10.Enabled = false;
                    }
                }
                else
                {
                    InvenLV.Items.Clear();
                    button10.Enabled = false;
                    MessageBox.Show("Inventory section is empty!", "Attention", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                break;

            case flag.InvPrice:

                SteamLibrary.InventItem ourItem1 = (SteamLibrary.InventItem)data;

                string priceRes = SteamParsing.Currencies.GetName() + " " + SteamLibrary.DoFracture(ourItem1.BuyPrice);
                string priceMes = SteamParsing.Currencies.GetName() + " " + ourItem1.MedianPrice.ToString();

                InvenLV.Items[searchId].SubItems[2].Text = priceRes;
                InvenLV.Items[searchId].SubItems[3].Text = priceMes;

                textBox2.Text = SteamLibrary.DoFracture(ourItem1.BuyPrice);
                textBox2_KeyUp(this, null);

                textBox2.ReadOnly = false;

                button11.Enabled = true;
                InvenLV.Enabled  = true;

                break;

            case flag.Items_Sold:
                if (searchId != 1)
                {
                    StatusLabel1.Text = "Ready";
                    StatusPB.Image    = null;

                    button10.Text = "Set price";

                    int app = comboBox1.SelectedIndex;

                    SteamAuto.InventoryThreadExcute(app);
                }
                break;
            }
        }