Exemplo n.º 1
0
        public static bool TestConnection(VssConnectionSettings connectionSettings, out Exception ex)
        {
            if (connectionSettings == null)
            {
                throw new ArgumentNullException("connectionSettings");
            }

            return(VssUtilities.TestConnection(connectionSettings.Database, connectionSettings.UserName, connectionSettings.Password, out ex));
        }
Exemplo n.º 2
0
        public static VSSDatabase OpenDatabase(VssConnectionSettings connectionSettings)
        {
            if (connectionSettings == null)
            {
                throw new ArgumentNullException("connectionSettings");
            }

            return(VssUtilities.OpenDatabase(connectionSettings.Database, connectionSettings.UserName, connectionSettings.Password));
        }
Exemplo n.º 3
0
        protected virtual void AddProjectToImportList(IVSSItem projectItem, Int32 path_len_to_chop)
        {
            if (projectItem == null)
            {
                throw new ArgumentNullException("projectItem");
            }

            if (!projectItem.IsProject())
            {
                throw new ArgumentException("Not a Visual SourceSafe project");
            }

            if (!this.VssProjects.Contains(projectItem))
            {
                this.LogMessage(projectItem.Spec);
                this.VssProjects.Add(projectItem);
                string str_rel_path = VssUtilities.GetLocalPath("", projectItem, path_len_to_chop);
                this.VssRelativeProjPaths.Add(str_rel_path);
            }

            foreach (IVSSItem childItem in projectItem.Items)
            {
                if (!childItem.IsProject())
                {
                    // add the file, if it is not excluded
                    if (!this.ShouldExludeFileName(childItem.Name))
                    {
                        this.VssFiles.Add(childItem);
                        string str_rel_path = VssUtilities.GetLocalPath("", childItem, path_len_to_chop);
                        this.VssRelativeFilePaths.Add(str_rel_path);
                    }

                    // display a warning if a file is checked out
                    if (childItem.IsFileCheckedOut())
                    {
                        this.LogMessage("WARNING: '{0}' is checked out.", childItem.Spec);
                        _checkedOutFilesDetected = true;
                    }

                    // display a warning if a file is pinned
                    if (childItem.IsPinned)
                    {
                        this.LogMessage("WARNING: '{0}' is pinned.", childItem.Spec);
                        _pinned_items_detected = true;
                    }
                }

                // add child projects
                if (childItem.IsProject())
                {
                    this.AddProjectToImportList(childItem, path_len_to_chop);
                }
            }
        }
Exemplo n.º 4
0
        public SelectVssProjectsDialog(VssMigration migrationSettings)
            : this()
        {
            if (migrationSettings == null)
            {
                throw new ArgumentNullException("migrationSettings");
            }

            this.MigrationSettings = migrationSettings;

            _database = VssUtilities.OpenDatabase(migrationSettings.VssConnectionSettings);
            this.AddProjectNode(null, _database.get_VSSItem("$/"));
        }
Exemplo n.º 5
0
        private void testButton_Click(object sender, EventArgs e)
        {
            Exception ex;

            if (VssUtilities.TestConnection(databaseNameTextBox.Text, userNameTextBox.Text, passwordTextBox.Text, out ex))
            {
                MessageBox.Show("Connection succeeded.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show(string.Format("Connection failed. {0}", ex.Message), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 6
0
 private void vssProjectsBrowseButton_Click(object sender, EventArgs e)
 {
     if (VssUtilities.TestConnection(_migration.VssConnectionSettings))
     {
         using (SelectVssProjectsDialog dialog = new SelectVssProjectsDialog(_migration))
         {
             if (dialog.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 this.RefreshMigrationSettings();
             }
         }
     }
     else
     {
         MessageBox.Show("No connection to Visual SourceSafe available.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemplo n.º 7
0
        public static bool TestConnection(string database, string username, string password, out Exception ex)
        {
            VSSDatabase ssDatabase;

            ssDatabase = null;
            ex         = null;

            try
            {
                ssDatabase = VssUtilities.OpenDatabase(database, username, password);
                ssDatabase.Close();
            }
            catch (Exception e)
            {
                ex = e;
            }

            return(ssDatabase != null);
        }
Exemplo n.º 8
0
        private void AddProjectNode(TreeNode parent, VSSItem project)
        {
            TreeNode node;

            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (project.Type != (int)VSSItemType.VSSITEM_PROJECT)
            {
                throw new ArgumentException("project");
            }

            node = new TreeNode()
            {
                Text     = project.Spec != "$/" ? project.Name : project.Spec,
                Name     = project.Spec,
                Checked  = this.MigrationSettings.SourceSafeProjects.Contains(project.Spec),
                ImageKey = "project"
            };

            if (VssUtilities.DoesProjectContainSubProjects(project))
            {
                node.Nodes.Add(new TreeNode("##autoload##"));
            }

            if (parent == null)
            {
                projectsTreeView.Nodes.Add(node);
            }
            else
            {
                parent.Nodes.Add(node);
            }
        }
Exemplo n.º 9
0
        public static bool TestConnection(VssConnectionSettings connectionSettings)
        {
            Exception ex;

            return(VssUtilities.TestConnection(connectionSettings, out ex));
        }
Exemplo n.º 10
0
        public static bool TestConnection(string database, string username, string password)
        {
            Exception ex;

            return(VssUtilities.TestConnection(database, username, password, out ex));
        }
Exemplo n.º 11
0
 private void InitializeVssDatabase()
 {
     this.VssDatabase = VssUtilities.OpenDatabase(this.VssConnectionSettings);
 }