Пример #1
0
 /// <summary>
 /// Replace place-holders in url with values from this service
 /// </summary>
 /// <param name="url">Url to replace</param>
 /// <returns>Replaced url</returns>
 public string ReplaceUrl(string url)
 {
     return(url.Replace("###IPADDRESS###", LocalIPAddressString.UrlEncode())
            .Replace("###REMOTEIPADDRESS###", RemoteIPAddressString.UrlEncode())
            .Replace("###MACHINENAME###", FQDN.UrlEncode())
            .Replace("###VERSION###", Version.UrlEncode())
            .Replace("###GUID###", MachineGuid.UrlEncode())
            .Replace("###OSNAME###", OSName.UrlEncode())
            .Replace("###OSVERSION###", OSVersion.UrlEncode()));
 }
Пример #2
0
        /// <summary>
        /// Constructor with string parameter </summary>
        /// <param name="uri"> String representation of URI </param>
        /// <exception cref="URISyntaxException"> which signals that URI has syntax error </exception>
        /// <exception cref="UnknownServiceException"> which signals that URI has incorrect scheme </exception>
        public URI(string uri)
        {
            parse(uri);

            if (FQDN == null || FQDN.Trim().Length == 0)
            {
                throw new Exception("Host not found");
            }
            if (!Scheme.Equals("aaa") && !Scheme.Equals("aaas"))
            {
                throw new Exception((new StringBuilder()).Append("Unsupported service: ").Append(Scheme).ToString());
            }
        }