public override CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); try { string checkOutPath = Path.Combine(NAntConsoleConfigurationSection.GetCheckOutDirectory(), SvnHelper.GetPathFromSvnUri(selection.SvnUriWithoutRepository)); result.CommandOutput = checkOutPath; if (DoNotCheckOutWhenLocalDirectoryExists && Directory.Exists(checkOutPath)) { result.Error = new ApplicationException(string.Format(Resources.ErrorCheckOutDirectoryExists, checkOutPath)); return result; } InvokeReportProgress(string.Format(Resources.CheckingOut, selection.SvnUri, checkOutPath)); SvnHelper.CheckOut(selection.SvnUri, checkOutPath, delegate(SvnExecutionProgressEventArgs args) { InvokeReportProgress(args.Message); }); string[] nantFiles = Directory.GetFiles(checkOutPath, "*.nant"); if (nantFiles.Length > 0) { result.NewProjectFile = new FileInfo(nantFiles[0]); } } catch (Exception ex) { result.Error = ex; } return result; }
public override CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); result.CommandOutput = false; UpdateInfo updateInfo = UpdateHelper.CheckNewVersionAvailability(true); if (updateInfo != null) { if ( MessageBox.Show(string.Format(Resources.NewUpdateFound, updateInfo.Version, updateInfo.Location.FullName), Resources.NewUpdateCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { UpdateHelper.Update(updateInfo); Application.Exit(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); result.Error = ex; } finally { result.CommandOutput = true; } } } else { MessageBox.Show(Resources.NewUpdateNotFound, Resources.UpdateCaption, MessageBoxButtons.OK, MessageBoxIcon.Information); } return result; }
public override sealed CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); try { CheckOutUICommand checkOutCommand = new CheckOutUICommand(Selection); checkOutCommand.DoNotCheckOutWhenLocalDirectoryExists = true; checkOutCommand.ReportProgress += delegate(object sender, IUICommandReportProgressEventArgs eventArgs) { InvokeReportProgress(eventArgs.Message); }; CommandExecutionResult checkOutCommandExecutionResult = checkOutCommand.Execute(); if (checkOutCommandExecutionResult.Error != null) throw checkOutCommandExecutionResult.Error; ParserContext context = new ParserContext(); FillContext(context); DirectoryInfo targetDir = new DirectoryInfo((string)checkOutCommandExecutionResult.CommandOutput); TemplateHelper.GenerateTemplateHierarchy(targetDir, baseTemplateDir, context, Encoding); result.CommandOutput = targetDir; result.NewProjectFile = new FileInfo(Path.Combine(targetDir.FullName, string.Concat(GetProjectName(Selection.SvnUri), ".nant"))); } catch (Exception ex) { result.Error = ex; } return result; }
public override CommandExecutionResult Execute() { AskSingleValue environmentAsk = new AskSingleValue(); environmentAsk.Text = Resources.EnvironmentAsk; environmentAsk.Prefix = Resources.EnvironmentName; if (environmentAsk.ShowDialog() != DialogResult.OK) { return new CommandExecutionResult(this); } DirectoryInfo envDir = new DirectoryInfo(Path.Combine(project.BuildFile.DirectoryName, EnvIncludeConstants.ENV_FOLDER_NAME)); if (!envDir.Exists) { envDir.Create(); } string targetFileName = string.Format("{0}.{1}.config", project.ProjectName, environmentAsk.Value); FileInfo targetFileInfo = new FileInfo(Path.Combine(envDir.FullName, targetFileName)); if (targetFileInfo.Exists) { CommandExecutionResult result = new CommandExecutionResult(this); result.Error = new ApplicationException(string.Format(Resources.EnvironmnentFileExists, targetFileInfo.FullName)); return result; } ParserContext context = new ParserContext(); context.Set("projectName", project.ProjectName); TemplateHelper.GenerateFile(targetFileInfo, @"EnvFile\env.config", context, Encoding.UTF8); return new CommandExecutionResult(this); }
public override CommandExecutionResult Execute() { string projectName = Path.GetFileNameWithoutExtension(filename); ParserContext context = new ParserContext(); context.Set("projectName", projectName); FileInfo targetFile = new FileInfo(filename); TemplateHelper.GenerateFile(targetFile, @"NAntFile\nantfile.nant", context, Encoding.UTF8); CommandExecutionResult result = new CommandExecutionResult(this); result.NewProjectFile = targetFile; return result; }
public override CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); try { if (!SvnHelper.IsLocalFolderUnderSvnControl(nantProject.BuildFile.Directory.FullName)) { MessageBox.Show(mainForm, Resources.LocalFolderNotUnderSourceControl, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return result; } if (MessageBox.Show(mainForm, Resources.LinkAnalysisConfirm, Resources.ConfirmationCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { SvnExplorer svnExplorer = new SvnExplorer(); svnExplorer.ReadOnly = true; if (svnExplorer.ShowDialog(mainForm) == DialogResult.OK) { LinkAnalysisProgress progress = new LinkAnalysisProgress(); progress.SvnExplorerSelection = svnExplorer.GetSvnExplorerSelection(); progress.SearchProjectUri = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName); progress.ShowDialog(mainForm); LinksList linksList = new LinksList(); linksList.Prefix = Resources.DependentProjects; linksList.Project = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName); foreach (string link in progress.Result) { linksList.AddLink(link, string.Empty); } linksList.ShowDialog(mainForm); } } } catch (Exception ex) { result.Error = ex; } return result; }
public override CommandExecutionResult Execute() { MergeBranchInfo mergeBranchInfo = SvnHelper.GetMergeBranchInfo(svnSelection.SvnUri); MergeBranchWizard wizard = new MergeBranchWizard(); CommandExecutionResult result = new CommandExecutionResult(this); try { if (wizard.ShowDialog() == DialogResult.OK) { MergeBranchExecute mergeBranchExecute = new MergeBranchExecute(); mergeBranchExecute.Source = svnSelection; mergeBranchExecute.MergeBranchInfo = mergeBranchInfo; mergeBranchExecute.MergeChoice = wizard.Choice; mergeBranchExecute.ShowDialog(); } } catch (Exception ex) { result.Error = ex; } return result; }
public override CommandExecutionResult Execute() { CommandExecutionResult result = new CommandExecutionResult(this); try { if (!SvnHelper.IsLocalFolderUnderSvnControl(nantProject.BuildFile.Directory.FullName)) { MessageBox.Show(mainForm, Resources.LocalFolderNotUnderSourceControl, Resources.ErrorCaption, MessageBoxButtons.OK, MessageBoxIcon.Error); return result; } string externalProp = SvnHelper.GetProperty(nantProject.BuildFile.Directory.FullName, SvnHelper.EXTERNALS_PROPERTY_NAME) ?? string.Empty; LinksList linksList = new LinksList(); linksList.Prefix = Resources.ProjectDependencies; linksList.Project = SvnHelper.GetUriFromWorkingCopy(nantProject.BuildFile.Directory.FullName); List<string> links = new List<string>(); using(StringReader reader = new StringReader(externalProp)) { string external = reader.ReadLine(); while(external != null) { string[] splittedExternal = external.Split(' '); if (splittedExternal.Length == 2) { linksList.AddLink(splittedExternal[0].Replace(" ", "%20"), splittedExternal[1]); } external = reader.ReadLine(); } } linksList.ShowDialog(mainForm); } catch (Exception ex) { result.Error = ex; } return result; }