Exemplo n.º 1
0
            public TcpConnectOptions Deserialize(global::Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new global::System.FormatException();
                }

                uint propertyCount = r.GetUInt32();

                bool            p_enabled      = false;
                TcpProxyOptions?p_proxyOptions = null;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:
                    {
                        p_enabled = r.GetBoolean();
                        break;
                    }

                    case 1:
                    {
                        p_proxyOptions = TcpProxyOptions.Formatter.Deserialize(r, rank + 1);
                        break;
                    }
                    }
                }

                return(new TcpConnectOptions(p_enabled, p_proxyOptions));
            }
Exemplo n.º 2
0
            public TcpAcceptOptions Deserialize(global::Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new global::System.FormatException();
                }

                uint propertyCount = r.GetUInt32();

                bool p_enabled = false;

                OmniAddress[] p_listenAddresses = global::System.Array.Empty <OmniAddress>();
                bool          p_useUpnp         = false;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:
                    {
                        p_enabled = r.GetBoolean();
                        break;
                    }

                    case 1:
                    {
                        var length = r.GetUInt32();
                        p_listenAddresses = new OmniAddress[length];
                        for (int i = 0; i < p_listenAddresses.Length; i++)
                        {
                            p_listenAddresses[i] = OmniAddress.Formatter.Deserialize(r, rank + 1);
                        }
                        break;
                    }

                    case 2:
                    {
                        p_useUpnp = r.GetBoolean();
                        break;
                    }
                    }
                }

                return(new TcpAcceptOptions(p_enabled, p_listenAddresses, p_useUpnp));
            }