Nanook.TheGhost.ProjectSong.replaceQbItems C# (CSharp) Method

replaceQbItems() private method

private replaceQbItems ( QbItemArray a, int items, bool split, int splitBy ) : void
a Nanook.QueenBee.Parser.QbItemArray
items int
split bool
splitBy int
return void
        private void replaceQbItems(QbItemArray a, int[] items, bool split, int splitBy)
        {
            a.Items.Clear();

            //no items to add
            if (items.Length == 0)
            {
                QbItemFloats f = new QbItemFloats(a.Root);
                f.Create(QbItemType.Floats);
                a.AddItem(f);
                a.Root.AlignPointers();
            }
            else
            {
                if (!split)
                {
                    //add array to parent as one large array
                    QbItemInteger qi = new QbItemInteger(a.Root);
                    qi.Create(QbItemType.ArrayInteger);
                    qi.Values = convertIntArrayToUIntArray(items);
                    a.AddItem(qi);
                    a.Root.AlignPointers();
                }
                else
                {
                    //split array down in to blocks of <splitBy>
                    QbItemInteger qi;
                    QbItemArray aa = new QbItemArray(a.Root);
                    aa.Create(QbItemType.ArrayArray);
                    uint[] uints;
                    a.AddItem(aa);
                    a.Root.AlignPointers();

                    for (int i = 0; i < items.Length; i += splitBy)
                    {
                        qi = new QbItemInteger(a.Root);
                        qi.Create(QbItemType.ArrayInteger);
                        uints = new uint[splitBy];
                        for (int j = 0; j < splitBy; j++)
                            uints[j] = (uint)items[i + j];
                        qi.Values = uints;
                        aa.AddItem(qi);
                        a.Root.AlignPointers();
                    }

                }
            }
        }

Same methods

ProjectSong::replaceQbItems ( QbItemArray a, int items, bool split ) : void