Exemple #1
0
 public AdvDupeObject this [Int32 index]
 {
     get
     {
         if (index < 0)
         {
             return(new AdvDupeObject());
         }
         AdvDupeObject Obj = this._Values [index];
         if (Obj is null)
         {
             return(new AdvDupeObject());
         }
         else
         {
             return(Obj);
         }
     }
 }
Exemple #2
0
                public static AdvDupeObject getTable(Byte [] b, ref Int32 index, Dupe dupe)
                {
                    AdvDupeObject t   = new AdvDupeObject(new Table());
                    Object        Key = null;

                    do
                    {
                        Key = Read(b, ref index, dupe);
                        if (Key != null)
                        {
                            t.TypeTable.Add(Key.ToString(), Read(b, ref index, dupe));
                        }
                    } while (Key != null);
                    Int32 Size = dupe.RefrancedObjects.Length;

                    Array.Resize(ref dupe.RefrancedObjects, Size + 1);
                    dupe.RefrancedObjects [Size] = t;
                    return(new AdvDupeObject(new AdvDupeRefrence(dupe.RefrancedObjects [Size])));
                }//255
Exemple #3
0
                }//255

                public static AdvDupeObject getArray(Byte [] b, ref Int32 index, Dupe dupe)
                {
                    AdvDupeObject a   = new AdvDupeObject(new AdvDupeObject [0]);
                    AdvDupeObject Var = null;

                    do
                    {
                        Var = Read(b, ref index, dupe);
                        if (Var != null)
                        {
                            Int32 size = a.TypeArray.Length;
                            Array.Resize(ref a.RefTypeArray, size + 1);
                            a.TypeArray [size] = Var;
                        }
                    } while (Var == null);
                    Int32 Size = dupe.RefrancedObjects.Length;

                    Array.Resize(ref dupe.RefrancedObjects, Size + 1);
                    dupe.RefrancedObjects [Size] = a;
                    return(new AdvDupeObject(new AdvDupeRefrence(dupe.RefrancedObjects [Size])));
                }// 254
Exemple #4
0
 public AdvDupeRefrence(AdvDupeObject obj) => this._Ref = new WeakReference <AdvDupeObject>(obj);
Exemple #5
0
        private void CleanArraysUp()// Remove null spaces
        {
            Int32 [] Indexes      = new Int32 [0];
            Int32    LowestIndex  = Int32.MaxValue;
            Int32    HighestIndex = -1;

            for (Int32 x = 0; x < this._Keys.Length; x++)
            {
                if (this._Keys [x] == null)
                {
                    if (x > HighestIndex)
                    {
                        HighestIndex = x;
                    }
                    if (x < LowestIndex)
                    {
                        LowestIndex = x;
                    }
                    Int32 Len = Indexes.Length;
                    Array.Resize(ref Indexes, Len + 1);
                    Indexes [Len] = x;
                }
            } // scan for blanks
            Int32 NewLen = this._Keys.Length - Indexes.Length;

            String []        Copy_Keys   = new String [NewLen];
            AdvDupeObject [] Copy_Values = new AdvDupeObject [NewLen];
            switch (Indexes.Length)
            {
            case 1:
                if (HighestIndex == NewLen) // remove last object
                {
                    Array.Copy(this._Keys, 0, Copy_Keys, 0, NewLen);
                    Array.Copy(this._Values, 0, Copy_Values, 0, NewLen);
                    break;
                }
                if (LowestIndex == 0) // remove first object
                {
                    Array.Copy(this._Keys, 1, Copy_Keys, 0, NewLen);
                    Array.Copy(this._Values, 1, Copy_Values, 0, NewLen);
                    break;
                }
                {
                    Int32 pos = 0;
                    Int32 ind = 0;
                    for (; ind < this._Keys.Length; ind++)
                    {
                        if (ind == LowestIndex)
                        {
                            break;
                        }
                        else
                        {
                            Copy_Keys [ind]   = this._Keys [pos];
                            Copy_Values [ind] = this._Values [pos];
                            pos++;
                        }
                    }
                    Int32 rest = Copy_Keys.Length - pos;
                    Array.Copy(this._Keys, ind, Copy_Keys, pos, rest);
                    Array.Copy(this._Values, ind, Copy_Values, pos, rest);
                }
                break;

            case 2:
                if (HighestIndex == NewLen && LowestIndex == 0) // remove last object
                {
                    Array.Copy(this._Keys, 0, Copy_Keys, 0, NewLen);
                    Array.Copy(this._Values, 0, Copy_Values, 0, NewLen);
                    break;
                }
                {
                    Int32 pos = 0;
                    Int32 ind = 0;
                    for (; ind < this._Keys.Length; ind++)
                    {
                        if (ind == LowestIndex)
                        {
                            break;
                        }
                        else
                        {
                            Copy_Keys [pos]   = this._Keys [ind];
                            Copy_Values [pos] = this._Values [ind];
                            pos++;
                        }
                    }
                    for (; ind < this._Keys.Length; ind++)
                    {
                        if (ind == HighestIndex)
                        {
                            break;
                        }
                        else
                        {
                            Copy_Keys [pos]   = this._Keys [ind];
                            Copy_Values [pos] = this._Values [ind];
                            pos++;
                        }
                    }
                    Int32 rest = Copy_Keys.Length - pos;
                    Array.Copy(this._Keys, ind, Copy_Keys, pos, rest);
                    Array.Copy(this._Values, ind, Copy_Values, pos, rest);
                }
                break;

            default:
            {
                Boolean W;
                for (Int32 ind = 0, pos = 0; ind < this._Keys.Length; ind++)
                {
                    W = true;
                    for (Int32 x = 0; x < Indexes.Length; x++)
                    {
                        if (Indexes [x] == ind)
                        {
                            W = false;
                            break;
                        }
                    }
                    if (!W)
                    {
                        continue;
                    }
                    Copy_Keys [pos]   = this._Keys [ind];
                    Copy_Values [pos] = this._Values [pos];
                    pos++;
                }
            }
            break;
            } // remove blanks
            lock (this._Keys)
            {
                this._Keys   = Copy_Keys;
                this._Values = Copy_Values;
            }
        }