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


C# IHeader类代码示例

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


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

示例1: For

        public static Output For(IHeader header)
        {
            ResponseContext context = new ResponseContext();
            context.AddHeader(header);

            return For(context);
        }
开发者ID:JunctionBoxca,项目名称:Rest-In-Practise-Product-Catalog-Service,代码行数:7,代码来源:Output.cs

示例2: Equals

 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.
 ///                 </param>
 public bool Equals(IHeader other)
 {
     var header = other as NumericHeader;
     if (header != null)
         return header.Value == Value;
     return false;
 }
开发者ID:jgauffin,项目名称:SipSharp,代码行数:15,代码来源:NumericHeader.cs

示例3: Equals

 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.
 ///                 </param>
 public bool Equals(IHeader other)
 {
     var header = other as StringHeader;
     if (header != null)
         return string.Compare(header.Value, Value, true) == 0;
     return false;
 }
开发者ID:jgauffin,项目名称:SipSharp,代码行数:15,代码来源:StringHeader.cs

示例4: Equals

 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <returns>
 /// true if the current object is equal to the <paramref name="other"/> parameter; otherwise, false.
 /// </returns>
 /// <param name="other">An object to compare with this object.
 ///                 </param>
 public virtual bool Equals(IHeader other)
 {
     var header = other as Event;
     if (header != null)
         return header.EventId == EventId && string.Compare(EventType, header.EventType) == 0;
     return false;
 }
开发者ID:jgauffin,项目名称:SipSharp,代码行数:15,代码来源:Event.cs

示例5: GetBytes

 public override PacketData GetBytes(IHeader header, PacketData packetData)
 {
     var ipHeader = (IPHeader)header;
     var currentData = new List<byte>();
     currentData.Add((byte)((ipHeader.VersionIHL << 4) | 5));
     currentData.Add(ipHeader.TypeOfService);
     //currentData.AddRange(GetBytes((UInt16)(packetData.Data.Count + 20)));
     currentData.AddRange(GetBytes(ipHeader.TotalLength));
     currentData.AddRange(GetBytes(ipHeader.Identification));
     //++ flags (3 bits-- left to right)
     //Bit 0: reserved, must be zero
     //Bit 1: (DF) 0 = May Fragment,  1 = Don't Fragment.
     //Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.
     //++ offset (13 bits)
     currentData.AddRange(GetBytes(ipHeader.FlagsFragmentOffset));
     currentData.Add(ipHeader.TTL);
     currentData.Add(ipHeader.Protocol);
     currentData.AddRange(new byte[]
                          {
                              0, 0
                          });
     currentData.AddRange(ipHeader.SourceAddress.GetBytes());
     currentData.AddRange(ipHeader.DestinationAddress.GetBytes());
     byte[] crc = GetCrc(currentData.ToArray());
     currentData[10] = crc[1];
     currentData[11] = crc[0];
     currentData.AddRange(packetData.Data);
     return packetData.UpdateData(currentData);
 }
开发者ID:davidbetz,项目名称:netrouter,代码行数:29,代码来源:IPv4Handler.cs

示例6: BaseMessage

 public BaseMessage(IHeader header)
 {
     _header = header;
     _stream = new MemoryStream();
     _writer = new BinaryWriter(_stream);
     _count = 0;
 }
开发者ID:gregorypilar,项目名称:interlace,代码行数:7,代码来源:BaseMessage.cs

示例7: AssertHeader

        private void AssertHeader(IHeader header)
        {
            var headerObj = JsonObject.Parse(header.JsonString());
            var subs = headerObj.Object("sub");

            var firstNameSubstitutions = subs.Get<string[]>(FirstNamePlaceholder).ToList();
            CollectionAssert.AreEqual(new List<string> { Subscriber1FirstName, Subscriber2FirstName }, firstNameSubstitutions);

            var lastNameSubstitutions = subs.Get<string[]>(LastNamePlaceholder).ToList();
            CollectionAssert.AreEqual(new List<string> { "", Subscriber2LastName }, lastNameSubstitutions);

            var emailSubstitutions = subs.Get<string[]>(EmailPlaceholder).ToList();
            CollectionAssert.AreEqual(new List<string> { Subscriber1Email, Subscriber2Email }, emailSubstitutions);

            var resolveKeySubstitutions = subs.Get<string[]>(ResolveKeyPlaceholder).ToList();
            CollectionAssert.AreEqual(new List<string> { Subscriber1ResolveKey, Subscriber2ResolveKey }, resolveKeySubstitutions);

            var uniqueArgs = headerObj.Object("unique_args");

            var campaingId = uniqueArgs.Get(CampaignCustomHeaderKey);
            Assert.AreEqual(CampaignCustomHeaderValue, campaingId);

            var subscriberId = uniqueArgs.Get(SubscriberCustomHeaderKey);
            Assert.AreEqual(SubscriberCustomHeaderValue, subscriberId);
        }
开发者ID:Sitefinity,项目名称:NewslettersSendGrid,代码行数:25,代码来源:SendGridSenderTests.cs

示例8: GetBytes

 public override PacketData GetBytes(IHeader header, PacketData packetData)
 {
     var udpHeader = (UdpHeader)header;
     var currentData = new List<byte>();
     currentData.AddRange(GetBytes(udpHeader.SourcePort));
     currentData.AddRange(GetBytes(udpHeader.DestinationPort));
     currentData.AddRange(GetBytes((ushort)(UdpHeaderProperty.Size + packetData.Data.Count)));
     currentData.AddRange(new byte[]
                          {
                              0, 0
                          });
     //+ crc
     List<byte> crcData = GetPseudoHeaderBytes(udpHeader, (uint)(packetData.Data.Count + UdpHeaderProperty.Size));
     crcData.AddRange(currentData);
     crcData.AddRange(packetData.Data);
     if (crcData.Count % 2 == 1)
     {
         crcData.Add(0);
     }
     byte[] crc = Checksum.GetCrc(crcData.ToArray());
     currentData[6] = crc[1];
     currentData[7] = crc[0];
     //+
     currentData.AddRange(packetData.Data);
     return packetData.UpdateData(currentData);
 }
开发者ID:davidbetz,项目名称:netrouter,代码行数:26,代码来源:UdpHandler.cs

示例9: GetBytes

 public override PacketData GetBytes(IHeader header, PacketData packetData)
 {
     var imageHeader = (ImageHeader)header;
     var currentData = new List<byte>();
     currentData.Add(imageHeader.Operation);
     currentData.AddRange(imageHeader.Data);
     return packetData.UpdateData(currentData);
 }
开发者ID:davidbetz,项目名称:netrouter,代码行数:8,代码来源:ImageHandler.cs

示例10: Mail

 internal Mail(IHeader header)
 {
     _message = new MailMessage();
     Header = header;
     Headers = new Dictionary<string, string>();
     TextTransferEncoding = TransferEncoding.Base64;
     HtmlTransferEncoding = TransferEncoding.Base64;
 }
开发者ID:advancedrei,项目名称:sendgridplus-csharp,代码行数:8,代码来源:Mail.cs

示例11: ContainsHeader

        public bool ContainsHeader(IHeader header)
        {
            if (!headers.ContainsKey(header.GetType()))
            {
                return false;
            }

            return headers[header.GetType()].Equals(header);
        }
开发者ID:JunctionBoxca,项目名称:Rest-In-Practise-Product-Catalog-Service,代码行数:9,代码来源:ResponseContext.cs

示例12: GetBytes

 public override PacketData GetBytes(IHeader header, PacketData packetData)
 {
     var icmpEchoHeader = (IcmpEchoHeader)header;
     var currentData = new List<byte>();
     currentData.AddRange(GetBytes(icmpEchoHeader.Identifier));
     currentData.AddRange(GetBytes(icmpEchoHeader.SequenceNumber));
     currentData.AddRange(icmpEchoHeader.Data);
     return packetData.UpdateData(currentData);
 }
开发者ID:davidbetz,项目名称:netrouter,代码行数:9,代码来源:IcmpEchoHandler.cs

示例13: Add

        public void Add(IHeader key, List<KartEntity> value)
        {
            if (map.ContainsKey(key))
            {
                map.Remove(key);
            }
            key.KayitSayisi = list.Count;

            this.map.Add(key, value);
        }
开发者ID:aserdaray,项目名称:Projects,代码行数:10,代码来源:ResultEntity.cs

示例14: GetBytes

 public override PacketData GetBytes(IHeader header, PacketData packetData)
 {
     var ethernetHeader = (EthernetHeader)header;
     var currentData = new List<byte>();
     currentData.AddRange(ethernetHeader.Destination.GetBytes());
     currentData.AddRange(ethernetHeader.Source.GetBytes());
     currentData.AddRange(ethernetHeader.TypeOrLength.GetBytes());
     currentData.AddRange(packetData.Data);
     return packetData.UpdateData(currentData);
 }
开发者ID:davidbetz,项目名称:netrouter,代码行数:10,代码来源:EthernetIIHandler.cs

示例15: SendGridMessage

		public SendGridMessage(MailAddress from, MailAddress[] to,
			String subject, String html, String text, IHeader header = null) : this()
		{
			From = from;
			To = to;

			_message.Subject = subject;

			Text = text;
			Html = html;
		}
开发者ID:jstawski,项目名称:sendgrid-csharp,代码行数:11,代码来源:SendGrid.cs


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