/// <summary> /// Modifies the MVCode collection with specified MVCodes (given as string list). /// </summary> /// <param name="mvCodes">MVCode collection</param> /// <param name="itemsToProcess">Items to add or remove</param> /// <param name="adding">Given items should be added (true) or removed (false)</param> private static void Modify(IList <MVCode> mvCodes, string itemsToProcess, bool adding) { if (null == mvCodes || null == itemsToProcess) { return; } string[] items = itemsToProcess.Split(new char[] { ',', ';', '|' }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in items) { MVCode mvCode = MVCodeHelper.ParseSafe(item); MVClass mvClass = MVClassHelper.ParseSafe(item); if (MVCode.INVALID != mvCode) { if (adding && !mvCodes.Contains(mvCode)) { mvCodes.Add(mvCode); } if (!adding && mvCodes.Contains(mvCode)) { mvCodes.Remove(mvCode); } } if (MVClass.INVALID != mvClass) { IEnumerator <MVCode> enumerator = MVEnumerator.GetCodesOfClass(mvClass); while (enumerator.MoveNext()) { MVCode current = enumerator.Current; if (current == MVCode.INVALID) { continue; } if (adding && !mvCodes.Contains(current)) { mvCodes.Add(current); } if (!adding && mvCodes.Contains(current)) { mvCodes.Remove(current); } } } } }
/// <summary> /// Initializes a new instance of the <see cref="MVClassOrMVCode" /> class. /// </summary> /// <param name="mvCode">The MVCode.</param> public MVClassOrMVCode(MVCode mvCode) : this(MVEnumerator.GetClass(mvCode), mvCode) { }