Beispiel #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            Configuration.SetCurrentCulture();

            base.OnStartup(e);

            var allowedHosts = File.ReadAllLines("AllowedHosts.txt");

            var browserUrl = new BrowserUrl(allowedHosts);

            MainWindow = new MainWindow(browserUrl);

            MainWindow.Show();
        }
Beispiel #2
0
 public IEnumerable <Uri> GetUris()
 {
     return((_bookmarksProvider() ?? new Bookmark[0])
            .Select(b =>
     {
         try
         {
             return BrowserUrl.ConvertToUri(b.Address, true);
         }
         catch
         {
             return null;
         }
     })
            .Where(u => u != null));
 }
Beispiel #3
0
        public string GetAddressCompletion(string addressStart)
        {
            if (string.IsNullOrWhiteSpace(addressStart))
            {
                return(string.Empty);
            }

            var startUri = BrowserUrl.ConvertToUri(addressStart, true);

            foreach (var uri in GetUris())
            {
                var matchingEnd = GetMatchingEnd(startUri, uri);
                if (!string.IsNullOrEmpty(matchingEnd))
                {
                    return(matchingEnd);
                }
            }

            return(string.Empty);
        }
Beispiel #4
0
 public AllowedUrisProvider(BrowserUrl browserUrl)
 {
     _browserUrl = browserUrl ?? throw new ArgumentNullException(nameof(browserUrl));
 }