示例#1
0
        private void AddRepoBT_Click(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            AddingPB.MarqueeAnimationSpeed = 10;
            AddingPB.Style   = ProgressBarStyle.Marquee;
            AddingPB.Visible = true;

            if (!string.IsNullOrEmpty(NewRepoNameTB.Text) && !string.IsNullOrWhiteSpace(NewRepoNameTB.Text))
            {
                RepoName = NewRepoNameTB.Text;

                Repo_Added = RepoHelpers.Create_Blank_Repository(StorePathTB.Text, RepoName);

                DirectoryInfo storeInfo = new DirectoryInfo(StorePath);

                if (Repo_Added)
                {
                    AutoClosingMessageBox.Show(RepoName + " added to " + storeInfo.Name, "Repo Added Successfully", 1500);
                    Close();
                }

                else
                {
                    MessageBox.Show("Unable to add repo.\nMay be issue with permissions on directory where GIT is located or on the destination directory.", "Unable To Add Repo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                MessageBox.Show("Please provide a repository name to continue", "Blank Repository Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            AddingPB.Visible = false;
            AddingPB.Style   = ProgressBarStyle.Blocks;
            this.Cursor      = Cursors.Default;
        }
示例#2
0
        public void Get_Store_Additions()
        {
            List <string> temp = Directory.GetDirectories(ManagerData.Selected_Store._Path).ToList();

            if (Refresh_Repo_Additions != null)
            {
                Refresh_Repo_Additions.Clear();
            }

            else
            {
                Refresh_Repo_Additions = new List <string>();
            }

            foreach (string path in temp)
            {
                bool contains = false;

                foreach (RepoCell cell in ManagerData.Selected_Store._Repos.Values)
                {
                    if (path == cell.Path)
                    {
                        contains = true;
                        break;
                    }
                }

                if (!contains)
                {
                    // Addition
                    if (RepoHelpers.Is_Git_Repo(path))
                    {
                        Refresh_Repo_Additions.Add(path);
                    }
                }
            }
        }
示例#3
0
        private void RefreshStoresBT_Click(object sender, EventArgs e)
        {
            if (Refresh_Complete)
            {
                Refresh_Complete = false;

                string currStore = StoreLocationCB.SelectedItem.ToString();

                this.Cursor = Cursors.WaitCursor;

                MainStatusSSL.Text = "Refreshing ...";

                // Need to rescan the current store for any new repos
                if (ManagerData.Selected_Store != null || !(string.IsNullOrEmpty(StoreLocationCB.SelectedItem.ToString()) && string.IsNullOrWhiteSpace(StoreLocationCB.SelectedItem.ToString())))
                {
                    if (RepoHelpers.Detect_Changes(false))
                    {
                        Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath);
                        Refresh_Elements(false);
                        MainStatusSSL.Text = "Refresh Complete - Changes Were Applied";
                    }

                    else
                    {
                        // If a new repo was added, it needs to have an initial commit otherwise it will not be detected
                        MainStatusSSL.Text = "Refresh Complete - No Changes Detected";
                    }

                    this.Cursor = Cursors.Default;
                }

                Refresh_Complete = true;

                StoreLocationCB.SelectedIndex = StoreLocationCB.FindStringExact(currStore);
            }
        }
        private void InitializationViewFRM_Load(object sender, EventArgs e)
        {
            VerifyConfigCheckPB.Image = Properties.Resources.ConfigCheck_Default;
            ReadConfigPB.Image        = Properties.Resources.ConfigCheck_Default;
            ChangesPB.Image           = Properties.Resources.ConfigCheck_Default;

            bool retry = true;

            while (retry)
            {
                retry = false;

                if (Config_Is_Empty_Path())
                {
                    if (!CreateConfig_Empty_Path(false))
                    {
                        if (!CreateConfig_Empty_Path(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Empty Configuration File Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                if (!Config_Exists(Properties.Settings.Default.ConfigPath))
                {
                    if (!CreateConfig_File_DNE(false))
                    {
                        if (!CreateConfig_File_DNE(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Configuration File Does Not Exist", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                else if (!Config_Is_Valid_XML(Properties.Settings.Default.ConfigPath))
                {
                    // Config is not a valid xml file, ask for a new one
                    if (!CreateConfig_Invalid_XML(false))
                    {
                        if (!CreateConfig_Invalid_XML(true))
                        {
                            MessageBox.Show("A configuration file is required, closing GIT Manager.", "Invalid Configuration File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            Application.ExitThread();
                            Application.Exit();
                            Environment.Exit(0);
                        }
                    }

                    retry = true;
                }

                retry = false;
            }

            VerifyConfigCheckPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;

            Configuration.Helpers.Deserialize_Condensed(Properties.Settings.Default.ConfigPath);

            ReadConfigPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;

            if (RepoHelpers.Detect_Changes(true))
            {
                Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath);

                ChangesPB.BackgroundImage = Properties.Resources.ConfigCheck_Complete;
            }

            InitializationData.Initialized = true;
        }