예제 #1
0
        public void Add(params object[] items)
        {
            if (items == null)
            {
                items = new object[] { null }
            }
            ;

            foreach (var item in items)
            {
                if (Lang13.IsNumber(item))
                {
                    object item2 = convert_number(item);
                    list_add(item2);
                }
                else if (item is ByTable)                   // we need to add the items from the other list...
                {
                    ByTable tab = (ByTable)item;

                    foreach (var k in tab.__GetRawEnum())
                    {
                        list_add(k);
                        if (tab.hash_haskey(k))
                        {
                            this.hash_set(k, tab.hash_get(k));
                        }
                    }
                }
                else
                {
                    list_add(item);
                }
            }
        }
예제 #2
0
        // LIKE ADD, IF YOU PASS A WHOLE TABLE, IT SHOULD ADD EVERY ITEM IN THE TABLE
        // UNLIKE ADD, ASSOCIATIVE VALUES SHOULD ONLY BE COPIED IF THE KEYS DO NOT EXIST YET!
        // THAT'S RIGHT, F**K YOU.
        public int Insert(int i, params object[] items)
        {
            if (items == null)
            {
                items = new object[] { null }
            }
            ;


            foreach (var item in items)
            {
                if (Lang13.IsNumber(item))
                {
                    object item2 = convert_number(item);
                    list_insert(i, item2);
                    i++;
                }
                else if (item is ByTable)                   // we need to add the items from the other list...
                {
                    ByTable tab = (ByTable)item;

                    // We need an actual arraylist to insert.
                    var       e = tab.__GetRawEnum();
                    ArrayList to_insert;
                    if (e is ArrayList)
                    {
                        to_insert = (ArrayList)e;
                    }
                    else
                    {
                        to_insert = new ArrayList();
                        foreach (var tmp in e)
                        {
                            to_insert.Add(tmp);
                        }
                    }

                    list_insert_range(i, to_insert);
                    i += tab.list_len();

                    foreach (var k in to_insert)
                    {
                        if (tab.hash_haskey(k) && !this.hash_haskey(k))
                        {
                            this.hash_set(k, tab.hash_get(k));
                        }
                    }
                }
                else
                {
                    list_insert(i, item);
                    i++;
                }
            }

            return(i);            // <- I think this is correct?
        }