Esempio n. 1
0
        private static void WriteHistory()
        {
            var history = new History.State()
            {
                LastLocation          = FindCallerWorkingDirectory(),
                LastRepositories      = _repos,
                OverwriteRepositories = (_repos?.Length > 1)                 /* 0 or 1 repo should not overwrite the last list */
            };

            var repository = new History.RegistryHistoryRepository();

            repository.Save(history);
        }
Esempio n. 2
0
        private static void WriteHistory(Repository[] repositories)
        {
            var history = new History.State()
            {
                LastLocation          = FindCallerWorkingDirectory(),
                LastRepositories      = repositories,
                OverwriteRepositories = (repositories?.Length > 1) /* 0 or 1 repo should not overwrite the last list */

                                                                   // OverwriteRepositories = false?!
                                                                   // if multiple repositories were found the last time we ran grr,
                                                                   // these were written to the last state.
                                                                   // if the user selects one with an index like "grr cd :2", we want
                                                                   // to keep the last repositories to enable him to choose another one
                                                                   // with the same indexes as before.
                                                                   // so we have to get the old repositories - load and copy them if required
            };

            var repository = new History.FileHistoryRepository();

            repository.Save(history);
        }