Beispiel #1
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType != typeof(string))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }
            AmsNetId id = (AmsNetId)value;

            return(!(id == AmsNetId.Empty) ? (!(id == AmsNetId.Local) ? (!(id == AmsNetId.LocalHost) ? id.ToString() : "LocalHost") : "Local") : "Empty");
        }
Beispiel #2
0
        public static bool TryParse(string str, out AmsAddress address)
        {
            AmsNetId netId = null;
            int      port  = 0;

            if (TryParse(str, out netId, out port))
            {
                address = new AmsAddress(netId, port);
                return(true);
            }
            address = null;
            return(false);
        }
Beispiel #3
0
        internal static bool TryParse(string str, out AmsNetId netId, out int port)
        {
            Match match = regex.Match(str);

            if (match.Success)
            {
                netId = AmsNetId.GetNetId(match);
                port  = GetPort(match);
                return(true);
            }
            netId = null;
            port  = 0;
            return(false);
        }
Beispiel #4
0
 public AdsSession(AmsNetId netId, int port, SessionSettings settings) : this(new AmsAddress(netId, port), settings, null)
 {
 }
Beispiel #5
0
 public AdsSession(AmsNetId netId, int port) : this(netId, port, SessionSettings.Default)
 {
 }
Beispiel #6
0
 public AmsAddress(byte[] netId, AmsPort port)
 {
     this.netId = new AmsNetId(netId);
     this.port  = (int)port;
 }
Beispiel #7
0
 public AmsAddress(AmsNetId netId, AmsPort port)
 {
     this.netId = netId;
     this.port  = (int)port;
 }
Beispiel #8
0
 public AmsAddress(byte[] netId, int port)
 {
     this.netId = new AmsNetId(netId);
     this.port  = port;
 }
Beispiel #9
0
 public AmsAddress(AmsNetId netId, int port)
 {
     this.netId = netId;
     this.port  = port;
 }
Beispiel #10
0
 public AmsAddress(string netId, int port)
 {
     this.netId = new AmsNetId(netId);
     this.port  = port;
 }
Beispiel #11
0
 public AmsAddress(AmsPort port)
 {
     this.netId = AmsNetId.Local;
     this.port  = (int)port;
 }
Beispiel #12
0
 public AmsAddress(AmsAddress address)
 {
     this.netId = address.netId;
     this.port  = address.port;
 }
Beispiel #13
0
 public AmsAddress(int port)
 {
     this.netId = AmsNetId.Local;
     this.port  = port;
 }
Beispiel #14
0
 public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) =>
 (!(value is string) ? base.ConvertFrom(context, culture, value) : AmsNetId.Parse((string)value));