Ejemplo n.º 1
0
        private void SaveRecentRepositories()
        {
            var cfgName  = "recent.xml";
            var newdoc   = new XmlDocument();
            var rootnode = newdoc.AppendChild(newdoc.CreateElement("Recent"));

            for (int i = 0; i < _repositoryManagerService.RecentRepositories.Count; ++i)
            {
                rootnode.AppendChild(newdoc.CreateElement("Repository")).Attributes.Append(newdoc.CreateAttribute("Path")).Value =
                    _repositoryManagerService.RecentRepositories[i].Path;
            }
            try
            {
                using (var stream = _configurationService.CreateFile(cfgName))
                {
                    SaveXml(newdoc, stream);
                }
            }
            catch (Exception exc)
            {
                if (exc.IsCritical())
                {
                    throw;
                }
            }
        }