Beispiel #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            int index = comboBox1.SelectedIndex;

            if (index < 0 || index > 2)
            {
                textBox5.Text = "E";
                return;
            }

            BlockOptions blockOptions = BlockOptions.BO_PassAll;

            switch (index)
            {
            case 0:
                blockOptions = BlockOptions.BO_BlockAll;
                break;

            case 1:
                blockOptions = BlockOptions.BO_PassSentFromLibrary;
                break;

            case 2:
                blockOptions = BlockOptions.BO_PassAll;;
                break;
            }

            int result = LibraryManager.blockKeys(blockOptions);

            textBox5.Text = result.ToString();
        }
Beispiel #2
0
 public static int EncodeBlock(System.IO.Stream buffer, BlockOptions options, UInt16 DCPBlockLength, out long DCPBlockLength_pos)
 {
     EncodeU16(buffer, (ushort)options);
     DCPBlockLength_pos = buffer.Position;
     EncodeU16(buffer, DCPBlockLength);
     return(4);
 }
Beispiel #3
0
 void LoadDefaultProps()
 {
     for (int b = 0; b < Props.Length; b++)
     {
         Props[b] = BlockOptions.DefaultProps(Props, this, (BlockID)b);
     }
 }
        void ResetProps(Player p, BlockProps[] scope, BlockID block)
        {
            scope[block] = BlockOptions.DefaultProps(scope, p.level, block);
            string name = BlockOptions.Name(scope, p, block);

            p.Message("Reset properties of {0} to default", name);
            BlockOptions.ApplyChanges(scope, p.level, block, true);
        }
        void ListProps(Player p, BlockProps[] scope, string[] args)
        {
            List <BlockID> filtered = FilterProps(scope);
            string         cmd      = "BlockProps " + args[0] + " list";
            string         modifier = args.Length > 2 ? args[2] : "";

            MultiPageOutput.Output(p, filtered, b => BlockOptions.Name(scope, p, b),
                                   cmd, "modified blocks", modifier, false);
        }
Beispiel #6
0
        public static int EncodeGetRequest(System.IO.Stream buffer, UInt32 Xid, BlockOptions options)
        {
            int ret = 0;

            ret += EncodeHeader(buffer, ServiceIds.Get_Request, Xid, 0, 2);
            ret += EncodeU16(buffer, (ushort)options);

            return(ret);
        }
Beispiel #7
0
        public static int DecodeBlock(System.IO.Stream buffer, out BlockOptions options, out UInt16 DCPBlockLength)
        {
            ushort opt;

            DecodeU16(buffer, out opt);
            options = (BlockOptions)opt;
            DecodeU16(buffer, out DCPBlockLength);
            return(4);
        }
Beispiel #8
0
 public MaxMindGeoLiteFileSource(string zipFile, string[] preferredLanguages, BlockOptions blockOptions)
 {
     _zipfile = zipFile ?? throw new ArgumentNullException(nameof(zipFile));
     if (preferredLanguages.Length == 0)
     {
         throw new ArgumentException("At least one preferred language must be specified", nameof(preferredLanguages));
     }
     _preferredlanguages = preferredLanguages;
     _blockoptions       = Enum.IsDefined(typeof(BlockOptions), blockOptions) ? blockOptions : throw new ArgumentOutOfRangeException(nameof(blockOptions));
 }
Beispiel #9
0
        public static int EncodeGetResponse(System.IO.Stream buffer, UInt32 Xid, BlockOptions options, object data)
        {
            int  ret = 0;
            long dcp_length;

            ret += EncodeHeader(buffer, ServiceIds.Get_Response, Xid, 0, 0, out dcp_length);
            ret += EncodeNextBlock(buffer, new KeyValuePair <BlockOptions, object>(options, data));
            ReEncodeDCPDataLength(buffer, dcp_length);

            return(ret);
        }
Beispiel #10
0
        public static int EncodeSetResponse(System.IO.Stream buffer, UInt32 Xid, BlockOptions options, BlockErrors status)
        {
            int  ret = 0;
            long dcp_length;

            ret += EncodeHeader(buffer, ServiceIds.Set_Response, Xid, 0, 0, out dcp_length);
            ret += EncodeNextBlock(buffer, new KeyValuePair <BlockOptions, object>(BlockOptions.Control_Response, new ResponseStatus(options, status)));
            ReEncodeDCPDataLength(buffer, dcp_length);

            return(ret);
        }
        void SetProps(Player p, BlockProps[] scope, BlockID block, string[] args)
        {
            BlockOption opt = BlockOptions.Find(args[2]);

            if (opt == null)
            {
                Help(p); return;
            }
            string value = args.Length > 3 ? args[3] : "";

            opt.SetFunc(p, scope, block, value);
            scope[block].ChangedScope |= BlockOptions.ScopeId(scope);
            BlockOptions.ApplyChanges(scope, p.level, block, true);
        }
        static void ResetProps(bool global, BlockID block, Player p)
        {
            BlockProps[] scope   = global ? Block.Props : p.level.Props;
            int          changed = scope[block].ChangedScope & BlockOptions.ScopeId(scope);

            if (changed != 0)
            {
                return;
            }

            // properties not manually modified, revert (e.g. make grass die in shadow again)
            scope[block] = BlockOptions.DefaultProps(scope, p.level, block);
            BlockOptions.ApplyChanges(scope, p.level, block, false);
        }
        static List <BlockID> FilterProps(BlockProps[] scope)
        {
            int            changed  = BlockOptions.ScopeId(scope);
            List <BlockID> filtered = new List <BlockID>();

            for (int b = 0; b < scope.Length; b++)
            {
                if ((scope[b].ChangedScope & changed) == 0)
                {
                    continue;
                }
                filtered.Add((BlockID)b);
            }
            return(filtered);
        }
        public MaxMindGeoLiteFileSource(string zipFile, string[] preferredLanguages, BlockOptions blockOptions)
        {
            _zipfile = zipFile ?? throw new ArgumentNullException(nameof(zipFile));
            if (preferredLanguages == null)
            {
                throw new ArgumentNullException(nameof(preferredLanguages));
            }
            if (preferredLanguages.Length == 0)
#pragma warning disable CA1303 // Do not pass literals as localized parameters
            {
                throw new ArgumentException("At least one preferred language must be specified", nameof(preferredLanguages));
            }
#pragma warning restore CA1303 // Do not pass literals as localized parameters
            _preferredlanguages = preferredLanguages;
            _blockoptions       = Enum.IsDefined(typeof(BlockOptions), blockOptions) ? blockOptions : throw new ArgumentOutOfRangeException(nameof(blockOptions));
        }
Beispiel #15
0
        public static Stream CreateBlock(this Stream baseStream, BlockOptions options, byte[] key, byte[] iv)
        {
            var compression = options.HasFlag(BlockOptions.Compression);
            var encryption  = options.HasFlag(BlockOptions.Encryption);

            if (compression)
            {
                if (encryption) //compression & encryption
                {
                    var gzipStream = new GZipStream(baseStream, CompressionLevel.Optimal, true);
                    var rijAlg     = Rijndael.Create();
                    rijAlg.Key = key;
                    rijAlg.IV  = iv;
                    var encryptor        = rijAlg.CreateEncryptor(rijAlg.Key, rijAlg.IV);
                    var encryptionStream = new CryptoStream(gzipStream, encryptor, CryptoStreamMode.Write);
                    return(BlockStream.Create(baseStream, encryptionStream, () =>
                    {
                        encryptionStream.FlushFinalBlock();
                        gzipStream.Close();
                    }, CloseOptions.Flush));
                }
                else //compression
                {
                    var gzipStream = new GZipStream(baseStream, CompressionLevel.Optimal, true);
                    return(BlockStream.Create(baseStream, gzipStream, null, CloseOptions.Flush | CloseOptions.CloseWrapper));
                }
            }
            else
            {
                if (encryption) //encryption
                {
                    var rijAlg = Rijndael.Create();
                    rijAlg.Key = key;
                    rijAlg.IV  = iv;
                    var encryptor        = rijAlg.CreateEncryptor(rijAlg.Key, rijAlg.IV);
                    var encryptionStream = new CryptoStream(baseStream, encryptor, CryptoStreamMode.Write);
                    return(BlockStream.Create(baseStream, encryptionStream, () =>
                    {
                        encryptionStream.FlushFinalBlock();
                    }, CloseOptions.Flush));
                }
                else
                {
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Beispiel #16
0
        private bool MatchesBlockOptionsFilter(string name, BlockOptions options)
        {
            var m = _blocksfilter.Match(name);

            if (m.Success)
            {
                switch (int.Parse(m.Groups[1].Value))
                {
                case 4:
                    return(options.HasFlag(BlockOptions.IPv4));

                case 6:
                    return(options.HasFlag(BlockOptions.IPv6));
                }
            }
            return(false);
        }
Beispiel #17
0
        public void UpdateSimulation()
        {
            //Proces player input
            UpdatePlayFieldRemoveBlock();
            ProcessPlayerInPut();
            UpdatePlayFieldAddBlock();

            //If it is game over end this method
            if (isGameOver)
            {
                return;
            }

            //Move the block
            UpdatePlayFieldRemoveBlock();
            MoveBlockHorizontal();
            MoveBlockVertical();
            UpdatePlayFieldAddBlock();

            //If a block has landed
            if (blockHasLanded)
            {
                //Turn block into filler
                TurnBlockToFiller();
                ClearBlockParameters();
                //Check for complete rows and delete them + update score
                RemoveCompletedRows();
                //put the next block at the top of the field
                PlaceBlock(nextBlock, (fieldWidth / 2));
                if (!BlockCanBeAddedToPlayField())
                {
                    isGameOver = true;
                    return;
                }
                //Get a new next block
                nextBlock = GetRandomBlock();
            }
            else
            {
                //UpdatePlayFieldAddBlock();
            }

            //Give a point to score
            score++;
        }
        public override void Help(Player p, string message)
        {
            if (message.CaselessEq("props") || message.CaselessEq("properties"))
            {
                p.Message("&HProperties: &f{0}", BlockOptions.Options.Join(o => o.Name));
                p.Message("&HUse &T/Help BlockProps [property] &Hfor more details");
                return;
            }

            BlockOption opt = BlockOptions.Find(message);

            if (opt != null)
            {
                p.Message(opt.Help);
            }
            else
            {
                p.Message("&WUnrecognised property \"{0}\"", message);
            }
        }
        void CopyProps(Player p, BlockProps[] scope, BlockID block, string[] args)
        {
            if (args.Length < 4)
            {
                Help(p); return;
            }
            BlockID dst = GetBlock(p, scope, args[3]);

            if (dst == Block.Invalid)
            {
                return;
            }

            scope[dst] = scope[block];
            scope[dst].ChangedScope |= BlockOptions.ScopeId(scope);

            p.Message("Copied properties of {0} to {1}",
                      BlockOptions.Name(scope, p, block),
                      BlockOptions.Name(scope, p, dst));
            BlockOptions.ApplyChanges(scope, p.level, block, true);
        }
Beispiel #20
0
        public static int EncodeSetRequest(System.IO.Stream buffer, UInt32 Xid, BlockOptions options, BlockQualifiers qualifiers, byte[] data)
        {
            int  ret         = 0;
            int  data_length = 0;
            bool do_pad      = false;

            if (data != null)
            {
                data_length = data.Length;
            }
            if ((data_length % 2) != 0)
            {
                do_pad = true;
            }

            //The following is modified by F.Chaxel.
            //TODO: Test that decode still work

            ret += EncodeHeader(buffer, ServiceIds.Set_Request, Xid, 0, (ushort)(12 + data_length + (do_pad ? 1 : 0)));
            ret += EncodeBlock(buffer, options, (ushort)(2 + data_length));

            ret += EncodeU16(buffer, (ushort)0);             // Don't care

            //data
            EncodeOctets(buffer, data);

            //pad (re-ordered by f.chaxel)
            if (do_pad)
            {
                ret += EncodeU8(buffer, 0);
            }

            //BlockQualifier
            ret += EncodeBlock(buffer, BlockOptions.Control_Stop, (ushort)(2));
            ret += EncodeU16(buffer, (ushort)qualifiers);

            return(ret);
        }
Beispiel #21
0
    // Start is called before the first frame update
    void Start()
    {
        Level level = new Level();

        level.levelNumber = 2;
        List <BlockOptions> blockList = new List <BlockOptions>();

        for (int i = 0; i < transform.childCount; i++)
        {
            Transform    block        = transform.GetChild(i);
            Vector2      position     = block.position;
            BlockOptions blockOptions = new BlockOptions();
            blockOptions.position = new Vector2(position.x, position.y);
            blockOptions.color    = block.GetComponent <SpriteRenderer>().color;
            blockList.Add(blockOptions);
        }
        level.blocks = blockList.ToArray();

        var    json = JsonUtility.ToJson(level, true);
        string path = $"{Application.dataPath}/Levels/{level.levelNumber}.json";

        File.WriteAllText(path, json);
    }
Beispiel #22
0
 public BlockOptionMeta(BlockOptions opt)
 {
     BlockOption = opt;
     Name        = opt.ToString();
     if (opt == BlockOptions.IP_MACAddress ||
         opt == BlockOptions.DeviceProperties_DeviceID ||
         opt == BlockOptions.DeviceProperties_DeviceVendor ||
         opt == BlockOptions.DeviceProperties_DeviceRole ||
         opt == BlockOptions.DeviceProperties_DeviceOptions ||
         opt == BlockOptions.DeviceProperties_DeviceInstance ||
         opt == BlockOptions.DeviceProperties_OEMDeviceID ||
         opt == BlockOptions.DeviceInitiative_DeviceInitiative)
     {
         IsReadable = true;
     }
     else if (opt == BlockOptions.DeviceProperties_AliasName ||
              opt == BlockOptions.Control_Response ||
              opt == BlockOptions.AllSelector_AllSelector)
     {
         //none
     }
     else if (opt == BlockOptions.Control_Start ||
              opt == BlockOptions.Control_Stop ||
              opt == BlockOptions.Control_Signal ||
              opt == BlockOptions.Control_FactoryReset ||
              opt == BlockOptions.Control_ResetToFactory)
     {
         IsWriteable = true;
     }
     else
     {
         //default
         IsReadable  = true;
         IsWriteable = true;
     }
 }
Beispiel #23
0
        private void PlaceBlock(BlockOptions chosenBlock, int x_coord_Offset = 0)
        {
            y_speed_Block = fallSpeed;
            x_speed_Block = 0;

            switch (chosenBlock)
            {
            case BlockOptions.Square:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(2);
                break;
            }

            case BlockOptions.Straight:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(3);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(4);
                break;
            }

            case BlockOptions.Normal_L:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(3);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(3);
                break;
            }

            case BlockOptions.Reverse_L:
            {
                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(3);

                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(3);
                break;
            }

            case BlockOptions.Normal_S:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(3);
                y_coord_Block_Float.Add(1);
                break;
            }

            case BlockOptions.Reverse_S:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(2);

                x_coord_Block_Float.Add(3);
                y_coord_Block_Float.Add(2);
                break;
            }

            case BlockOptions.T_piece:
            {
                x_coord_Block_Float.Add(1);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(3);
                y_coord_Block_Float.Add(1);

                x_coord_Block_Float.Add(2);
                y_coord_Block_Float.Add(2);
                break;
            }
            }
            for (int i = 0; i < x_coord_Block_Float.Count(); i++)
            {
                x_coord_Block_Float[i] += x_coord_Offset;
            }
        }
Beispiel #24
0
        public GameData()
        {
            flag_BreakGameLoop = false;

            fieldHeight = 20;
            fieldWidth  = 15;

            playField = new char[fieldWidth, fieldHeight];
            fallSpeed = 0.27;

            //The stringBuilder used for the display
            toDisPstring = new StringBuilder();

            //The score
            score = 0;

            //Bool to store whether the block has landed
            blockHasLanded = false;

            //Block properties
            y_speed_Block       = 0;
            x_speed_Block       = 0;
            y_coord_Block_Float = new List <double>();
            x_coord_Block_Float = new List <double>();

            //Random number
            rand = new Random();

            //the next block to be played
            nextBlock = GetRandomBlock();

            //Draw an empty field
            for (int i = 0; i < fieldHeight; i++)
            {
                for (int j = 0; j < fieldWidth; j++)
                {
                    if (i == 0)
                    {
                        if (j == 0)
                        {
                            playField[j, i] = Convert.ToChar(code_WallTL);
                        }
                        else if (j == fieldWidth - 1)
                        {
                            playField[j, i] = Convert.ToChar(code_WallTR);
                        }
                        else
                        {
                            playField[j, i] = Convert.ToChar(code_WallHor);
                        }
                    }
                    else if (i == fieldHeight - 1)
                    {
                        if (j == 0)
                        {
                            playField[j, i] = Convert.ToChar(code_WallBL);
                        }
                        else if (j == fieldWidth - 1)
                        {
                            playField[j, i] = Convert.ToChar(code_WallBR);
                        }
                        else
                        {
                            playField[j, i] = Convert.ToChar(code_WallHor);
                        }
                    }
                    else if (j == 0 || j == fieldWidth - 1)
                    {
                        playField[j, i] = Convert.ToChar(code_WallVer);
                    }
                    else
                    {
                        playField[j, i] = code_Empty;
                    }
                }
            }

            //Place a block
            PlaceBlock(GetRandomBlock(), (fieldWidth / 2));
            //Update Playfield with new block
            UpdatePlayFieldAddBlock();
        }
 public static extern Int32 blockKeys(BlockOptions blockOptions);
Beispiel #26
0
 public static extern Int32 blockKeys(BlockOptions blockOptions);
Beispiel #27
0
 public MaxMindGeoLiteFileSource(string zipFile, BlockOptions blockOptions)
     : this(zipFile, new[] { "en" }, blockOptions)
 {
 }
Beispiel #28
0
        public static int EncodeBlock(System.IO.Stream buffer, BlockOptions options, UInt16 DCPBlockLength)
        {
            long dummy;

            return(EncodeBlock(buffer, options, DCPBlockLength, out dummy));
        }
Beispiel #29
0
 public ResponseStatus(BlockOptions Option, BlockErrors Error)
 {
     this.Option = Option;
     this.Error  = Error;
 }
        internal static void Detail(Player p, BlockProps[] scope, BlockID block)
        {
            BlockProps props = scope[block];
            string     name  = BlockOptions.Name(scope, p, block);

            p.Message("&TProperties of {0}:", name);

            if (props.KillerBlock)
            {
                p.Message("  Kills players who collide with this block");
            }
            if (props.DeathMessage != null)
            {
                p.Message("  Death message: &S" + props.DeathMessage);
            }

            if (props.IsDoor)
            {
                p.Message("  Is an ordinary door");
            }
            if (props.IsTDoor)
            {
                p.Message("  Is a tdoor (allows other blocks through when open)");
            }
            if (props.oDoorBlock != Block.Invalid)
            {
                p.Message("  Is an odoor (can be toggled by doors, and toggles other odoors)");
            }

            if (props.IsPortal)
            {
                p.Message("  Can be used as a &T/Portal");
            }
            if (props.IsMessageBlock)
            {
                p.Message("  Can be used as a &T/MessageBlock");
            }

            if (props.WaterKills)
            {
                p.Message("  Is destroyed by flooding water");
            }
            if (props.LavaKills)
            {
                p.Message("  Is destroyed by flooding lava");
            }

            if (props.OPBlock)
            {
                p.Message("  Is not affected by explosions");
            }
            if (props.IsRails)
            {
                p.Message("  Can be used as rails for &T/Train");
            }

            if (props.AnimalAI != AnimalAI.None)
            {
                p.Message("  Has the {0} AI behaviour", props.AnimalAI);
            }
            if (props.StackBlock != Block.Air)
            {
                p.Message("  Stacks as {0} when placed on top of itself",
                          BlockOptions.Name(scope, p, props.StackBlock));
            }
            if (props.Drownable)
            {
                p.Message("&H  Players can drown in this block");
            }

            if (props.GrassBlock != Block.Invalid)
            {
                p.Message("  Grows into {0} when in sunlight",
                          BlockOptions.Name(scope, p, props.GrassBlock));
            }
            if (props.DirtBlock != Block.Invalid)
            {
                p.Message("  Decays into {0} when in shadow",
                          BlockOptions.Name(scope, p, props.DirtBlock));
            }
        }
Beispiel #31
0
        private static int DecodeNextBlock(System.IO.Stream buffer, ushort dcp_length, out KeyValuePair <BlockOptions, object> block)
        {
            int            ret = 0;
            BlockOptions   options;
            UInt16         dcp_block_length;
            UInt16         block_info = 0;
            UInt16         tmp, tmp2;
            string         str;
            object         content;
            ResponseStatus set_response;

            if (buffer.Position >= buffer.Length || dcp_length <= 0)
            {
                block = new KeyValuePair <BlockOptions, object>(0, null);
                return(ret);
            }

            ret += DecodeBlock(buffer, out options, out dcp_block_length);
            if (dcp_block_length >= 2)
            {
                ret += DecodeU16(buffer, out block_info);
            }
            dcp_block_length -= 2;

            switch (options)
            {
            case BlockOptions.DeviceProperties_NameOfStation:
                ret    += DecodeString(buffer, dcp_block_length, out str);
                content = str;
                break;

            case BlockOptions.IP_IPParameter:
                byte[] ip, subnet, gateway;
                ret    += DecodeOctets(buffer, 4, out ip);
                ret    += DecodeOctets(buffer, 4, out subnet);
                ret    += DecodeOctets(buffer, 4, out gateway);
                content = new IpInfo((BlockInfo)block_info, ip, subnet, gateway);;
                break;

            case BlockOptions.DeviceProperties_DeviceID:
                ret    += DecodeU16(buffer, out tmp);
                ret    += DecodeU16(buffer, out tmp2);
                content = new DeviceIdInfo(tmp, tmp2);
                break;

            case BlockOptions.DeviceProperties_DeviceOptions:
                BlockOptions[] option_list = new BlockOptions[dcp_block_length / 2];
                for (int i = 0; i < option_list.Length; i++)
                {
                    ret           += DecodeU16(buffer, out tmp);
                    option_list[i] = (BlockOptions)tmp;
                }
                content = option_list;
                break;

            case BlockOptions.DeviceProperties_DeviceRole:
                DeviceRoles roles = (DeviceRoles)buffer.ReadByte();
                buffer.ReadByte();                         //padding
                ret    += 2;
                content = new DeviceRoleInfo(roles);
                break;

            case BlockOptions.DeviceProperties_DeviceVendor:
                ret    += DecodeString(buffer, dcp_block_length, out str);
                content = str;
                break;

            case BlockOptions.Control_Response:
                set_response        = new ResponseStatus();
                set_response.Option = (BlockOptions)block_info;
                set_response.Error  = (BlockErrors)buffer.ReadByte();
                ret++;
                content = set_response;
                break;

            default:
                byte[] arr;
                ret    += DecodeOctets(buffer, dcp_block_length, out arr);
                content = arr;
                break;
            }
            block = new KeyValuePair <BlockOptions, object>(options, content);

            //padding
            if ((dcp_block_length % 2) != 0)
            {
                buffer.ReadByte();
                ret++;
            }

            return(ret);
        }