hds.DynamicArray.insertBefore C# (CSharp) Метод

insertBefore() публичный Метод

public insertBefore ( byte data ) : void
data byte
Результат void
        public void insertBefore(byte data)
        {
            byte[] d = {data};
            insertBefore(d);
        }

Usage Example

Пример #1
0
        public byte[] getCreationAttributes()
        {
            DynamicArray din = new DynamicArray();
            bool lastGroupEmpty = true;
            int attribCounter = 0;

            for (int i = (creationGroups-1);i>=0;i--){
                int attribOffset = i*7;
                bool anyAttribEnabled = false;
                byte tempHeader = 0x00;

                for (int j = 6;j>=0;j--){
                    int position = attribOffset+j;
                    // This verifies that the attribute is in a group but groups has not 7 attributes
                    if (position<attributesCreation.Length){
                        Attribute temp = attributesCreation[attribOffset+j];
                        if (temp.isActive()){
                            anyAttribEnabled = true;
                            attribCounter++;
                            tempHeader = (byte) (tempHeader + (1<<j)); // Displacement
                            din.insertBefore(temp.getValue());
                        }
                    }
                }

                // Updating last attribute group, set it as 0b0XXXXXXX
                if (i == (creationGroups-1)){
                    if (anyAttribEnabled){
                        din.insertBefore(tempHeader);
                        lastGroupEmpty = false;
                    }
                }
                // Updating other than last attribute group
                else{
                    if (!lastGroupEmpty){
                        tempHeader = (byte) (tempHeader+0x80);
                        din.insertBefore(tempHeader);
                    }else{
                        if(anyAttribEnabled){
                            din.insertBefore(tempHeader);
                            lastGroupEmpty = false;
                        }
                    }
                }

            }

            //add the counter of attributes sent
            din.insertBefore((byte)attribCounter);
            return din.getBytes();
        }
All Usage Examples Of hds.DynamicArray::insertBefore