コード例 #1
0
ファイル: AssetInfo.cs プロジェクト: jojozhuang/Projects
 public AssetInfo Clone()
 {
     AssetInfo asset = new AssetInfo();
     asset.IId = this._iid;
     asset.Name = this._name;
     asset.Description = this._description;
     asset.StandardPrice = this._standardprice;
     asset.CurrentPrice = this._currentprice;
     return asset;
 }
コード例 #2
0
ファイル: ConfigCtrl.cs プロジェクト: jojozhuang/Projects
        public static Collection<AssetInfo> GetAssetsInShop()
        {
            try
            {
                XmlDocument objXmlDoc = GetMasterDataFile(Constants.FILE_ASSETSMASTERDATA);
                if (objXmlDoc == null)
                    return null;

                DataView dv = GetData(objXmlDoc, "data/assets");

                Collection<AssetInfo> assets = new Collection<AssetInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    AssetInfo asset = new AssetInfo();
                    asset.IId = DataConvert.GetInt32(dv.Table.Rows[ix]["iid"]);
                    asset.Name = DataConvert.GetString(dv.Table.Rows[ix]["name"]);
                    asset.StandardPrice = DataConvert.GetInt64(dv.Table.Rows[ix]["standardprice"]);
                    asset.BuyRatio = DataConvert.GetDecimal(dv.Table.Rows[ix]["buyratio"]);
                    asset.BuyPrice = DataConvert.GetInt64(dv.Table.Rows[ix]["buyprice"]);
                    asset.SellRatio = DataConvert.GetDecimal(dv.Table.Rows[ix]["sellratio"]);
                    asset.SellPrice = DataConvert.GetInt64(dv.Table.Rows[ix]["sellprice"]);
                    asset.Description = DataConvert.GetString(dv.Table.Rows[ix]["description"]);
                    assets.Add(asset);
                }
                return assets;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetAssetsInShop", ex);
                return null;
            }
        }
コード例 #3
0
ファイル: GameRich.cs プロジェクト: jojozhuang/Projects
        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;
        }