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); } } }
// 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? }
private static void add_contents_r(ArrayList list, ByTable c, Type t) { foreach (Base_Static ent in c.__GetRawEnum()) { if (t == null || t.IsInstanceOfType(ent)) { list.Add(ent); } add_contents_r(list, ent.contents, t); } }