コード例 #1
0
        public static SsData ReadArgumentBlock(MemoryRegion data)
        {
            KphSsArgumentBlock argBlock = data.ReadStruct <KphSsArgumentBlock>(0, KphSsArgumentBlock.SizeOf, 0);

            MemoryRegion dataRegion;
            SsData       ssArg = null;

            dataRegion = new MemoryRegion(data, KphSsArgumentBlock.DataOffset);

            // Process the argument block based on its type.
            switch (argBlock.Type)
            {
            case KphSsArgumentType.Int8:
            {
                SsSimple simpleArg = new SsSimple
                {
                    Argument = argBlock.Data.Int8,
                    Type     = typeof(Byte)
                };

                ssArg = simpleArg;
            }
            break;

            case KphSsArgumentType.Int16:
            {
                SsSimple simpleArg = new SsSimple
                {
                    Argument = argBlock.Data.Int16,
                    Type     = typeof(Int16)
                };

                ssArg = simpleArg;
            }
            break;

            case KphSsArgumentType.Int32:
            {
                SsSimple simpleArg = new SsSimple
                {
                    Argument = argBlock.Data.Int32,
                    Type     = typeof(Int32)
                };

                ssArg = simpleArg;
            }
            break;

            case KphSsArgumentType.Int64:
            {
                SsSimple simpleArg = new SsSimple
                {
                    Argument = argBlock.Data.Int64,
                    Type     = typeof(Int64)
                };

                ssArg = simpleArg;
            }
            break;

            case KphSsArgumentType.Handle:
            {
                ssArg = new SsHandle(dataRegion);
            }
            break;

            case KphSsArgumentType.UnicodeString:
            {
                ssArg = new SsUnicodeString(dataRegion);
            }
            break;

            case KphSsArgumentType.ObjectAttributes:
            {
                ssArg = new SsObjectAttributes(dataRegion);
            }
            break;

            case KphSsArgumentType.ClientId:
            {
                ssArg = new SsClientId(dataRegion);
            }
            break;

            case KphSsArgumentType.Bytes:
            {
                ssArg = new SsBytes(dataRegion);
            }
            break;
            }

            ssArg.Index = argBlock.Index;

            return(ssArg);
        }
コード例 #2
0
        public static SsData ReadArgumentBlock(MemoryRegion data)
        {
            KphSsArgumentBlock argBlock = data.ReadStruct<KphSsArgumentBlock>(0, KphSsArgumentBlock.SizeOf, 0);

            MemoryRegion dataRegion;
            SsData ssArg = null;

            dataRegion = new MemoryRegion(data, KphSsArgumentBlock.DataOffset);

            // Process the argument block based on its type.
            switch (argBlock.Type)
            {
                case KphSsArgumentType.Int8:
                    {
                        SsSimple simpleArg = new SsSimple
                        {
                            Argument = argBlock.Data.Int8, 
                            Type = typeof(Byte)
                        };

                        ssArg = simpleArg;
                    }
                    break;
                case KphSsArgumentType.Int16:
                    {
                        SsSimple simpleArg = new SsSimple
                        {
                            Argument = argBlock.Data.Int16, 
                            Type = typeof(Int16)
                        };

                        ssArg = simpleArg;
                    }
                    break;
                case KphSsArgumentType.Int32:
                    {
                        SsSimple simpleArg = new SsSimple
                        {
                            Argument = argBlock.Data.Int32, 
                            Type = typeof(Int32)
                        };

                        ssArg = simpleArg;
                    }
                    break;
                case KphSsArgumentType.Int64:
                    {
                        SsSimple simpleArg = new SsSimple
                        {
                            Argument = argBlock.Data.Int64, 
                            Type = typeof(Int64)
                        };

                        ssArg = simpleArg;
                    }
                    break;
                case KphSsArgumentType.Handle:
                    {
                        ssArg = new SsHandle(dataRegion);
                    }
                    break;
                case KphSsArgumentType.UnicodeString:
                    {
                        ssArg = new SsUnicodeString(dataRegion);
                    }
                    break;
                case KphSsArgumentType.ObjectAttributes:
                    {
                        ssArg = new SsObjectAttributes(dataRegion);
                    }
                    break;
                case KphSsArgumentType.ClientId:
                    {
                        ssArg = new SsClientId(dataRegion);
                    }
                    break;
                case KphSsArgumentType.Bytes:
                    {
                        ssArg = new SsBytes(dataRegion);
                    }
                    break;
            }

            ssArg.Index = argBlock.Index;

            return ssArg;
        }