当前位置: 首页>>代码示例>>C#>>正文


C# RecordType类代码示例

本文整理汇总了C#中RecordType的典型用法代码示例。如果您正苦于以下问题:C# RecordType类的具体用法?C# RecordType怎么用?C# RecordType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RecordType类属于命名空间,在下文中一共展示了RecordType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Write

        public override void Write(RecordType type, TlsVersion version, byte[] data)
        {
            var cipher = GetCipher().Cipher;

            // TODO parametrised from CipherSpec
            var explicitNonceLength = 8;
            var nonce = RandomGenerator.RandomBytes(explicitNonceLength);

            var aad = new byte[13];
            Array.Copy(EndianBitConverter.Big.GetBytes(State.WriteSeqNum++), 0, aad, 0, 8);
            Array.Copy(new[] { (byte)type, version.Major, version.Major }, 0, aad, 8, 3);
            Array.Copy(EndianBitConverter.Big.GetBytes((ushort)data.Length), 0, aad, 11, 2);

            var payload = new byte[explicitNonceLength + data.Length + cipher.TagLength];
            Array.Copy(nonce, payload, explicitNonceLength);

            cipher.Init(State.GetAEADParameters(false, aad, nonce));

            var payloadLength = explicitNonceLength;
            payloadLength += cipher.Encrypt(data, 0, payload, payloadLength, data.Length);
            payloadLength += cipher.EncryptFinal(payload, payloadLength);

            Writer.Write(type);
            Writer.Write(version);
            Writer.Write((ushort)payloadLength);
            Writer.Write(payload, 0, payloadLength);
        }
开发者ID:will14smith,项目名称:Crypto,代码行数:27,代码来源:AEADCipherStrategy.cs

示例2: AssertMxRecordAncestorIsObsolete

        public void AssertMxRecordAncestorIsObsolete(RecordType recordType)
        {
            var expectedMessage = "Obsolete - use an MX record.";
            var attribute = recordType.Attribute<ObsoleteAttribute>();

            Assert.That(attribute.Message, Is.EqualTo(expectedMessage));
        }
开发者ID:BenjaminRicketts,项目名称:DotNetDns,代码行数:7,代码来源:RecordTypeTests.cs

示例3: Read

        public override Record Read(RecordType type, TlsVersion version, ushort length)
        {
            var cipher = GetCipher().Cipher;

            // TODO parametrised from CipherSpec
            var explicitNonceLength = 8;

            var nonce = Reader.ReadBytes(explicitNonceLength);
            var payload = Reader.ReadBytes(length - explicitNonceLength);

            var aad = new byte[13];
            Array.Copy(EndianBitConverter.Big.GetBytes(State.ReadSeqNum++), 0, aad, 0, 8);
            Array.Copy(new[] { (byte)type, version.Major, version.Major }, 0, aad, 8, 3);
            Array.Copy(EndianBitConverter.Big.GetBytes((ushort)(length - explicitNonceLength - cipher.TagLength)), 0, aad, 11, 2);

            cipher.Init(State.GetAEADParameters(true, aad, nonce));

            var plaintext = new byte[payload.Length - cipher.TagLength];
            var plaintextLength = cipher.Decrypt(payload, 0, plaintext, 0, payload.Length - cipher.TagLength);
            plaintextLength += cipher.DecryptFinal(payload, plaintextLength, plaintext, plaintextLength);

            Array.Resize(ref plaintext, plaintextLength);

            return new Record(type, version, plaintext);
        }
开发者ID:will14smith,项目名称:Crypto,代码行数:25,代码来源:AEADCipherStrategy.cs

示例4: WellKnownServiceData

 public WellKnownServiceData(RecordType recordType)
 {
     _address = new AddressData(recordType);
     _protocol = 0;
     _bitMap = new byte[0];
     _recordType = recordType;
 }
开发者ID:CodeMangler,项目名称:DNSLookup,代码行数:7,代码来源:WellKnownServiceData.cs

示例5: Add

 public void Add(string controllerId, int count, string reason, RecordType type=RecordType.Permanent)
 {
     if (!Records.ContainsKey(controllerId))
         Records[controllerId] = new List<ScoreRecord>();
     Records[controllerId].Add(new ScoreRecord(count, reason, world.Clocks.CurrentTime, type));
     if (ScoresChanged != null) ScoresChanged();
 }
开发者ID:mironov-alexey,项目名称:uCvarc,代码行数:7,代码来源:Scores.cs

示例6: AudioParameters

 public AudioParameters(RecordType recordType, int durationLimit, int sizeLimit, params string[] supportedExtensions)
 {
     DurationLimit = durationLimit;
     SizeLimit = sizeLimit;
     SupportedExtensions = supportedExtensions;
     AudioRecordType = recordType;
 }
开发者ID:Zaldroc,项目名称:DisaOpenSource,代码行数:7,代码来源:ServiceInfo.cs

示例7: Lookup

        /// <summary>
        /// Retrieves whois information
        /// </summary>
        /// <param name="domainName">The registrar or domain or name server whose whois information to be retrieved</param>
        /// <param name="recordType">The type of record i.e a domain, nameserver or a registrar</param>
        /// <returns></returns>
        public static string Lookup(string domainName, RecordType recordType)
        {
            string whoisServerName = WhoisServerResolver.GetWhoisServerName(domainName);
            using (TcpClient whoisClient = new TcpClient())
            {
                whoisClient.Connect(whoisServerName, Whois_Server_Default_PortNumber);

                string domainQuery = recordType.ToString() + " " + domainName + "\r\n";
                byte[] domainQueryBytes = Encoding.ASCII.GetBytes(domainQuery.ToCharArray());

                Stream whoisStream = whoisClient.GetStream();
                whoisStream.Write(domainQueryBytes, 0, domainQueryBytes.Length);

                StreamReader whoisStreamReader = new StreamReader(whoisClient.GetStream(), Encoding.ASCII);

                string streamOutputContent = "";
                List<string> whoisData = new List<string>();
                while (null != (streamOutputContent = whoisStreamReader.ReadLine()))
                {
                    whoisData.Add(streamOutputContent);
                }

                whoisClient.Close();

                return String.Join(Environment.NewLine, whoisData);
            }
        }
开发者ID:coderbuddyblog,项目名称:DomainTools,代码行数:33,代码来源:Whois.cs

示例8: WriteQuestion

 public void WriteQuestion(Name name, RecordType qtype, RecordClass qclass = RecordClass.Internet)
 {
     WriteName(name);
     WriteUInt16((ushort)qtype);
     WriteUInt16((ushort)qclass);
     _questionCount++;
 }
开发者ID:joltmode,项目名称:Tmds.MDns,代码行数:7,代码来源:DnsMessageWriter.cs

示例9: DnsResponse

 private DnsResponse(ushort messageId, DnsName queryName, RecordType queryType, RecordClass queryClass)
 {
     this.MessageId = messageId;
     this.QueryName = queryName;
     this.QueryType = queryType;
     this.QueryClass = queryClass;
 }
开发者ID:RadicalResearch,项目名称:RadicalResearch.Net.Dns,代码行数:7,代码来源:DnsResponse.cs

示例10: Record

 private Record(List<DateTime> records, int minutes, DateTime day, RecordType type)
 {
     mRecordsOfDay = records;
     mMinutes = minutes;
     mDay = day;
     mType = type;
 }
开发者ID:AmongOthers,项目名称:MonthDemo,代码行数:7,代码来源:Record.cs

示例11: ResourceRecord

 internal ResourceRecord(string name, RecordType type, RecordClass rClass, DateTime expiry)
 {
     _name = name;
     _type = type;
     _class = rClass;
     _expiry = expiry;
 }
开发者ID:marinehero,项目名称:ThinkAway.net,代码行数:7,代码来源:ResourceRecord.cs

示例12: Record

		public Record (byte version, RecordType type, ushort requestID,
		               byte[] bodyData, int bodyIndex, int bodyLength)
		{
			if (bodyData == null)
				throw new ArgumentNullException ("bodyData");

			if (bodyIndex < 0 || bodyIndex > bodyData.Length)
				throw new ArgumentOutOfRangeException (
					"bodyIndex");

			if (bodyLength < 0)
				bodyLength = bodyData.Length - bodyIndex;

			if (bodyLength > MaxBodySize)
				throw new ArgumentException (
					Strings.Record_DataTooBig,
					"data");


			this.Version = version;
			this.Type = type;
			this.RequestId = requestID;
			this.Body = bodyData;
			this.BodyOffset = bodyIndex;
			this.BodyLength = (ushort)bodyLength;
			this.PaddingLength = 0;
		}
开发者ID:qinfengzhu,项目名称:HyperFastCgi,代码行数:27,代码来源:Record.cs

示例13: ResourceRecord

        public ResourceRecord(DnsReader br)
        {
            _domain = br.ReadDomain();
            _qtype = (RecordType)br.ReadInt16();
            _qclass = (RecordClass)br.ReadInt16();
            _ttl = br.ReadInt32();

            int recordLength = br.ReadInt16();
            if (recordLength != 0)
            {
                switch (_qtype)
                {
                    case RecordType.A:     _record = new ARecord(br);      break;
                    case RecordType.CNAME: _record = new CNAMERecord(br);  break;
                    case RecordType.MX:    _record = new MXRecord(br);     break;
                    case RecordType.NS:    _record = new NSRecord(br);     break;
                    case RecordType.SOA:   _record = new SOARecord(br);    break;
                    case RecordType.TXT:   _record = new TXTRecord(br);    break;
                    case RecordType.PTR:   _record = new PTRERecord(br);	break;

                    // NetBIOS related records
                    case RecordType.NB:    _record = new NBRecord(br);     break;

                    default:
                        br += recordLength;
                        break;
                }
            }
        }
开发者ID:marinehero,项目名称:microserver,代码行数:29,代码来源:ResourceRecord.cs

示例14: RecordDataFor

        public static RecordData RecordDataFor(RecordType recordType)
        {
            switch (recordType)
            {
                case RecordType.A:
                    return new AddressData(recordType);
                case RecordType.AAAA:
                    return new IPv6AddressData(recordType);
                case RecordType.CNAME:
                case RecordType.MB: // Experimental
                case RecordType.MD: // Obsolete.. Should throw exception instead? Or use MX?
                case RecordType.MF: // Obsolete.. Should throw exception instead? Or use MX?
                case RecordType.MG: // Experimental
                case RecordType.MR: // Experimental
                case RecordType.NS:
                case RecordType.PTR:
                    return new DomainNameData(recordType);
                case RecordType.HINFO:
                    return new HostInformationData(recordType);
                case RecordType.MINFO:
                    return new MailInformationData(recordType);
                case RecordType.MX:
                    return new MailExchangeData(recordType);
                case RecordType.SOA:
                    return new StartOfAuthorityData(recordType);
                case RecordType.TXT:
                    return new TextData(recordType);
                case RecordType.WKS:
                    return new WellKnownServiceData(recordType);
                case RecordType.NULL: // Experimental
                    return new NullData(recordType);

            }
            return new NullData(recordType);
        }
开发者ID:CodeMangler,项目名称:DNSLookup,代码行数:35,代码来源:RecordDataFactory.cs

示例15: Record

        public Record(Socket socket, Buffers receive_buffer)
            : this()
        {
            if (socket == null)
                throw new ArgumentNullException ("socket");

            CompatArraySegment<byte> header_buffer = receive_buffer.EnforceHeaderLength (HeaderSize);

            // Read the 8 byte record header.
            ReceiveAll (socket, header_buffer, HeaderSize);

            // Read the values from the data.
            version        = header_buffer [0];
            type           = (RecordType) header_buffer [1];
            request_id     = ReadUInt16 (header_buffer, 2);
            BodyLength     = ReadUInt16 (header_buffer, 4);
            byte padding_length = header_buffer [6];

            CompatArraySegment<byte> body_buffer  = receive_buffer.EnforceBodyLength (BodyLength);

            // Read the record data, and throw an exception if the
            // complete data cannot be read.
            if (BodyLength > 0)
                ReceiveAll (socket, body_buffer, BodyLength);

            CompatArraySegment<byte> padding_buffer = receive_buffer.EnforcePaddingLength (padding_length);

            if(padding_length > 0)
                ReceiveAll(socket, padding_buffer, padding_length);

            buffers = receive_buffer;

            Logger.Write (LogLevel.Debug, Strings.Record_Received, Type, RequestID, BodyLength);
        }
开发者ID:symform,项目名称:xsp,代码行数:34,代码来源:Record.cs


注:本文中的RecordType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。