public void PlaceholderE2EUrlTest()
        {
            IKeePassEntry entry = GetTestEntry();
            entry.OverrideUrl = "http://{C:test}example.com/{URL:HOST}";

            Assert.AreEqual(
                "http://example.com/www.example.com",
                entry.ConstructUriString()
            );
        }
Exemple #2
0
        /// <summary>
        /// Attempts to construct a URI from either <paramref name="entry"/>'s URL or override URL.
        /// </summary>
        /// <param name="entry">The entry to construct a URI for.</param>
        /// <returns>A launchable URI, or null.</returns>
        public static Uri GetLaunchableUri(this IKeePassEntry entry)
        {
            string uriCandidate = entry.ConstructUriString();

            if (uriCandidate == null)
            {
                return(null);
            }

            try
            {
                Uri uri = new Uri(uriCandidate);
                return(uri);
            }
            catch (FormatException)
            {
                return(null);
            }
        }