Esempio n. 1
0
		public string ExpandVariables( string input )
		{
			string result = input;

			result = result.Replace( "$(Port)", Convert.ToString(Number) );
			result = result.Replace( "$(PortAddressFamily)", AddressFamily.ToString() );
			result = result.Replace( "$(PortSocketType)", SocketType.ToString() );
			result = result.Replace( "$(PortProtocolType)", ProtocolType.ToString() );
			//result = result.Replace( "$(HostName)", Owner.Address );
			result = result.Replace( "$(Now)", DateTime.Now.ToString() );
			result = result.Replace( "$(ErrorMessage)", Exception!=null?Exception.Message:"(no exception)" );

			return result;
		}
Esempio n. 2
0
        public ITransport CreateTransport(ILoggerFactory loggerFactory)
        {
            if (_customFactory != null)
            {
                return(_customFactory.CreateTransport());
            }

            if (_socketType == SocketType.TCP)
            {
                return(SocketTools.CreateTcpTransport(_address, (SocketTransportSettings)_settings, loggerFactory));
            }
            else
            {
                throw new NotSupportedException(_socketType.ToString());
            }
        }
Esempio n. 3
0
    // =========================================================================================== //
    // get the offset from central position for each socket
    public static Position GetSocketOffset(SocketType socketType)
    {
        switch (socketType)
        {
        case SocketType.HEAD:
            return(new Position(-8, 75));

        case SocketType.NECK:
            return(new Position(0, 40));

        case SocketType.TORSO:
            return(new Position(-6, 16));

        case SocketType.BACK:
            return(new Position(0, 0));

        case SocketType.WRIST:
            return(new Position(0, -10));

        case SocketType.MAIN_HAND:
            return(new Position(-41, 26));

        case SocketType.OFF_HAND:
            return(new Position(20, 0));

        case SocketType.WAIST:
            return(new Position(0, -20));

        case SocketType.FEET:
            return(new Position(0, -60));

        /*case SocketType.FINGER:
         *  break;*/
        case SocketType.RANGED:
            return(new Position(-19, 46));

        case SocketType.AMMO:
            return(new Position(20, 35));

        /*case SocketType.POCKET:
         *  return new Position(0, -);*/
        default:
            Debug.LogError("Unknown socket type " + socketType.ToString());
            return(Position.NullPosition);
        }
    }