private async Task <IRestoreViewModel> BuildViewModel(string selectedFolder) { var archives = _filesystem.GetFiles(selectedFolder, ".bak"); var files = _filesystem.GetFiles(selectedFolder, ".zip"); var list = await GetInputForGrid(files); _view.ShowDatagrid(list, new[] { "Backup archive files location", "Destination folder to restore" }); return(new RestoreViewModel { WebsiteZip = list.FirstOrDefault(i => IsMainSitecoreSite(i.Key)).Key, XConnectZip = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.XConnect)).Key, IdentityZip = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.IdentityServer)).Key, HorizonZip = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.Horizon)).Key, PublishingZip = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.PublishingService)).Key, WebsiteFolder = list.FirstOrDefault(i => IsMainSitecoreSite(i.Key)).Value, XConnectFolder = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.XConnect)).Value, IdentityFolder = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.IdentityServer)).Value, HorizonFolder = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.Horizon)).Value, PublishingFolder = list.FirstOrDefault(i => i.Key.Contains(Settings.Parameters.PublishingService)).Value, CommerceSites = list.Where(i => CheckCommerceSite(i.Key)).ToDictionary(s => s.Key, s => s.Value), ProcessDatabases = archives.Any(), Databases = archives.Select(f => f.Value).ToArray() }); }
public TreeNode EnumerateDirectory(TreeNode parentNode) { try { parentNode.Nodes[0].Remove(); foreach (var dir in _filesystem.GetDirectories(parentNode.FullPath)) { var node = new TreeNode { Text = dir.Value, Tag = dir.Key }; node.Nodes.Add(""); parentNode.Nodes.Add(node); } if (ShowFiles) { foreach (var file in _filesystem.GetFiles(parentNode.FullPath, String.Empty)) { var node = new TreeNode { Text = file.Value, Tag = file.Key, ImageIndex = 2, SelectedImageIndex = 2 }; parentNode.Nodes.Add(node); } } } catch (Exception e) { } return(parentNode); }
public IEnumerable <Script> Scan(string upScriptPath, params string[] environment) { var scriptFiles = _filesystem.GetFiles(upScriptPath, "*.sql") .OrderBy(scriptPath => scriptPath); var filteredScriptFiles = scriptFiles.Where(scriptPath => environment.Any(e => scriptPath.FileName().Matches(FilePattern.ForEnvironment(e))) || scriptPath.FileName().Matches(FilePattern.NoEnvironment)); return(filteredScriptFiles.Select(scriptPath => new Script(scriptPath, ParseVersion(scriptPath.FileName())))); }
public IEnumerable <Script> Scan(string downScriptPath, params string[] environment) { var scriptFiles = _filesystem.GetFiles(downScriptPath, "*.sql") .OrderByDescending(s => s); var filteredScriptFiles = scriptFiles.Where(s => environment.Any(e => s.FileName().Substring(3).Matches(FilePattern.ForEnvironment(e))) || s.FileName().Substring(3).Matches(FilePattern.NoEnvironment)); return(filteredScriptFiles.Select(s => new Script(s, ParseRollbackVersion(s.FileName())))); }
public void Execute() { var allFiles = filesystem.GetFiles(source); foreach (var file in allFiles) { var command = new FileCopyCommand(filesystem, $"{source}/{file}", $"{destination}/{file}"); command.Execute(); children.Push(command); } filesystem.CreateDirectory(destination); }