Ejemplo n.º 1
0
        AddDAType(tDAType[] tmpl)
        {
            var ignored = new System.Collections.Generic.List <tDAType> ();
            var toadd   = new System.Collections.ArrayList();

            tDAType dt = new tDAType();;

            if (tmpl == null)
            {
                dt.iedType = "TEMPLATE";
                dt.id      = "TEMPLATE.DAType" + tDataTypeTemplates.ndat++;
            }

            if (dATypeField == null && tmpl != null)
            {
                dATypeField = new tDAType[tmpl.Length];
                tmpl.CopyTo(dATypeField, 0);
                return(ignored);
            }

            if (dATypeField == null && tmpl == null)
            {
                dATypeField     = new tDAType[1];
                dATypeField [0] = dt;
                return(ignored);
            }

            if (dATypeField != null && tmpl != null)
            {
                for (int i = 0; i < tmpl.Length; i++)
                {
                    int j = this.GetDOType(tmpl [i].id);
                    if (j >= 0)
                    {
                        ignored.Add(tmpl [i]);
                        continue;
                    }
                    else
                    {
                        toadd.Add(tmpl [i]);
                    }
                }
            }

            if (dATypeField != null && tmpl == null)
            {
                toadd.Add(dt);
            }

            int index = this.dATypeField.Length;

            System.Array.Resize <tDAType>(ref this.dATypeField,
                                          this.dATypeField.Length + toadd.Count);

            for (int i = 0; i < toadd.Count; i++)
            {
                this.dATypeField[i + index] = (tDAType)toadd[i];
            }
            return(ignored);
        }
Ejemplo n.º 2
0
 public int GetDAType(string id)
 {
     if (this.dATypeField == null)
     {
         return(-1);
     }
     for (int i = 0; i < this.dATypeField.Length; i++)
     {
         tDAType dat = this.dATypeField[i];
         if (dat.id.Equals(id))
         {
             return(i);
         }
     }
     return(-1);
 }