Beispiel #1
0
        public static Collection<ProductInfo> GetMyWarehouseProduct(string strxml)
        {
            try
            {
                XmlDocument objXmlDoc = new XmlDocument();
                objXmlDoc.LoadXml(strxml);
                if (objXmlDoc == null)
                    return null;

                if (objXmlDoc.SelectSingleNode(Constants.GARDEN_WAREHOUSE_ROOT + Constants.CHAR_SLASH + Constants.GARDEN_WAREHOUSE_FRUIT) == null)
                {
                    return new Collection<ProductInfo>();
                }

                DataView dv = GetData(objXmlDoc, Constants.GARDEN_WAREHOUSE_ROOT + Constants.CHAR_SLASH + Constants.GARDEN_WAREHOUSE_FRUIT);

                Collection<ProductInfo> products = 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]["aid"]);
                    product.Num = DataConvert.GetInt32(dv.Table.Rows[ix]["num"]);
                    product.Type = DataConvert.GetInt32(dv.Table.Rows[ix]["type"]);
                    product.Pic = dv.Table.Rows[ix]["pic"].ToString();
                    product.Name = dv.Table.Rows[ix]["name"].ToString();
                    products.Add(product);
                }
                return products;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetMyWarehouseProduct", strxml, ex, LogSeverity.Error);
                return null;
            }
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
        public static Collection<ProductInfo> GetAnimalProducts()
        {
            try
            {
                XmlDocument objXmlDoc = GetMasterDataFile(Constants.FILE_ANIMALPRODUCTMASTERDATA);
                if (objXmlDoc == null)
                    return null;

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

                Collection<ProductInfo> products = 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]["aid"]);
                    product.Type = DataConvert.GetInt32(dv.Table.Rows[ix]["type"]);
                    product.Name = dv.Table.Rows[ix]["name"].ToString();
                    product.Price = DataConvert.GetInt32(dv.Table.Rows[ix]["price"]);
                    products.Add(product);
                }

                return products;
            }
            catch (Exception ex)
            {
                LogHelper.Write("ConfigCtrl.GetAnimalProducts", ex);
                return null;
            }
        }