Ejemplo n.º 1
0
        private bool ReadAssetsMarket(string content, bool printMessage, ref int page)
        {
            if (content != null)
            {
                if (content == "\r\n\r\n\t\t\t<div class=\"c\"></div>\r\n\t\t</div>\r\n\t\t")
                {
                    return(false);
                }
                if (content == "\n<div class=\"c\"></div>\n</div>\n")
                {
                    return(false);
                }

                if (printMessage)
                {
                    SetMessageLn("第" + (page / 20 + 1).ToString() + "页");
                }

                int num;
                for (string info = JsonHelper.GetMid(content, "<ul >", "</ul>", out num); info != null; info = JsonHelper.GetMid(content, "<ul >", "</ul>", out num))
                {
                    content = content.Substring(num);
                    string   detail  = JsonHelper.GetMid(info, "<a href=\"javascript:purchase(", ");\"");
                    string[] details = detail.Split(',');
                    if (details != null && details.Length == 2)
                    {
                        AssetInfo asset = new AssetInfo();
                        asset.IId          = DataConvert.GetInt32(details[0]);
                        asset.CurrentPrice = DataConvert.GetInt64(JsonHelper.GetMid(details[1], "'", "'"));
                        asset.Name         = JsonHelper.GetMid(info, "<li class=\"tac mt5\"><b>", "</b></li>");
                        if (asset.IId != 0)
                        {
                            this._assetsMarketList.Add(asset);
                        }
                        if (printMessage)
                        {
                            SetMessageLn(asset.ToString());
                        }
                    }
                }
                page += 20;
            }
            else
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private bool ReadAssetsMarket(string content, bool printMessage, ref int page)
        {
            if (content != null)
            {
                if (content == "\r\n\r\n\t\t\t<div class=\"c\"></div>\r\n\t\t</div>\r\n\t\t")
                    return false;
                if (content == "\n<div class=\"c\"></div>\n</div>\n")
                    return false;

                if (printMessage)
                    SetMessageLn("第" + (page / 20 + 1).ToString() + "页");

                int num;
                for (string info = JsonHelper.GetMid(content, "<ul >", "</ul>", out num); info != null; info = JsonHelper.GetMid(content, "<ul >", "</ul>", out num))
                {
                    content = content.Substring(num);
                    string detail = JsonHelper.GetMid(info, "<a href=\"javascript:purchase(", ");\"");
                    string[] details = detail.Split(',');
                    if (details != null && details.Length == 2)
                    {
                        AssetInfo asset = new AssetInfo();
                        asset.IId = DataConvert.GetInt32(details[0]);
                        asset.CurrentPrice = DataConvert.GetInt64(JsonHelper.GetMid(details[1], "'", "'"));
                        asset.Name = JsonHelper.GetMid(info, "<li class=\"tac mt5\"><b>", "</b></li>");
                        if (asset.IId != 0)
                            this._assetsMarketList.Add(asset);
                        if (printMessage)
                            SetMessageLn(asset.ToString());
                    }
                }
                page += 20;
            }
            else
            {
                return false;
            }

            return true;
        }