private System.Collections.Generic.List <tIED> AddIED(tIED[] array, string iedVersion, string iedRevision) { if (array == null) { return(null); } System.Collections.Generic.List <tIED> ignored; System.Collections.ArrayList toadd; ignored = new System.Collections.Generic.List <tIED>(); toadd = new System.Collections.ArrayList(); if (this.iEDField != null) { for (int i = 0; i < array.Length; i++) { int j = this.GetIED(array[i].name); if (j >= 0) { ignored.Add(array[i]); continue; } else { toadd.Add(array[i]); } } int index = this.iEDField.Length; System.Array.Resize <tIED>(ref this.iEDField, this.iEDField.Length + toadd.Count); // Setup History items to add this.Header.UpdateRevision(); tHitem item = new tHitem(); item.version = this.Header.version; item.revision = this.Header.revision; item.what = "Configured IEDs"; string why = " [ConfVer:" + iedVersion + " ConfRev:" + iedRevision; for (int i = 0; i < toadd.Count; i++) { // Set value and item to add this.iEDField[i + index] = (tIED)toadd[i]; item.why = "Added IED: " + this.iEDField[i + index].name + why; this.Header.AddHistoryItem(item); } } else { this.iEDField = (tIED[])toadd.ToArray(); } return(ignored); }
/// <summary> /// Add a tHitem object to History. /// </summary> /// <param name="item"> /// A <see cref="tHitem"/> object to add. /// </param> /// <returns> /// A <see cref="System.Int32"/> index of the added item. /// </returns> public int AddHistoryItem(tHitem item) { int index = -1; if (this.historyField != null) { System.Array.Resize <tHitem>(ref this.historyField, this.historyField.Length + 1); index = this.historyField.Length - 1; } else { this.historyField = new tHitem[1]; index = 0; } this.historyField[index] = item; return(index); }