public static byte[] Marshal(AmsAddress address)
 {
     byte[] destinationArray = new byte[8];
     Array.Copy(address.NetId.netId, destinationArray, 6);
     Array.Copy(BitConverter.GetBytes((ushort)address.Port), 0, destinationArray, 6, 2);
     return(destinationArray);
 }
Example #2
0
        public static AmsAddress Parse(string str)
        {
            AmsAddress address = null;

            if (!TryParse(str, out address))
            {
                throw new FormatException();
            }
            return(address);
        }
Example #3
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);
        }
Example #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (!(obj is AmsAddress))
            {
                return(false);
            }
            AmsAddress address = (AmsAddress)obj;

            return((this.port == address.port) ? !(this.netId != address.netId) : false);
        }
 public static int SizeOf(AmsAddress address) =>
 8;
Example #6
0
 public AdsSession(AmsAddress address, SessionSettings settings, object owner) : base(SessionProvider <AdsSession, AmsAddress, SessionSettings> .Self)
 {
     this._owner    = owner;
     this._address  = address.Clone();
     this._settings = settings;
 }
Example #7
0
 public AdsSession(AmsAddress address, SessionSettings settings) : this(address, settings, null)
 {
 }
Example #8
0
 public AdsSession(AmsAddress address) : this(address, SessionSettings.Default)
 {
 }
Example #9
0
 public AmsAddress(AmsAddress address)
 {
     this.netId = address.netId;
     this.port  = address.port;
 }