示例#1
0
        public virtual void Encode(Stream output)
        {
            //IL_0000: Unknown result type (might be due to invalid IL or missing references)
            //IL_0006: Expected O, but got Unknown
            MemoryStream val = new MemoryStream();

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)ServerNames).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ServerName serverName = (ServerName)enumerator.get_Current();
                    serverName.Encode((Stream)(object)val);
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            TlsUtilities.CheckUint16(((Stream)val).get_Length());
            TlsUtilities.WriteUint16((int)((Stream)val).get_Length(), output);
            val.WriteTo(output);
        }
        public virtual void Encode(Stream output)
        {
            MemoryStream stream = new MemoryStream();

            byte[]      emptyBytes = TlsUtilities.EmptyBytes;
            IEnumerator enumerator = this.ServerNames.GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    ServerName current = (ServerName)enumerator.Current;
                    emptyBytes = CheckNameType(emptyBytes, current.NameType);
                    if (emptyBytes == null)
                    {
                        throw new TlsFatalAlert(80);
                    }
                    current.Encode(stream);
                }
            }
            finally
            {
                if (enumerator is IDisposable disposable)
                {
                    IDisposable disposable;
                    disposable.Dispose();
                }
            }
            TlsUtilities.CheckUint16(stream.Length);
            TlsUtilities.WriteUint16((int)stream.Length, output);
            stream.WriteTo(output);
        }