///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Pay functions ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static void Pay(BasePlayer player, BaseEntity entity, RemoveType removeType) { if (removeType == RemoveType.Admin || removeType == RemoveType.All) { return; } Dictionary <string, object> cost = GetCost(entity); List <Item> collect = new List <Item>(); foreach (KeyValuePair <string, object> pair in cost) { string itemname = pair.Key.ToLower(); if (displaynameToShortname.ContainsKey(itemname)) { itemname = displaynameToShortname[itemname]; } ItemDefinition itemdef = ItemManager.FindItemDefinition(itemname); if (itemdef == null) { continue; } player.inventory.Take(collect, itemdef.itemid, Convert.ToInt32(pair.Value)); player.Command(string.Format("note.inv {0} -{1}", itemdef.itemid.ToString(), pair.Value.ToString()), new object[0]); } foreach (Item item in collect) { item.Remove(0f); } }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Refund ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static void Refund(BasePlayer player, BaseEntity entity, RemoveType removeType) { if (removeType == RemoveType.All) { return; } if (refundDeployable && entity.GetComponentInParent <Deployable>() != null) { Deployable worlditem = entity.GetComponentInParent <Deployable>(); if (deployedToItem.ContainsKey(worlditem.gameObject.name)) { player.inventory.GiveItem(deployedToItem[worlditem.gameObject.name], 1, true); } } else if (refundStructure && entity is BuildingBlock) { BuildingBlock buildingblock = entity as BuildingBlock; if (buildingblock.blockDefinition == null) { return; } int buildingblockGrade = (int)buildingblock.grade; if (buildingblock.blockDefinition.grades[buildingblockGrade] != null && refundPercentage.ContainsKey(buildingblockGrade.ToString())) { decimal refundRate = decimal.Parse((string)refundPercentage[buildingblockGrade.ToString()]) / 100.0m; List <ItemAmount> currentCost = buildingblock.blockDefinition.grades[buildingblockGrade].costToBuild as List <ItemAmount>; foreach (ItemAmount ia in currentCost) { player.inventory.GiveItem(ia.itemid, Convert.ToInt32((decimal)ia.amount * refundRate), true); } } } }
public void Remove(RemoveType Type, int Col, string Match) { switch (Type) { case RemoveType.All: foreach (ListViewItem item in base.Items) { base.Items.Remove(item); } break; case RemoveType.Selected: foreach (ListViewItem item in base.SelectedItems) { base.Items.Remove(item); } break; case RemoveType.Matching: foreach (ListViewItem item in base.Items) { if (item.SubItems[Col].Text == Match) { base.Items.Remove(item); } } break; } for (int i = 0; i < this._embeddedControls.Count; i++) { EmbeddedControl control = (EmbeddedControl)this._embeddedControls[i]; control.Row = base.Items.IndexOf(control.Item); this._embeddedControls[i] = control; } }
/// <summary> /// 执行流程后 /// </summary> /// <param name="workflow">工作流</param> /// <param name="removeType">移除类型</param> /// <param name="isSuccess">是否成功</param> /// <param name="connectionId">连接ID</param> /// <param name="comData">通用数据</param> /// <returns>返回信息</returns> public override ReturnInfo <bool> AfterExecFlow(WorkflowInfo workflow, RemoveType removeType, bool isSuccess, CommonUseData comData = null, string connectionId = null) { if (isSuccess) { var currUser = UserTool <int> .GetCurrUser(comData); switch (removeType) { case RemoveType.REMOVE: case RemoveType.FORCE_REMOVE: return(FormService.RemoveByWorkflowId(workflow.Id, connectionId: connectionId, comData: comData)); case RemoveType.UNDO: ConcreteFormInfoT form = typeof(ConcreteFormInfoT).CreateInstance <ConcreteFormInfoT>(); form.WorkflowId = workflow.Id; form.FlowStatus = FlowStatusEnum.REVERSED; form.SetModifyInfo(currUser); return(FormService.ModifyFlowStatusByWorkflowId(form, connectionId: connectionId, comData: comData)); } } return(new ReturnInfo <bool>()); }
static bool CanPay(BasePlayer player, BaseEntity entity, RemoveType removeType) { if (removeType == RemoveType.Admin || removeType == RemoveType.All) { return(true); } Dictionary <string, object> cost = GetCost(entity); foreach (KeyValuePair <string, object> pair in cost) { string itemname = pair.Key.ToLower(); if (displaynameToShortname.ContainsKey(itemname)) { itemname = displaynameToShortname[itemname]; } ItemDefinition itemdef = ItemManager.FindItemDefinition(itemname); if (itemdef == null) { continue; } int amount = player.inventory.GetAmount(itemdef.itemid); if (amount < Convert.ToInt32(pair.Value)) { return(false); } } return(true); }
/// <summary> /// Used to retrieve the timespan for when a task is completed and should be removed. /// Converts RemoveType to TimeSpan. /// </summary> /// <param name="Type">Removal setting.</param> /// <returns>TimeSpan of how long after a task is completed to remove it.</returns> public static TimeSpan GetRemoveTimeSpan(RemoveType Type) { switch (Type) { case RemoveType.Never: { return(TimeSpan.Zero); } case RemoveType.Immediate: { return(TimeSpan.Zero); } case RemoveType.OneHour: { return(new TimeSpan(0, 1, 0, 0)); } case RemoveType.TwelveHours: { return(new TimeSpan(0, 12, 0, 0)); } case RemoveType.OneDay: { return(new TimeSpan(1, 0, 0, 0)); } case RemoveType.TwoDays: { return(new TimeSpan(2, 0, 0, 0)); } case RemoveType.OneWeek: { return(new TimeSpan(7, 0, 0, 0)); } case RemoveType.TwoWeeks: { return(new TimeSpan(14, 0, 0, 0)); } case RemoveType.OneMonth: { return(new TimeSpan(30, 0, 0, 0)); } case RemoveType.ThreeMonths: { return(new TimeSpan(90, 0, 0, 0)); } case RemoveType.SixMonths: { return(new TimeSpan(180, 0, 0, 0)); } case RemoveType.OneYear: { return(new TimeSpan(365, 0, 0, 0)); } default: { return(TimeSpan.Zero); } } }
internal RegistryKey(string name, RemoveType removeType, List <RegistryKey> keys, List <RegistryValue> values, Microsoft.Win32.RegistryView registryView) { KeyName = name; _removeType = removeType; Keys = new RegistryKeyCollection(keys); Values = new RegistryValueCollection(values); _registryView = registryView; }
public void Remove(RemoveType Type) { if (Type == RemoveType.Matching) { throw new ArgumentException("Must specify a column and type to match."); } this.Remove(Type, 0, ""); }
private static RegistryKey ReadRegistryKey(XmlReader reader) { Microsoft.Win32.RegistryView registryView = Microsoft.Win32.RegistryView.Default; RemoveType removeType = RemoveType.No; string name = string.Empty; List <RegistryKey> keys = new List <RegistryKey>(); List <RegistryValue> values = new List <RegistryValue>(); while (reader.MoveToNextAttribute()) { switch (reader.Name) { case KeyNameAttributeName: name = reader.ReadContentAsString(); break; case KeyRegistryViewAttributeName: registryView = reader.ReadContentAsEnum <Microsoft.Win32.RegistryView>(); break; case KeyRemoveTypeAttributeName: removeType = reader.ReadContentAsEnum <RemoveType>(); break; } } reader.MoveToElement(); while (reader.Read()) { if (reader.NodeType == XmlNodeType.EndElement && string.Equals(KeyElementName, reader.Name)) { break; } if (reader.NodeType != XmlNodeType.Element) { continue; } switch (reader.Name) { case KeyElementName: RegistryKey registryKey = ReadRegistryKey(reader); keys.Add(registryKey); break; case ValueElementName: RegistryValue registryValue = ReadRegistryValue(reader); values.Add(registryValue); break; } } RegistryKey registry = new RegistryKey(name, removeType, keys, values, registryView); return(registry); }
public RemoveBuffCombatNode(Actor source, TileNode targetedTile, bool removetrait, bool removeall, string key, string tag, RemoveType type) : base(source, targetedTile) { this.removeall = removeall; this.removetrait = removetrait; this.removeBuff = type; this.key = key; this.tag = tag; }
public override string ToString() { var properties = new Dictionary <string, string> { { "RemoveType", RemoveType.ToString() }, { "FileGlobs", StringifyList(FileGlobs) } }; return(StringifyValues(GetType().ToString(), properties)); }
public override bool Equals(object obj) { var other = obj as RemoveNode; if (other == null) { return(false); } return(RemoveType.Equals(other.RemoveType) && ListsAreEqual(FileGlobs, other.FileGlobs)); }
public RemoveButton(int id, RemoveType removeType) { HorizontalAlignment = HorizontalAlignment.Right; Content = " - "; Name = $"BId{id}"; ToolTip = $"Могат да се изтриват само {toolTipParams[(int)removeType]}, които нямат {toolTipParams[(int)removeType + 1]}."; FontSize = 18; FontWeight = FontWeights.ExtraBold; Padding = new Thickness(2); Background = new SolidColorBrush(Colors.OrangeRed); }
static object CanRemoveEntity(BasePlayer player, BaseEntity entity, RemoveType removeType) { if (entity.isDestroyed) { return("Entity is already destroyed"); } if (removeType == RemoveType.Admin || removeType == RemoveType.All) { return(true); } var externalPlugins = Interface.CallHook("canRemove", player); if (externalPlugins != null) { return(externalPlugins is string?(string)externalPlugins : MessageErrorExternalBlock); } if (raidBlockedPlayers[player] != null) { if (raidBlockedPlayers[player] > UnityEngine.Time.realtimeSinceStartup) { return(string.Format(MessageRaidBlocked, Mathf.Ceil(raidBlockedPlayers[player] - UnityEngine.Time.realtimeSinceStartup).ToString())); } raidBlockedPlayers.Remove(player); } if (entity is BuildingBlock && useBuildingOwners) { var returnhook = Interface.GetMod().CallHook("FindBlockData", new object[] { entity as BuildingBlock }); if (returnhook is string) { string ownerid = (string)returnhook; if (player.userID.ToString() == ownerid) { return(true); } if (useRustIO && RustIOIsInstalled()) { if (HasFriend(ownerid, player.userID.ToString())) { return(true); } } } } if (useToolCupboard) { if (hasTotalAccess(player)) { return(true); } } return(MessageErrorNotAllowedToRemove); }
public void RemovePlayerSpawnersFromExisting([EnumToggleButtons] RemoveType type = RemoveType.all) { if (type == RemoveType.all) { foreach (PlayerRespawner VARIABLE in _playerSpawners) { VARIABLE.IsFirstSpawner = false; } } else { for (var i = 1; i < _playerSpawners.Count; i++) { _playerSpawners[i].IsFirstSpawner = false; } } Check(); }
public void Remove(Tag tag, RemoveType type) { if (tag.Parent == null) { return; } if (type == RemoveType.ConnectRelatedChildrenToParent) { ConnectChildrenToParent(tag); } else { RemoveChildren(tag); } RemoveFromDictonary(tag); OnTagRemoved(tag); DisconnectFromParent(tag); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /// Remove functions ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static void TryRemove(BasePlayer player, Ray ray, RemoveType removeType, float distance) { BaseEntity removeObject = FindRemoveObject(ray, distance); if (removeObject == null) { PrintToChat(player, MessageErrorNothingToRemove); return; } var success = CanRemoveEntity(player, removeObject, removeType); if (success is string) { PrintToChat(player, (string)success); return; } if (usePay && !CanPay(player, removeObject, removeType)) { PrintToChat(player, MessageErrorNotEnoughPay); return; } if (removeType == RemoveType.All) { Interface.Call("RemoveAllFrom", removeObject.transform.position); return; } if (usePay) { Pay(player, removeObject, removeType); } if (useRefund) { Refund(player, removeObject, removeType); } DoRemove(removeObject); }
public virtual ReturnInfo <bool> BeforeExecFlow(WorkflowInfo workflow, RemoveType removeType, string connectionId = null) { return(new ReturnInfo <bool>()); }
public void Remove(RemoveType Type, int Col, string Match) { switch (Type) { case RemoveType.All: foreach (ListViewItem item in base.Items) { base.Items.Remove(item); } break; case RemoveType.Selected: foreach (ListViewItem item in base.SelectedItems) { base.Items.Remove(item); } break; case RemoveType.Matching: foreach (ListViewItem item in base.Items) { if (item.SubItems[Col].Text == Match) { base.Items.Remove(item); } } break; } for (int i = 0; i < this._embeddedControls.Count; i++) { EmbeddedControl control = (EmbeddedControl) this._embeddedControls[i]; control.Row = base.Items.IndexOf(control.Item); this._embeddedControls[i] = control; } }
void cmdChatRemove(BasePlayer player, string command, string[] args) { int removeTime = RemoveTimeDefault; BasePlayer target = player; RemoveType removetype = RemoveType.Normal; int distanceRemove = playerDistanceRemove; if (args.Length != 0) { switch (args[0]) { case "admin": if (!hasAccess(player, adminPermission, adminAuthLevel)) { return; } removetype = RemoveType.Admin; distanceRemove = adminDistanceRemove; if (args.Length > 1) { int.TryParse(args[1], out removeTime); } break; case "all": if (!hasAccess(player, allPermission, adminAuthLevel)) { return; } removetype = RemoveType.All; distanceRemove = allDistanceRemove; if (args.Length > 1) { int.TryParse(args[1], out removeTime); } break; case "target": if (!hasAccess(player, targetPermission, adminAuthLevel)) { return; } if (args.Length == 1) { SendReply(player, "/remove target PLAYERNAME/STEAMID optional:Time"); return; } BasePlayer tempTarget = null; var success = FindOnlinePlayer(args[1], out tempTarget); if (success is string) { SendReply(player, (string)success); return; } target = tempTarget; if (args.Length > 2) { int.TryParse(args[2], out removeTime); } break; default: if (!hasAccess(player, normalPermission, playerAuthLevel)) { return; } if (overrideDisabled) { SendReply(player, MessageOverrideDisabled); return; } int.TryParse(args[0], out removeTime); break; } } if (removeTime > MaxRemoveTime) { removeTime = MaxRemoveTime; } ToolRemover toolremover = target.GetComponent <ToolRemover>(); if (toolremover != null && args.Length == 0) { EndRemoverTool(target); SendReply(player, string.Format(MessageToolDeactivated, target.displayName)); return; } if (toolremover == null) { toolremover = target.gameObject.AddComponent <ToolRemover>(); } toolremover.endTime = removeTime; toolremover.removeType = removetype; toolremover.playerActivator = player; toolremover.distance = (int)distanceRemove; toolremover.RefreshDestroy(); }
public void RemoveObject(OutputArray _Dst, int Under, int Over, RemoveType Type) { Mat Dst = _Dst.GetMat(); unsafe { bool[] SaveLabel = new bool[_Stats.Rows]; SaveLabel[0] = false; for (int H = 1, ObjArea = 0; H < _Stats.Rows; H++) { IntPtr ptr = _Stats.Ptr(H); int * p = (int *)ptr.ToPointer(); ObjArea = p[4]; switch ((int)Type) { case 0: if (Under <= ObjArea && ObjArea <= Over) { SaveLabel[H] = true; } break; case 1: if (Under > ObjArea || ObjArea > Over) { SaveLabel[H] = true; } break; default: break; } } for (int H = 0; H < _Label.Rows; H++) { IntPtr ptr = _Label.Ptr(H); IntPtr Dst_ptr = Dst.Ptr(H); int * p = (int *)ptr.ToPointer(); byte * Dst_p = (byte *)Dst_ptr.ToPointer(); for (int W = 0; W < _Label.Cols; W++) { if (SaveLabel[p[W]]) { Dst_p[W] = 255; } else { Dst_p[W] = 0; } } } foreach (bool IsSave in SaveLabel) { if (!IsSave) { _RemoveObjCount++; } } } }
/// <summary> /// 执行流程后 /// </summary> /// <param name="workflow">工作流</param> /// <param name="removeType">移除类型</param> /// <param name="isSuccess">是否成功</param> /// <param name="connectionId">连接ID</param> /// <param name="currUser">当前用户</param> /// <returns>返回信息</returns> public virtual ReturnInfo <bool> AfterExecFlow(WorkflowInfo workflow, RemoveType removeType, bool isSuccess, string connectionId = null, BasicUserInfo <int> currUser = null) { return(new ReturnInfo <bool>()); }
public abstract bool RemoveCache(string objName, Type type, RemoveType removeType);
/// <summary> /// Delete video /// </summary> private void deleteVideo(RemoveType type) { var video = dataController.Videos.ElementAt(Position - 1); dataController.RemoveVideo(video, type); this.videoChange(); this.Max = Convert.ToInt32(dataController.VideosCount); }
private void RemoveImpact(CharacterInfo target, int id, RemoveType removeType) { List <ImpactInfo> impactInfos = target.GetSkillStateInfo().GetAllImpact(); if (-1 == id) { ImpactSystem.Instance.StopAllImpact(target); } else { switch (removeType) { case RemoveType.IMPACT_ID: for (int i = 0; i < impactInfos.Count; i++) { if (impactInfos[i].m_ImpactId == id) { ImpactSystem.Instance.StopImpactById(target, impactInfos[i].m_ImpactId); } } /* * foreach (ImpactInfo impact in target.GetSkillStateInfo().GetAllImpact()) { * if (-1 == id || impact.m_ImpactId == id) { * ImpactSystem.Instance.StopImpactById(target, impact.m_ImpactId); * } * }*/ break; case RemoveType.LOGIC_ID: for (int i = 0; i < impactInfos.Count; i++) { if (impactInfos[i].ConfigData.ImpactLogicId == id) { ImpactSystem.Instance.StopImpactById(target, impactInfos[i].m_ImpactId); } } /* * foreach (ImpactInfo impact in target.GetSkillStateInfo().GetAllImpact()) { * if (-1 == id || impact.ConfigData.ImpactLogicId == id) { * ImpactSystem.Instance.StopImpactById(target, impact.m_ImpactId); * } * }*/ break; case RemoveType.GFX_ID: for (int i = 0; i < impactInfos.Count; i++) { if (impactInfos[i].ConfigData.ImpactGfxLogicId == id) { ImpactSystem.Instance.StopImpactById(target, impactInfos[i].m_ImpactId); } } /* * foreach (ImpactInfo impact in target.GetSkillStateInfo().GetAllImpact()) { * if (-1 == id || impact.ConfigData.ImpactGfxLogicId == id) { * ImpactSystem.Instance.StopImpactById(target, impact.m_ImpactId); * } * }*/ break; } } }
public bool RemoveCache <T>(string obj, RemoveType removeType) where T : UnityEngine.Object => default;
/// <summary> /// Remvoe picture /// </summary> /// <param name="picture"></param> public void RemovePicture(Picture picture, RemoveType type) { //delete files Storage.DeleteFile(picture.Path); if (type == RemoveType.HardDelete) { //delete record baseData.Pictures.Remove(picture); this.Save(); OnPropertyChanged("PicturesCount"); OnPropertyChanged("Pictures"); } OnPropertyChanged("AvailableSpace"); }
/// <summary> /// 执行流程后 /// </summary> /// <param name="workflow">工作流</param> /// <param name="removeType">移除类型</param> /// <param name="isSuccess">是否成功</param> /// <param name="connectionId">连接ID</param> /// <param name="comData">通用数据</param> /// <returns>返回信息</returns> public virtual ReturnInfo <bool> AfterExecFlow(WorkflowInfo workflow, RemoveType removeType, bool isSuccess, CommonUseData comData = null, string connectionId = null) { return(new ReturnInfo <bool>()); }
/// <summary> /// Remvoe video /// </summary> /// <param name="video"></param> public void RemoveVideo(Video video, RemoveType type) { //delete files Storage.DeleteFile(video.Path); Storage.DeleteFile(video.Preview); if (type == RemoveType.HardDelete) { //delete record baseData.Videos.Remove(video); this.Save(); OnPropertyChanged("VideosCount"); OnPropertyChanged("Videos"); } OnPropertyChanged("AvailableSpace"); }