Esempio n. 1
0
 public TaskNode(TaskInfo tsk)
 {
     nodeType = NodeType.Task;
     Task = tsk;
     this.Text = tsk.TaskName;
     this.ImageIndex = DataConvert.GetInt32(IconType.Task);
     this.SelectedImageIndex = DataConvert.GetInt32(IconType.Task);
 }
Esempio n. 2
0
 private static bool IsExistTaskNode(XmlDocument xmldoc, TaskInfo task)
 {
     XmlNode objTasksNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);
     foreach (XmlNode xn in objTasksNode.ChildNodes)
     {
         if (xn.SelectSingleNode(Constants.TASK_TASKID).InnerText == task.TaskId)
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 3
0
 private static void DeleteTaskNode(XmlDocument xmldoc, TaskInfo task)
 {
     XmlNode objTasksNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);
     foreach (XmlNode xn in objTasksNode.ChildNodes)
     {
         if (xn.SelectSingleNode(Constants.TASK_TASKID).InnerText == task.TaskId)
         {
             objTasksNode.RemoveChild(xn);
             break;
         }
     }
 }
Esempio n. 4
0
 private static void EditTaskNode(XmlDocument xmldoc, TaskInfo task)
 {
     XmlNode objTasksNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);
     foreach (XmlNode xn in objTasksNode.ChildNodes)
     {
         if (xn.SelectSingleNode(Constants.TASK_TASKID).InnerText == task.TaskId)
         {
             xn.SelectSingleNode(Constants.TASK_TASKNAME).InnerText = task.TaskName;
             if (xn.SelectSingleNode(Constants.TASK_GROUPNAME) == null)
             {
                 XmlElement objGroupNameNode = xmldoc.CreateElement(Constants.TASK_GROUPNAME);
                 xn.AppendChild(objGroupNameNode);
             }
             xn.SelectSingleNode(Constants.TASK_GROUPNAME).InnerText = task.GroupName;
             break;
         }
     }
 }
Esempio n. 5
0
 private static void InsertTaskNode(XmlDocument xmldoc, TaskInfo task)
 {
     XmlNode objTasksNode = xmldoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);
     XmlElement objChildNode = xmldoc.CreateElement(Constants.TASK_TASK);
     objTasksNode.AppendChild(objChildNode);
     XmlElement emtTaskId = xmldoc.CreateElement(Constants.TASK_TASKID);
     emtTaskId.InnerText = task.TaskId;
     XmlElement emtTaskName = xmldoc.CreateElement(Constants.TASK_TASKNAME);
     emtTaskName.InnerText = task.TaskName;
     objChildNode.AppendChild(emtTaskId);
     objChildNode.AppendChild(emtTaskName);
 }
Esempio n. 6
0
        public static string DeleteTask(TaskInfo task)
        {
            try
            {
                XmlDocument objXmlDoc = GetAssistantConfigFile();
                if (objXmlDoc == null)
                    return "配置文件不存在!";

                DeleteTaskNode(objXmlDoc, task);

                SetAssistantConfigFile(objXmlDoc);

                //delete task file
                string folder = Path.Combine(Application.StartupPath, Constants.FOLDER_TASKS);
                string taskFile = folder + Constants.CHAR_DOUBLEBACKSLASH + task.TaskId + ".xml";
                File.Delete(taskFile);

                return Constants.STATUS_SUCCESS;
            }
            catch (Exception ex)
            {
                LogHelper.Write("删除任务" + task.TaskName, ex);
                return Constants.STATUS_FAIL;
            }
        }
Esempio n. 7
0
        public static string EditTask(TaskInfo task)
        {
            try
            {
                XmlDocument objXmlDoc = GetAssistantConfigFile();
                if (objXmlDoc == null)
                    return "配置文件不存在!";

                if (task.TaskId == null || task.TaskId == string.Empty)
                {
                    Random rd = new Random();
                    int num = rd.Next(1, 999999999);
                    DateTime now = DateTime.Now; //获取系统时间   
                    string taskId = now.Year.ToString() + now.Month.ToString() + now.Day.ToString() + now.Hour.ToString() + now.Minute.ToString() + now.Second.ToString() + now.Millisecond.ToString() + "_" + num.ToString();

                    task.TaskId = taskId;
                    InsertTaskNode(objXmlDoc, task);
                }
                else
                {
                    EditTaskNode(objXmlDoc, task);
                }

                bool ret = SetAssistantConfigFile(objXmlDoc);
                if (ret)
                    return Constants.STATUS_SUCCESS;
                else
                    return Constants.STATUS_FAIL;
            }
            catch (Exception ex)
            {
                LogHelper.Write("编辑任务" + task.TaskName, ex);
                return Constants.STATUS_FAIL;
            }
        }
Esempio n. 8
0
 public void ShowTaskEditor(TaskInfo task)
 {
     FrmTaskEditor frmtaskeditor = new FrmTaskEditor();
     frmtaskeditor.TaskId = task.TaskId;
     frmtaskeditor.TaskName = task.TaskName;
     frmtaskeditor.GroupName = task.GroupName;
     frmtaskeditor.Text = task.TaskName;
     frmtaskeditor.taskSaved += new FrmTaskEditor.TaskSavedEventHandler(frmtaskeditor_taskSaved);
     if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
     {
         frmtaskeditor.MdiParent = this;
         frmtaskeditor.Show();
     }
     else
     {
         foreach (IDockContent content in dockPanel.Documents)
         {
             FrmTaskEditor form = content as FrmTaskEditor;
             if (form != null && form.TaskId == task.TaskId)
             {
                 content.DockHandler.Show();
                 return;
             }
         }
         frmtaskeditor.Show(dockPanel);
     }
 }
Esempio n. 9
0
        public static Collection<TaskInfo> GetSimpleTasks()
        {
            try
            {
                XmlDocument objXmlDoc = GetAssistantConfigFile();
                if (objXmlDoc == null)
                    return null;

                DataView dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);

                Collection<TaskInfo> tasks = new Collection<TaskInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    TaskInfo task = new TaskInfo();
                    task.TaskId = dv.Table.Rows[ix][0].ToString();
                    task.TaskName = dv.Table.Rows[ix][1].ToString();
                    if (dv.Table.Columns.Count > 2)
                        task.GroupName = dv.Table.Rows[ix][2].ToString();
                    else
                        task.GroupName = "";
                    tasks.Add(task);
                }

                return tasks;
            }
            catch (Exception ex)
            {
                LogHelper.Write("读取简单任务列表", ex);
                return null;
            }
        }
Esempio n. 10
0
        public static bool SetTask(string taskid, string taskname, TaskInfo taskitem)
        {
            try
            {
                if (taskid == null || taskid == string.Empty)
                    return false;

                XmlDocument objXmlDoc = GetTaskConfigFile(taskid, taskname);
                if (objXmlDoc == null)
                    return false;

                //root node
                XmlNode objTaskNode = objXmlDoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK);
                if (objTaskNode == null)
                    return false;

                XmlNode objNode;
                /*------------------------------ExecutingMode-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_EXECUTINGMODE);
                if (objNode != null)
                {
                    if (taskitem.RunMode == EnumRunMode.SingleLoop)
                        objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNMODE).InnerText = "SingleLoop";
                    else if (taskitem.RunMode == EnumRunMode.MultiLoop)
                        objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNMODE).InnerText = "MultiLoop";
                    else
                        objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNMODE).InnerText = "Timing";
                    XmlNode objRunInLoop = objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNINLOOP);
                    objRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_ROUNDTIME).InnerText = taskitem.RoundTime.ToString();
                    objRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDEN).InnerText = taskitem.Forbidden.ToString();
                    objRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENSTART).InnerText = taskitem.ForbiddenStart.Hour + ":" + taskitem.ForbiddenStart.Minute;
                    objRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENEND).InnerText = taskitem.ForbiddenEnd.Hour + ":" + taskitem.ForbiddenEnd.Minute;
                    //StartTimes
                    XmlNode objStartTimesNode = objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNINTIME + Constants.CHAR_SLASH + Constants.TASK_RUNINTIME_STARTTIMES);
                    if (objStartTimesNode == null)
                        return false;

                    objStartTimesNode.RemoveAll();
                    foreach (TimeInfo time in taskitem.StartTimes)
                    {
                        XmlElement objChildNode = objXmlDoc.CreateElement(Constants.TASK_RUNINTIME_DATETIME);
                        objChildNode.InnerText = time.Hour + ":" + time.Minute;
                        objStartTimesNode.AppendChild(objChildNode);
                    }
                }
                /*------------------------------ExecutingMode-----------------------------------*/

                /*------------------------------Park-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_PARK);
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_PARK_EXECUTEPARK).InnerText = taskitem.ExecutePark.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_PARKMYCARS).InnerText = taskitem.ParkMyCars.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_POSTOTHERSCARS).InnerText = taskitem.PostOthersCars.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_JOINMATCH).InnerText = taskitem.JoinMatch.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_ORIGINATEMATCH).InnerText = taskitem.OriginateMatch.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATEMATCHID, "1").InnerText = taskitem.OriginateMatchId.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATETEAMNUM, "2").InnerText = taskitem.OriginateTeamNum.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_STARTCAR).InnerText = taskitem.StartCar.ToString();
                    objNode.SelectSingleNode(Constants.TASK_PARK_CHEERUP).InnerText = taskitem.CheerUp.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_STARTCARTIME, "8:30").InnerText = taskitem.StartCarTime.Hour + ":" + taskitem.StartCarTime.Minute;
                }
                /*------------------------------Park-----------------------------------*/

                /*------------------------------Bite-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_BITE);
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_BITE_EXECUTEBITE).InnerText = taskitem.ExecuteBite.ToString();
                    objNode.SelectSingleNode(Constants.TASK_BITE_APPROVERECOVERY).InnerText = taskitem.ApproveRecovery.ToString();
                    objNode.SelectSingleNode(Constants.TASK_BITE_BITEOTHERS).InnerText = taskitem.BiteOthers.ToString();
                    objNode.SelectSingleNode(Constants.TASK_BITE_AUTORECOVER).InnerText = taskitem.AutoRecover.ToString();
                    if (objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND) == null)
                    {
                        XmlElement objChildNode = objXmlDoc.CreateElement(Constants.TASK_BITE_PROTECTFRIEND);
                        objNode.AppendChild(objChildNode);
                    }
                    objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND).InnerText = taskitem.ProtectFriend.ToString();
                }
                /*------------------------------Bite-----------------------------------*/

                /*------------------------------Slave-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_SLAVE);
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_EXECUTESLAVE).InnerText = taskitem.ExecuteSlave.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_MAXSLAVES).InnerText = taskitem.MaxSlaves.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_NICKNAME).InnerText = taskitem.NickName;
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYSLAVE).InnerText = taskitem.BuySlave.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYLOWPRICESLAVE).InnerText = taskitem.BuyLowPriceSlave.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_FAWNMASTER).InnerText = taskitem.FawnMaster.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_PROPITIATESLAVE).InnerText = taskitem.PropitiateSlave.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_AFFLICTSLAVE).InnerText = taskitem.AfflictSlave.ToString();
                    objNode.SelectSingleNode(Constants.TASK_SLAVE_RELEASESLAVE).InnerText = taskitem.ReleaseSlave.ToString();
                }
                /*------------------------------Slave-----------------------------------*/

                /*------------------------------House-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_HOUSE);
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_EXECUTEHOUSE).InnerText = taskitem.ExecuteHouse.ToString();
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_DOJOB).InnerText = taskitem.DoJob.ToString();
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_STAYHOUSE).InnerText = taskitem.StayHouse.ToString();
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFRIENDS).InnerText = taskitem.RobFriends.ToString();
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFREEFRIENDS).InnerText = taskitem.RobFreeFriends.ToString();
                    objNode.SelectSingleNode(Constants.TASK_HOUSE_DRIVEFRIENDS).InnerText = taskitem.DriveFriends.ToString();                    
                }
                /*------------------------------House-----------------------------------*/

                /*------------------------------Garden-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_GARDEN);                
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_EXECUTEGARDEN).InnerText = taskitem.ExecuteGarden.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSELF).InnerText = taskitem.FarmSelf.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSELF).InnerText = taskitem.ExpensiveFarmSelf.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSELF).InnerText = taskitem.CustomFarmSelf.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSHARED).InnerText = taskitem.FarmShared.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSHARED).InnerText = taskitem.ExpensiveFarmShared.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSHARED).InnerText = taskitem.CustomFarmShared.ToString();                    
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_HARVESTFRUIT).InnerText = taskitem.HarvestFruit.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEED).InnerText = taskitem.BuySeed.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEEDCOUNT).InnerText = taskitem.BuySeedCount.ToString();
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_HELPOTHERS).InnerText = taskitem.HelpOthers.ToString();                    
                    objNode.SelectSingleNode(Constants.TASK_GARDEN_STEALFRUIT).InnerText = taskitem.StealFruit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUIT, "False").InnerText = taskitem.PresentFruit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITBYPRICE, "True").InnerText = taskitem.PresentFruitByPrice.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKVALUE, "True").InnerText = taskitem.PresentFruitCheckValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITVALUE, "100").InnerText = taskitem.PresentFruitValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITID, "11").InnerText = taskitem.PresentFruitId.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKNUM, "True").InnerText = taskitem.PresentFruitCheckNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITNUM, "1000").InnerText = taskitem.PresentFruitNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFRUIT, "True").InnerText = taskitem.SellFruit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASH, "True").InnerText = taskitem.LowCash.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASHLIMIT, "100").InnerText = taskitem.LowCashLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLALLFRUIT, "False").InnerText = taskitem.SellAllFruit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_MAXSELLLIMIT, "300").InnerText = taskitem.MaxSellLimit.ToString();
                    XmlNode objSellFobiddenFruitsNode = GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFORBIDDENNFRUITSLIST, ""); ;
                    if (objSellFobiddenFruitsNode == null)
                        return false;
                    objSellFobiddenFruitsNode.RemoveAll();
                    foreach (int fruitid in taskitem.SellForbiddennFruitsList)
                    {
                        XmlElement objFruitIdNode = objXmlDoc.CreateElement("fruitid");
                        objFruitIdNode.InnerText = fruitid.ToString();
                        objSellFobiddenFruitsNode.AppendChild(objFruitIdNode);
                    }
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SOWMYSEEDSFIRST, "False").InnerText = taskitem.SowMySeedsFirst.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALUNKNOWFRUIT, "True").InnerText = taskitem.StealUnknowFruit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST, "");
                    XmlNode objStealForbiddenFruitsNode = objNode.SelectSingleNode(Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST);
                    if (objStealForbiddenFruitsNode == null)
                        return false;
                    objStealForbiddenFruitsNode.RemoveAll();
                    foreach (int fruitid in taskitem.StealForbiddenFruitsList)
                    {
                        XmlElement objFruitIdNode = objXmlDoc.CreateElement("fruitid");
                        objFruitIdNode.InnerText = fruitid.ToString();
                        objStealForbiddenFruitsNode.AppendChild(objFruitIdNode);
                    }
                }
                /*------------------------------Garden-----------------------------------*/

                /*------------------------------Ranch-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RANCH, "");
                if (objNode != null)
                {
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_EXECUTERANCH, "True").InnerText = taskitem.ExecuteRanch.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTPRODUCT, "True").InnerText = taskitem.HarvestProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTANIMAL, "True").InnerText = taskitem.HarvestAnimal.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDWATER, "True").InnerText = taskitem.AddWater.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDWATER, "False").InnerText = taskitem.HelpAddWater.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDGRASS, "True").InnerText = taskitem.AddGrass.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDGRASS, "False").InnerText = taskitem.HelpAddGrass.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALF, "True").InnerText = taskitem.BuyCalf.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFBYPRICE, "True").InnerText = taskitem.BuyCalfByPrice.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFCUSTOM, "1").InnerText = taskitem.BuyCalfCustom.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_STEALPRODUCT, "False").InnerText = taskitem.StealProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_MAKEPRODUCT, "True").InnerText = taskitem.MakeProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPMAKEPRODUCT, "False").InnerText = taskitem.HelpMakeProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BREEDANIMAL, "False").InnerText = taskitem.BreedAnimal.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_FOODNUM, "200").InnerText = taskitem.FoodNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCT, "False").InnerText = taskitem.PresentProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTBYPRICE, "True").InnerText = taskitem.PresentProductByPrice.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKVALUE, "True").InnerText = taskitem.PresentProductCheckValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTVALUE, "100").InnerText = taskitem.PresentProductValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTAID, "1").InnerText = taskitem.PresentProductAid.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTTYPE, "0").InnerText = taskitem.PresentProductType.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKNUM, "True").InnerText = taskitem.PresentProductCheckNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTNUM, "100").InnerText = taskitem.PresentProductNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCT, "False").InnerText = taskitem.SellProduct.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASH, "True").InnerText = taskitem.SellProductLowCash.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASHLIMIT, "100").InnerText = taskitem.SellProductLowCashLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLALLPRODUCTS, "True").InnerText = taskitem.SellAllProducts.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTMAXLIMIT, "300").InnerText = taskitem.SellProductMaxLimit.ToString();
                    XmlNode objSellProductFobiddenNode = GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTFORBIDDENLIST, ""); ;
                    objSellProductFobiddenNode.RemoveAll();
                    foreach (ProductInfo product in taskitem.SellProductForbiddenList)
                    {
                        XmlElement objChildNode = objXmlDoc.CreateElement("item");
                        objSellProductFobiddenNode.AppendChild(objChildNode);
                        XmlElement emtProductAIdNode = objXmlDoc.CreateElement(Constants.TASK_RANCH_PRODUCTAID);
                        emtProductAIdNode.InnerText = product.Aid.ToString();
                        XmlElement emtProductTypeNode = objXmlDoc.CreateElement(Constants.TASK_RANCH_PRODUCTTYPE);
                        emtProductTypeNode.InnerText = product.Type.ToString();
                        objChildNode.AppendChild(emtProductAIdNode);
                        objChildNode.AppendChild(emtProductTypeNode);                        
                    }
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDCARROT, "True").InnerText = taskitem.AddCarrot.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDCARROT, "False").InnerText = taskitem.HelpAddCarrot.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_CARROTNUM, "200").InnerText = taskitem.CarrotNum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDBAMBOO, "True").InnerText = taskitem.AddBamboo.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDBAMBOO, "False").InnerText = taskitem.HelpAddBamboo.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BAMBOONUM, "200").InnerText = taskitem.BambooNum.ToString();
                }
                /*------------------------------Ranch-----------------------------------*/

                /*------------------------------Fish-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_FISH, "");
                if (objNode != null)
                {
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_EXECUTEFISH, "True").InnerText = taskitem.ExecuteFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SHAKE, "True").InnerText = taskitem.Shake.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_TREATFISH, "True").InnerText = taskitem.TreatFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_UPDATEFISHPOND, "True").InnerText = taskitem.UpdateFishPond.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BANGKEJING, "True").InnerText = taskitem.BangKeJing.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISH, "True").InnerText = taskitem.BuyFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXFISHES, "20").InnerText = taskitem.MaxFishes.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHBYRANK, "True").InnerText = taskitem.BuyFishByRank.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHFISHID, "1").InnerText = taskitem.BuyFishFishId.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_FISHING, "True").InnerText = taskitem.Fishing.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYUPDATETACKLE, "False").InnerText = taskitem.BuyUpdateTackle.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXTACKLES, "5").InnerText = taskitem.MaxTackles.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HARVESTFISH, "True").InnerText = taskitem.HarvestFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISH, "False").InnerText = taskitem.NetSelfFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHCHEAP, "False").InnerText = taskitem.NetSelfFishCheap.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHMATURE, "80").InnerText = taskitem.NetSelfFishMature.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HELPFISH, "True").InnerText = taskitem.HelpFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISH, "False").InnerText = taskitem.PresentFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHEAP, "False").InnerText = taskitem.PresentFishCheap.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHECKVALUE, "True").InnerText = taskitem.PresentFishCheckValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHVALUE, "10000").InnerText = taskitem.PresentFishValue.ToString();
                    XmlNode objPresentFishesNode = GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHFORBIDDENLIST, "");
                    objPresentFishesNode.RemoveAll();
                    foreach (int fishid in taskitem.PresentFishForbiddenList)
                    {
                        XmlElement objFishIdNode = objXmlDoc.CreateElement(Constants.TASK_FISH_FISHID);
                        objFishIdNode.InnerText = fishid.ToString();
                        objPresentFishesNode.AppendChild(objFishIdNode);
                    }
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISH, "False").InnerText = taskitem.SellFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASH, "False").InnerText = taskitem.SellFishLowCash.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASHLIMIT, "10").InnerText = taskitem.SellFishLowCashLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLALLFISH, "False").InnerText = taskitem.SellAllFish.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHCHECKVALUE, "False").InnerText = taskitem.SellFishCheckValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHVALUE, "10000").InnerText = taskitem.SellFishValue.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHMAXLIMIT, "20").InnerText = taskitem.SellFishMaxLimit.ToString();
                    XmlNode objSellFishesNode = GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHFORBIDDENLIST, "");
                    objSellFishesNode.RemoveAll();
                    foreach (int fishid in taskitem.SellFishForbiddenList)
                    {
                        XmlElement objFishIdNode = objXmlDoc.CreateElement(Constants.TASK_FISH_FISHID);
                        objFishIdNode.InnerText = fishid.ToString();
                        objSellFishesNode.AppendChild(objFishIdNode);
                    }
                }
                /*------------------------------Fish-----------------------------------*/

                /*------------------------------Rich-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RICH, "");
                if (objNode != null)
                {
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_EXECUTERICH, "True").InnerText = taskitem.ExecuteRich.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_SELLASSET, "True").InnerText = taskitem.SellAsset.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSET, "True").InnerText = taskitem.BuyAsset.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETCHEAP, "False").InnerText = taskitem.BuyAssetCheap.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFRATIO, "True").InnerText = taskitem.GiveUpIfRatio.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPRATIO, "50").InnerText = taskitem.GiveUpRatio.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMINIMUM, "True").InnerText = taskitem.GiveUpIfMinimum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPMINIMUM, "5").InnerText = taskitem.GiveUpMinimum.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMYASSET, "False").InnerText = taskitem.GiveUpIfMyAsset.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPASSETCOUNT, "3").InnerText = taskitem.GiveUpAssetCount.ToString();                    
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_ADVANCEDPURCHASE, "False").InnerText = taskitem.AdvancedPurchase.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETSLIST, "");
                    XmlNode objBuyAssetsNode = objNode.SelectSingleNode(Constants.TASK_RICH_BUYASSETSLIST);
                    if (objBuyAssetsNode == null)
                        return false;
                    objBuyAssetsNode.RemoveAll();
                    foreach (int assetid in taskitem.BuyAssetsList)
                    {
                        XmlElement objAssetIdNode = objXmlDoc.CreateElement(Constants.TASK_RICH_ASSETID);
                        objAssetIdNode.InnerText = assetid.ToString();
                        objBuyAssetsNode.AppendChild(objAssetIdNode);
                    }
                }
                /*------------------------------Rich-----------------------------------*/

                /*------------------------------Cafe-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_CAFE, "");
                if (objNode != null)
                {
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_EXECUTECAFE, "True").InnerText = taskitem.ExecuteCafe.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_BOXCLEAN, "True").InnerText = taskitem.BoxClean.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOK, "True").InnerText = taskitem.Cook.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKTOMATOFIRST, "True").InnerText = taskitem.CookTomatoFirst.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKMEDLARFIRST, "False").InnerText = taskitem.CookMedlarFirst.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKCRABFIRST, "False").InnerText = taskitem.CookCrabFirst.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKPINEAPPLEFIRST, "False").InnerText = taskitem.CookPineappleFirst.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKDISHID, "4").InnerText = taskitem.CookDishId.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASH, "True").InnerText = taskitem.CookLowCash.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASHLIMIT, "2000").InnerText = taskitem.CookLowCashLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HIRE, "True").InnerText = taskitem.Hire.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_MAXEMPLOYEES, "12").InnerText = taskitem.MaxEmployees.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HELPFRIEND, "True").InnerText = taskitem.HelpFriend.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOOD, "False").InnerText = taskitem.PresentFood.ToString();
                    XmlNode objPresentForbiddenDishesNode = GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFORBIDDENFOODLIST, "");
                    if (objPresentForbiddenDishesNode == null)
                        return false;
                    objPresentForbiddenDishesNode.RemoveAll();
                    foreach (int dishid in taskitem.PresentForbiddenFoodList)
                    {
                        XmlElement objDishIdNode = objXmlDoc.CreateElement("DishId");
                        objDishIdNode.InnerText = dishid.ToString();
                        objPresentForbiddenDishesNode.AppendChild(objDishIdNode);
                    }
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODBYCOUNT, "True").InnerText = taskitem.PresentFoodByCount.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODDISHID, "4").InnerText = taskitem.PresentFoodDishId.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODMESSAGE, "送你食物啦!").InnerText = taskitem.PresentFoodMessage.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODRATIO, "50").InnerText = taskitem.PresentFoodRatio.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASH, "True").InnerText = taskitem.PresentLowCash.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASHLIMIT, "2000").InnerText = taskitem.PresentLowCashLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNT, "True").InnerText = taskitem.PresentFoodLowCount.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNTLIMIT, "2").InnerText = taskitem.PresentFoodLowCountLimit.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOOD, "False").InnerText = taskitem.PurchaseFood.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOODBYREFPRICE, "True").InnerText = taskitem.PurchaseFoodByRefPrice.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOOD, "False").InnerText = taskitem.SellFood.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOODBYREFPRICE, "True").InnerText = taskitem.SellFoodByRefPrice.ToString();
                }
                /*------------------------------Cafe-----------------------------------*/

                /*------------------------------Miscellaneous-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_MISCELLANEOUS);
                if (objNode != null)
                {
                    objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_GROUP).InnerText = taskitem.GroupName;
                    objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_SENDLOG).InnerText = taskitem.SendLog.ToString();
                    objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_RECEIVEREMAIL).InnerText = taskitem.ReceiverEmail.ToString();
                    if (objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE) == null)
                    {
                        XmlElement objChildNode = objXmlDoc.CreateElement(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE);
                        objNode.AppendChild(objChildNode);
                    }
                    objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE).InnerText = taskitem.WriteLogToFile.ToString();
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_MISCELLANEOUS_SKIPVALIDATION, "False").InnerText = taskitem.SkipValidation.ToString();
                }
                /*------------------------------Miscellaneous-----------------------------------*/

                /*------------------------------Accounts-----------------------------------*/
                XmlNode objAccountsNode = objTaskNode.SelectSingleNode(Constants.ACCOUNT_ACCOUNTS);
                if (objAccountsNode == null)
                    return false;

                objAccountsNode.RemoveAll();
                foreach (AccountInfo account in taskitem.Accounts)
                {
                    XmlElement objChildNode = objXmlDoc.CreateElement(Constants.ACCOUNT_ACCOUNT);
                    objAccountsNode.AppendChild(objChildNode);
                    XmlElement emtEmail = objXmlDoc.CreateElement(Constants.ACCOUNT_EMAIL);
                    emtEmail.InnerText = account.Email;
                    XmlElement emtPassword = objXmlDoc.CreateElement(Constants.ACCOUNT_PASSWORD);
                    emtPassword.InnerText = account.Password;
                    XmlElement emtUserName = objXmlDoc.CreateElement(Constants.ACCOUNT_USERNAME);
                    emtUserName.InnerText = account.UserName;
                    XmlElement emtUserId = objXmlDoc.CreateElement(Constants.ACCOUNT_USERID);
                    emtUserId.InnerText = account.UserId;
                    XmlElement emtGender = objXmlDoc.CreateElement(Constants.ACCOUNT_GENDER);
                    emtGender.InnerText = account.Gender.ToString();
                    objChildNode.AppendChild(emtEmail);
                    objChildNode.AppendChild(emtPassword);
                    objChildNode.AppendChild(emtUserName);
                    objChildNode.AppendChild(emtUserId);
                    objChildNode.AppendChild(emtGender);
                }
                /*------------------------------Accounts-----------------------------------*/

                //主配置文件
                if (EditTask(taskitem) == Constants.STATUS_FAIL)
                    return false;

                return SetTaskConfigFile(objXmlDoc, taskid);
                
            }
            catch (Exception ex)
            {
                LogHelper.Write("保存任务" + taskname, ex);
                return false;
            }
        }
Esempio n. 11
0
 private void TaskTree_BeforeLabelEdit(object sender, NodeLabelEditEventArgs e)
 {
     try
     {
         if (e.Node is TaskNode)
         {
             TaskNode tn = e.Node as TaskNode;
             if (tn != null)
             {
                 _task = tn.Task;
             }
         }
         else
         {
             e.CancelEdit = true;
         }
     }
     catch (Exception ex)
     {
         ErrorHandler.ShowMessageBox(TaskConstants.EXCEPTION_MODULE, ex);
     }
 }
Esempio n. 12
0
 public void TaskNodeSelected(TaskInfo task, Collection<OperationInfo> operations)
 {
     if (!IsHiding())
     {
         _propertyForm.Task = task;
         _propertyForm.Operations = operations;
         _propertyForm.Show(dockPanel);
     }
 }
Esempio n. 13
0
 public void ChangeTaskEditTabName(TaskInfo task)
 {
     if (dockPanel.DocumentStyle == DocumentStyle.SystemMdi)
     {
         
     }
     else
     {
         foreach (IDockContent content in dockPanel.Documents)
         {
             FrmTaskEditor form = content as FrmTaskEditor;
             if (form != null && form.TaskId == task.TaskId)
             {
                 form.TaskName = task.TaskName;
                 form.Text = task.TaskName;
                 return;
             }
         }
     }
 }
Esempio n. 14
0
 public void OpenTaskConfigFile(TaskInfo task)
 {
     string folder = Path.Combine(Application.StartupPath, Constants.FOLDER_TASKS);
     string fullName = folder + Constants.CHAR_DOUBLEBACKSLASH + task.TaskId + ".xml";
     OpenFile(fullName, task.TaskName + "[任务]");
 }
Esempio n. 15
0
        public static TaskInfo GetTask(string taskid, string taskname, bool IsDefault)
        {
            try
            {
                XmlDocument objXmlDoc;
                TaskInfo task = new TaskInfo();

                if (IsDefault)
                {
                    string configContent = Utility.GetTaskConfig("default", "defaultpassword");

                    objXmlDoc = new XmlDocument();

                    objXmlDoc.LoadXml(configContent);
                }
                else
                {
                    if (taskid == null || taskid == string.Empty)
                        return null;

                    objXmlDoc = GetTaskConfigFile(taskid, taskname);
                    if (objXmlDoc == null)
                        return null;

                    task.TaskId = taskid;
                    task.TaskName = taskname;
                }

                //root node
                XmlNode objTaskNode = objXmlDoc.SelectSingleNode(Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK);
                if (objTaskNode == null)
                    return null;

                XmlNode objNode;
                DataView dv;
                /*------------------------------ExecutingMode-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_EXECUTINGMODE);
                if (objNode != null)
                {
                    task.RunMode = GetRunMode(DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNMODE).InnerText));
                    XmlNode nodeRunInLoop = objNode.SelectSingleNode(Constants.TASK_EXECUTINGMODE_RUNINLOOP);
                    task.RoundTime = DataConvert.GetInt32(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_ROUNDTIME).InnerText);
                    task.Forbidden = DataConvert.GetBool(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDEN).InnerText);
                    string strtime = DataConvert.GetString(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENSTART).InnerText);
                    string[] atime = strtime.Split(':');
                    if (strtime == string.Empty)
                        task.ForbiddenStart = new TimeInfo();
                    else
                    {
                        task.ForbiddenStart = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1]));
                    }
                    strtime = DataConvert.GetString(nodeRunInLoop.SelectSingleNode(Constants.TASK_RUNINLOOP_FOBIDDENEND).InnerText);
                    atime = strtime.Split(':');
                    if (strtime == string.Empty)
                        task.ForbiddenEnd = new TimeInfo();
                    else
                    {
                        task.ForbiddenEnd = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1]));
                    }
                    //StartTimes
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.TASK_NODE_EXECUTINGMODE + Constants.CHAR_SLASH + Constants.TASK_EXECUTINGMODE_RUNINTIME + Constants.CHAR_SLASH + Constants.TASK_RUNINTIME_STARTTIMES);

                    Collection<TimeInfo> starttimes = new Collection<TimeInfo>();

                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        string strTime = dv.Table.Rows[ix][0].ToString();
                        string[] temp = strTime.Split(':');
                        starttimes.Add(new TimeInfo(DataConvert.GetInt32(temp[0]), DataConvert.GetInt32(temp[1])));
                    }
                    task.StartTimes = starttimes;
                }
                /*------------------------------ExecutingMode-----------------------------------*/

                /*------------------------------Park-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_PARK);
                if (objNode != null)
                {
                    task.ExecutePark = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_EXECUTEPARK).InnerText);
                    task.ParkMyCars = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_PARKMYCARS).InnerText);
                    task.PostOthersCars = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_POSTOTHERSCARS).InnerText);
                    task.JoinMatch = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_JOINMATCH).InnerText);
                    task.OriginateMatch = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_ORIGINATEMATCH).InnerText);
                    task.OriginateMatchId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATEMATCHID, "1").InnerText);
                    task.OriginateTeamNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_ORIGINATETEAMNUM, "2").InnerText);
                    task.StartCar = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_STARTCAR).InnerText);
                    task.CheerUp = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_PARK_CHEERUP).InnerText);
                    string strcartime = DataConvert.GetString(GetAppendNode(objNode, objXmlDoc, Constants.TASK_PARK_STARTCARTIME, "8:30").InnerText);
                    string[] atime = strcartime.Split(':');
                    task.StartCarTime = new TimeInfo(DataConvert.GetInt32(atime[0]), DataConvert.GetInt32(atime[1]));
                }
                /*------------------------------Park-----------------------------------*/

                /*------------------------------Bite-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_BITE);
                if (objNode != null)
                {
                    task.ExecuteBite = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_EXECUTEBITE).InnerText);
                    task.ApproveRecovery = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_APPROVERECOVERY).InnerText);
                    task.BiteOthers = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_BITEOTHERS).InnerText);
                    task.AutoRecover = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_AUTORECOVER).InnerText);
                    if (objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND) != null)
                        task.ProtectFriend = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_BITE_PROTECTFRIEND).InnerText);
                    else
                        task.ProtectFriend = false;
                }
                /*------------------------------Bite-----------------------------------*/

                /*------------------------------Slave-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_SLAVE);
                if (objNode != null)
                {
                    task.ExecuteSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_EXECUTESLAVE).InnerText);
                    task.MaxSlaves = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_SLAVE_MAXSLAVES).InnerText);
                    task.NickName = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_SLAVE_NICKNAME).InnerText);
                    task.BuySlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYSLAVE).InnerText);
                    task.BuyLowPriceSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_BUYLOWPRICESLAVE).InnerText);
                    task.FawnMaster = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_FAWNMASTER).InnerText);
                    task.PropitiateSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_PROPITIATESLAVE).InnerText);
                    task.AfflictSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_AFFLICTSLAVE).InnerText);
                    task.ReleaseSlave = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_SLAVE_RELEASESLAVE).InnerText);
                }
                /*------------------------------Slave-----------------------------------*/

                /*------------------------------House-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_HOUSE);
                if (objNode != null)
                {
                    task.ExecuteHouse = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_EXECUTEHOUSE).InnerText);
                    task.DoJob = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_DOJOB).InnerText);
                    task.StayHouse = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_STAYHOUSE).InnerText);
                    task.RobFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFRIENDS).InnerText);
                    task.RobFreeFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_ROBFREEFRIENDS).InnerText);
                    task.DriveFriends = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_HOUSE_DRIVEFRIENDS).InnerText);                    
                }
                /*------------------------------House-----------------------------------*/

                /*------------------------------Garden-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.GAME_GARDEN);                
                if (objNode != null)
                {
                    task.ExecuteGarden = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXECUTEGARDEN).InnerText);                    
                    task.FarmSelf = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSELF).InnerText);
                    task.ExpensiveFarmSelf = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSELF).InnerText);
                    task.CustomFarmSelf = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSELF).InnerText);
                    task.FarmShared = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_FARMSHARED).InnerText);
                    task.ExpensiveFarmShared = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_EXPENSIVEFARMSHARED).InnerText);
                    task.CustomFarmShared = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_CUSTOMFARMSHARED).InnerText);
                    task.HarvestFruit = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_HARVESTFRUIT).InnerText);
                    task.BuySeed = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEED).InnerText);
                    task.BuySeedCount = DataConvert.GetInt32(objNode.SelectSingleNode(Constants.TASK_GARDEN_BUYSEEDCOUNT).InnerText);
                    task.HelpOthers = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_HELPOTHERS).InnerText);                    
                    task.StealFruit = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_GARDEN_STEALFRUIT).InnerText);
                    task.PresentFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUIT, "False").InnerText);
                    task.PresentFruitByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITBYPRICE, "True").InnerText);
                    task.PresentFruitCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKVALUE, "True").InnerText);
                    task.PresentFruitValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITVALUE, "100").InnerText);
                    task.PresentFruitId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITID, "11").InnerText);
                    task.PresentFruitCheckNum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITCHECKNUM, "True").InnerText);
                    task.PresentFruitNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_PRESENTFRUITNUM, "1000").InnerText);
                    task.SellFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFRUIT, "False").InnerText);
                    task.LowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASH, "True").InnerText);
                    task.LowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_LOWCASHLIMIT, "100").InnerText);
                    task.SellAllFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLALLFRUIT, "False").InnerText);
                    task.MaxSellLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_MAXSELLLIMIT, "300").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SELLFORBIDDENNFRUITSLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_GARDEN + Constants.CHAR_SLASH + Constants.TASK_GARDEN_SELLFORBIDDENNFRUITSLIST);
                    Collection<int> sellfruits = new Collection<int>();
                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        sellfruits.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.SellForbiddennFruitsList = sellfruits;
                    task.SowMySeedsFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_SOWMYSEEDSFIRST, "False").InnerText);
                    task.StealUnknowFruit = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALUNKNOWFRUIT, "True").InnerText);

                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_GARDEN + Constants.CHAR_SLASH + Constants.TASK_GARDEN_STEALFORBIDDENFRUITSLIST);
                    Collection<int> fruits = new Collection<int>();

                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        fruits.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.StealForbiddenFruitsList = fruits;
                }
                /*------------------------------Garden-----------------------------------*/

                /*------------------------------Ranch-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RANCH, "");                
                if (objNode != null)
                {
                    task.ExecuteRanch = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_EXECUTERANCH, "True").InnerText);
                    task.HarvestProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTPRODUCT, "True").InnerText);
                    task.HarvestAnimal = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HARVESTANIMAL, "True").InnerText);
                    task.AddWater = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDWATER, "True").InnerText);
                    task.HelpAddWater = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDWATER, "False").InnerText);
                    task.AddGrass = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDGRASS, "True").InnerText);
                    task.HelpAddGrass = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDGRASS, "False").InnerText);
                    task.BuyCalf = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALF, "True").InnerText);
                    task.BuyCalfByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFBYPRICE, "True").InnerText);
                    task.BuyCalfCustom = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BUYCALFCUSTOM, "1").InnerText);
                    task.StealProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_STEALPRODUCT, "False").InnerText);
                    task.MakeProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_MAKEPRODUCT, "True").InnerText);
                    task.HelpMakeProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPMAKEPRODUCT, "False").InnerText);
                    task.BreedAnimal = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BREEDANIMAL, "False").InnerText);
                    task.FoodNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_FOODNUM, "200").InnerText);
                    task.PresentProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCT, "False").InnerText);
                    task.PresentProductByPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTBYPRICE, "True").InnerText);
                    task.PresentProductCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKVALUE, "True").InnerText);
                    task.PresentProductValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTVALUE, "100").InnerText);
                    task.PresentProductAid = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTAID, "1").InnerText);
                    task.PresentProductType = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTTYPE, "0").InnerText);
                    task.PresentProductCheckNum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTCHECKNUM, "True").InnerText);
                    task.PresentProductNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_PRESENTPRODUCTNUM, "100").InnerText);
                    task.SellProduct = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCT, "False").InnerText);
                    task.SellProductLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASH, "True").InnerText);
                    task.SellProductLowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTLOWCASHLIMIT, "100").InnerText);
                    task.SellAllProducts = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLALLPRODUCTS, "False").InnerText);
                    task.SellProductMaxLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTMAXLIMIT, "300").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_SELLPRODUCTFORBIDDENLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_RANCH + Constants.CHAR_SLASH + Constants.TASK_RANCH_SELLPRODUCTFORBIDDENLIST);
                    Collection<ProductInfo> sellproducts = new Collection<ProductInfo>();
                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        ProductInfo product = new ProductInfo();
                        product.Aid = DataConvert.GetInt32(dv.Table.Rows[ix][0]);
                        product.Type = DataConvert.GetInt32(dv.Table.Rows[ix][1]);
                        sellproducts.Add(product);
                    }
                    task.SellProductForbiddenList = sellproducts;
                    task.AddCarrot = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDCARROT, "True").InnerText);
                    task.HelpAddCarrot = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDCARROT, "False").InnerText);
                    task.CarrotNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_CARROTNUM, "200").InnerText);
                    task.AddBamboo = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_ADDBAMBOO, "True").InnerText);
                    task.HelpAddBamboo = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_HELPADDBAMBOO, "False").InnerText);
                    task.BambooNum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RANCH_BAMBOONUM, "200").InnerText);

                }
                /*------------------------------Ranch-----------------------------------*/

                /*------------------------------Fish-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_FISH, "");
                if (objNode != null)
                {
                    task.ExecuteFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_EXECUTEFISH, "True").InnerText);
                    task.Shake = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SHAKE, "True").InnerText);
                    task.TreatFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_TREATFISH, "True").InnerText);
                    task.UpdateFishPond = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_UPDATEFISHPOND, "True").InnerText);
                    task.BangKeJing = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BANGKEJING, "True").InnerText);
                    task.BuyFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISH, "True").InnerText);
                    task.MaxFishes = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXFISHES, "20").InnerText);
                    task.BuyFishByRank = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHBYRANK, "True").InnerText);
                    task.BuyFishFishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYFISHFISHID, "1").InnerText);
                    task.Fishing = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_FISHING, "True").InnerText);
                    task.BuyUpdateTackle = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_BUYUPDATETACKLE, "False").InnerText);
                    task.MaxTackles = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_MAXTACKLES, "5").InnerText);
                    task.HarvestFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HARVESTFISH, "True").InnerText);
                    task.NetSelfFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISH, "False").InnerText);
                    task.NetSelfFishCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHCHEAP, "False").InnerText);
                    task.NetSelfFishMature = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_NETSELFFISHMATURE, "80").InnerText);
                    task.HelpFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_HELPFISH, "True").InnerText);
                    task.PresentFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISH, "False").InnerText);
                    task.PresentFishCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHEAP, "False").InnerText);
                    task.PresentFishCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHCHECKVALUE, "True").InnerText);
                    task.PresentFishValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHVALUE, "10000").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_PRESENTFISHFORBIDDENLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_FISH + Constants.CHAR_SLASH + Constants.TASK_FISH_PRESENTFISHFORBIDDENLIST);
                    Collection<int> presentfishes = new Collection<int>();

                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        presentfishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.PresentFishForbiddenList = presentfishes;
                    task.SellFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISH, "False").InnerText);
                    task.SellFishLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASH, "False").InnerText);
                    task.SellFishLowCashLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHLOWCASHLIMIT, "10").InnerText);
                    task.SellAllFish = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLALLFISH, "False").InnerText);
                    task.SellFishCheckValue = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHCHECKVALUE, "False").InnerText);
                    task.SellFishValue = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHVALUE, "10000").InnerText);
                    task.SellFishMaxLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHMAXLIMIT, "20").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_FISH_SELLFISHFORBIDDENLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_FISH + Constants.CHAR_SLASH + Constants.TASK_FISH_SELLFISHFORBIDDENLIST);
                    Collection<int> sellfishes = new Collection<int>();

                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        sellfishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.SellFishForbiddenList = sellfishes;
                }
                /*------------------------------Fish-----------------------------------*/

                /*------------------------------Rich-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_RICH, "");
                if (objNode != null)
                {
                    task.ExecuteRich = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_EXECUTERICH, "True").InnerText);
                    task.SellAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_SELLASSET, "True").InnerText);
                    task.BuyAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSET, "True").InnerText);
                    task.BuyAssetCheap = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETCHEAP, "False").InnerText);
                    task.GiveUpIfRatio = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFRATIO, "True").InnerText);
                    task.GiveUpRatio = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPRATIO, "50").InnerText);
                    task.GiveUpIfMinimum = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMINIMUM, "True").InnerText);
                    task.GiveUpMinimum = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPMINIMUM, "5").InnerText);
                    task.GiveUpIfMyAsset = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPIFMYASSET, "False").InnerText);
                    task.GiveUpAssetCount = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_GIVEUPASSETCOUNT, "3").InnerText);                    
                    task.AdvancedPurchase = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_ADVANCEDPURCHASE, "False").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_RICH_BUYASSETSLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_RICH + Constants.CHAR_SLASH + Constants.TASK_RICH_BUYASSETSLIST);
                    Collection<int> buyassets = new Collection<int>();

                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        buyassets.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.BuyAssetsList = buyassets;
                }
                /*------------------------------Rich-----------------------------------*/

                /*------------------------------Cafe-----------------------------------*/
                objNode = GetAppendNode(objTaskNode, objXmlDoc, Constants.GAME_CAFE, "");
                if (objNode != null)
                {
                    task.ExecuteCafe = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_EXECUTECAFE, "True").InnerText);
                    task.BoxClean = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_BOXCLEAN, "True").InnerText);
                    task.Cook = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOK, "True").InnerText);
                    task.CookTomatoFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKTOMATOFIRST, "True").InnerText);
                    task.CookMedlarFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKMEDLARFIRST, "False").InnerText);
                    task.CookCrabFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKCRABFIRST, "False").InnerText);
                    task.CookPineappleFirst = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKPINEAPPLEFIRST, "False").InnerText);
                    task.CookDishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKDISHID, "4").InnerText);
                    task.CookLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASH, "True").InnerText);
                    task.CookLowCashLimit = DataConvert.GetInt64(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_COOKLOWCASHLIMIT, "2000").InnerText);
                    task.Hire = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HIRE, "True").InnerText);
                    task.MaxEmployees = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_MAXEMPLOYEES, "12").InnerText);
                    task.HelpFriend = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_HELPFRIEND, "True").InnerText);
                    task.PresentFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOOD, "False").InnerText);
                    GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFORBIDDENFOODLIST, "");
                    dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.GAME_CAFE + Constants.CHAR_SLASH + Constants.TASK_CAFE_PRESENTFORBIDDENFOODLIST);
                    Collection<int> presentdishes = new Collection<int>();
                    for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                    {
                        presentdishes.Add(DataConvert.GetInt32(dv.Table.Rows[ix][0]));
                    }
                    task.PresentForbiddenFoodList = presentdishes;
                    task.PresentFoodByCount = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODBYCOUNT, "True").InnerText);
                    task.PresentFoodDishId = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODDISHID, "4").InnerText);
                    task.PresentFoodMessage = DataConvert.GetString(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODMESSAGE, "送你食物啦!").InnerText);
                    task.PresentFoodRatio = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODRATIO, "50").InnerText);
                    task.PresentLowCash = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASH, "True").InnerText);
                    task.PresentLowCashLimit = DataConvert.GetInt64(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTLOWCASHLIMIT, "2000").InnerText);
                    task.PresentFoodLowCount = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNT, "True").InnerText);
                    task.PresentFoodLowCountLimit = DataConvert.GetInt32(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PRESENTFOODLOWCOUNTLIMIT, "2").InnerText);
                    task.PurchaseFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOOD, "False").InnerText);
                    task.PurchaseFoodByRefPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_PURCHASEFOODBYREFPRICE, "True").InnerText);
                    task.SellFood = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOOD, "False").InnerText);
                    task.SellFoodByRefPrice = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_CAFE_SELLFOODBYREFPRICE, "True").InnerText);
                }
                /*------------------------------Cafe-----------------------------------*/

                /*------------------------------Miscellaneous-----------------------------------*/
                objNode = objTaskNode.SelectSingleNode(Constants.TASK_NODE_MISCELLANEOUS);
                if (objNode != null)
                {
                    task.GroupName = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_GROUP).InnerText);
                    task.SendLog = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_SENDLOG).InnerText);                    
                    task.ReceiverEmail = DataConvert.GetString(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_RECEIVEREMAIL).InnerText);
                    if (objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE) != null)
                        task.WriteLogToFile = DataConvert.GetBool(objNode.SelectSingleNode(Constants.TASK_MISCELLANEOUS_WRITELOGTOFILE).InnerText);
                    else
                        task.WriteLogToFile = false;
                    task.SkipValidation = DataConvert.GetBool(GetAppendNode(objNode, objXmlDoc, Constants.TASK_MISCELLANEOUS_SKIPVALIDATION, "False").InnerText);
                }
                /*------------------------------Miscellaneous-----------------------------------*/

                /*------------------------------Accounts-----------------------------------*/
                dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASK + Constants.CHAR_SLASH + Constants.ACCOUNT_ACCOUNTS);

                Collection<AccountInfo> accounts = new Collection<AccountInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    AccountInfo account = new AccountInfo();
                    account.Email = dv.Table.Rows[ix][0].ToString();
                    account.Password = dv.Table.Rows[ix][1].ToString();
                    account.UserName = dv.Table.Rows[ix][2].ToString();
                    account.UserId = dv.Table.Rows[ix][3].ToString();
                    account.Gender = DataConvert.GetBool(dv.Table.Rows[ix][4]);
                    accounts.Add(account);
                }
                task.Accounts = accounts;
                /*------------------------------Accounts-----------------------------------*/

                return task;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetTask", taskname + "(" + taskid.ToString() + ")", ex, LogSeverity.Fatal);
                throw;
            }
        }
Esempio n. 16
0
        public static Collection<TaskInfo> GetTasks()
        {
            try
            {
                XmlDocument objXmlDoc = GetAssistantConfigFile();
                if (objXmlDoc == null)
                    return null;

                DataView dv = GetData(objXmlDoc, Constants.CONFIG_ROOT + Constants.CHAR_SLASH + Constants.TASK_TASKS);

                Collection<TaskInfo> tasks = new Collection<TaskInfo>();

                for (int ix = 0; ix < dv.Table.Rows.Count; ix++)
                {
                    try
                    {
                        TaskInfo task = new TaskInfo();
                        task = GetTask(dv.Table.Rows[ix][0].ToString(), dv.Table.Rows[ix][1].ToString(), false);
                        tasks.Add(task);
                    }
                    catch
                    {
                        continue;
                    }
                }

                return tasks;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetTasks", ex, LogSeverity.Fatal);
                throw;
            }
        }
Esempio n. 17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbGroup.Items.Count == 0 || cmbGroup.Text == string.Empty)
                {
                    MessageBox.Show("请先选择组!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    cmbGroup.Select();
                    return;
                }

                if ((rdbSingleLoop.Checked || rdbMultiLoop.Checked) && (!DataValidation.IsInt32(txtRoundTime.Text)))
                {
                    MessageBox.Show("循环时间必须为整数!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtRoundTime.Select();
                    return;
                }

                if (chkForbidden.Checked && timeForbiddenStart.Hour == -1 && timeForbiddenStart.Minute == -1)
                {
                    MessageBox.Show("时间不能为空!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    timeForbiddenStart.Select();
                    return;
                }

                if (chkForbidden.Checked && (!CheckTimeControl(timeForbiddenStart)))
                {
                    return;
                }

                if (chkForbidden.Checked && timeForbiddenEnd.Hour == -1 && timeForbiddenEnd.Minute == -1)
                {
                    MessageBox.Show("时间不能为空!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    timeForbiddenEnd.Select();
                    return;
                }

                if (chkForbidden.Checked && (!CheckTimeControl(timeForbiddenEnd)))
                {
                    return;
                }

                if (!CheckTimeControl(timeSelector1))
                {                    
                    return;
                }

                if (!CheckTimeControl(timeSelector2))
                {                   
                    return;
                }

                if (!CheckTimeControl(timeSelector3))
                {                   
                    return;
                }

                if (!CheckTimeControl(timeSelector4))
                {                   
                    return;
                }

                if (!CheckTimeControl(timeSelector5))
                {                    
                    return;
                }

                if (!CheckTimeControl(timeSelector6))
                {                   
                    return;
                }

                if (!CheckTimeControl(timeSelector7))
                {                   
                    return;
                }

                if (!CheckTimeControl(timeSelector8))
                {                    
                    return;
                }

                if (!CheckTimeControl(timeSelector9))
                {                    
                    return;
                }

                if (!CheckTimeControl(timeSelector10))
                {                   
                    return;
                }

                if (chkSendLog.Checked && DataValidation.IsNullOrEmpty(txtReceiverEmail.Text))
                {
                    MessageBox.Show("接收邮箱不能为空!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtReceiverEmail.Select();
                    return;
                }

                if (chkSendLog.Checked && !DataValidation.IsEmail(txtReceiverEmail.Text))
                {
                    MessageBox.Show("Email格式不正确!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtReceiverEmail.Select();
                    return;
                }

                if (chkTaskGarden.Checked && chkPresentFruit.Checked && rdbPresentFruitByPrice.Checked && chkPresentFruitCheckValue.Checked && (!DataValidation.IsInt32(txtPresentFruitValue.Text) || DataConvert.GetInt32(txtPresentFruitValue.Text) < 1))
                {
                    MessageBox.Show("赠送果实的价值必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageGarden;
                    txtPresentFruitValue.Select();
                    return;
                }

                if (chkTaskGarden.Checked && chkPresentFruit.Checked && rdbPresentFruitCustom.Checked && (!DataValidation.IsInt32(txtPresentFruitNum.Text) || DataConvert.GetInt32(txtPresentFruitNum.Text) < 1))
                {
                    MessageBox.Show("赠送果实的数量必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageGarden;
                    txtPresentFruitNum.Select();
                    return;
                }

                if (chkTaskGarden.Checked && (!DataValidation.IsInt32(txtLowCashLimit.Text)))
                {
                    MessageBox.Show("出售果实的现金阀值(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageGarden;
                    txtLowCashLimit.Select();
                    return;
                }

                if (chkTaskGarden.Checked && (!DataValidation.IsInt32(txtMaxSellLimit.Text)))
                {
                    MessageBox.Show("出售的额度(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageGarden;
                    txtMaxSellLimit.Select();
                    return;
                }

                if (chkTaskRanch.Checked && (!DataValidation.IsInt32(txtFoodNum.Text) || DataConvert.GetInt32(txtFoodNum.Text) > 200 || DataConvert.GetInt32(txtFoodNum.Text) < 1))
                {
                    MessageBox.Show("牧草的数量必须为数字,而且在1~200范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtFoodNum.Select();
                    return;
                }

                if (chkTaskRanch.Checked && (!DataValidation.IsInt32(txtCarrotNum.Text) || DataConvert.GetInt32(txtCarrotNum.Text) > 200 || DataConvert.GetInt32(txtCarrotNum.Text) < 1))
                {
                    MessageBox.Show("胡萝卜的数量必须为数字,而且在1~200范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtCarrotNum.Select();
                    return;
                }

                if (chkTaskRanch.Checked && chkPresentProduct.Checked && rdbPresentProductByPrice.Checked && chkPresentProductCheckValue.Checked && (!DataValidation.IsInt32(txtPresentProductValue.Text) || DataConvert.GetInt32(txtPresentProductValue.Text) < 1))
                {
                    MessageBox.Show("赠送农副产品的价值必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtPresentProductValue.Select();
                    return;
                }

                if (chkTaskRanch.Checked && chkPresentProduct.Checked && rdbPresentProductCustom.Checked && (!DataValidation.IsInt32(txtPresentProductNum.Text) || DataConvert.GetInt32(txtPresentProductNum.Text) < 1))
                {
                    MessageBox.Show("赠送农副产品的数量必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtPresentProductNum.Select();
                    return;
                }

                if (chkTaskRanch.Checked && (!DataValidation.IsInt32(txtSellProductLowCashLimit.Text)))
                {
                    MessageBox.Show("出售农副产品的现金阀值(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtSellProductLowCashLimit.Select();
                    return;
                }

                if (chkTaskRanch.Checked && (!DataValidation.IsInt32(txtSellProductMaxLimit.Text)))
                {
                    MessageBox.Show("出售的额度(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRanch;
                    txtSellProductMaxLimit.Select();
                    return;
                }

                if (chkTaskFish.Checked && chkNetSelfFish.Checked && (!DataValidation.IsInt32(txtNetSelfFishMature.Text) || DataConvert.GetInt32(txtNetSelfFishMature.Text) < 0 || DataConvert.GetInt32(txtNetSelfFishMature.Text) > 100))
                {
                    MessageBox.Show("成熟度必须为数字,而且在0~100范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageFish;
                    txtNetSelfFishMature.Select();
                    return;
                }

                if (chkTaskFish.Checked && chkPresentFish.Checked && (!DataValidation.IsInt32(txtPresentFishValue.Text) || DataConvert.GetInt32(txtPresentFishValue.Text) < 1))
                {
                    MessageBox.Show("鱼的价值必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageFish;
                    txtPresentFishValue.Select();
                    return;
                }

                if (chkTaskFish.Checked && chkSellFish.Checked && (!DataValidation.IsInt32(txtSellFishLowCashLimit.Text)))
                {
                    MessageBox.Show("出售鱼的现金阀值(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageFish;
                    txtSellFishLowCashLimit.Select();
                    return;
                }

                if (chkTaskFish.Checked && chkSellFish.Checked && (!DataValidation.IsInt32(txtSellFishValue.Text) || DataConvert.GetInt32(txtSellFishValue.Text) < 1))
                {
                    MessageBox.Show("鱼的价值必须为大于0的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageFish;
                    txtSellFishValue.Select();
                    return;
                }

                if (chkTaskFish.Checked && chkSellFish.Checked && (!DataValidation.IsInt32(txtSellFishMaxLimit.Text)))
                {
                    MessageBox.Show("出售鱼的额度(单位:万)必须为数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageFish;
                    txtSellFishMaxLimit.Select();
                    return;
                }


                if (chkTaskRich.Checked && chkGiveUpIfRatio.Checked && (!DataValidation.IsInt32(txtGiveUpRatio.Text) || DataConvert.GetInt32(txtGiveUpRatio.Text) < 0 || DataConvert.GetInt32(txtGiveUpRatio.Text) > 100))
                {
                    MessageBox.Show("现金/总资产比必须为数字,而且在0~100范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRich;
                    txtGiveUpRatio.Select();
                    return;
                }

                if (chkTaskRich.Checked && chkGiveUpIfMinimum.Checked && (!DataValidation.IsInt32(txtGiveUpMinimum.Text) || DataConvert.GetInt32(txtGiveUpMinimum.Text) <= 0 || DataConvert.GetInt32(txtGiveUpMinimum.Text) > 1000))
                {
                    MessageBox.Show("连续最小购买数必须为数字,而且在1~1000范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRich;
                    txtGiveUpMinimum.Select();
                    return;
                }

                if (chkTaskRich.Checked && chkGiveUpIfMyAsset.Checked && (!DataValidation.IsInt32(txtGiveUpAssetCount.Text) || DataConvert.GetInt32(txtGiveUpAssetCount.Text) <= 0 || DataConvert.GetInt32(txtGiveUpAssetCount.Text) > 100))
                {
                    MessageBox.Show("资产项目数必须为数字,而且在1~100范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageRich;
                    txtGiveUpAssetCount.Select();
                    return;
                }

                if (chkTaskCafe.Checked && chkCook.Checked && (!DataValidation.IsInt64(txtCookLowCashLimit.Text) || DataConvert.GetInt64(txtCookLowCashLimit.Text) <= 0))
                {
                    MessageBox.Show("炒菜最低现金阀值必须为大于1的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageCafe;
                    txtCookLowCashLimit.Select();
                    return;
                }

                if (chkTaskCafe.Checked && chkPresentFood.Checked && (!DataValidation.IsInt32(txtPresentFoodRatio.Text) || DataConvert.GetInt32(txtPresentFoodRatio.Text) <= 0 || DataConvert.GetInt32(txtPresentFoodRatio.Text) > 100))
                {
                    MessageBox.Show("赠送率必须为数字,而且在1~100范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageCafe;
                    txtPresentFoodRatio.Select();
                    return;
                }

                if (chkTaskCafe.Checked && chkPresentFood.Checked && (!DataValidation.IsInt64(txtPresentLowCashLimit.Text) || DataConvert.GetInt64(txtPresentLowCashLimit.Text) <= 0))
                {
                    MessageBox.Show("赠送最低现金阀值必须为大于1的数字!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageCafe;
                    txtPresentLowCashLimit.Select();
                    return;
                }

                if (chkTaskCafe.Checked && chkPresentFood.Checked && (!DataValidation.IsInt32(txtPresentFoodLowCountLimit.Text) || DataConvert.GetInt32(txtPresentFoodLowCountLimit.Text) <= 0 || DataConvert.GetInt32(txtPresentFoodLowCountLimit.Text) > 20))
                {
                    MessageBox.Show("最低食物种类数必须为数字,而且在1~20范围之内!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    tabGames.SelectedTab = tabPageCafe;
                    txtPresentFoodLowCountLimit.Select();
                    return;
                }

                if (!chkTaskParking.Checked && !chkTaskBiting.Checked && !chkTaskSlave.Checked && !chkTaskHouse.Checked && !chkTaskGarden.Checked && !chkTaskRanch.Checked && !chkTaskFish.Checked && !chkTaskRich.Checked && !chkTaskCafe.Checked)
                {
                    MessageBox.Show("请至少选择一个要执行的操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    chkTaskParking.Select();
                    return;
                }

                //park
                if (chkTaskParking.Checked)
                {
                    if (!chkParkMyCars.Checked && !chkPostOthersCars.Checked && !chkCheerUp.Checked && !chkJoinMatch.Checked && !chkOriginateMatch.Checked && !chkStartCar.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[争车位]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkParkMyCars.Select();
                        return;
                    }
                }

                //bite
                if (chkTaskBiting.Checked)
                {
                    if (!chkApproveRecovery.Checked && !chkBiteOthers.Checked && !chkAutoRecover.Checked && !chkProtectFriend.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[咬人]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkApproveRecovery.Select();
                        return;
                    }
                }

                //slave
                if (chkTaskSlave.Checked)
                {
                    if (!chkBuySlave.Checked && !chkBuyLowPriceSlave.Checked && !chkFawnMaster.Checked && !chkPropitiateSlave.Checked && !chkAfflictSlave.Checked & !chkReleaseSlave.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[朋友买卖]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkBuySlave.Select();
                        return;
                    }
                }

                //house
                if (chkTaskHouse.Checked)
                {
                    if (!chkDoJob.Checked && !chkStayHouse.Checked && !chkRobFriends.Checked && !chkRobFreeFriends.Checked && !chkDriveFriends.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[买房子]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkDoJob.Select();
                        return;
                    }
                }

                //garden
                if (chkTaskGarden.Checked)
                {
                    if (!chkFarmSelf.Checked && !chkHarvestFruit.Checked && !chkPresentFruit.Checked && !chkSellFruit.Checked && !chkHelpOthers.Checked && !chkFarmShared.Checked && !chkStealFruit.Checked && !chkBuySeed.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[花园]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkFarmSelf.Select();
                        return;
                    }
                }

                //ranch
                if (chkTaskRanch.Checked)
                {
                    if (!chkHarvestProduct.Checked && !chkHarvestAnimal.Checked && !chkAddWater.Checked && !chkHelpAddWater.Checked && !chkAddGrass.Checked && !chkHelpAddGrass.Checked && !chkBuyCalf.Checked && !chkStealProduct.Checked && !chkMakeProduct.Checked && !chkHelpMakeProduct.Checked && !chkBreedAnimal.Checked && !chkPresentProduct.Checked && !chkSellProduct.Checked && !chkAddCarrot.Checked && !chkHelpAddCarrot.Checked && !chkAddBamboo.Checked && !chkHelpAddBamboo.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[牧场]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkAddWater.Select();
                        return;
                    }
                }

                //fish
                if (chkTaskFish.Checked)
                {
                    if (!chkShake.Checked && !chkTreatFish.Checked && !chkUpdateFishPond.Checked && !chkBangKeJing.Checked && !chkBuyFish.Checked && !chkFishing.Checked && !chkBuyUpdateTackle.Checked && !chkHarvestFish.Checked && !chkNetSelfFish.Checked && !chkHelpFish.Checked && !chkPresentFish.Checked && !chkSellFish.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[钓鱼]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkShake.Select();
                        return;
                    }
                }

                //rich
                if (chkTaskRich.Checked)
                {
                    if (!chkSellAsset.Checked && !chkBuyAsset.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[超级大亨]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkSellAsset.Select();
                        return;
                    }
                }

                //cafe
                if (chkTaskCafe.Checked)
                {
                    if (!chkBoxClean.Checked && !chkCook.Checked && !chkHire.Checked && !chkHelpFriend.Checked && !chkPresentFood.Checked && !chkPurchaseFood.Checked && !chkSellFood.Checked)
                    {
                        MessageBox.Show("请至少选择一个要执行的[开心餐厅]操作!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        chkBoxClean.Select();
                        return;
                    }
                }

                TaskInfo taskitem = new TaskInfo();
                //taskitem.
                taskitem.TaskId = _taskid;
                taskitem.TaskName = _taskname;
                taskitem.GroupName = cmbGroup.Text;
                if (rdbSingleLoop.Checked)
                    taskitem.RunMode = EnumRunMode.SingleLoop;
                else if (rdbMultiLoop.Checked)
                    taskitem.RunMode = EnumRunMode.MultiLoop;
                else if (rdbTiming.Checked)
                    taskitem.RunMode = EnumRunMode.Timing;

                taskitem.RoundTime = DataConvert.GetInt32(txtRoundTime.Text);
                taskitem.Forbidden = chkForbidden.Checked;
                taskitem.ForbiddenStart = new TimeInfo(timeForbiddenStart.Hour, timeForbiddenStart.Minute);
                taskitem.ForbiddenEnd = new TimeInfo(timeForbiddenEnd.Hour, timeForbiddenEnd.Minute);

                if (timeSelector1.Hour >= 0 && timeSelector1.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector1.Hour, timeSelector1.Minute));
                if (timeSelector2.Hour >= 0 && timeSelector2.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector2.Hour, timeSelector2.Minute));
                if (timeSelector3.Hour >= 0 && timeSelector3.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector3.Hour, timeSelector3.Minute));
                if (timeSelector4.Hour >= 0 && timeSelector4.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector4.Hour, timeSelector4.Minute));
                if (timeSelector5.Hour >= 0 && timeSelector5.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector5.Hour, timeSelector5.Minute));
                if (timeSelector6.Hour >= 0 && timeSelector6.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector6.Hour, timeSelector6.Minute));
                if (timeSelector7.Hour >= 0 && timeSelector7.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector7.Hour, timeSelector7.Minute));
                if (timeSelector8.Hour >= 0 && timeSelector8.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector8.Hour, timeSelector8.Minute));
                if (timeSelector9.Hour >= 0 && timeSelector9.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector9.Hour, timeSelector9.Minute));
                if (timeSelector10.Hour >= 0 && timeSelector10.Minute >= 0)
                    taskitem.StartTimes.Add(new TimeInfo(timeSelector10.Hour, timeSelector10.Minute));
                if (rdbTiming.Checked && taskitem.StartTimes.Count <= 0)
                {
                    MessageBox.Show("定时执行时,请至少设置一个时间!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    timeSelector1.Select();
                    return;
                }

                taskitem.ExecutePark = chkTaskParking.Checked;
                taskitem.ExecuteBite = chkTaskBiting.Checked;
                taskitem.ExecuteSlave = chkTaskSlave.Checked;
                taskitem.ExecuteHouse = chkTaskHouse.Checked;
                taskitem.ExecuteGarden = chkTaskGarden.Checked;
                taskitem.ExecuteRanch = chkTaskRanch.Checked;
                taskitem.ExecuteFish = chkTaskFish.Checked;
                taskitem.ExecuteRich = chkTaskRich.Checked;
                taskitem.ExecuteCafe = chkTaskCafe.Checked;
                taskitem.SendLog = chkSendLog.Checked;
                taskitem.ReceiverEmail = txtReceiverEmail.Text;
                taskitem.WriteLogToFile = chkWriteLogToFile.Checked;
                taskitem.SkipValidation = rdbSkip.Checked;
                //park                
                taskitem.ParkMyCars = chkParkMyCars.Checked;
                taskitem.PostOthersCars = chkPostOthersCars.Checked;
                taskitem.CheerUp = chkCheerUp.Checked;
                taskitem.StartCar = chkStartCar.Checked;
                taskitem.OriginateMatch = chkOriginateMatch.Checked;
                MatchInfo originateMatchId = cmbOriginateMatchId.SelectedItem as MatchInfo;
                if (originateMatchId == null)
                    taskitem.OriginateMatchId = 1;
                else
                    taskitem.OriginateMatchId = originateMatchId.MatchId;
                taskitem.OriginateTeamNum = cmbOriginateTeamNum.SelectedIndex + 2;
                taskitem.JoinMatch = chkJoinMatch.Checked;
                taskitem.StartCarTime = new TimeInfo(timeStartCarTime.Hour, timeStartCarTime.Minute);
                //bite
                taskitem.ApproveRecovery = chkApproveRecovery.Checked;
                taskitem.BiteOthers = chkBiteOthers.Checked;
                taskitem.AutoRecover = chkAutoRecover.Checked;
                taskitem.ProtectFriend = chkProtectFriend.Checked;
                //slave
                taskitem.BuySlave = chkBuySlave.Checked;
                taskitem.BuyLowPriceSlave = chkBuyLowPriceSlave.Checked;
                taskitem.FawnMaster = chkFawnMaster.Checked;
                taskitem.PropitiateSlave = chkPropitiateSlave.Checked;
                taskitem.AfflictSlave = chkAfflictSlave.Checked;
                taskitem.ReleaseSlave = chkReleaseSlave.Checked;
                taskitem.MaxSlaves = cmbMaxSlaves.SelectedIndex + 1;
                taskitem.NickName = txtNickName.Text;
                //house
                taskitem.DoJob = chkDoJob.Checked;
                taskitem.StayHouse = chkStayHouse.Checked;
                taskitem.RobFriends = chkRobFriends.Checked;
                taskitem.RobFreeFriends = chkRobFreeFriends.Checked;
                taskitem.DriveFriends = chkDriveFriends.Checked;
                //garden
                taskitem.FarmSelf = chkFarmSelf.Checked;
                taskitem.ExpensiveFarmSelf = rdbExpensiveFarmSelf.Checked;
                SeedInfo seedCustomFarmSelf = cmbCustomFarmSelf.SelectedItem as SeedInfo;
                if (seedCustomFarmSelf == null)
                    taskitem.CustomFarmSelf = 1;
                else
                    taskitem.CustomFarmSelf = seedCustomFarmSelf.SeedId;
                taskitem.FarmShared = chkFarmShared.Checked;
                taskitem.ExpensiveFarmShared = rdbExpensiveFarmShared.Checked;
                SeedInfo seedCustomFarmShared = cmbCustomFarmShared.SelectedItem as SeedInfo;
                if (seedCustomFarmShared == null)
                    taskitem.CustomFarmShared = 1;
                else
                    taskitem.CustomFarmShared = seedCustomFarmShared.SeedId;
                taskitem.HarvestFruit = chkHarvestFruit.Checked;
                taskitem.PresentFruit = chkPresentFruit.Checked;
                taskitem.PresentFruitByPrice = rdbPresentFruitByPrice.Checked;
                taskitem.PresentFruitCheckValue = chkPresentFruitCheckValue.Checked;
                taskitem.PresentFruitValue = DataConvert.GetInt32(txtPresentFruitValue.Text);
                FruitInfo presentFruit = cmbPresentFruitId.SelectedItem as FruitInfo;
                if (presentFruit == null)
                    taskitem.PresentFruitId = 1;
                else
                    taskitem.PresentFruitId = presentFruit.FruitId;
                taskitem.PresentFruitCheckNum = chkPresentFruitCheckNum.Checked;
                taskitem.PresentFruitNum = DataConvert.GetInt32(txtPresentFruitNum.Text);
                taskitem.SellFruit = chkSellFruit.Checked;
                taskitem.LowCash = chkLowCash.Checked;
                taskitem.LowCashLimit = DataConvert.GetInt32(txtLowCashLimit.Text);
                taskitem.SellAllFruit = rdbSellAllFruit.Checked;
                taskitem.MaxSellLimit = DataConvert.GetInt32(txtMaxSellLimit.Text);
                taskitem.SellForbiddennFruitsList = _sellforbiddenfruitslist;
                taskitem.BuySeed = chkBuySeed.Checked;
                taskitem.BuySeedCount = cmbBuySeedCount.SelectedIndex + 1;
                taskitem.HelpOthers = chkHelpOthers.Checked;
                taskitem.StealFruit = chkStealFruit.Checked;
                //taskitem.StealPrice = DataConvert.GetInt32(JsonHelper.GetMidLast(cmbStealPrice.Text, "(", ")"));
                taskitem.SowMySeedsFirst = chkSowMySeedsFirst.Checked;
                taskitem.StealUnknowFruit = chkStealUnknowFruit.Checked;
                taskitem.StealForbiddenFruitsList = _stealforbiddenfruitslist;

                //ranch
                taskitem.HarvestProduct = chkHarvestProduct.Checked;
                taskitem.HarvestAnimal = chkHarvestAnimal.Checked;
                taskitem.AddWater = chkAddWater.Checked;
                taskitem.HelpAddWater = chkHelpAddWater.Checked;
                taskitem.AddGrass = chkAddGrass.Checked;
                taskitem.HelpAddGrass = chkHelpAddGrass.Checked;
                taskitem.BuyCalf = chkBuyCalf.Checked;
                taskitem.BuyCalfByPrice = rdbBuyCalfByPrice.Checked;
                CalfInfo calfBuyCalfCustom = cmbBuyCalfCustom.SelectedItem as CalfInfo;
                if (calfBuyCalfCustom == null)
                    taskitem.BuyCalfCustom = 1;
                else
                    taskitem.BuyCalfCustom = calfBuyCalfCustom.AId;
                taskitem.StealProduct = chkStealProduct.Checked;
                taskitem.MakeProduct = chkMakeProduct.Checked;
                taskitem.HelpMakeProduct = chkHelpMakeProduct.Checked;
                taskitem.BreedAnimal = chkBreedAnimal.Checked;
                taskitem.FoodNum = DataConvert.GetInt32(txtFoodNum.Text);
                taskitem.PresentProduct = chkPresentProduct.Checked;
                taskitem.PresentProductByPrice = rdbPresentProductByPrice.Checked;
                taskitem.PresentProductCheckValue = chkPresentProductCheckValue.Checked;
                taskitem.PresentProductValue = DataConvert.GetInt32(txtPresentProductValue.Text);
                ProductInfo productPresentProductCustom = cmbAnimalProducts.SelectedItem as ProductInfo;
                if (productPresentProductCustom == null)
                {
                    taskitem.PresentProductAid = 1;
                    taskitem.PresentProductType = 0;
                }
                else
                {
                    taskitem.PresentProductAid = productPresentProductCustom.Aid;
                    taskitem.PresentProductType = productPresentProductCustom.Type;
                }
                taskitem.PresentProductCheckNum = chkPresentProductCheckNum.Checked;
                taskitem.PresentProductNum = DataConvert.GetInt32(txtPresentProductNum.Text);
                taskitem.SellProduct = chkSellProduct.Checked;
                taskitem.SellProductLowCash = chkSellProductLowCash.Checked;
                taskitem.SellProductLowCashLimit = DataConvert.GetInt32(txtSellProductLowCashLimit.Text);
                taskitem.SellAllProducts = rdbSellAllProducts.Checked;
                taskitem.SellProductMaxLimit = DataConvert.GetInt32(txtSellProductMaxLimit.Text);
                taskitem.SellProductForbiddenList = _sellproductforbiddenlist;
                taskitem.AddCarrot = chkAddCarrot.Checked;
                taskitem.HelpAddCarrot = chkHelpAddCarrot.Checked;
                taskitem.CarrotNum = DataConvert.GetInt32(txtCarrotNum.Text);
                taskitem.AddBamboo = chkAddBamboo.Checked;
                taskitem.HelpAddBamboo = chkHelpAddBamboo.Checked;
                taskitem.BambooNum = DataConvert.GetInt32(txtBambooNum.Text);

                //fish
                taskitem.Shake = chkShake.Checked;
                taskitem.TreatFish = chkTreatFish.Checked;
                taskitem.UpdateFishPond = chkUpdateFishPond.Checked;
                taskitem.BangKeJing = chkBangKeJing.Checked;
                taskitem.BuyFish = chkBuyFish.Checked;
                taskitem.MaxFishes = cmbMaxFishes.SelectedIndex + 1;
                taskitem.BuyFishByRank = rdbBuyFishByRank.Checked;
                FishFryInfo fishfryBuyFish = cmbBuyFishFishId.SelectedItem as FishFryInfo;
                if (fishfryBuyFish == null)
                    taskitem.BuyFishFishId = 1;
                else
                    taskitem.BuyFishFishId = fishfryBuyFish.FId;
                taskitem.Fishing = chkFishing.Checked;
                taskitem.BuyUpdateTackle = chkBuyUpdateTackle.Checked;
                taskitem.MaxTackles = cmbMaxTackles.SelectedIndex + 1;
                taskitem.HarvestFish = chkHarvestFish.Checked;
                taskitem.NetSelfFish = chkNetSelfFish.Checked;
                taskitem.NetSelfFishCheap = rdbNetSelfFishCheap.Checked;
                taskitem.NetSelfFishMature = DataConvert.GetInt32(txtNetSelfFishMature.Text);
                taskitem.HelpFish = chkHelpFish.Checked;
                taskitem.PresentFish = chkPresentFish.Checked;
                taskitem.PresentFishCheap = rdbPresentFishCheap.Checked;
                taskitem.PresentFishCheckValue = chkPresentFishCheckValue.Checked;
                taskitem.PresentFishValue = DataConvert.GetInt32(txtPresentFishValue.Text);
                taskitem.PresentFishForbiddenList = _presentforbiddenfishlist;
                taskitem.SellFish = chkSellFish.Checked;
                taskitem.SellFishLowCash = chkSellFishLowCash.Checked;
                taskitem.SellFishLowCashLimit = DataConvert.GetInt32(txtSellFishLowCashLimit.Text);
                taskitem.SellAllFish = rdbSellAllFish.Checked;
                taskitem.SellFishCheckValue = chkSellFishCheckValue.Checked;
                taskitem.SellFishValue = DataConvert.GetInt32(txtSellFishValue.Text);
                taskitem.SellFishMaxLimit = DataConvert.GetInt32(txtSellFishMaxLimit.Text);
                taskitem.SellFishForbiddenList = _sellforbiddenfishlist;

                //rich
                taskitem.SellAsset = chkSellAsset.Checked;
                taskitem.BuyAsset = chkBuyAsset.Checked;
                taskitem.BuyAssetCheap = rdbBuyAssetCheap.Checked;
                taskitem.GiveUpIfRatio = chkGiveUpIfRatio.Checked;
                taskitem.GiveUpRatio = DataConvert.GetInt32(txtGiveUpRatio.Text);
                taskitem.GiveUpIfMinimum = chkGiveUpIfMinimum.Checked;
                taskitem.GiveUpMinimum = DataConvert.GetInt32(txtGiveUpMinimum.Text);
                taskitem.GiveUpIfMyAsset = chkGiveUpIfMyAsset.Checked;
                taskitem.GiveUpAssetCount = DataConvert.GetInt32(txtGiveUpAssetCount.Text);
                taskitem.AdvancedPurchase = chkAdvancedPurchase.Checked;          
                taskitem.BuyAssetsList = _buyassetslist;

                //cafe
                taskitem.BoxClean = chkBoxClean.Checked;
                taskitem.Cook = chkCook.Checked;
                taskitem.CookTomatoFirst = chkCookTomatoFirst.Checked;
                taskitem.CookMedlarFirst = chkCookMedlarFirst.Checked;
                taskitem.CookCrabFirst = chkCookCrabFirst.Checked;
                taskitem.CookPineappleFirst = chkCookPineappleFirst.Checked;
                DishInfo cookDishId = cmbCookDishId.SelectedItem as DishInfo;
                if (cookDishId == null)
                    taskitem.CookDishId = 4;
                else
                    taskitem.CookDishId = cookDishId.DishId;
                taskitem.CookLowCash = chkCookLowCash.Checked;
                taskitem.CookLowCashLimit = DataConvert.GetInt64(txtCookLowCashLimit.Text);
                taskitem.Hire = chkHire.Checked;
                taskitem.MaxEmployees = cmbMaxEmployees.SelectedIndex + 1;
                taskitem.HelpFriend = chkHelpFriend.Checked;
                taskitem.PresentFood = chkPresentFood.Checked;
                taskitem.PresentForbiddenFoodList = _presentforbiddenfoodlist;
                taskitem.PresentFoodByCount = rdbPresentFoodByCount.Checked;
                DishInfo presentDishId = cmbPresentFoodDishId.SelectedItem as DishInfo;
                if (presentDishId == null)
                    taskitem.PresentFoodDishId = 4;
                else
                    taskitem.PresentFoodDishId = presentDishId.DishId;
                taskitem.PresentFoodRatio = DataConvert.GetInt32(txtPresentFoodRatio.Text);
                taskitem.PresentFoodMessage = DataConvert.GetString(txtPresentFoodMessage.Text);
                taskitem.PresentLowCash = chkPresentLowCash.Checked;
                taskitem.PresentLowCashLimit = DataConvert.GetInt64(txtPresentLowCashLimit.Text);
                taskitem.PresentFoodLowCount = chkPresentFoodLowCount.Checked;
                taskitem.PresentFoodLowCountLimit = DataConvert.GetInt32(txtPresentFoodLowCountLimit.Text);
                taskitem.SellFood = chkSellFood.Checked;
                taskitem.SellFoodByRefPrice = rdbSellFoodByRefPrice.Checked;
                taskitem.PurchaseFood = chkPurchaseFood.Checked;
                taskitem.PurchaseFoodByRefPrice = rdbPurchaseFoodByRefPrice.Checked;

                //accounts
                foreach (object item in lstSelectedAccounts.Items)
                {
                    AccountInfo user = item as AccountInfo;
                    if (user != null)
                    {
                        taskitem.Accounts.Add(user);
                    }
                }

                if (rdbSingleLoop.Checked && taskitem.Accounts.Count!=1)
                {
                    MessageBox.Show("运行模式是单账号循环时,只能选择一个账号!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    lstSelectedAccounts.Select();
                    return;
                }

                if (rdbSingleLoop.Checked && taskitem.RoundTime > 15)
                {
                    MessageBox.Show("运行模式是单账号循环时,循环时间不能超过15分钟!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtRoundTime.Select();
                    return;
                }

                if (ConfigCtrl.SetTask(_taskid, _taskname, taskitem))
                    MessageBox.Show("配置信息保存成功!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.None);
                else
                    MessageBox.Show("配置信息保存失败!", MainConstants.MESSAGEBOX_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
                
                if (taskSaved != null)
                    taskSaved(_taskid, _taskname);
                
            }
            catch (Exception ex)
            {
                Program.ShowMessageBox("FrmTaskEditor", ex);
            }
        }