本文整理汇总了C#中Protocol类的典型用法代码示例。如果您正苦于以下问题:C# Protocol类的具体用法?C# Protocol怎么用?C# Protocol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Protocol类属于命名空间,在下文中一共展示了Protocol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProtocolReporter
/// <summary>
/// Constructs a ProtocolReporter
/// </summary>
/// <param name="protocol">Protocol to attach to</param>
public ProtocolReporter(Protocol protocol)
{
this.protocol = protocol;
this.debug = new Debug(protocol.Name);
this.protocol.AddListener(this);
}
示例2: ContainsLayer
public override bool ContainsLayer(Protocol layer)
{
if (layer == Protocol.UDP)
return true;
else
return base.ContainsLayer(layer);
}
示例3: Test_CanApprove
public void Test_CanApprove()
{
Procedure procedure = new Procedure();
Protocol protocol = new Protocol(procedure);
ProtocolAssignmentStep procedureStep = new ProtocolAssignmentStep(protocol);
Assert.AreEqual(ProtocolStatus.PN, procedureStep.Protocol.Status);
Assert.IsFalse(procedureStep.CanApprove);
protocol.SubmitForApproval();
Assert.AreEqual(ActivityStatus.SC, procedureStep.State);
Assert.AreEqual(ProtocolStatus.AA, procedureStep.Protocol.Status);
Assert.IsTrue(procedureStep.CanApprove);
procedureStep.Start(new Staff());
Assert.AreEqual(ActivityStatus.IP, procedureStep.State);
Assert.AreEqual(ProtocolStatus.AA, procedureStep.Protocol.Status);
Assert.IsTrue(procedureStep.CanApprove);
procedureStep.Suspend();
Assert.AreEqual(ActivityStatus.SU, procedureStep.State);
Assert.AreEqual(ProtocolStatus.AA, procedureStep.Protocol.Status);
Assert.IsFalse(procedureStep.CanApprove);
procedureStep.Complete();
Assert.AreEqual(ActivityStatus.CM, procedureStep.State);
Assert.AreEqual(ProtocolStatus.AA, procedureStep.Protocol.Status);
Assert.IsFalse(procedureStep.CanApprove);
// TODO : test all other Protocol state conditions
}
示例4: createProtocol
public static void createProtocol(TreeView tree)
{
TreeNodeCollection treeCol = tree.Nodes;
Protocol prot = new Protocol(treeCol[0].Text, treeCol[0].ImageKey, treeCol[0].SelectedImageKey);
Block data = null;
foreach (TreeNode t in treeCol[0].Nodes)
{
if (t.Name.Equals("block"))
{
data = prot.createBlock(t.Text, t.ImageKey, t.SelectedImageKey);
createProtocol(t.Nodes, data);
}
else
{
if(t.Name.Equals("multi"))
{
Field f = prot.createField(t.Text, t.Name, "", t.SelectedImageKey);
string[] values = t.ImageKey.Split(';');
foreach(string s in values)
{
string[] pair = s.Split(':');
((MultiField)f).addKey(pair[0], pair[1]);
}
} else prot.createField(t.Text, t.Name, t.ImageKey, t.SelectedImageKey);
}
}
createXML(prot);
}
示例5: Send
public void Send(int msgno, MemoryStream stream)
{
Protocol protocol = new Protocol();
protocol.msgno = msgno;
protocol.stream = stream;
mSendBuffer.PushBack(protocol);
}
示例6: MessageSegment
public MessageSegment(IChannel connection, Protocol protocol, EndPoint ep, byte[] data)
{
Protocol = protocol;
EndPoint = ep;
Data = data;
Connection = connection;
}
示例7: Test_IsPreStep
public void Test_IsPreStep()
{
Protocol protocol = new Protocol();
ConcreteProtocolProcedureStep procedureStep = new ConcreteProtocolProcedureStep(protocol);
Assert.IsTrue(procedureStep.IsPreStep);
}
示例8: Update
public override void Update(Protocol.Types.Shortcut shortcut)
{
base.Update(shortcut);
if (shortcut is ShortcutEmote)
Emote = ObjectDataManager.Instance.Get<Emoticon>((shortcut as ShortcutEmote).emoteId);
}
示例9: Process
public void Process(string s)
{
// split protocol, separator and actual value
int separatorIndex = s.IndexOf(SEPARATOR);
if (separatorIndex != -1)
{
switch(s.Substring(0, separatorIndex))
{
case XML_RPC:
m_type = Protocol.XmlRpc;
break;
case SOAP:
m_type = Protocol.Soap;
break;
case REST:
m_type = Protocol.Rest;
break;
case UIML:
// uiml:// style location
m_type = Protocol.Local;
m_value = Uiml.Utils.Location.Transform(s);
break;
}
if (m_value == string.Empty) // only if not already assigned
m_value = s.Substring(separatorIndex + SEPARATOR.Length);
}
else
{
// no separator, thus it's local
m_type = Protocol.Local;
m_value = s; // value is the complete string
}
}
示例10: OpenDocument
public static void OpenDocument(Protocol p, string url)
{
string cmd = "";
url = url.Trim().ToLower();
if ( url.Length > 0 ) {
if ( p == Protocol.Email ) {
cmd += EmailProtocolPrefix;
}
else
if ( p == Protocol.Http ) {
if ( !url.StartsWith( HttpProtocolPrefix ) ) {
cmd += HttpProtocolPrefix;
}
}
cmd += url;
System.Diagnostics.Process.Start( cmd );
} else {
throw new ApplicationException( "Empty url" );
}
return;
}
示例11: MessageOut
public MessageOut(Protocol id)
{
data=new MemoryStream();
writer=new BinaryWriter(data);
writer.Write((UInt16)id);
}
示例12: ScanEndpoint
private static ScanNetworkResult ScanEndpoint(CancellationToken userToken, DnsResolverBase resolver, Protocol protocol, IPEndpoint endpoint)
{
var status = Ping.PerformPing(endpoint, protocol);
var hostName = status ? GetHostName(resolver, endpoint) : null;
var result = new ScanNetworkResult(protocol, endpoint, hostName, status);
return result;
}
示例13: RemoveRequest
public void RemoveRequest(Protocol.Request request)
{
lock(_requests)
{
_requests.Remove(request.Id);
}
}
示例14: AddRequest
public void AddRequest(Protocol.Request request)
{
lock(_requests)
{
_requests.Add(request.Id, request);
}
}
示例15: AddMessage
public void AddMessage(Protocol.IMessage message, Interfaces.IUserAgent user)
{
lock (this)
{
mQueue.Enqueue(new MessageToken { Message = message, UserAgent = user });
}
}