• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Protocol类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Protocol类属于命名空间,在下文中一共展示了Protocol类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
        }
开发者ID:peteward44,项目名称:nbm-messenger,代码行数:11,代码来源:ProtocolReporter.cs


示例2: ContainsLayer

 public override bool ContainsLayer(Protocol layer)
 {
     if (layer == Protocol.UDP)
         return true;
     else
         return base.ContainsLayer(layer);
 }
开发者ID:zzz654321,项目名称:fireBwall,代码行数:7,代码来源:UDPPacket.cs


示例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
        }
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:ProtocolAssignmentStepTests.cs


示例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);
 }
开发者ID:vicban3d,项目名称:Hackaton,代码行数:28,代码来源:Facade.cs


示例5: Send

 public void Send(int msgno, MemoryStream stream)
 {
     Protocol protocol = new Protocol();
     protocol.msgno = msgno;
     protocol.stream = stream;
     mSendBuffer.PushBack(protocol);
 }
开发者ID:goome,项目名称:eternal-client,代码行数:7,代码来源:NetManager.cs


示例6: MessageSegment

 public MessageSegment(IChannel connection, Protocol protocol, EndPoint ep, byte[] data)
 {
     Protocol = protocol;
     EndPoint = ep;
     Data = data;
     Connection = connection;
 }
开发者ID:odinhaus,项目名称:Suffuz,代码行数:7,代码来源:MessageSegment.cs


示例7: Test_IsPreStep

        public void Test_IsPreStep()
        {
            Protocol protocol = new Protocol();
            ConcreteProtocolProcedureStep procedureStep = new ConcreteProtocolProcedureStep(protocol);

            Assert.IsTrue(procedureStep.IsPreStep);
        }
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:ProtocolProcedureStepTests.cs


示例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);
        }
开发者ID:Ryuuke,项目名称:BehaviorIsManaged,代码行数:7,代码来源:EmoteShortcut.cs


示例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
			}
		}
开发者ID:jozilla,项目名称:Uiml.net,代码行数:35,代码来源:Location.cs


示例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;
        }
开发者ID:Baltasarq,项目名称:Tacto,代码行数:25,代码来源:ConnectionManager.cs


示例11: MessageOut

        public MessageOut(Protocol id)
        {
            data=new MemoryStream();
            writer=new BinaryWriter(data);

            writer.Write((UInt16)id);
        }
开发者ID:Postremus,项目名称:libraries,代码行数:7,代码来源:MessageOut.cs


示例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;
 }
开发者ID:atanasmihaylov,项目名称:lanscan,代码行数:7,代码来源:Scanner.cs


示例13: RemoveRequest

 public void RemoveRequest(Protocol.Request request)
 {
     lock(_requests)
     {
         _requests.Remove(request.Id);
     }
 }
开发者ID:samfromdeath,项目名称:sharpfastcgi,代码行数:7,代码来源:SyncronizedRequestsRepository.cs


示例14: AddRequest

 public void AddRequest(Protocol.Request request)
 {
     lock(_requests)
     {
         _requests.Add(request.Id, request);
     }
 }
开发者ID:samfromdeath,项目名称:sharpfastcgi,代码行数:7,代码来源:SyncronizedRequestsRepository.cs


示例15: AddMessage

 public void AddMessage(Protocol.IMessage message, Interfaces.IUserAgent user)
 {
     lock (this)
     {
         mQueue.Enqueue(new MessageToken { Message = message, UserAgent = user });
     }
 }
开发者ID:GameHackers,项目名称:siqi,代码行数:7,代码来源:Desk.cs


示例16: Create

        /// <summary>
        /// Construct an StreamContent from a provided populated OFX object
        /// </summary>
        /// <param name="ofxObject">A populated OFX message with request or response data</param>
        /// <returns>Created StreamContent ready to send with HttpClient.Post</returns>
        public static StreamContent Create(Protocol.OFX ofxObject)
        {
            // Serialized data will be written to a MemoryStream
            var memoryStream = new System.IO.MemoryStream();

            // XMLWriter will be used to encode the data using UTF8Encoding without a Byte Order Marker (BOM)
            var xmlWriter = new System.Xml.XmlTextWriter(memoryStream, new System.Text.UTF8Encoding(false));

            // Write xml processing instruction
            xmlWriter.WriteStartDocument();
            // Our OFX protocol uses a version 2.0.0 header with 2.1.1 protocol body
            xmlWriter.WriteProcessingInstruction("OFX", "OFXHEADER=\"200\" VERSION=\"211\" SECURITY=\"NONE\" OLDFILEUID=\"NONE\" NEWFILEUID=\"NONE\"");

            // Don't include namespaces in the root element
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
            ns.Add("", "");

            // Generate XML to the stream
            m_serializer.Serialize(xmlWriter, ofxObject, ns);

            // Flush writer to stream
            xmlWriter.Flush();

            // Position the stream back to the start for reading
            memoryStream.Position = 0;

            // Wrap in our HttpContent-derived class to provide headers and other HTTP encoding information
            return new StreamContent(memoryStream);
        }
开发者ID:rhadman,项目名称:SoDotCash,代码行数:34,代码来源:StreamContent.cs


示例17: FriendTreeNode

 /// <summary>
 /// Constructs a FriendTreeNode
 /// </summary>
 /// <param name="protocol">Associated protocol</param>
 /// <param name="friend">Associated friend</param>
 public FriendTreeNode(Protocol protocol, Friend friend)
 {
     this.protocol = protocol;
     this.friend = friend;
     this.Tag = friend;
     this.Text = friend.DisplayName;
 }
开发者ID:peteward44,项目名称:nbm-messenger,代码行数:12,代码来源:FriendTreeNode.cs


示例18: CharacterInfomation

 public CharacterInfomation(int myID, string myName, int myTextureID, Protocol.Type myType)
 {
     setID(myID);
     setName(myName);
     setTextureID(myTextureID);
     setType(myType);
 }
开发者ID:k402xxxcenxxx,项目名称:our-RPGMineSweep,代码行数:7,代码来源:CharacterInfomation.cs


示例19: LoadBalancerProbe

 public LoadBalancerProbe(Protocol protocol, string path, int? port)
 {
     //TODO: Validate params
     this.Protocol = protocol;
     this.Path = path;
     this.Port = port;
 }
开发者ID:tquinn86,项目名称:azure-sdk-for-net,代码行数:7,代码来源:LoadBalancerProbe.cs


示例20: Read

 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.I32) {
           Pid = (Protocol)iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
开发者ID:yakolla,项目名称:HelloVertX,代码行数:27,代码来源:ProtocolReqBase.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ProtocolType类代码示例发布时间:2022-05-24
下一篇:
C# ProtoWriter类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap