Exemplo n.º 1
0
        private static RepositoryHistory LoadRepositoryHistory()
        {
            int    size    = AppSettings.RecentRepositoriesHistorySize;
            object setting = AppSettings.GetString("history", null);

            if (setting == null)
            {
                return(new RepositoryHistory(size));
            }

            RepositoryHistory repositoryHistory = DeserializeHistoryFromXml(setting.ToString());

            if (repositoryHistory == null)
            {
                return(new RepositoryHistory(size));
            }

            repositoryHistory.MaxCount = size;
            AssignRepositoryHistoryFromCategories(repositoryHistory, null);

            // migration from old version (move URL history to _remoteRepositoryHistory)
            if (AppSettings.GetString("history remote", null) == null)
            {
                _remoteRepositoryHistory = new RepositoryHistory(size);
                foreach (Repository repo in repositoryHistory.Repositories)
                {
                    if (repo.IsRemote)
                    {
                        repo.Path = repo.Path.ToPosixPath();
                        _remoteRepositoryHistory.AddRepository(repo);
                    }
                }

                foreach (Repository repo in _remoteRepositoryHistory.Repositories)
                {
                    repositoryHistory.RemoveRepository(repo);
                }
            }

            return(repositoryHistory);
        }
Exemplo n.º 2
0
        private static RepositoryHistory LoadRepositoryHistory()
        {
            var    repositoryHistory = new RepositoryHistory();
            object setting           = Settings.GetString("history", null);

            if (setting == null)
            {
                repositoryHistory = new RepositoryHistory();
                return(repositoryHistory);
            }

            repositoryHistory = DeserializeHistoryFromXml(setting.ToString());
            if (repositoryHistory != null)
            {
                AssignRepositoryHistoryFromCategories(repositoryHistory, null);

                // migration from old version (move URL history to _remoteRepositoryHistory)
                if (Settings.GetString("history remote", null) == null)
                {
                    _remoteRepositoryHistory = new RepositoryHistory();
                    foreach (Repository repo in repositoryHistory.Repositories)
                    {
                        if (repo.IsRemote)
                        {
                            repo.Path = repo.Path.Replace('\\', '/');
                            _remoteRepositoryHistory.AddRepository(repo);
                        }
                    }
                    foreach (Repository repo in _remoteRepositoryHistory.Repositories)
                    {
                        repositoryHistory.RemoveRepository(repo);
                    }
                }
            }

            return(repositoryHistory ?? new RepositoryHistory());
        }
Exemplo n.º 3
0
        private static RepositoryHistory LoadRepositoryHistory()
        {
            int size = AppSettings.GetInt("history size", DefaultRepositoriesCount);
            object setting = AppSettings.GetString("history", null);
            if (setting == null)
            {
                return new RepositoryHistory(size);
            }

            RepositoryHistory repositoryHistory = DeserializeHistoryFromXml(setting.ToString());
            if (repositoryHistory == null)
                return new RepositoryHistory(size);

            repositoryHistory.MaxCount = size;
            AssignRepositoryHistoryFromCategories(repositoryHistory, null);

            // migration from old version (move URL history to _remoteRepositoryHistory)
            if (AppSettings.GetString("history remote", null) == null)
            {
                _remoteRepositoryHistory = new RepositoryHistory(size);
                foreach (Repository repo in repositoryHistory.Repositories)
                {
                    if (repo.IsRemote)
                    {
                        repo.Path = repo.Path.Replace('\\', '/');
                        _remoteRepositoryHistory.AddRepository(repo);
                    }
                }
                foreach (Repository repo in _remoteRepositoryHistory.Repositories)
                {
                    repositoryHistory.RemoveRepository(repo);
                }
            }

            return repositoryHistory;
        }
Exemplo n.º 4
0
        private static RepositoryHistory LoadRepositoryHistory()
        {
            var repositoryHistory = new RepositoryHistory();
            object setting = Settings.GetValue<string>("history", null);
            if (setting == null)
            {
                repositoryHistory = new RepositoryHistory();
                return repositoryHistory;
            }

            repositoryHistory = DeserializeHistoryFromXml(setting.ToString());
            if (repositoryHistory != null)
            {
                AssignRepositoryHistoryFromCategories(repositoryHistory, null);

                // migration from old version (move URL history to _remoteRepositoryHistory)
                if (Settings.GetValue<string>("history remote", null) == null)
                {
                    _remoteRepositoryHistory = new RepositoryHistory();
                    foreach (Repository repo in repositoryHistory.Repositories)
                    {
                        if (repo.IsRemote)
                        {
                            repo.Path = repo.Path.Replace('\\', '/');
                            _remoteRepositoryHistory.AddRepository(repo);
                        }
                    }
                    foreach (Repository repo in _remoteRepositoryHistory.Repositories)
                    {
                        repositoryHistory.RemoveRepository(repo);
                    }
                }
            }

            return repositoryHistory ?? new RepositoryHistory();
        }