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


C# TransportType.ToString方法代码示例

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


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

示例1: TransportSource

 public ITransportInterface TransportSource(TransportType type)
 {
     switch (type)
     {
         case TransportType.Metro:
             return new MetroSource();
         case TransportType.Train:
             return new TrainSource();
         default:
             throw new NotSupportedException("TransportType: " + type.ToString());
     }
 }
开发者ID:andrew-js-wright,项目名称:nirail,代码行数:12,代码来源:TransportFactory.cs

示例2: GetTransport

        public Transport GetTransport(TransportType type)
        {
            // A BoatPlane is worth 500k, otherwise it is worth 100k
            var transportValue = type == TransportType.BoatPlane ? 500000 : 100000;
            const int carSize = 6;

            var transportString = type.ToString();
            var normalGraphic = _content.Load<Texture2D>(String.Concat("Images/Transport/", transportString));
            var glowGraphic = _content.Load<Texture2D>(String.Concat("Images/Transport/", transportString, "_glow"));
            var newTransport = new Transport(type, transportString, carSize, normalGraphic, glowGraphic, transportValue);

            return newTransport;
        }
开发者ID:AlanFoster,项目名称:Game-of-Life,代码行数:13,代码来源:TransportFactory.cs

示例3: CreateFromConnectionString

        /// <summary>
        /// Create DeviceClient from the specified connection string using the specified transport type
        /// (WinRT) Only Http transport is allowed
        /// </summary>
        /// <param name="connectionString">Connection string for the IoT hub (including DeviceId)</param>
        /// <param name="transportType">Specifies whether Amqp or Http transport is used</param>
        /// <returns>DeviceClient</returns>
        public static DeviceClient CreateFromConnectionString(string connectionString, TransportType transportType)
        {
            if (connectionString  == null)
            {
                throw new ArgumentNullException("connectionString");
            }

            var iotHubConnectionString = IotHubConnectionString.Parse(connectionString);
            if (transportType == TransportType.Http1)
            {
                return new DeviceClient(new HttpDeviceClient(iotHubConnectionString));
            }
            else
            {
                throw new NotImplementedException();
            }
            
            throw new InvalidOperationException("Unsupported Transport Type " + transportType.ToString());
        }
开发者ID:jasoneilts,项目名称:azure-iot-sdks,代码行数:26,代码来源:DeviceClient.cs

示例4: OscServer

		/// <summary>
		/// Creates a new instance of OscServer.
		/// </summary>
        /// <param name="transportType">The underlying transport protocol.</param>
		/// <param name="ipAddress">The local IP address to bind to.</param>
		/// <param name="port">The UDP port to bind to.</param>
		/// <param name="multicastAddress">The multicast IP address to join.</param>
		/// <param name="transmissionType">The transmission type for the server to use.</param>
        /// <param name="consumeParsingExceptions">Specifies the behavior of handling parsing exceptions.</param>
		/// <remarks>If ipAddress is specified, Unicast; otherwise, if multicastAddress is specified, Multicast.</remarks>
		public OscServer(TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType, bool consumeParsingExceptions)
		{
            Assert.IsTrue(transportType == TransportType.Udp || transportType == TransportType.Tcp);
            if ((transportType == TransportType.Tcp) && (transmissionType != TransmissionType.Unicast))
            {
                throw new InvalidOperationException("TCP must be used with TransmissionType.Unicast.");
            }

            mTransportType = transportType;
			mIPAddress = ipAddress;
			mPort = port;
            mIPEndPoint = new IPEndPoint(ipAddress, port);
			mTransmissionType = transmissionType;

			if (mTransmissionType == TransmissionType.Multicast)
			{
				Assert.ParamIsNotNull(multicastAddress);
				mMulticastAddress = multicastAddress;
			}

			mRegisteredMethods = new List<string>();
			mFilterRegisteredMethods = true;
            mConsumeParsingExceptions = consumeParsingExceptions;
            
            switch (mTransportType)
            {
                case TransportType.Udp:
                    mUdpServer = new UdpServer(mIPAddress, mPort, mMulticastAddress, mTransmissionType);
                    mUdpServer.DataReceived += new UdpDataReceivedHandler(mUdpServer_DataReceived);
                    break;

                case TransportType.Tcp:                   
                    mTcpServer = new TcpServer(mIPAddress, mPort, true, false, OscPacket.LittleEndianByteOrder);
                    mTcpServer.DataReceived += new TcpDataReceivedHandler(mTcpServer_DataReceived);
                    break;

                default:
                    throw new InvalidOperationException("Invalid transport type: " + mTransportType.ToString());
            }
		}
开发者ID:erwinmnl,项目名称:Tools,代码行数:50,代码来源:OscServer.cs

示例5: CreateTransport

 public IVoIPTransport CreateTransport(TransportType transportType)
 {
     return _container.Get<IVoIPTransport>(transportType.ToString());
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:4,代码来源:DefaultVoIPTransportFactory.cs


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