Example #1
0
        private static unsafe byte[] GetRecordBytes(BlocksRecord record)
        {
            byte[] bytes = new byte[sizeof(BlocksRecord)];
            fixed(byte *p = bytes)
            {
                BlocksRecord *temp = (BlocksRecord *)p;

                *temp = record;
            }

            return(bytes);
        }
Example #2
0
        public bool CollectDataFromBinary(BinaryTable table, int index)
        {
            BlocksRecord record = GetRecord(table, index);

            Id              = DBCUtil.ExtractInt(table, record.Id, 0);
            Description     = DBCUtil.ExtractString(table, record.Description, "");
            Length          = DBCUtil.ExtractFloat(table, record.Length, 0);
            Width           = DBCUtil.ExtractFloat(table, record.Width, 0);
            Res             = DBCUtil.ExtractString(table, record.Res, "");
            Type            = DBCUtil.ExtractInt(table, record.Type, 0);
            LeftPortType    = DBCUtil.ExtractInt(table, record.LeftPortType, 0);
            LeftOffeset     = DBCUtil.ExtractFloatArray(table, record.LeftOffeset, null);
            RightPortType   = DBCUtil.ExtractInt(table, record.RightPortType, 0);
            RightOffset     = DBCUtil.ExtractFloatArray(table, record.RightOffset, null);
            ForwardPortType = DBCUtil.ExtractInt(table, record.ForwardPortType, 0);
            ForwardOffset   = DBCUtil.ExtractFloatArray(table, record.ForwardOffset, null);
            BackPortType    = DBCUtil.ExtractInt(table, record.BackPortType, 0);
            BackOffset      = DBCUtil.ExtractFloatArray(table, record.BackOffset, null);
            return(true);
        }
Example #3
0
        public void AddToBinary(BinaryTable table)
        {
            BlocksRecord record = new BlocksRecord();

            record.Id              = DBCUtil.SetValue(table, Id, 0);
            record.Description     = DBCUtil.SetValue(table, Description, "");
            record.Length          = DBCUtil.SetValue(table, Length, 0);
            record.Width           = DBCUtil.SetValue(table, Width, 0);
            record.Res             = DBCUtil.SetValue(table, Res, "");
            record.Type            = DBCUtil.SetValue(table, Type, 0);
            record.LeftPortType    = DBCUtil.SetValue(table, LeftPortType, 0);
            record.LeftOffeset     = DBCUtil.SetValue(table, LeftOffeset, null);
            record.RightPortType   = DBCUtil.SetValue(table, RightPortType, 0);
            record.RightOffset     = DBCUtil.SetValue(table, RightOffset, null);
            record.ForwardPortType = DBCUtil.SetValue(table, ForwardPortType, 0);
            record.ForwardOffset   = DBCUtil.SetValue(table, ForwardOffset, null);
            record.BackPortType    = DBCUtil.SetValue(table, BackPortType, 0);
            record.BackOffset      = DBCUtil.SetValue(table, BackOffset, null);
            byte[] bytes = GetRecordBytes(record);
            table.Records.Add(bytes);
        }