コード例 #1
0
ファイル: Type2Message.cs プロジェクト: BoyarinO/EmailClient
 private Type2Message()
 {
     TargetInformation = new Type2TargetInformation();
     OSVersion = new OSVersion();
 }
コード例 #2
0
ファイル: Type2Message.cs プロジェクト: BoyarinO/EmailClient
        public static Type2TargetInformation ReadTargetInformation(BinaryReader r)
        {
            Type2TargetInformation info = new Type2TargetInformation();
            while (true)
            {
                var type = (Type2InformationType)r.ReadInt16();
                if (type == Type2InformationType.TerminatorBlock)
                {
                    break;
                }

                short length = r.ReadInt16();
                string content = Encoding.Unicode.GetString(r.ReadBytes(length));
                switch (type)
                {
                    case Type2InformationType.ServerName:
                        info.ServerName = content;
                        break;
                    case Type2InformationType.DomainName:
                        info.DomainName = content;
                        break;
                    case Type2InformationType.DnsHostname:
                        info.DnsHostname = content;
                        break;
                    case Type2InformationType.DnsDomainName:
                        info.DnsDomainName = content;
                        break;
                }
            }

            return info;
        }