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


C# Protocol.ToString方法代码示例

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


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

示例1: OpenPort

        /// <summary>
        /// Opens a port with the UPnP protocol.
        /// </summary>
        /// <param name="PortNumber">The number of the port to add.</param>
        /// <param name="protocol">The protocol used for the port.</param>
        public static void OpenPort(int PortNumber, Protocol protocol)
        {
            NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();

            NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;

            if (mappings != null)
            {
                mappings.Add(PortNumber, protocol.ToString(), PortNumber, Global.GetMyLocalIP(), true, "iKiwi");

                Utilities.Log.Write("Opened the port " + PortNumber + " with the UPnP protocol", Utilities.Log.LogCategory.Info);
            }
        }
开发者ID:pesapower,项目名称:ikiwi,代码行数:18,代码来源:UPnP.cs

示例2: RemoveMapping

        public bool RemoveMapping(int iExternalPort, Protocol eProtocol)
        {
            bool bResult = false;

            mappings.Remove(iExternalPort, eProtocol.ToString());

            return bResult;
        }
开发者ID:jordanburnam,项目名称:FamilyUtilities,代码行数:8,代码来源:Router.cs

示例3: EnsureProtocol

        ///<summary>
        ///Assesses a url and returns a url that is guaranteed to begin with the specified protocol
        ///</summary>
        ///<param name="url">The url to be checked for the protocol</param>
        ///<returns>A url that is guaranteed to begin with the specified protocol</returns>
        ///<remarks></remarks>
        public static string EnsureProtocol(string url, Protocol protocol)
        {
            string output = url;

            if (!string.IsNullOrEmpty(output) && !output.StartsWith(protocol + "://", StringComparison.OrdinalIgnoreCase))
                output = string.Format("{0}://{1}", protocol.ToString().ToLower(), url);

            return output;
        }
开发者ID:wduffy,项目名称:Toltech.Mvc,代码行数:15,代码来源:PathTools.cs

示例4: AddMapping

        public bool AddMapping(int iExternalPort, Protocol eProtocol, int iInternalPort, string sInternalClientIP, string sDescription)
        {
            bool bResult = false;
            IStaticPortMapping oPortMapping = null;
            oPortMapping = mappings.Add(iExternalPort, eProtocol.ToString(), iInternalPort, sInternalClientIP, true, sDescription);
            if (oPortMapping != null)
            {

            }
            return bResult;
        }
开发者ID:jordanburnam,项目名称:FamilyUtilities,代码行数:11,代码来源:Router.cs

示例5: ClosePort

        /// <summary>
        /// Closes a port with the UPnP protocol.
        /// </summary>
        /// <param name="PortNumber">The number of the port to close.</param>
        /// <param name="protocol">The protocol used for the port.</param>
        public static void ClosePort(int PortNumber, Protocol protocol)
        {
            NATUPNPLib.UPnPNATClass upnpnat = new NATUPNPLib.UPnPNATClass();

            NATUPNPLib.IStaticPortMappingCollection mappings = upnpnat.StaticPortMappingCollection;

            if (mappings != null)
            {
                mappings.Remove(PortNumber, protocol.ToString());

                Utilities.Log.Write("Closed the port " + PortNumber + " with the UPnP protocol", Utilities.Log.LogCategory.Info);
            }
        }
开发者ID:pesapower,项目名称:ikiwi,代码行数:18,代码来源:UPnP.cs

示例6: HrdRequest

        /// <summary>
        /// Constructs HrdRequest
        /// </summary>
        /// <param name="issuer">The issuer url</param>
        /// <param name="realm">Realm of the relying party</param>
        /// <param name="protocol">Relying party protocol</param>
        /// <param name="replyTo">Optional reply_to for the relying party</param>
        /// <param name="context">Optional context for the request</param>
        /// <param name="callback">Optional callback method. When specified the response will include java script to call this method.</param>
        public HrdRequest(string issuer,
            string realm,
            Protocol protocol = Protocol.wsfederation,
            string replyTo = null,
            string context = null,
            string callback = null)
        {
            uriBuilder = new UriBuilder(issuer);

            parameters["protocol"] = protocol.ToString();
            parameters["realm"] = realm;
            parameters["version"] = Version;

            AddParameterIfNotNull("reply_to", replyTo);
            AddParameterIfNotNull("context", context);
            AddParameterIfNotNull("callback", callback);
        }
开发者ID:smichelotti,项目名称:MichelottiPlaybook,代码行数:26,代码来源:HrdRequest.cs

示例7: BuildRawMsg

 public static string BuildRawMsg(Protocol p, string[] contents)
 {
     StringBuilder sb = new StringBuilder(MSG_START);
     sb.Append(MSG_DELIMITER).Append(AppSetting.PROTOCOL_VERSION);
     sb.Append(MSG_DELIMITER).Append(p.ToString());
     int count = 0;
     StringBuilder content = new StringBuilder();
     foreach (string s in contents)
     {
         if (!string.IsNullOrEmpty(s))
         {
             content.Append(MSG_DELIMITER).Append(s);
             count += 1;
         }
     }
     sb.Append(MSG_DELIMITER).Append(count.ToString());
     if (!string.IsNullOrEmpty(content.ToString()))
         sb.Append(content.ToString());
     sb.Append(MSG_DELIMITER);
     return sb.ToString();
 }
开发者ID:harryho,项目名称:demo-fx-trading-platform-prototype,代码行数:21,代码来源:NetHelper.cs

示例8: Imposter

 public Imposter(int port, Protocol protocol, string name)
 {
     Port = port;
     Protocol = protocol.ToString().ToLower();
     Name = name;
 }
开发者ID:mattherman,项目名称:MbDotNet,代码行数:6,代码来源:Imposter.cs

示例9: GenerateResourcePath

        /// <summary>
        /// Returns the resource path for the given distribution, object, and protocol.
        /// </summary>
        private static string GenerateResourcePath(Protocol protocol,
                                                   string distributionDomain,
                                                   string path)
        {

            if (protocol == Protocol.http || protocol == Protocol.https)
            {
                return protocol.ToString() + "://" + distributionDomain + "/" + path;
            }
            else
            {
                return path;
            }
        }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:17,代码来源:AmazonCloudFrontUrlSigner.cs

示例10: javaEditor_OperationStarted

 void javaEditor_OperationStarted(object sender, Protocol.Request e)
 {
     if (Root != null)
     {
         Root.Dispatcher.Invoke((Action)delegate()
         {
             Root.BusyProgressBar = true;
             Root.BusyProgressMessage = e.ToString();
         });
     }
 }
开发者ID:XewTurquish,项目名称:vsminecraft,代码行数:11,代码来源:JavaMargin.cs

示例11: Exists

        /// <summary>
        ///     Checks to see if a port exists in the mapping.
        /// </summary>
        /// <param name="port">The port to check.</param>
        /// <param name="protocol">The protocol of the port [TCP/UDP]</param>
        /// <exception cref="ApplicationException">This exception is thrown when UPnP is disabled.</exception>
        /// <exception cref="ObjectDisposedException">This exception is thrown when this class has been disposed.</exception>
        /// <exception cref="ArgumentException">This exception is thrown when the port [or protocol] is invalid.</exception>
        /// <remarks></remarks>
        public bool Exists(long port, Protocol protocol)
        {
            try
            {
                // Final check!
                if (!_staticEnabled)
                    throw new ApplicationException(
                        "UPnP is not enabled, or there was an error with UPnP Initialization.");

                Logger.Log(LogLevel.Info, "uPnP", "Checking if port is in use...");
                // Begin checking

                foreach (IStaticPortMapping mapping in _staticMapping)
                {
                    // Compare
                    if (mapping.ExternalPort == port && mapping.Protocol.ToLower().Equals(protocol.ToString().ToLower()))
                        return true;
                }
                Logger.Log(LogLevel.Info, "uPnP", "ok: Port is not in use", port + ":" + protocol);
                //Nothing!
                return false;
            }
            catch (Exception ex)
            {
                Logger.Log(LogLevel.Warning, "uPnP", "Couldn't check if port mapping exists", ex.Message);
                throw new Exception("Couldn't check if mapping exists!", ex);
            }
        }
开发者ID:CaptainTF,项目名称:bukkitgui2,代码行数:37,代码来源:Upnp.cs

示例12: Remove

        /// <summary>
        ///     Removes a port mapping from the UPnP enabled device.
        /// </summary>
        /// <param name="port">The port to remove.</param>
        /// <param name="protocol">The protocol of the port [TCP/UDP]</param>
        /// <exception cref="ApplicationException">This exception is thrown when UPnP is disabled.</exception>
        /// <exception cref="ObjectDisposedException">This exception is thrown when this class has been disposed.</exception>
        /// <exception cref="ArgumentException">This exception is thrown when the port [or protocol] is invalid.</exception>
        /// <remarks></remarks>
        public static void Remove(int port, Protocol protocol)
        {
            if (_lastInstance == null) _lastInstance = new UPnP();


            if (!UpnpEnabled)
                throw new ApplicationException("UPnP is not enabled, or there was an error with UPnP Initialization.");

            // Begin utilizing
            if (!_lastInstance.Exists(port, protocol))
                throw new ArgumentException("This mapping doesn't exist!", port + " : " + protocol);

            // Okay, continue on
            _lastInstance._staticMapping.Remove(port, protocol.ToString());
            GetMapping(); //refresh
        }
开发者ID:CaptainTF,项目名称:bukkitgui2,代码行数:25,代码来源:Upnp.cs

示例13: Add

        /// <summary>
        ///     Adds a port mapping to the UPnP enabled device.
        /// </summary>
        /// <param name="localIp">The local IP address to map to.</param>
        /// <param name="port">The port to forward.</param>
		/// <param name="protocol">The protocol of the port [TCP/UDP]</param>
        /// <param name="desc">A small description of the port.</param>
        /// <exception cref="ApplicationException">This exception is thrown when UPnP is disabled.</exception>
        /// <exception cref="ObjectDisposedException">This exception is thrown when this class has been disposed.</exception>
        /// <exception cref="ArgumentException">This exception is thrown when any of the supplied arguments are invalid.</exception>
        /// <remarks></remarks>
		private void Add(string localIp, uint port, Protocol protocol, string desc)
        {
            // Begin utilizing
            if (Exists(port, protocol))
				throw new ArgumentException("This mapping aLocale.Tready exists!", port + " : " + protocol);

            // Check
            if (!IsPrivateIp(localIp))
                throw new ArgumentException("This is not a local IP address!", "localIp");

            // Final check!
            if (!_staticEnabled)
                throw new ApplicationException("UPnP is not enabled, or there was an error with UPnP Initialization.");

            // Okay, continue on
			_staticMapping.Add(Convert.ToInt32(port), protocol.ToString(), Convert.ToInt32(port), localIp, true, desc);
        }
开发者ID:CaptainTF,项目名称:bukkitgui2,代码行数:28,代码来源:Upnp.cs

示例14: UpdatePorts

 private void UpdatePorts(int port, Protocol protocol)
 {
     if (txtPorts.Text == "")
         txtPorts.Text = protocol.ToString().ToUpper() + "/" + port.ToString() + ":\tMay be a hidden port.";
     else
         txtPorts.Text += Environment.NewLine + protocol.ToString().ToUpper() + "/" + port.ToString() + ":\tMay be a hidden port.";
 }
开发者ID:michaellandi,项目名称:hpdetector,代码行数:7,代码来源:frmMain.cs

示例15: UpdatePortLabel

 private void UpdatePortLabel(int port, Protocol protocol)
 {
     lblPort.Text = "Port: " + protocol.ToString().ToUpper() + "/" + port.ToString();
 }
开发者ID:michaellandi,项目名称:hpdetector,代码行数:4,代码来源:frmMain.cs


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