예제 #1
0
        private bool isSelectedRepoModified(NPanday.Model.Settings.Repository selectedRepo)
        {
            if (selectedRepo == null)
            {
                return(false);
            }

            if (selectedRepo.snapshots == null || selectedRepo.releases == null ||
                checkBoxSnapshot.Checked != selectedRepo.snapshots.enabled || checkBoxRelease.Checked != selectedRepo.releases.enabled)
            {
                return(true);
            }

            // check if URL is already in NPanday.id profile
            NPanday.Model.Settings.Profile defaultProfile = getDefaultProfile();
            if (defaultProfile != null)
            {
                foreach (NPanday.Model.Settings.Repository repo in defaultProfile.repositories)
                {
                    if (repo.url == RepoCombo.Text)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
예제 #2
0
        private void executeRepoUpdate()
        {
            if (string.IsNullOrEmpty(RepoCombo.Text))
            {
                MessageBox.Show("Sorry, Repository cannot be blank.", "Repository Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                string selectedUrl = RepoCombo.Text;

                // verify if URL is accessible
                try
                {
                    if (selectedUrl.Contains("file:///"))
                    {
                        verifyFileProtocol(selectedUrl);
                    }
                    else
                    {
                        verifyRemoteAccess(selectedUrl);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Repository Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    artifactTabControl.SelectedIndex = 2;
                    RepoCombo.Text = string.Empty;
                    return;
                }

                // add repository to profile
                NPanday.Model.Settings.Repository repo = SettingsUtil.SetProfileRepository(getDefaultProfile(), selectedUrl, checkBoxRelease.Checked, checkBoxSnapshot.Checked);
                selectedRepoUrl = selectedUrl;

                // set the mirror too
                SettingsUtil.SetMirrorUrl(settings, selectedUrl);

                // make NPanday.id profile active
                SettingsUtil.AddActiveProfile(settings, SettingsUtil.defaultProfileID);

                // write to Settings.xml
                SettingsUtil.MergeSettings(settings, settingsPath);

                // do not specify SelectedUrl to suppress SelectedIndexChanged event
                repoCombo_Refresh(null);
                MessageBox.Show(this, "Successfully Changed Remote Repository.", "Repository Configuration");
                //localListView_Refresh();
            }
        }
예제 #3
0
 private string getDefaultRepositoryUrl()
 {
     NPanday.Model.Settings.Repository repo = getRepositoryFromDefaultProfile();
     return(repo != null ? repo.url : SettingsUtil.GetSettingsRepositories()["central"]);
 }
예제 #4
0
 private void RepoCombo_SelectedIndexChanged(object sender, EventArgs e)
 {
     NPanday.Model.Settings.Repository selectedRepo = getRepository(RepoCombo.Text);
     selectedRepoUrl = RepoCombo.Text;
     repoCheckboxes_Refresh(selectedRepo);
 }
예제 #5
0
 private void repoCheckboxes_Refresh(NPanday.Model.Settings.Repository selectedRepo)
 {
     checkBoxRelease.Checked  = (selectedRepo != null && selectedRepo.releases != null) ? selectedRepo.releases.enabled : true;
     checkBoxSnapshot.Checked = (selectedRepo != null && selectedRepo.snapshots != null) ? selectedRepo.snapshots.enabled : false;
 }