public int IndexOf(IntentData.Property property, object propertyValue) { for (int i = 0; i < this.Count; i++) { switch (property) { case IntentData.Property.SdkId: if (this[i].IntentSDKId == (uint?)propertyValue) { return(i); } else { continue; } case IntentData.Property.IntentType: if (this[i].IntentType.ToLower() == propertyValue.ToString().ToLower().Trim()) { return(i); } else { continue; } case IntentData.Property.IntentName: if (this[i].IntentName.ToLower() == propertyValue.ToString().ToLower().Trim()) { return(i); } else { continue; } case IntentData.Property.IntentLabel: if (this[i].IntentLabel.ToLower() == propertyValue.ToString().ToLower().Trim()) { return(i); } else { continue; } case IntentData.Property.MinimumVersion: default: if (this[i].MinVersion.ToLower() == propertyValue.ToString().ToLower().Trim()) { return(i); } else { continue; } } } return(-1); }
public List <string> ListAll(IntentData.Property property) { List <string> result = new List <string>(); foreach (IntentData intent in this) { switch (property) { case IntentData.Property.SdkId: if ((intent.IntentSDKId != null) && (!result.Contains(intent.IntentSDKId.ToString()))) { result.Add(intent.IntentSDKId.ToString()); } break; case IntentData.Property.IntentType: if ((!string.IsNullOrEmpty(intent.IntentType)) && (!result.Contains(intent.IntentType.Sanitize()))) { result.Add(intent.IntentType.Sanitize()); } break; case IntentData.Property.IntentName: if ((!string.IsNullOrEmpty(intent.IntentName)) && (!result.Contains(intent.IntentName.Sanitize()))) { result.Add(intent.IntentName.Sanitize()); } break; case IntentData.Property.IntentLabel: if ((!string.IsNullOrEmpty(intent.IntentLabel)) && (!result.Contains(intent.IntentLabel.Sanitize()))) { result.Add(intent.IntentLabel.Sanitize()); } break; case IntentData.Property.MinimumVersion: default: if ((!string.IsNullOrEmpty(intent.MinVersion)) && (!result.Contains(intent.MinVersion.Trim()))) { result.Add(intent.MinVersion.Trim()); } break; } } return(result); }
public IntentData GetIntentBy(IntentData.Property property, object propertyValue) { int index = this.IndexOf(property, propertyValue); return((index != -1) ? this[index] : null); }
public bool Contains(IntentData.Property property, object propertyValue) { return(this.IndexOf(property, propertyValue) != -1); }
public void SortIntents(IntentData.Property sortProperty = IntentData.Property.IntentName) { this.Sort(new IntentComparer(sortProperty)); }
public IntentComparer(IntentData.Property compareProperty) { this.compareProperty = compareProperty; }