Beispiel #1
0
        private void InsertToCollection(IEnumerable <string> listToAdd, ModelItem modelItem)
        {
            var modelProperty = modelItem.Properties["SystemInformationCollection"];

            if (modelProperty != null)
            {
                ModelItemCollection mic = modelProperty.Collection;

                if (mic != null)
                {
                    List <GatherSystemInformationTO> listOfValidRows = SystemInformationCollection.Where(c => !c.CanRemove()).ToList();
                    if (listOfValidRows.Count > 0)
                    {
                        GatherSystemInformationTO gatherSystemInformationTo = SystemInformationCollection.Last(c => !c.CanRemove());
                        int startIndex = SystemInformationCollection.IndexOf(gatherSystemInformationTo) + 1;
                        foreach (string s in listToAdd)
                        {
                            mic.Insert(startIndex, new GatherSystemInformationTO(SystemInformationCollection[startIndex - 1].EnTypeOfSystemInformation, s, startIndex + 1));
                            startIndex++;
                        }
                        CleanUpCollection(mic, modelItem, startIndex);
                    }
                    else
                    {
                        AddToCollection(listToAdd, modelItem);
                    }
                }
            }
        }
Beispiel #2
0
        void InsertToCollection(IEnumerable <string> listToAdd, ModelItem modelItem)
        {
            var modelProperty = modelItem.Properties["SystemInformationCollection"];

            if (modelProperty != null)
            {
                var mic = modelProperty.Collection;

                if (mic != null)
                {
                    var listOfValidRows = SystemInformationCollection.Where(c => !c.CanRemove()).ToList();
                    if (listOfValidRows.Count > 0)
                    {
                        var gatherSystemInformationTo = SystemInformationCollection.Last(c => !c.CanRemove());
                        var startIndex = SystemInformationCollection.IndexOf(gatherSystemInformationTo) + 1;
                        startIndex = InsertAllItems(listToAdd, mic, startIndex);
                        CleanUpCollection(mic, modelItem, startIndex);
                    }
                    else
                    {
                        AddToCollection(listToAdd, modelItem);
                    }
                }
            }
        }
Beispiel #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (SystemInformationCollection != null ? SystemInformationCollection.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #4
0
        // ReSharper restore RedundantOverridenMember

        private void CleanArgs()
        {
            int count = 0;

            while (count < SystemInformationCollection.Count)
            {
                if (string.IsNullOrWhiteSpace(SystemInformationCollection[count].Result))
                {
                    SystemInformationCollection.RemoveAt(count);
                }
                else
                {
                    count++;
                }
            }
        }
Beispiel #5
0
        public override void UpdateForEachOutputs(IList <Tuple <string, string> > updates)
        {
            if (updates != null)
            {
                foreach (Tuple <string, string> t in updates)
                {
                    // locate all updates for this tuple
                    Tuple <string, string> t1 = t;
                    var items = SystemInformationCollection.Where(c => !string.IsNullOrEmpty(c.Result) && c.Result.Equals(t1.Item1));

                    // issues updates
                    foreach (var a in items)
                    {
                        a.Result = t.Item2;
                    }
                }
            }
        }
Beispiel #6
0
 public int GetCollectionCount()
 {
     return(SystemInformationCollection.Count(caseConvertTo => !caseConvertTo.CanRemove()));
 }
Beispiel #7
0
        public override IList <DsfForEachItem> GetForEachOutputs()
        {
            var enumerable = SystemInformationCollection.Select(to => to.Result);

            return(GetForEachItems(enumerable.ToArray()));
        }
Beispiel #8
0
 public override List <string> GetOutputs() => SystemInformationCollection.Select(to => to.Result).ToList();