Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }