Exemple #1
0
        public void ReadAllMyFriends(string content, bool printMessage)
        {
            if (printMessage)
            {
                SetMessageLn("读取我的所有朋友信息...");
            }

            this._allMyFriendsList.Clear();

            //我的所有好友
            JsonTextParser      parser            = new JsonTextParser();
            JsonArrayCollection arrayAllMyFriends = parser.Parse(content) as JsonArrayCollection;

            foreach (JsonObjectCollection item in arrayAllMyFriends)
            {
                FriendInfo friend = new FriendInfo();
                friend.Id   = JsonHelper.GetIntegerValue(item["uid"]);
                friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                this._allMyFriendsList.Add(friend);
                if (printMessage)
                {
                    SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                }
            }

            if (printMessage)
            {
                SetMessageLn(string.Format("您有{0}个朋友", new object[] { this._allMyFriendsList.Count }));
            }
        }
Exemple #2
0
        public void ReadSlaves(string content, bool printMessage)
        {
            int num;

            this._mySlaveList.Clear();

            if (printMessage)
            {
                SetMessageLn("读取奴隶列表:");
            }
            for (string info = JsonHelper.GetMid(content, "<div class=\"w265 l c6\">", "\t\t\t </div>", out num); info != null; info = JsonHelper.GetMid(content, "<div class=\"w265 l c6\">", "\t\t\t </div>", out num))
            {
                content = content.Substring(num);

                FriendInfo slave = new FriendInfo();
                slave.Name   = JsonHelper.GetMid(info, "class=\"sl2\">", "<");
                slave.Id     = JsonHelper.GetInteger(JsonHelper.GetMid(info, "/home/?uid=", "'"));
                slave.Gender = JsonHelper.GetMid(info, "\">我要释放", "<") == "他" ? true : false;
                slave.Price  = JsonHelper.GetInteger(JsonHelper.GetMid(info, "身 价:<strong class=\"dgreen\">&yen;", "<"));
                if ((slave.Name != null))
                {
                    this._mySlaveList.Add(slave);
                    if (printMessage)
                    {
                        SetMessageLn(slave.Name + "(" + slave.Id.ToString() + ")--" + slave.Price);
                    }
                }
            }
            this._slaveNum = this._mySlaveList.Count;
            if (printMessage)
            {
                SetMessageLn(string.Format("您有{0}个奴隶", new object[] { this._slaveNum }));
            }
        }
Exemple #3
0
        private bool BuyTheSlave(int slaveuid)
        {
            if (Operation.BuyBlackList.Contains(slaveuid))
            {
                SetMessage("#" + GetFriendNameById(slaveuid) + ",不购买黑名单里的奴隶 ");
                return(false);
            }
            string slaveNick = Task.NickName;

            if (slaveNick == null)
            {
                slaveNick = string.Empty;
            }
            else
            {
                slaveNick = DataConvert.GetEncodeData(slaveNick);
            }

            //get slave info
            HH.DelayedTime = Constants.DELAY_2SECONDS;
            string content = HH.Get(string.Format("http://www.kaixin001.com/slave/buy_dialog.php?slaveuid={0}&verify={1}", slaveuid, this._verifyCode));

            if (!GetBuySlaveFeedback(content))
            {
                return(false);
            }

            //current price
            int slaveprice = JsonHelper.GetInteger(JsonHelper.GetMid(content, "你想花 <strong class=\"dgreen\">&yen;", "</strong> 的价格购买"));

            //request for buying
            string param = "verify=" + this._verifyCode + "&slaveuid=" + slaveuid + "&nick=" + slaveNick + "&acc=" + GetAccCode(content);

            HH.DelayedTime = Constants.DELAY_2SECONDS;
            content        = HH.Post("http://www.kaixin001.com/slave/buy.php", param);
            if (!GetBuySlaveFeedback(content))
            {
                return(false);
            }

            if (this.GetFeedback(content))
            {
                FriendInfo slave = new FriendInfo();
                slave.Id   = Convert.ToInt32(slaveuid);
                slave.Name = JsonHelper.GetMid(content, "<span class=\"sl\">", "<");
                if (slave.Name == null)
                {
                    slave.Name = string.Empty;
                }
                slave.Gender = JsonHelper.GetMid(content, "<br />同时,", "的") == "他" ? true : false;
                slave.Price  = JsonHelper.GetInteger(JsonHelper.GetMid(content, "&yen;", "<"));
                this._mySlaveList.Add(slave);
                this._slavecash -= slaveprice;
                return(true);
            }
            else
            {
                return(false);
            }
        }
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         _selecteduser = new Collection<FriendInfo>();
         foreach (ListViewItem item in lstViewFriend.SelectedItems)
         {
             FriendInfo user = new FriendInfo();
             user.Name = item.SubItems[0].Text;
             user.Id = Convert.ToInt32(item.SubItems[1].Text);                    
             _selecteduser.Add(user);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     catch (Exception ex)
     {
         Program.ShowMessageBox("DlgSelectionBase", ex);
     }
 }
Exemple #5
0
        public void ReadRestableFriends(string content, bool printMessage)
        {
            int num;

            this._restableFriendsList.Clear();

            if (printMessage)
            {
                SetMessageLn("读取[我能休息的房间]信息:");
            }
            for (string pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num))
            {
                content = content.Substring(num);
                int uid = JsonHelper.GetInteger(pos);
                if (uid > 0)
                {
                    string     name   = JsonHelper.GetMid(content, "\">", "</a>");
                    FriendInfo friend = new FriendInfo();
                    friend.Id   = uid;
                    friend.Name = name;
                    string status = JsonHelper.GetMid(content, "\"width:1em;\">", "</div>");
                    if ((status != null) && status.Trim() != string.Empty)
                    {
                        friend.Status = "在线";
                    }
                    else
                    {
                        friend.Status = "离线";
                    }
                    this._restableFriendsList.Add(friend);
                    if (printMessage)
                    {
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--" + friend.Status);
                    }
                }
            }
            if (printMessage)
            {
                SetMessageLn("完成读取!");
            }
        }
Exemple #6
0
        public void ReadBitableFriends(string content, bool printMessage)
        {
            int num;

            this._bitableFriendsList.Clear();

            if (printMessage)
            {
                SetMessageLn("读取[我可以去咬的人]信息:");
            }
            for (string pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num))
            {
                content = content.Substring(num);
                string status = JsonHelper.GetMid(content, "\"width:13em;\">(", ")");
                if ((status != null) && (status.IndexOf("今天咬过") == -1))
                {
                    int uid = JsonHelper.GetInteger(pos);
                    if (uid > 0)
                    {
                        string     name   = JsonHelper.GetMid(content, "\">", "</a>");
                        FriendInfo friend = new FriendInfo();
                        friend.Id     = uid;
                        friend.Name   = name;
                        friend.Status = status;
                        this._bitableFriendsList.Add(friend);
                        if (printMessage)
                        {
                            SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--" + friend.Status);
                        }
                    }
                }
            }
            if (printMessage)
            {
                SetMessageLn("完成读取!");
            }
        }
Exemple #7
0
        public void ReadBuyableSlaves(string content, bool printMessage)
        {
            int num;

            this._buyableSlaveList.Clear();

            if (printMessage)
            {
                SetMessageLn("读取[我能买的奴隶]信息:");
            }
            for (string pos = JsonHelper.GetMid(content, "javascript:parent.gotouser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:parent.gotouser(", ")", out num))
            {
                content = content.Substring(num);
                int id = JsonHelper.GetInteger(pos);
                if (id > 0)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id   = id;
                    friend.Name = JsonHelper.GetMid(content, "<strong>", "</strong></a>");
                    string price = JsonHelper.GetMid(content, "10em;\">(价格:¥", ")</div>");
                    if ((price != null) && price.Trim() != string.Empty)
                    {
                        friend.Price = JsonHelper.GetInteger(price);
                    }
                    this._buyableSlaveList.Add(friend);
                    if (printMessage)
                    {
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--价格:¥" + friend.Price);
                    }
                }
            }
            if (printMessage)
            {
                SetMessageLn("完成读取!");
            }
        }
Exemple #8
0
        public static Collection<FriendInfo> GetCafeFriends(string content)
        {
            try
            {
                if (String.IsNullOrEmpty(content))
                    return new Collection<FriendInfo>();

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(content);

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

                Collection<FriendInfo> friends = new Collection<FriendInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id = DataConvert.GetInt32(dv.Table.Rows[ix]["uid"]);
                    friend.Name = DataConvert.GetString(dv.Table.Rows[ix]["real_name"]);
                    if (dv.Table.Columns.Contains("help"))
                        friend.Help = ConvertIntToBool(DataConvert.GetInt32(dv.Table.Rows[ix]["help"]));
                    if (dv.Table.Columns.Contains("food"))
                        friend.Food = ConvertIntToBool(DataConvert.GetInt32(dv.Table.Rows[ix]["food"]));
                    if (dv.Table.Columns.Contains("employ"))
                        friend.Employ = ConvertIntToBool(DataConvert.GetInt32(dv.Table.Rows[ix]["employ"]));
                    if (dv.Table.Columns.Contains("appinstall"))
                        friend.AppInstall = ConvertIntToBool(DataConvert.GetInt32(dv.Table.Rows[ix]["appinstall"]));
                    friends.Add(friend);
                }

                return friends;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetCafeFriends", content, ex, LogSeverity.Error);
                return null;
            }
        }
Exemple #9
0
        public static Collection<FriendInfo> GetHelpFriend(string strxml)
        {
            try
            {
                //<data>
                //  <help>
                //    <item>
                //      <uid>7995015</uid>
                //      <realname>石智星</realname>
                //      <online>0</online>
                //      <icon20>http://pic.kaixin001.com/logo/73/34/20_6733418_1.jpg</icon20>
                //      <extext>需帮忙</extext>
                //    </item>
                //    <item>
                //      <uid>6209015</uid>
                //      <realname>沈炳</realname>
                //      <online>0</online>
                //      <icon20>http://img.kaixin001.com.cn/i/20_0_0.gif</icon20>
                //      <extext>需帮忙</extext>
                //    </item>
                //    <item>
                //      <uid>6209093</uid>
                //      <realname>陈江铸</realname>
                //      <online>0</online>
                //      <icon20>http://img.kaixin001.com.cn/i/20_0_0.gif</icon20>
                //      <extext>需帮忙</extext>
                //    </item>
                //    <item>
                //      <uid>6209093</uid>
                //      <realname>李富县</realname>
                //      <online>0</online>
                //      <icon20>http://img.kaixin001.com.cn/i/20_0_0.gif</icon20>
                //      <extext>需帮忙</extext>
                //    </item>
                //  </help>
                //</data>
                if (String.IsNullOrEmpty(strxml))
                    return null;

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(strxml);
                if (objXmlDoc == null)
                    return null;
               
                //fishs
                DataView dv = GetData(objXmlDoc, "data/help");
                Collection<FriendInfo> friends = new Collection<FriendInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        FriendInfo friend = new FriendInfo();
                        friend.Id = DataConvert.GetInt32(dv.Table.Rows[ix]["uid"]);
                        friend.Name = DataConvert.GetString(dv.Table.Rows[ix]["realname"]);
                        friends.Add(friend);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetHelpFriend", strxml, ex, LogSeverity.Error);
                        continue;
                    }
                }

                return friends;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetHelpFriend", strxml, ex, LogSeverity.Error);
                return null;
            }
        }
 protected virtual string[] BuildListView(FriendInfo user) { return new string[2];}
Exemple #11
0
        public void ReadFreeFriends(string content, bool printMessage)
        {
            int num;
            this._freeFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[露宿街头的好友]信息:");
            //<input type=hidden id=gender_4 value="0">
            //<div id=udiv_4 style="border-bottom:1px dashed #ccc;padding:3px 5px;">
            //    <div class="l" style="width:8em;"><a href="javascript:gotoUser(10753474);" class="sl">武大郎</a></div>
            //    <div class="l c9" style="width:13em;"></div>
            //    <div class="c"></div>
            //</div>
            //<input type=hidden id=gender_5 value="1">
            //<div id=udiv_5 style="border-bottom:1px dashed #ccc;padding:3px 5px;">
            //    <div class="l" style="width:8em;"><a href="javascript:gotoUser(10753642);" class="sl">王思懿</a></div>
            //    <div class="l c9" style="width:13em;"></div>
            //    <div class="c"></div>
            //</div>
            string content2 = content;
            for (string pos = JsonHelper.GetMid(content, "<div class=\"l\" style=\"width:8em;\">", "</div>", out num); pos != null; pos = JsonHelper.GetMid(content, "<div class=\"l\" style=\"width:8em;\">", "</div>", out num))
            {
                FriendInfo friend = new FriendInfo();
                friend.Id = JsonHelper.GetMidInteger(content, "<a href=\"javascript:gotoUser(", ");\"");
                friend.Name = JsonHelper.GetMid(content, "class=\"sl\">", "</a>");
                if (friend.Id != 0 && friend.Name != string.Empty)
                {
                    this._freeFriendsList.Add(friend);                    
                }
                content = content.Substring(num);
            }
            int ix = 0;
            for (string pos = JsonHelper.GetMid(content2, "<input type=hidden id=gender_", ">", out num); pos != null; pos = JsonHelper.GetMid(content2, "<input type=hidden id=gender_", ">", out num))
            {
                if (pos.IndexOf("value=\"1\"") > -1)
                {
                    this._freeFriendsList[ix].Gender = false;
                }
                else if (pos.IndexOf("value=\"0\"") > -1)
                {
                    this._freeFriendsList[ix].Gender = true;
                }
                else
                {
                    break;
                }
                if (printMessage)
                    SetMessageLn(this._freeFriendsList[ix].Name + "(" + this._freeFriendsList[ix].Id.ToString() + ")--" + (this._freeFriendsList[ix].Gender ? "男" : "女"));
                ix++;
                content2 = content2.Substring(num);
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #12
0
        public void ReadSameVillageFriends(string content, bool printMessage)
        {
            int num;
            this._sameVillageFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[住在同小区里的好友]信息:");
            content = JsonHelper.GetMid(content, "<div class=\"mt30 ml10\"><b class=\"f13\">住在本小区里的好友:</b>", "</div>");
            for (string pos = JsonHelper.GetMid(content, "<a href='/~house/index.php?", "</a>", out num); pos != null; pos = JsonHelper.GetMid(content, "<a href='/~house/index.php?", "</a>", out num))
            {
                FriendInfo friend = new FriendInfo();
                friend.Id = JsonHelper.GetMidInteger(content, "_lgmode=pri&fuid=", "' class='sl'>");
                friend.Name = JsonHelper.GetMid(content, "' class='sl'>", "</a>");
                friend.Gender = GetGenderById(friend.Id);
                this._sameVillageFriendsList.Add(friend);
                if (printMessage)
                    SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                content = content.Substring(num);
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #13
0
        public static Collection<FriendInfo> GetContactsFromFile(string file)
        {
            try
            {
                if (!File.Exists(file))
                    return null;

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.Load(file);

                if (objXmlDoc == null)
                    return null;

                DataView dv = GetData(objXmlDoc, "ZrAssistant/Contact");

                Collection<FriendInfo> friends = new Collection<FriendInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Name = dv.Table.Rows[ix][0].ToString();
                    friend.Id = DataConvert.GetInt32(dv.Table.Rows[ix][1]);
                    friends.Add(friend);
                }

                return friends;
            }
            catch (Exception ex)
            {
                LogHelper.Write("读取联系人信息" + file, ex);
                return null;
            }
        }
Exemple #14
0
        private void FishingThePond(string fuid, FriendInfo friend)
        {
            try
            {
                PondInfo pond = ReadPond(this._verifyCode, fuid, true);
                if (pond == null)
                {
                    SetMessage("无法读取鱼塘信息,失败");
                    return;
                }

                if (pond.Fishs.Count <= 0)
                {
                    SetMessageLn("当前鱼塘没有鱼,跳过");
                    return;
                }

                Collection<int> poses = GetValidPondPos(pond);
                if (poses.Count <= 0)
                {
                    SetMessageLn("没有空余的座位,跳过");
                    return;
                }

                string content = RequestMyTacklesList();
                Collection<FishTackleInfo> myTackcles = ConfigCtrl.GetMyTackles(content);

                int busecount = 0;
                int tacklecount = 0;
                foreach(FishTackleInfo fishtackle in myTackcles)
                {
                    if (fishtackle.Status == 0 || fishtackle.Status == 1)
                    {
                        tacklecount++;
                        if (fishtackle.BUse == 1)
                            busecount++;
                    }
                }
                if (busecount == tacklecount)
                {
                    _canfish = false;
                    return;
                }
                int ix = 0;
                for (ix = 0; ix < myTackcles.Count; ix++)
                {
                    if (myTackcles[ix].Status == 1 && myTackcles[ix].BUse != 1)
                    {
                        int pos = poses[0];
                        SetMessageLn(string.Format("=>第{0}个座位 :", pos));
                        HH.DelayedTime = Constants.DELAY_2SECONDS;
                        content = HH.Post("http://www.kaixin001.com/!fish/!fish.php", string.Format("r=0%2E6440917486324906&verify={0}&fuid={1}&pos={2}&tackleid={3}", DataConvert.GetEncodeData(this._verifyCode), fuid, pos, myTackcles[ix].TackleId));
                        GetFishingThePondFeedback(content);
                        poses.Remove(pos);
                        if (poses.Count == 0)
                            break;
                        if (!_canfish)
                            return;
                    }
                }
                if (ix == tacklecount - 1)
                    _canfish = false;
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameFish.FishingThePond", ex, LogSeverity.Error);
                SetMessage(" 去" + GetFriendNameById(fuid) + "的鱼塘钓鱼失败!错误:" + ex.Message);
            }
        }
Exemple #15
0
        public void ReadAllFishFriends(string content, bool printMessage)
        {
            //{"fishing":[],"fishable":[{"uid":10151052,"realname":"\u5b59\u6b63\u82b3","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/15\/10\/20_10151052_1.jpg","extext":"\u53ef\u9493","decor":0},{"uid":1283947,"realname":"\u6797\u8054\u5bf9","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/28\/39\/20_1283947_2.jpg","extext":"\u53ef\u9493","decor":0},{"uid":2511621,"realname":"\u4e07\u6d69","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/51\/16\/20_2511621_5.jpg","extext":"\u53ef\u9493","decor":0},{"uid":26366307,"realname":"\u6731\u4f1f","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/36\/63\/20_26366307_2.jpg","extext":"\u53ef\u9493","decor":0},{"uid":2803054,"realname":"\u8f66\u79be\u5409","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/80\/30\/20_2803054_1.jpg","extext":"\u53ef\u9493","decor":0},{"uid":3092481,"realname":"\u534e\u7ef4\u82ac","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/9\/24\/20_3092481_6.jpg","extext":"\u53ef\u9493","decor":0},{"uid":3125472,"realname":"\u738b\u535a\u667a","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/12\/54\/20_3125472_9.jpg","extext":"\u53ef\u9493","decor":0},{"uid":4026057,"realname":"\u8521\u632f\u534e","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/2\/60\/20_4026057_2.jpg","extext":"\u53ef\u9493","decor":1},{"uid":434362,"realname":"\u59da\u851a\u98de(\uff2aa","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/43\/43\/20_434362_15.jpg","extext":"\u53ef\u9493","decor":1},{"uid":4789786,"realname":"\u5b5f\u519b\u534e","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/78\/97\/20_4789786_2.jpg","extext":"\u53ef\u9493","decor":0},{"uid":5969055,"realname":"\u534e\u654f\u5cf0","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/96\/90\/20_5969055_7.jpg","extext":"\u53ef\u9493","decor":1},{"uid":6194153,"realname":"\u5e84\u5b50","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/19\/41\/20_6194153_1.jpg","extext":"\u53ef\u9493","decor":0},{"uid":6352682,"realname":"\u674e\u4e3a\u6c11","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/35\/26\/20_6352682_4.jpg","extext":"\u53ef\u9493","decor":0},{"uid":7744681,"realname":"\u6587\u6653\u6653","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/74\/46\/20_7744681_2.jpg","extext":"\u53ef\u9493","decor":0},{"uid":8006646,"realname":"\u59da\u7426\u6590","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/0\/66\/20_8006646_1.jpg","extext":"\u53ef\u9493","decor":0},{"uid":405591,"realname":"\u5c45\u7b11\u5929","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/40\/55\/20_405591_1.jpg","extext":"","decor":2},{"uid":2395406,"realname":"\u6731\u8273\u96ef","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/39\/54\/20_2395406_3.jpg","extext":"","decor":1},{"uid":1922571,"realname":"\u4f40\u95ef","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/92\/25\/20_1922571_5.jpg","extext":"","decor":1},{"uid":3788889,"realname":"\u6c88\u51ef\u8f89","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/78\/88\/20_3788889_10.jpg","extext":"","decor":1},{"uid":4538025,"realname":"\u738b\u747e","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/53\/80\/20_4538025_6.jpg","extext":"","decor":1},{"uid":3612627,"realname":"\u5468\u6797","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/61\/26\/20_3612627_4.jpg","extext":"","decor":1},{"uid":5629041,"realname":"\u5f20\u52e4","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/62\/90\/20_5629041_5.jpg","extext":"","decor":1},{"uid":9134133,"realname":"\u5f90\u6c47\u6c5f","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/13\/41\/20_9134133_1.jpg","extext":"","decor":1},{"uid":11860509,"realname":"\u5f90\u5723\u541b","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/86\/5\/20_11860509_1.jpg","extext":"","decor":1},{"uid":4585976,"realname":"\u65b9\u5fd7\u8363","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/58\/59\/20_4585976_3.jpg","extext":"","decor":2},{"uid":18643363,"realname":"\u595a\u51e4(\u6021\u6021)","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/64\/33\/20_18643363_1.jpg","extext":"","decor":1},{"uid":28860603,"realname":"\u9648\u5609\u59ae","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/86\/6\/20_28860603_6.jpg","extext":"","decor":1},{"uid":32263316,"realname":"\u5f90\u6daf\u7433","online":0,"icon20":"http:\/\/pic.kaixin001.com\/logo\/26\/33\/20_32263316_15.jpg","extext":"","decor":1},{"uid":10168533,"realname":"\u864e\u738b","online":1,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/16\/85\/20_10168533_1.jpg","extext":"","decor":1},{"uid":7134351,"realname":"\u5f3a\u601d\u601d","online":1,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/13\/43\/20_7134351_4.jpg","extext":"","decor":1}],"imgdomain":"img.kaixin001.com.cn"}
            //{"fishing":[{"uid":7995015,"realname":"\u5b5f\u83b7","online":0,"icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_1_0.gif","extext":"\u4e0a\u94a9","decor":0},{"uid":6194153,"realname":"\u5e84\u5b50","online":0,"icon20":"http:\/\/pic1.kaixin001.com\/logo\/19\/41\/20_6194153_1.jpg","extext":"\u4e0a\u94a9","decor":0}],"fishable":[],"imgdomain":"img.kaixin001.com.cn"}
            this._allFishFriendsList.Clear();
            this._harvestFishFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[所有钓鱼的好友]信息:");

            if (content.IndexOf("\"fishing\":[],") > -1 && content.IndexOf(",\"fishable\":[]") > -1)
            {
                if (printMessage)
                    SetMessageLn("没有任何钓鱼的好友!");
                return;
            }

            content = content.Replace("\"fishing\":[],", "").Replace(",\"fishable\":[]", "").Replace(",\"imgdomain\":\"img.kaixin001.com.cn\"", "");
            JsonTextParser parser = new JsonTextParser();

            JsonObjectCollection objects = parser.Parse(content) as JsonObjectCollection;
            //我下杆的鱼塘
            JsonArrayCollection arrayFishingFriends = objects["fishing"] as JsonArrayCollection;
            if (arrayFishingFriends != null)
            {
                if (printMessage)
                    SetMessageLn("我下杆的鱼塘:");
                foreach (JsonObjectCollection item in arrayFishingFriends)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                    friend.Name = JsonHelper.GetStringValue(item["realname"]);
                    this._harvestFishFriendsList.Add(friend);
                    if (printMessage)
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                }
            }
            //可钓的鱼塘
            JsonArrayCollection arrayFishableFriends = objects["fishable"] as JsonArrayCollection;
            if (arrayFishableFriends != null)
            {
                foreach (JsonObjectCollection item in arrayFishableFriends)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                    friend.Name = JsonHelper.GetStringValue(item["realname"]);
                    friend.Decor = JsonHelper.GetIntegerValue(item["decor"]) == 0 ? true : false;
                    this._allFishFriendsList.Add(friend);
                    if (printMessage)
                    {
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                        if (friend.Decor)
                            SetMessage("可钓");
                    }

                }
            }
        }
Exemple #16
0
        private void ReadParkFriends(string content, bool empty, bool printMessage)
        {
            if (printMessage)
                SetMessageLn("读取争车位好友信息...");
            //string strFriends = JsonHelper.GetMid(content, "v_frienddata = ", "\n");
            if (content != null)
            {
                if (empty)
                    this._parkEmptyGarageFriendsList.Clear();
                else
                    this._parkFriendsList.Clear();
                JsonTextParser parser = new JsonTextParser();

                //我的所有争车位的好友
                JsonArrayCollection friendslist = parser.Parse(content) as JsonArrayCollection;
                foreach (JsonObjectCollection item in friendslist)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                    friend.Full = JsonHelper.GetStringValue(item["full"]) != "0";
                    friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                    friend.Online = JsonHelper.GetIntegerValue(item["online"]) == 1;
                    friend.IsNeighbor = JsonHelper.GetIntegerValue(item["neighbor"]) == 1;

                    if (printMessage)
                    {
                        if (empty)
                            SetMessageLn(string.Format(" #{0}: {1}({2}) {3}", new object[] { _parkEmptyGarageFriendsList.Count + 1, friend.Name, friend.Id, friend.Full ? "车位满" : "" }));
                        else
                            SetMessageLn(string.Format(" #{0}: {1}({2}) {3}", new object[] { _parkFriendsList.Count + 1, friend.Name, friend.Id, friend.Full ? "车位满" : "" }));
                    }
                    if (empty)
                        this._parkEmptyGarageFriendsList.Add(friend);
                    else
                        this._parkFriendsList.Add(friend);
                }
            }
        }
Exemple #17
0
 public void Clone(FriendInfo source)
 {
     this.Id = source.Id;
     this.Name = source.Name;
     this.Power = source.Power;
 }
Exemple #18
0
 public void Clone(FriendInfo source)
 {
     this.Id    = source.Id;
     this.Name  = source.Name;
     this.Power = source.Power;
 }
Exemple #19
0
        public void ReadBitableFriends(string content, bool printMessage)
        {
            int num;
            this._bitableFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[我可以去咬的人]信息:");
            for (string pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num))
            {
                content = content.Substring(num);
                string status = JsonHelper.GetMid(content, "\"width:13em;\">(", ")");
                if ((status != null) && (status.IndexOf("今天咬过") == -1))
                {
                    int uid = JsonHelper.GetInteger(pos);
                    if (uid > 0)
                    {
                        string name = JsonHelper.GetMid(content, "\">", "</a>");
                        FriendInfo friend = new FriendInfo();
                        friend.Id = uid;
                        friend.Name = name;
                        friend.Status = status;
                        this._bitableFriendsList.Add(friend);
                        if (printMessage)
                            SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--" + friend.Status);
                    }
                }
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #20
0
        public static CafeInfo GetCafe(string strxml)
        {
            try
            {
                if (String.IsNullOrEmpty(strxml))
                    return null;

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(strxml);
                if (objXmlDoc == null)
                    return null;

                CafeInfo cafe = new CafeInfo();

                //cafe
                XmlNode objNode = objXmlDoc.SelectSingleNode("data/account");
                if (objNode == null)
                    return null;

                cafe.Grade = DataConvert.GetInt32(objNode.SelectSingleNode("grade/item/grade").InnerText);
                cafe.GradeLabel = objNode.SelectSingleNode("grade/item/label").InnerText;
                cafe.Name = objNode.SelectSingleNode("real_name").InnerText;
                cafe.Cash = DataConvert.GetInt64(objNode.SelectSingleNode("cash").InnerText);
                cafe.GoldNum = DataConvert.GetInt32(objNode.SelectSingleNode("goldnum").InnerText);
                cafe.Evalue = DataConvert.GetInt32(objNode.SelectSingleNode("evalue").InnerText);

                objNode = objXmlDoc.SelectSingleNode("data/cafe");
                if (objNode == null)
                    return null;
                cafe.CafeName = objNode.SelectSingleNode("cafename").InnerText;
                cafe.CafeId = DataConvert.GetInt32(objNode.SelectSingleNode("cafeid").InnerText);

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

                Collection<CookingInfo> cookings = new Collection<CookingInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        CookingInfo cooking = new CookingInfo();
                        cooking.OrderId = DataConvert.GetInt32(dv.Table.Rows[ix]["orderid"]);
                        if (dv.Table.Columns.Contains("stage"))
                            cooking.Stage = DataConvert.GetInt32(dv.Table.Rows[ix]["stage"]);
                        else
                            cooking.Stage = -98;
                        if (dv.Table.Columns.Contains("stage") && cooking.Stage != -1)
                        {                            
                            cooking.DishId = DataConvert.GetInt32(dv.Table.Rows[ix]["dishid"]);
                            cooking.Name = DataConvert.GetString(dv.Table.Rows[ix]["name"]);
                            cooking.FoodNum = DataConvert.GetInt32(dv.Table.Rows[ix]["foodnum"]);
                            cooking.Step = DataConvert.GetInt32(dv.Table.Rows[ix]["step"]);
                            cooking.Resver = DataConvert.GetInt32(dv.Table.Rows[ix]["resver"]);
                        }
                        cookings.Add(cooking);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetCafe(Get CookingInfo)", strxml, ex, LogSeverity.Warn);
                        continue;
                    }
                }
                cafe.Cookings = cookings;

                //Employees
                //dv = GetData(objXmlDoc, "data/employees");

                //Collection<EmployeeInfo> employees = new Collection<EmployeeInfo>();

                //for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                //{
                //    try
                //    {
                //        EmployeeInfo employee = new EmployeeInfo();
                //        employee.UId = DataConvert.GetInt32(dv.Table.Rows[ix]["uid"]);
                //        employee.Name = DataConvert.GetString(dv.Table.Rows[ix]["real_name"]);
                //        employees.Add(employee);
                //    }
                //    catch (Exception ex)
                //    {
                //        LogHelper.Write("ConfigCtrl.GetCafe(Get EmployeeInfo)", strxml, ex, LogSeverity.Error);
                //        continue;
                //    }
                //}
                //cafe.Employees = employees;
                XmlNodeList nodes = objXmlDoc.SelectNodes("data/employees/item");
                Collection<FriendInfo> employees = new Collection<FriendInfo>();

                foreach (XmlNode node in nodes)
                {
                    try
                    {
                        FriendInfo employee = new FriendInfo();
                        employee.Id = DataConvert.GetInt32(node.SelectSingleNode("uid").InnerText);
                        employee.Name = node.SelectSingleNode("real_name").InnerText;
                        employees.Add(employee);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetCafe(Get EmployeeInfo)", strxml, ex, LogSeverity.Error);
                        continue;
                    }
                }
                cafe.Employees = employees;
                

                //Foods
                dv = GetData(objXmlDoc, "data/dish");

                Collection<DinnerTableInfo> dinnertables = new Collection<DinnerTableInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        DinnerTableInfo dinnertable = new DinnerTableInfo();
                        dinnertable.OrderId = DataConvert.GetInt64(dv.Table.Rows[ix]["orderid"]);
                        if (dv.Table.Columns.Contains("name"))
                            dinnertable.Name = DataConvert.GetString(dv.Table.Rows[ix]["name"]);
                        if (dv.Table.Columns.Contains("foodnum"))
                            dinnertable.FoodNum = DataConvert.GetInt32(dv.Table.Rows[ix]["foodnum"]);
                        if (dv.Table.Columns.Contains("dishid"))
                            dinnertable.DishId = DataConvert.GetInt32(dv.Table.Rows[ix]["dishid"]);
                        if (dv.Table.Columns.Contains("num"))
                            dinnertable.Num = DataConvert.GetInt32(dv.Table.Rows[ix]["num"]);
                        if (dv.Table.Columns.Contains("resver"))
                            dinnertable.Resver = DataConvert.GetInt32(dv.Table.Rows[ix]["resver"]);
                        dinnertables.Add(dinnertable);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.Write("ConfigCtrl.GetCafe(Get DishInfo)", strxml, ex, LogSeverity.Warn);
                        continue;
                    }
                }
                cafe.DinnerTables = dinnertables;

                //equipments
                dv = GetData(objXmlDoc, "data/equipments");
                if (dv.Table.Rows.Count > 0)
                {
                    string tkey = "";
                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        try
                        {
                            tkey = DataConvert.GetString(dv.Table.Rows[ix]["tkey"]);
                            if (tkey == "autochef")
                                cafe.Chef = true;
                        }
                        catch (Exception ex)
                        {
                            LogHelper.Write("ConfigCtrl.GetCafe(Get DishInfo)", strxml, ex, LogSeverity.Warn);
                            continue;
                        }
                    }
                }
                return cafe;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetCafe", strxml, ex, LogSeverity.Error);
                return null;
            }
        }
Exemple #21
0
        public static Collection<FriendInfo> GetEmptyEmployees(string content)
        {
            try
            {
                if (String.IsNullOrEmpty(content))
                    return new Collection<FriendInfo>();

                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(content);

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

                Collection<FriendInfo> employees = new Collection<FriendInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    FriendInfo employee = new FriendInfo();
                    employee.Id = DataConvert.GetInt32(dv.Table.Rows[ix]["fuid"]);
                    employee.Name = DataConvert.GetString(dv.Table.Rows[ix]["real_name"]);
                    employee.Power = DataConvert.GetInt32(dv.Table.Rows[ix]["power"]);
                    employees.Add(employee);
                }

                return employees;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetEmptyEmployees", content, ex, LogSeverity.Error);
                return null;
            }
        }
Exemple #22
0
        private void HelpTheRanch(string fuid, FriendInfo friend, bool helpaddwater, bool helpaddgrass, bool helpaddcarrot, bool helpaddbamboo)
        {
            try
            {
                string content = RequestRanch(fuid);
                string verifyCode = JsonHelper.GetMid(content, "g_verify = \"", "\"");

                RanchInfo ranch = ReadRanch(verifyCode, fuid, true);
                if (ranch == null)
                {
                    SetMessage("无法读取牧场信息,跳过");
                }
                if (friend != null)
                {
                    if (helpaddwater && friend.RanchWater)
                        AddWater(fuid, ranch);
                    if (helpaddgrass && friend.RanchFood)
                        AddGrass(fuid, ranch);
                    if (helpaddcarrot && friend.RanchFood)
                        AddCarrot(fuid, ranch);
                    if (helpaddbamboo && friend.RanchFood)
                        AddBamboo(fuid, ranch);
                }
                else
                {
                    if (helpaddwater)
                        AddWater(fuid, ranch);
                    if (helpaddgrass)
                        AddGrass(fuid, ranch);
                    if (helpaddcarrot)
                        AddCarrot(fuid, ranch);
                    if (helpaddbamboo)
                        AddBamboo(fuid, ranch);
                }


                //_hasNothingTobeHelpedList.Add(DataConvert.GetInt32(fuid));
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameRanch.HelpTheRanch", ex, LogSeverity.Error);
                SetMessage(" 去" + GetFriendNameById(fuid) + "的牧场帮忙失败!错误:" + ex.Message);
            }
        }
Exemple #23
0
        public void ReadAllMyFriends(string content, bool printMessage)
        {
            if (printMessage)
                SetMessageLn("读取我的所有朋友信息...");

            this._allMyFriendsList.Clear();

            //我的所有好友
            JsonTextParser parser = new JsonTextParser();
            JsonArrayCollection arrayAllMyFriends = parser.Parse(content) as JsonArrayCollection;
            foreach (JsonObjectCollection item in arrayAllMyFriends)
            {
                FriendInfo friend = new FriendInfo();
                friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                this._allMyFriendsList.Add(friend);
                if (printMessage)
                    SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
            }

            if (printMessage)
                SetMessageLn(string.Format("您有{0}个朋友", new object[] { this._allMyFriendsList.Count }));
        }
Exemple #24
0
        public void ReadAgriculturalProductFriends(string content, bool printMessage)
        {
            try
            {
                if (printMessage)
                    SetMessageLn("读取[牧场中有成熟农副产品的好友]信息...");

                //[{"uid":11860509,"real_name":"\u5f90\u5723\u541b","icon20":"http:\/\/pic1.kaixin001.com\/logo\/86\/5\/20_11860509_1.jpg","harvest":1,"food":1},{"uid":1504367,"real_name":"\u4f59\u661f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/50\/43\/20_1504367_20.jpg","harvest":1,"food":1},{"uid":18643363,"real_name":"\u595a\u51e4(\u6021\u6021)","icon20":"http:\/\/pic1.kaixin001.com\/logo\/64\/33\/20_18643363_1.jpg","harvest":1,"food":1},{"uid":32263316,"real_name":"\u5f90\u6daf\u7433","icon20":"http:\/\/pic.kaixin001.com\/logo\/26\/33\/20_32263316_15.jpg","harvest":1,"product":1,"food":1},{"uid":4026057,"real_name":"\u8521\u632f\u534e","icon20":"http:\/\/pic1.kaixin001.com\/logo\/2\/60\/20_4026057_2.jpg","harvest":1},{"uid":4179925,"real_name":"\u51b7\u8840","icon20":"http:\/\/pic1.kaixin001.com\/logo\/17\/99\/20_4179925_1.jpg","harvest":1,"food":1},{"uid":4789786,"real_name":"\u5b5f\u519b\u534e","icon20":"http:\/\/pic.kaixin001.com\/logo\/78\/97\/20_4789786_2.jpg","harvest":1},{"uid":27618660,"real_name":"\u9ad8\u4ebf\u658c","icon20":"http:\/\/pic.kaixin001.com\/logo\/61\/86\/20_27618660_3.jpg","product":1},{"uid":4121752,"real_name":"\u5f90\u4e3d\u82ac","icon20":"http:\/\/pic.kaixin001.com\/logo\/12\/17\/20_4121752_1.jpg","product":1},{"uid":4343401,"real_name":"\u9648\u9e4f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/34\/34\/20_4343401_5.jpg","product":1},{"uid":4570613,"real_name":"\u6f58\u534e","icon20":"http:\/\/pic1.kaixin001.com\/logo\/57\/6\/20_4570613_6.jpg","product":1},{"uid":10151052,"real_name":"\u5b59\u6b63\u82b3","icon20":"http:\/\/pic.kaixin001.com\/logo\/15\/10\/20_10151052_1.jpg","food":1,"water":1},{"uid":10368525,"real_name":"\u502a\u4f1f\u534e","icon20":"http:\/\/pic1.kaixin001.com\/logo\/36\/85\/20_10368525_1.jpg","food":1},{"uid":1560381,"real_name":"\u848b\u745b","icon20":"http:\/\/pic1.kaixin001.com\/logo\/56\/3\/20_1560381_4.jpg","food":1},{"uid":18601260,"real_name":"\u6731\u5e7f\u7530","icon20":"http:\/\/pic.kaixin001.com\/logo\/60\/12\/20_18601260_2.jpg","food":1},{"uid":1922571,"real_name":"\u4f40\u95ef","icon20":"http:\/\/pic1.kaixin001.com\/logo\/92\/25\/20_1922571_5.jpg","food":1},{"uid":1991973,"real_name":"\u5de2\u5a67","icon20":"http:\/\/pic1.kaixin001.com\/logo\/99\/19\/20_1991973_2.jpg","food":1},{"uid":2119333,"real_name":"\u4faf\u9e23","icon20":"http:\/\/pic1.kaixin001.com\/logo\/11\/93\/20_2119333_4.jpg","food":1},{"uid":2511621,"real_name":"\u4e07\u6d69","icon20":"http:\/\/pic1.kaixin001.com\/logo\/51\/16\/20_2511621_5.jpg","food":1},{"uid":26366307,"real_name":"\u6731\u4f1f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/36\/63\/20_26366307_2.jpg","food":1},{"uid":2865629,"real_name":"\u7ae5\u610f\u5fe0(@)","icon20":"http:\/\/pic1.kaixin001.com\/logo\/86\/56\/20_2865629_21.jpg","food":1},{"uid":28860603,"real_name":"\u9648\u5609\u59ae","icon20":"http:\/\/pic1.kaixin001.com\/logo\/86\/6\/20_28860603_6.jpg","food":1,"fee":1},{"uid":3342217,"real_name":"\u5468\u4e3d","icon20":"http:\/\/pic1.kaixin001.com\/logo\/34\/22\/20_3342217_71.jpg","food":1},{"uid":362564,"real_name":"\u9648\u52bc","icon20":"http:\/\/pic.kaixin001.com\/logo\/36\/25\/20_362564_22.jpg","food":1},{"uid":3653622,"real_name":"\u9ec4\u6587\u7fa4","icon20":"http:\/\/pic.kaixin001.com\/logo\/65\/36\/20_3653622_12.jpg","food":1},{"uid":3754193,"real_name":"\u502a\u519b","icon20":"http:\/\/pic1.kaixin001.com\/logo\/75\/41\/20_3754193_9.jpg","food":1},{"uid":5505715,"real_name":"\u77bf\u535a","icon20":"http:\/\/pic1.kaixin001.com\/logo\/50\/57\/20_5505715_1.jpg","food":1},{"uid":6106453,"real_name":"\u6c5f\u950b","icon20":"http:\/\/pic1.kaixin001.com\/logo\/10\/64\/20_6106453_1.jpg","food":1},{"uid":6265093,"real_name":"\u987e\u73fa\u96ef","icon20":"http:\/\/pic1.kaixin001.com\/logo\/26\/50\/20_6265093_3.jpg","food":1},{"uid":6320371,"real_name":"\u5f20\u79e6\u8273","icon20":"http:\/\/pic1.kaixin001.com\/logo\/32\/3\/20_6320371_5.jpg","food":1},{"uid":6888001,"real_name":"\u66f9\u6e0a","icon20":"http:\/\/pic1.kaixin001.com\/logo\/88\/80\/20_6888001_1.jpg","food":1,"water":1},{"uid":7744681,"real_name":"\u6587\u6653\u6653","icon20":"http:\/\/pic1.kaixin001.com\/logo\/74\/46\/20_7744681_2.jpg","food":1},{"uid":8063649,"real_name":"\u675c\u6ce2","icon20":"http:\/\/pic1.kaixin001.com\/logo\/6\/36\/20_8063649_15.jpg","food":1},{"uid":9637731,"real_name":"\u66f9\u840d","icon20":"http:\/\/pic1.kaixin001.com\/logo\/63\/77\/20_9637731_2.jpg","food":1},{"uid":1283947,"real_name":"\u6797\u8054\u5bf9","icon20":"http:\/\/pic1.kaixin001.com\/logo\/28\/39\/20_1283947_2.jpg","water":1},{"uid":1581208,"real_name":"\u7fc1\u5c11\u534e","icon20":"http:\/\/pic.kaixin001.com\/logo\/58\/12\/20_1581208_4.jpg","water":1},{"uid":1703568,"real_name":"\u5510\u8c6a\u5ddd","icon20":"http:\/\/pic.kaixin001.com\/logo\/70\/35\/20_1703568_6.jpg","water":1},{"uid":1945978,"real_name":"\u9648\u5b66\u8d85","icon20":"http:\/\/pic.kaixin001.com\/logo\/94\/59\/20_1945978_7.jpg","water":1},{"uid":2125264,"real_name":"\u66f9\u548f\u840d","icon20":"http:\/\/pic.kaixin001.com\/logo\/12\/52\/20_2125264_6.jpg","water":1},{"uid":2596914,"real_name":"\u5510\u5ddd\u519b","icon20":"http:\/\/pic.kaixin001.com\/logo\/59\/69\/20_2596914_1.jpg","water":1},{"uid":3223271,"real_name":"\u53f2\u53f2","icon20":"http:\/\/pic1.kaixin001.com\/logo\/22\/32\/20_3223271_2.jpg","water":1},{"uid":3644956,"real_name":"\u6c88\u71d5\u9752","icon20":"http:\/\/pic.kaixin001.com\/logo\/64\/49\/20_3644956_2.jpg","water":1},{"uid":3933628,"real_name":"\u5468\u654f","icon20":"http:\/\/pic.kaixin001.com\/logo\/93\/36\/20_3933628_1.jpg","water":1},{"uid":3986105,"real_name":"\u6c88\u84d3\u6654","icon20":"http:\/\/pic1.kaixin001.com\/logo\/98\/61\/20_3986105_1.jpg","water":1},{"uid":4114760,"real_name":"\u6768\u6770","icon20":"http:\/\/pic.kaixin001.com\/logo\/11\/47\/20_4114760_3.jpg","water":1},{"uid":5010598,"real_name":"\u7f2a\u5357","icon20":"http:\/\/pic.kaixin001.com\/logo\/1\/5\/20_5010598_2.jpg","water":1},{"uid":5969055,"real_name":"\u534e\u654f\u5cf0","icon20":"http:\/\/pic1.kaixin001.com\/logo\/96\/90\/20_5969055_7.jpg","water":1},{"uid":779907,"real_name":"\u9a6c\u749f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/77\/99\/20_779907_1.jpg","water":1},{"uid":9414220,"real_name":"\u738b\u4eae","icon20":"http:\/\/pic.kaixin001.com\/logo\/41\/42\/20_9414220_15.jpg","water":1}]
                JsonTextParser parser = new JsonTextParser();
                JsonArrayCollection arraySharedFriends = parser.Parse(content) as JsonArrayCollection;
                if (arraySharedFriends != null)
                {
                    if (printMessage)
                        SetMessageLn("可以生产的牧场:");
                    foreach (JsonObjectCollection item in arraySharedFriends)
                    {
                        FriendInfo friend = new FriendInfo();
                        friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                        friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                        friend.RanchHarvest = item["harvest"] != null ? true : false;
                        friend.RanchFood = item["food"] != null ? true : false;
                        friend.RanchProduct = item["product"] != null ? true : false;
                        friend.RanchWater = item["water"] != null ? true : false;
                        this._ranchFriendsList.Add(friend);
                        if (printMessage)
                            SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                    }
                }                
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameRanch.ReadAgriculturalProductFriends", content, ex, LogSeverity.Error);
                SetMessage(" 读取[牧场中有成熟农副产品的好友]信息失败!" + ex.Message);
            }
        }
Exemple #25
0
        public void ReadAllHouseFriends(string content, bool printMessage)
        {
            int num;
            this._allHouseFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[所有买房子的好友]信息:");
            //<div class="l" style="width:8em;"><a href="javascript:gotoUser(6194153);" class="sl">庄子</a></div>
            string content2 = content;
            for (string pos = JsonHelper.GetMid(content, "<div class=\"l\" style=\"width:8em;\">", "</div>", out num); pos != null; pos = JsonHelper.GetMid(content, "<div class=\"l\" style=\"width:8em;\">", "</div>", out num))
            {
                FriendInfo friend = new FriendInfo();
                friend.Id = JsonHelper.GetMidInteger(content, "<a href=\"javascript:gotoUser(", ");\"");
                friend.Name = JsonHelper.GetMid(content, "class=\"sl\">", "</a>");
                this._allHouseFriendsList.Add(friend);
                if (printMessage)
                    SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")");
                content = content.Substring(num);
            }
            
            int ix = 0;
            for (string pos = JsonHelper.GetMid(content2, "<input type=hidden id=gender_", ">", out num); pos != null; pos = JsonHelper.GetMid(content2, "<input type=hidden id=gender_", ">", out num))
            {
                if (pos.IndexOf("value=\"1\"") > -1)
                {
                    this._allHouseFriendsList[ix].Gender = false;
                }
                else if (pos.IndexOf("value=\"0\"") > -1)
                {
                    this._allHouseFriendsList[ix].Gender = true;
                }
                else
                {
                    break;
                }

                if (printMessage)
                    SetMessageLn(this._allHouseFriendsList[ix].Name + "(" + this._allHouseFriendsList[ix].Id.ToString() + ")--" + (this._allHouseFriendsList[ix].Gender ? "男" : "女"));
                ix++;
                content2 = content2.Substring(num);
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
 protected override string[] BuildListView(FriendInfo user)
 {
     string[] subItem = new string[3];
     subItem[0] = user.Name;
     subItem[1] = user.Id.ToString();
     subItem[2] = user.Online ? "是" : "否";
     return subItem;
 }
Exemple #27
0
        private bool BuyTheSlave(int slaveuid)
        {
            if (Operation.BuyBlackList.Contains(slaveuid))
            {
                SetMessage("#" + GetFriendNameById(slaveuid) + ",不购买黑名单里的奴隶 ");
                return false;
            }
            string slaveNick = Task.NickName;
            if (slaveNick == null)
            {
                slaveNick = string.Empty;
            }
            else
            {
                slaveNick = DataConvert.GetEncodeData(slaveNick);
            }

            //get slave info   
            HH.DelayedTime = Constants.DELAY_2SECONDS;
            string content = HH.Get(string.Format("http://www.kaixin001.com/slave/buy_dialog.php?slaveuid={0}&verify={1}", slaveuid, this._verifyCode));
            if (!GetBuySlaveFeedback(content))
                return false;

            //current price
            int slaveprice = JsonHelper.GetInteger(JsonHelper.GetMid(content, "你想花 <strong class=\"dgreen\">&yen;", "</strong> 的价格购买"));

            //request for buying            
            string param = "verify=" + this._verifyCode + "&slaveuid=" + slaveuid + "&nick=" + slaveNick + "&acc=" + GetAccCode(content);
            HH.DelayedTime = Constants.DELAY_2SECONDS;
            content = HH.Post("http://www.kaixin001.com/slave/buy.php", param);
            if (!GetBuySlaveFeedback(content))
                return false;

            if (this.GetFeedback(content))
            {
                FriendInfo slave = new FriendInfo();
                slave.Id = Convert.ToInt32(slaveuid);
                slave.Name = JsonHelper.GetMid(content, "<span class=\"sl\">", "<");
                if (slave.Name == null)
                {
                    slave.Name = string.Empty;
                }
                slave.Gender = JsonHelper.GetMid(content, "<br />同时,", "的") == "他" ? true : false;
                slave.Price = JsonHelper.GetInteger(JsonHelper.GetMid(content, "&yen;", "<"));
                this._mySlaveList.Add(slave);
                this._slavecash -= slaveprice;
                return true;
            }
            else
            {
                return false;
            }
        }
 protected override string[] BuildListView(FriendInfo user)
 {
     string[] subItem = new string[3];
     subItem[0] = user.Name;
     subItem[1] = user.Id.ToString();
     if (user.Price > 0)
         subItem[2] = user.Price.ToString();
     else
         subItem[2] = "";           
     return subItem;
 }
Exemple #29
0
        public void ReadBuyableSlaves(string content, bool printMessage)
        {
            int num;
            this._buyableSlaveList.Clear();

            if (printMessage)
                SetMessageLn("读取[我能买的奴隶]信息:");
            for (string pos = JsonHelper.GetMid(content, "javascript:parent.gotouser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:parent.gotouser(", ")", out num))
            {
                content = content.Substring(num);
                int id = JsonHelper.GetInteger(pos);
                if (id > 0)
                {
                    FriendInfo friend = new FriendInfo();
                    friend.Id = id;
                    friend.Name = JsonHelper.GetMid(content, "<strong>", "</strong></a>");
                    string price = JsonHelper.GetMid(content, "10em;\">(价格:¥", ")</div>");
                    if ((price != null) && price.Trim() != string.Empty)
                        friend.Price = JsonHelper.GetInteger(price);
                    this._buyableSlaveList.Add(friend);
                    if (printMessage)
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--价格:¥" + friend.Price);
                }
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #30
0
        public void ReadRestableFriends(string content, bool printMessage)
        {
            int num;
            this._restableFriendsList.Clear();

            if (printMessage)
                SetMessageLn("读取[我能休息的房间]信息:");
            for (string pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num); pos != null; pos = JsonHelper.GetMid(content, "javascript:gotoUser(", ")", out num))
            {
                content = content.Substring(num);
                int uid = JsonHelper.GetInteger(pos);
                if (uid > 0)
                {
                    string name = JsonHelper.GetMid(content, "\">", "</a>");
                    FriendInfo friend = new FriendInfo();
                    friend.Id = uid;
                    friend.Name = name;
                    string status = JsonHelper.GetMid(content, "\"width:1em;\">", "</div>");
                    if ((status != null) && status.Trim() != string.Empty)
                        friend.Status = "在线";
                    else
                        friend.Status = "离线";
                    this._restableFriendsList.Add(friend);
                    if (printMessage)
                        SetMessageLn(friend.Name + "(" + friend.Id.ToString() + ")--" + friend.Status);
                }
            }
            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #31
0
        public void ReadHirableFriends(CafeInfo cafe, bool printMessage)
        {
            if (printMessage)
                SetMessage("读取可以雇佣的好友信息...");
            this._hirableFriendsList.Clear();
            string content = HH.Get(string.Format("http://www.kaixin001.com/cafe/api_notemployees.php?verify={0}&cafeid={1}&start=0&text=&rand=0.7530548870563507", DataConvert.GetEncodeData(this._verifyCode), cafe.CafeId));
            this._hirableFriendsList = ConfigCtrl.GetEmptyEmployees(content);
            if (this._hirableFriendsList == null || this._hirableFriendsList.Count == 0)
                return;
            int totalcount = JsonHelper.GetMidInteger(content, "<data><total>", "</total>");
            int offset = JsonHelper.GetMidInteger(content, "</start><num>", "</num>");
            int page = offset;
            do
            {
                HH.DelayedTime = Constants.DELAY_1SECONDS;
                content = HH.Get(string.Format("http://www.kaixin001.com/cafe/api_notemployees.php?verify={0}&cafeid={1}&start={2}&text=&rand=0.7530548870563507", DataConvert.GetEncodeData(this._verifyCode), cafe.CafeId, page));
                Collection<FriendInfo> employees = new Collection<FriendInfo>();
                employees = ConfigCtrl.GetEmptyEmployees(content);
                if (employees == null || employees.Count == 0)
                    break;
                else
                {
                    foreach (FriendInfo item in employees)
                    {
                        FriendInfo employee = new FriendInfo();
                        employee.Clone(item);
                        this._hirableFriendsList.Add(employee);
                    }
                    page += offset;
                }
            }
            while (true);
            this._hirableFriendsList = SortEmployeeByPower(this._hirableFriendsList);
            if (printMessage)
            {
                foreach (FriendInfo friend in this._hirableFriendsList)
                {
                    SetMessageLn(friend.Name + "(" + friend.Power.ToString() + ")");
                }
            }

            if (printMessage)
                SetMessageLn("完成读取!");
        }
Exemple #32
0
        public void ReadMatureFriends(string content, bool printMessage)
        {
            try
            {
                if (printMessage)
                    SetMessageLn("读取[花园中有成熟果实的好友]信息...");

                //this._mySharedFriendsList.Clear();
                //this._matureFriendsList.Clear();
                this._myGardenFriendsList.Clear();
               
                //[{"uid":"10752908","real_name":"\u5173\u4ec1","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","share":1},{"uid":"10752309","real_name":"\u5b8b\u6c5f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/75\/23\/20_10752309_1.jpg","share":1},{"uid":10752657,"real_name":"\u6b66\u5c0f\u6d6a","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","harvest":1},{"uid":10755959,"real_name":"\u5218\u6210\u540d","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_1_0.gif","harvest":1}]
                //[{"uid":"5629041","real_name":"\u5f20\u52e4","icon20":"http:\/\/pic1.kaixin001.com\/logo\/62\/90\/20_5629041_5.jpg","share":1},{"uid":13285985,"real_name":"\u66f9\u519b","icon20":"http:\/\/pic1.kaixin001.com\/logo\/28\/59\/20_13285985_23.jpg","harvest":1},{"uid":2176837,"real_name":"\u9676\u51b6\uff08\u82b1\u843d\u65e0\u98ce\uff09","icon20":"http:\/\/pic1.kaixin001.com\/logo\/17\/68\/20_2176837_2.jpg","harvest":1},{"uid":2287096,"real_name":"\u5510\u6167","icon20":"http:\/\/pic.kaixin001.com\/logo\/28\/70\/20_2287096_1.jpg","harvest":1,"antiharvest":1},{"uid":2395406,"real_name":"\u6731\u8273\u96ef","icon20":"http:\/\/pic.kaixin001.com\/logo\/39\/54\/20_2395406_3.jpg","harvest":1,"fee":1},{"uid":27353139,"real_name":"\u9648\u6b63\u4e1c","icon20":"http:\/\/pic1.kaixin001.com\/logo\/35\/31\/20_27353139_1.jpg","harvest":1},{"uid":2803054,"real_name":"\u8f66\u79be\u5409","icon20":"http:\/\/pic.kaixin001.com\/logo\/80\/30\/20_2803054_1.jpg","harvest":1},{"uid":3125472,"real_name":"\u738b\u535a\u667a","icon20":"http:\/\/pic.kaixin001.com\/logo\/12\/54\/20_3125472_9.jpg","harvest":1},{"uid":3172993,"real_name":"\u5f90\u632f\u4e9a","icon20":"http:\/\/pic1.kaixin001.com\/logo\/17\/29\/20_3172993_2.jpg","harvest":1},{"uid":330818,"real_name":"\u8881\u4f73\u534e","icon20":"http:\/\/pic.kaixin001.com\/logo\/33\/8\/20_330818_22.jpg","harvest":1},{"uid":3352378,"real_name":"\u5f90\u9e4f\u52c7","icon20":"http:\/\/pic.kaixin001.com\/logo\/35\/23\/20_3352378_2.jpg","harvest":1},{"uid":35926680,"real_name":"\u65bd\u6625\u534e","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","harvest":1},{"uid":3612627,"real_name":"\u5468\u6797","icon20":"http:\/\/pic1.kaixin001.com\/logo\/61\/26\/20_3612627_4.jpg","harvest":1},{"uid":4026057,"real_name":"\u8521\u632f\u534e","icon20":"http:\/\/pic1.kaixin001.com\/logo\/2\/60\/20_4026057_2.jpg","harvest":1},{"uid":4343401,"real_name":"\u9648\u9e4f","icon20":"http:\/\/pic1.kaixin001.com\/logo\/34\/34\/20_4343401_5.jpg","harvest":1},{"uid":5350880,"real_name":"\u5434\u6653\u6e05","icon20":"http:\/\/pic.kaixin001.com\/logo\/35\/8\/20_5350880_1.jpg","harvest":1},{"uid":6265093,"real_name":"\u987e\u73fa\u96ef","icon20":"http:\/\/pic1.kaixin001.com\/logo\/26\/50\/20_6265093_3.jpg","harvest":1},{"uid":7969758,"real_name":"\u9ad8\u5927\u519b","icon20":"http:\/\/pic.kaixin001.com\/logo\/96\/97\/20_7969758_8.jpg","harvest":1},{"uid":8288802,"real_name":"\u738b\u5ca9","icon20":"http:\/\/pic.kaixin001.com\/logo\/28\/88\/20_8288802_8.jpg","harvest":1},{"uid":9637731,"real_name":"\u66f9\u840d","icon20":"http:\/\/pic1.kaixin001.com\/logo\/63\/77\/20_9637731_2.jpg","harvest":1}]
                //[{"uid":"6752990","real_name":"\u5434\u5b50\u725b","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","share":1},{"uid":"6752812","real_name":"\u6c88\u81f4\u51b0","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","share":1},{"uid":"6904295","real_name":"\u5218\u7684\u8bdd","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","share":1},{"uid":"6903449","real_name":"\u9676\u5b9d","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_1_0.gif","share":1},{"uid":6194153,"real_name":"\u5e84\u5b50","icon20":"http:\/\/pic1.kaixin001.com\/logo\/19\/41\/20_6194153_1.jpg","harvest":1},{"uid":6733320,"real_name":"\u9676\u9187","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","harvest":1,"grass":1},{"uid":6209710,"real_name":"\u9648\u5fd7","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","grass":1},{"uid":6985380,"real_name":"\u9648\u89c2\u897f","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","grass":1},{"uid":7995480,"real_name":"\u9648\u6c5f\u94f8","icon20":"http:\/\/img.kaixin001.com.cn\/i\/20_0_0.gif","grass":1}]
                JsonTextParser parser = new JsonTextParser();
                JsonArrayCollection arraySharedFriends = parser.Parse(content) as JsonArrayCollection;
                if (arraySharedFriends != null)
                {                   
                    foreach (JsonObjectCollection item in arraySharedFriends)
                    {
                        FriendInfo friend = new FriendInfo();
                        friend.Id = JsonHelper.GetIntegerValue(item["uid"]);
                        friend.Name = JsonHelper.GetStringValue(item["real_name"]);
                        friend.GardenShare = item["share"] != null ? true : false;
                        friend.GardenHarvest = item["harvest"] != null ? true : false;
                        friend.GardenFee = item["fee"] != null ? true : false;
                        friend.GardenGrass = item["grass"] != null ? true : false;
                        friend.GardenVermin = item["vermin"] != null ? true : false;
                        this._myGardenFriendsList.Add(friend);
                        //if (friend.GardenShare)
                        //    this._mySharedFriendsList.Add(friend);
                        //if (friend.GardenHarvest)
                        //    this._matureFriendsList.Add(friend);
                    }
                }
            }
            catch (ThreadAbortException)
            {
                throw;
            }
            catch (ThreadInterruptedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                LogHelper.Write("GameGarden.ReadMatureFriends", content, ex, LogSeverity.Error);
                SetMessage(" 读取[花园中有成熟果实的好友]信息失败!" + ex.Message);
            }
        }
 protected override string[] BuildListView(FriendInfo user)
 {
     string[] subItem = new string[3];
     subItem[0] = user.Name;
     subItem[1] = user.Id.ToString();
     //subItem[2] = user.Gender ? "男" : "女";
     return subItem;
 }
Exemple #34
0
        public void ReadSlaves(string content, bool printMessage)
        {
            int num;
            this._mySlaveList.Clear();

            if (printMessage)
                SetMessageLn("读取奴隶列表:");
            for (string info = JsonHelper.GetMid(content, "<div class=\"w265 l c6\">", "\t\t\t </div>", out num); info != null; info = JsonHelper.GetMid(content, "<div class=\"w265 l c6\">", "\t\t\t </div>", out num))
            {
                content = content.Substring(num);

                FriendInfo slave = new FriendInfo();
                slave.Name = JsonHelper.GetMid(info, "class=\"sl2\">", "<");
                slave.Id = JsonHelper.GetInteger(JsonHelper.GetMid(info, "/home/?uid=", "'"));
                slave.Gender = JsonHelper.GetMid(info, "\">我要释放", "<") == "他" ? true : false;
                slave.Price = JsonHelper.GetInteger(JsonHelper.GetMid(info, "身 价:<strong class=\"dgreen\">&yen;", "<"));
                if ((slave.Name != null))
                {
                    this._mySlaveList.Add(slave);
                    if (printMessage)
                        SetMessageLn(slave.Name + "(" + slave.Id.ToString() + ")--" + slave.Price);
                }
            }
            this._slaveNum = this._mySlaveList.Count;
            if (printMessage)
                SetMessageLn(string.Format("您有{0}个奴隶", new object[] { this._slaveNum }));
        }