示例#1
0
        /// <summary>
        /// Turns a '@' separated value into a full path.
        /// Format is 'queue@machine', or 'queue@ipaddress'
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static string GetFullPath(Address value)
        {
            IPAddress ipAddress;

            if (IPAddress.TryParse(value.Machine, out ipAddress))
            {
                return(PREFIX_TCP + MsmqQueueCreator.GetFullPathWithoutPrefix(value));
            }

            return(PREFIX + MsmqQueueCreator.GetFullPathWithoutPrefix(value));
        }
示例#2
0
        /// <summary>
        /// Gets the name of the return address from the provided value.
        /// If the target includes a machine name, uses the local machine name in the returned value
        /// otherwise uses the local IP address in the returned value.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static string GetReturnAddress(Address value, Address target)
        {
            var machine = target.Machine;

            IPAddress targetIpAddress;

            //see if the target is an IP address, if so, get our own local ip address
            if (IPAddress.TryParse(machine, out targetIpAddress))
            {
                if (string.IsNullOrEmpty(localIp))
                {
                    localIp = LocalIpAddress(targetIpAddress);
                }

                return(PREFIX_TCP + localIp + PRIVATE + value.Queue);
            }

            return(PREFIX + MsmqQueueCreator.GetFullPathWithoutPrefix(value));
        }