Exemple #1
0
 public override void OnEval()
 {
     if (FInput.IsConnected && (FInput.SliceCount != 0))
     {
         FValid.SliceCount = FInput.SliceCount;
         for (int i = 0; i < FInput.SliceCount; i++)
         {
             FValid[i] = FInput[i] is PrimitiveObject;
             if (FValid[i])
             {
                 CurrObj = i;
                 GetObject(FInput[i] as PrimitiveObject);
             }
         }
     }
     else
     {
         FValid.SliceCount = 0;
         for (int ii = 0; ii < TypesAndFields.Count; ii++)
         {
             Type      type       = IdentityType.Instance[TypesAndFields[ii][0]];
             string    name       = TypesAndFields[ii][1];
             NGISpread currspread = Spreads[name];
             currspread.SliceCount = 0;
         }
     }
 }
Exemple #2
0
        public void SetObject(PrimitiveObject pro)
        {
            int i = CurrObj;

            for (int ii = 0; ii < Spreads.Count; ii++)
            {
                string    name       = TypesAndFields[ii][1];
                NGISpread currspread = (NGISpread)Spreads[name][i];

                List <object> objl = pro[name];
                if (currspread.SliceCount != objl.Count)
                {
                    objl.Clear();
                    for (int j = 0; j < currspread.SliceCount; j++)
                    {
                        objl.Add(currspread[j]);
                    }
                }
                else
                {
                    for (int j = 0; j < currspread.SliceCount; j++)
                    {
                        objl[j] = currspread[j];
                    }
                }
            }
        }
Exemple #3
0
        public void GetObject(PrimitiveObject pro)
        {
            int i = CurrObj;

            for (int ii = 0; ii < TypesAndFields.Count; ii++)
            {
                Type      type       = IdentityType.Instance[TypesAndFields[ii][0]];
                string    name       = TypesAndFields[ii][1];
                NGISpread currspread = Spreads[name];
                currspread.SliceCount = FInput.SliceCount;
                NGISpread currvalues = (NGISpread)currspread[i];

                if (pro.Fields.ContainsKey(name))
                {
                    List <object> objl = pro[name];
                    currvalues.SliceCount = objl.Count;

                    for (int j = 0; j < currvalues.SliceCount; j++)
                    {
                        currvalues[j] = objl[j];
                    }
                }
                else
                {
                    currvalues.SliceCount = 0;
                }
            }
        }
Exemple #4
0
        public void ChangePins()
        {
            TypesAndFields.Clear();

            string def = "";

            if (FDefinition[0] != null)
            {
                def = FDefinition[0];
            }
            string[] tempfields = def.Trim().Split(',');

            int           order      = 100;
            List <string> fieldnames = new List <string>();

            foreach (string field in tempfields)
            {
                string[] typefieldpair = field.Trim().Split(' ');
                if (typefieldpair.Length == 2)
                {
                    typefieldpair[0] = typefieldpair[0].Trim();
                    typefieldpair[0] = typefieldpair[0].ToLower();
                    typefieldpair[1] = typefieldpair[1].Trim();

                    if (IdentityType.Instance.ContainsKey(typefieldpair[0]) && (!fieldnames.Contains(typefieldpair[1].ToLower())))
                    {
                        fieldnames.Add(typefieldpair[1].ToLower());
                        TypesAndFields.Add(typefieldpair);

                        if (!Spreads.ContainsKey(typefieldpair[1]))
                        {
                            Type         currtype   = IdentityType.Instance[typefieldpair[0]];
                            Type         pinType    = typeof(ISpread <>).MakeGenericType((typeof(ISpread <>)).MakeGenericType(currtype));
                            IIOContainer currpin    = FIOFactory.CreateIOContainer(pinType, PinAttribute(typefieldpair[1], order));
                            NGISpread    currspread = currpin.ToISpread();
                            Spreads.Add(typefieldpair[1], currspread);
                            Pins.Add(typefieldpair[1], currpin);
                        }
                    }
                }
                order++;
            }
            List <string> Removable = new List <string>();

            foreach (string k in Spreads.Keys)
            {
                if (!fieldnames.Contains(k.ToLower()))
                {
                    Removable.Add(k);
                }
            }
            foreach (string k in Removable)
            {
                Spreads.Remove(k);
                Pins[k].Dispose();
                Pins.Remove(k);
            }
        }
Exemple #5
0
        public void SetObject(PrimitiveObject pro)
        {
            int i = CurrObj;

            for (int ii = 0; ii < Spreads.Count; ii++)
            {
                Type      type       = IdentityType.Instance[TypesAndFields[ii][0]];
                string    name       = TypesAndFields[ii][1];
                NGISpread currspread = (NGISpread)Spreads[name][i];

                if (pro.Fields.ContainsKey(name))
                {
                    List <object> objl = pro[name];
                    if (currspread.SliceCount != objl.Count)
                    {
                        objl.Clear();
                        for (int j = 0; j < currspread.SliceCount; j++)
                        {
                            objl.Add(currspread[j]);
                        }
                    }
                    else
                    {
                        for (int j = 0; j < currspread.SliceCount; j++)
                        {
                            objl[j] = currspread[j];
                        }
                    }
                }
                else
                {
                    if (FNotExist[0] == ManageNotExisting.Create)
                    {
                        List <object> objl = new List <object>();
                        for (int j = 0; j < currspread.SliceCount; j++)
                        {
                            objl.Add(currspread[j]);
                        }
                        pro.Add(name, objl);
                    }
                }
            }
        }
Exemple #6
0
        public PrimitiveObject ConstructObject()
        {
            int             i   = CurrObj;
            PrimitiveObject pro = new PrimitiveObject();

            for (int ii = 0; ii < Spreads.Count; ii++)
            {
                List <object> objl       = new List <object>();
                string        type       = TypesAndFields[ii][0];
                string        name       = TypesAndFields[ii][1];
                NGISpread     currspread = (NGISpread)Spreads[name][i];
                objl.Clear();
                for (int j = 0; j < currspread.SliceCount; j++)
                {
                    objl.Add(currspread[j]);
                }
                pro.Fields.Add(TypesAndFields[ii][1], objl);
            }
            return(pro);
        }
Exemple #7
0
 public SpreadPin(NGISpread spread, IOAttribute attr, IIOContainer ioc)
 {
     Attributes  = attr;
     IOContainer = ioc;
     Spread      = spread;
 }