本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例6: BaseMessage
public BaseMessage(IHeader header)
{
_header = header;
_stream = new MemoryStream();
_writer = new BinaryWriter(_stream);
_count = 0;
}
示例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);
}
示例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);
}
示例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);
}
示例10: Mail
internal Mail(IHeader header)
{
_message = new MailMessage();
Header = header;
Headers = new Dictionary<string, string>();
TextTransferEncoding = TransferEncoding.Base64;
HtmlTransferEncoding = TransferEncoding.Base64;
}
示例11: ContainsHeader
public bool ContainsHeader(IHeader header)
{
if (!headers.ContainsKey(header.GetType()))
{
return false;
}
return headers[header.GetType()].Equals(header);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}