Exemplo n.º 1
0
        public IEnumerable <Uri> GetRepositoryUris(bool forBrowse)
        {
            HybridCollection <Uri> uris = new HybridCollection <Uri>();

            if (ProjectRootUri != null)
            {
                uris.Add(ProjectRootUri);
            }

            // Global keys (over all versions)
            using (RegistryKey rk = Config.OpenGlobalKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Per hive
            using (RegistryKey rk = Config.OpenInstanceKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Per user + Per hive
            using (RegistryKey rk = Config.OpenUserInstanceKey("Repositories"))
            {
                if (rk != null)
                {
                    LoadUris(uris, rk);
                }
            }

            // Finally add the last used list from TortoiseSVN
            try
            {
                using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(
                           "SOFTWARE\\TortoiseSVN\\History\\repoURLS", RegistryKeyPermissionCheck.ReadSubTree))
                {
                    if (rk != null)
                    {
                        LoadUris(uris, rk);
                    }
                }
            }
            catch (SecurityException)
            { /* Ignore no read only access; stupid sysadmins */ }

            IAnkhConfigurationService configSvc = GetService <IAnkhConfigurationService>();

            if (configSvc != null)
            {
                foreach (string u in configSvc.GetRecentReposUrls())
                {
                    Uri uri;
                    if (u != null && Uri.TryCreate(u, UriKind.Absolute, out uri))
                    {
                        if (!uris.Contains(uri))
                        {
                            uris.Add(uri);
                        }
                    }
                }
            }

            return(uris);
        }