public OperationNode(OperationInfo op) { nodeType = NodeType.Operation; Operation = op; this.Text = op.Account.UserName; this.ImageIndex = DataConvert.GetInt32(IconType.User); this.SelectedImageIndex = DataConvert.GetInt32(IconType.User); }
public static OperationInfo GetOperation(string groupname, AccountInfo account) { try { if (account.Email == null || account.Email == string.Empty) return null; XmlDocument objXmlDoc = GetOperationConfigFile(groupname, account.Email, account.Password); if (objXmlDoc == null) return null; OperationInfo operation = new OperationInfo(); operation.Account = account; //email operation.Email = GetInnerText(objXmlDoc, Constants.ACCOUNT_EMAIL); //password operation.Password = GetInnerText(objXmlDoc, Constants.ACCOUNT_PASSWORD); //park operation.ParkWhiteList = GetAccountList(objXmlDoc, Constants.PARK_PARKWHITE); operation.ParkBlackList = GetAccountList(objXmlDoc, Constants.PARK_PARKBLACK); operation.PostList = GetAccountList(objXmlDoc, Constants.PARK_POSTLIST); operation.PostAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.PARK_POSTALL)); //operation.ParkingDelayTime = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CONFIG_PARKINGDELAYTIME)); //operation.ParkMyCars = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_PARKMYCARS)); //operation.PostOthersCars = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_POSTOTHERSCARS)); //bite operation.BiteWhiteList = GetAccountList(objXmlDoc, Constants.BITE_BITEWHITE); operation.BiteBlackList = GetAccountList(objXmlDoc, Constants.BITE_BITEBLACK); operation.RecoverWhiteList = GetAccountList(objXmlDoc, Constants.BITE_RECOVERWHITE); operation.RecoverBlackList = GetAccountList(objXmlDoc, Constants.BITE_RECOVERBLACK); operation.BiteAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.BITE_BITEALL)); operation.ProtectId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.BITE_PROTECTID)); //operation.ApproveRecovery = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_APPROVERECOVERY)); //operation.BiteOthers = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BITEOTHERS)); //operation.AutoRecover = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_AUTORECOVER)); //slave operation.BuyWhiteList = GetAccountList(objXmlDoc, Constants.SLAVE_BUYWHITE); operation.BuyBlackList = GetAccountList(objXmlDoc, Constants.SLAVE_BUYBLACK); //operation.MaxSlaves = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CONFIG_MAXSLAVES)); //operation.NickName = GetInnerText(objXmlDoc, Constants.CONFIG_NICKNAME); //operation.BuySlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BUYSLAVE)); //operation.BuyLowPriceSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_BUYLOWPRICESLAVE)); //operation.PropitiateSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_PROPITIATESLAVE)); //operation.AfflictSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_AFFLICTSLAVE)); //operation.ReleaseSlave = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CONFIG_RELEASESLAVE)); //house operation.StayWhiteList = GetAccountList(objXmlDoc, Constants.HOUSE_STAYWHITE); operation.StayBlackList = GetAccountList(objXmlDoc, Constants.HOUSE_STAYBLACK); operation.RobWhiteList = GetAccountList(objXmlDoc, Constants.HOUSE_ROBWHITE); operation.RobBlackList = GetAccountList(objXmlDoc, Constants.HOUSE_ROBBLACK); //garden operation.StealWhiteList = GetAccountList(objXmlDoc, Constants.GARDEN_STEALWHITE); operation.StealBlackList = GetAccountList(objXmlDoc, Constants.GARDEN_STEALBLACK); operation.StealAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.GARDEN_STEALALL)); operation.FarmWhiteList = GetAccountList(objXmlDoc, Constants.GARDEN_FARMWHITE); operation.FarmBlackList = GetAccountList(objXmlDoc, Constants.GARDEN_FARMBLACK); operation.FarmAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.GARDEN_FARMALL)); operation.PresentId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.GARDEN_PRESENTID)); //ranch operation.HelpRanchWhiteList = GetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHWHITE); operation.HelpRanchBlackList = GetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHBLACK); operation.HelpRanchAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.RANCH_HELPRANCHALL)); operation.StealProductWhiteList = GetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTWHITE); operation.StealProductBlackList = GetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTBLACK); operation.StealProductAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.RANCH_STEALPRODUCTALL)); operation.PresentProductId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.RANCH_PRESENTPRODUCTID)); //fish operation.FishingWhiteList = GetAccountList(objXmlDoc, Constants.FISH_FISHINGWHITE); operation.FishingBlackList = GetAccountList(objXmlDoc, Constants.FISH_FISHINGBLACK); operation.FishingAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.FISH_FISHINGALL)); operation.HelpFishWhiteList = GetAccountList(objXmlDoc, Constants.FISH_HELPFISHWHITE); operation.HelpFishBlackList = GetAccountList(objXmlDoc, Constants.FISH_HELPFISHBLACK); operation.HelpFishAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.FISH_HELPFISHALL)); operation.PresentFishId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.FISH_PRESENTFISHID)); //cafe operation.HireWhiteList = GetAccountList(objXmlDoc, Constants.CAFE_HIREWHITE); operation.HireBlackList = GetAccountList(objXmlDoc, Constants.CAFE_HIREBLACK); operation.HireAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CAFE_HIREALL)); operation.PurchaseWhiteList = GetAccountList(objXmlDoc, Constants.CAFE_PURCHASEWHITE); operation.PurchaseBlackList = GetAccountList(objXmlDoc, Constants.CAFE_PURCHASEBLACK); operation.PurchaseAll = DataConvert.GetBool(GetInnerText(objXmlDoc, Constants.CAFE_PURCHASEALL)); operation.PresentFoodId = DataConvert.GetInt32(GetInnerText(objXmlDoc, Constants.CAFE_PRESENTFOODID)); return operation; } catch (Exception ex) { LogHelper.Write("读取黑白名单配置" + account.UserName, ex); return null; } }
public static bool SetOperation(string groupname, OperationInfo operation) { try { if (operation.Email == null || operation.Email == string.Empty) return false; XmlDocument objXmlDoc = GetOperationConfigFile(groupname, operation.Email, operation.Password); if (objXmlDoc == null) return false; //email SetInnerText(objXmlDoc, Constants.ACCOUNT_EMAIL, operation.Email); //password SetInnerText(objXmlDoc, Constants.ACCOUNT_PASSWORD, operation.Password); //park SetAccountList(objXmlDoc, Constants.PARK_PARKWHITE, operation.ParkWhiteList); SetAccountList(objXmlDoc, Constants.PARK_PARKBLACK, operation.ParkBlackList); SetAccountList(objXmlDoc, Constants.PARK_POSTLIST, operation.PostList); SetInnerText(objXmlDoc, Constants.PARK_POSTALL, operation.PostAll.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_PARKINGDELAYTIME, operation.ParkingDelayTime.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_PARKMYCARS, operation.ParkMyCars.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_POSTOTHERSCARS, operation.PostOthersCars.ToString()); //bite SetAccountList(objXmlDoc, Constants.BITE_BITEWHITE, operation.BiteWhiteList); SetAccountList(objXmlDoc, Constants.BITE_BITEBLACK, operation.BiteBlackList); SetAccountList(objXmlDoc, Constants.BITE_RECOVERWHITE, operation.RecoverWhiteList); SetAccountList(objXmlDoc, Constants.BITE_RECOVERBLACK, operation.RecoverBlackList); SetInnerText(objXmlDoc, Constants.BITE_BITEALL, operation.BiteAll.ToString()); SetInnerText(objXmlDoc, Constants.BITE_PROTECTID, operation.ProtectId.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_APPROVERECOVERY, operation.ApproveRecovery.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_BITEOTHERS, operation.BiteOthers.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_AUTORECOVER, operation.AutoRecover.ToString()); //slave SetAccountList(objXmlDoc, Constants.SLAVE_BUYWHITE, operation.BuyWhiteList); SetAccountList(objXmlDoc, Constants.SLAVE_BUYBLACK, operation.BuyBlackList); //SetInnerText(objXmlDoc, Constants.CONFIG_MAXSLAVES, operation.MaxSlaves.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_NICKNAME, operation.NickName.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_BUYSLAVE, operation.BuySlave.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_BUYLOWPRICESLAVE, operation.BuyLowPriceSlave.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_PROPITIATESLAVE, operation.PropitiateSlave.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_AFFLICTSLAVE, operation.AfflictSlave.ToString()); //SetInnerText(objXmlDoc, Constants.CONFIG_RELEASESLAVE, operation.ReleaseSlave.ToString()); //house SetAccountList(objXmlDoc, Constants.HOUSE_STAYWHITE, operation.StayWhiteList); SetAccountList(objXmlDoc, Constants.HOUSE_STAYBLACK, operation.StayBlackList); SetAccountList(objXmlDoc, Constants.HOUSE_ROBWHITE, operation.RobWhiteList); SetAccountList(objXmlDoc, Constants.HOUSE_ROBBLACK, operation.RobBlackList); //garden SetAccountList(objXmlDoc, Constants.GARDEN_STEALWHITE, operation.StealWhiteList); SetAccountList(objXmlDoc, Constants.GARDEN_STEALBLACK, operation.StealBlackList); SetInnerText(objXmlDoc, Constants.GARDEN_STEALALL, operation.StealAll.ToString()); SetAccountList(objXmlDoc, Constants.GARDEN_FARMWHITE, operation.FarmWhiteList); SetAccountList(objXmlDoc, Constants.GARDEN_FARMBLACK, operation.FarmBlackList); SetInnerText(objXmlDoc, Constants.GARDEN_FARMALL, operation.FarmAll.ToString()); SetInnerText(objXmlDoc, Constants.GARDEN_PRESENTID, operation.PresentId.ToString()); //ranch SetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHWHITE, operation.HelpRanchWhiteList); SetAccountList(objXmlDoc, Constants.RANCH_HELPRANCHBLACK, operation.HelpRanchBlackList); SetInnerText(objXmlDoc, Constants.RANCH_HELPRANCHALL, operation.HelpRanchAll.ToString()); SetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTWHITE, operation.StealProductWhiteList); SetAccountList(objXmlDoc, Constants.RANCH_STEALPRODUCTBLACK, operation.StealProductBlackList); SetInnerText(objXmlDoc, Constants.RANCH_STEALPRODUCTALL, operation.StealProductAll.ToString()); SetInnerText(objXmlDoc, Constants.RANCH_PRESENTPRODUCTID, operation.PresentProductId.ToString()); //fish SetAccountList(objXmlDoc, Constants.FISH_FISHINGWHITE, operation.FishingWhiteList); SetAccountList(objXmlDoc, Constants.FISH_FISHINGBLACK, operation.FishingBlackList); SetInnerText(objXmlDoc, Constants.FISH_FISHINGALL, operation.FishingAll.ToString()); SetAccountList(objXmlDoc, Constants.FISH_HELPFISHWHITE, operation.HelpFishWhiteList); SetAccountList(objXmlDoc, Constants.FISH_HELPFISHBLACK, operation.HelpFishBlackList); SetInnerText(objXmlDoc, Constants.FISH_HELPFISHALL, operation.HelpFishAll.ToString()); SetInnerText(objXmlDoc, Constants.FISH_PRESENTFISHID, operation.PresentFishId.ToString()); //cafe SetAccountList(objXmlDoc, Constants.CAFE_HIREWHITE, operation.HireWhiteList); SetAccountList(objXmlDoc, Constants.CAFE_HIREBLACK, operation.HireBlackList); SetInnerText(objXmlDoc, Constants.CAFE_HIREALL, operation.HireAll.ToString()); SetAccountList(objXmlDoc, Constants.CAFE_PURCHASEWHITE, operation.PurchaseWhiteList); SetAccountList(objXmlDoc, Constants.CAFE_PURCHASEBLACK, operation.PurchaseBlackList); SetInnerText(objXmlDoc, Constants.CAFE_PURCHASEALL, operation.PurchaseAll.ToString()); SetInnerText(objXmlDoc, Constants.CAFE_PRESENTFOODID, operation.PresentFoodId.ToString()); return SetOperationConfigFile(objXmlDoc, groupname, operation.Email); } catch (Exception ex) { LogHelper.Write("读取黑白名单配置" + operation.Account.UserName, ex); return false; } }
public void OperationNodeSelected(OperationInfo operation) { if (!IsHiding()) { _propertyForm.Operation = operation; _propertyForm.Show(dockPanel); } }