public int GetIndexByRuleId(RuleId id) { this.CheckSaved(); if (id == null) { ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Rules::Bind. {0} should not be null.", "id"); throw new ArgumentNullException(ServerStrings.ExNullParameter("id", 1)); } if (id.RuleIndex < this.data.Count) { Rule rule = this.data[id.RuleIndex]; if (rule.Id.Equals(id)) { return(id.RuleIndex); } } foreach (Rule rule2 in this) { if (rule2.Id.Equals(id)) { return(rule2.Id.RuleIndex); } } return(-1); }
public static RuleId Deserialize(string base64Id, int ruleIndex) { if (base64Id == null) { throw new ArgumentNullException(base64Id); } byte[] byteArrayId = StoreId.Base64ToByteArray(base64Id); return(RuleId.Deserialize(byteArrayId, ruleIndex)); }
public static RuleId Deserialize(byte[] byteArrayId, int ruleIndex) { if (byteArrayId == null) { throw new ArgumentNullException("byteArrayId"); } RuleId ruleId = new RuleId(); ruleId.Parse(byteArrayId, ruleIndex); return(ruleId); }
public Rule FindByRuleId(RuleId id) { this.CheckSaved(); if (id == null) { ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Rules::Bind. {0} should not be null.", "id"); throw new ArgumentNullException(ServerStrings.ExNullParameter("id", 1)); } int indexByRuleId = this.GetIndexByRuleId(id); if (indexByRuleId != -1) { return(this[indexByRuleId]); } throw new ObjectNotFoundException(ServerStrings.ExItemNotFound); }
public void Delete(RuleId id) { this.CheckSaved(); ExTraceGlobals.StorageTracer.Information((long)this.GetHashCode(), "Rules::Delete."); if (id == null) { ExTraceGlobals.StorageTracer.TraceError <string>(0L, "Rules::Delete. {0} should not be null.", "id"); throw new ArgumentNullException(ServerStrings.ExNullParameter("id", 1)); } int indexByRuleId = this.GetIndexByRuleId(id); if (indexByRuleId != -1) { this.data.RemoveAt(indexByRuleId); return; } throw new ObjectNotFoundException(ServerStrings.ExItemNotFound); }
public override bool Equals(object id) { RuleId ruleId = id as RuleId; return(ruleId != null && this.storeRuleId == ruleId.storeRuleId); }