Пример #1
0
        private void EditDescription(object sender, EventArgs e)
        {
            var newDesc = Prompts.ShowDialog_TextBox("Enter Description");

            gc.EditDesc(selected, newDesc);
            outputBox.Text = "Description Edit Successful";
        }
Пример #2
0
        private void SelectFP(object sender, EventArgs e)
        {
            var fp = Prompts.ShowDialog_FolderPath();

            mainFP = fp;
            var fpBreakdown = fp.Split(@"\"[0]);

            selected           = fpBreakdown[fpBreakdown.Length - 1];
            selectedLabel.Text = "Selected : " + selected;
            outputBox.Text    += string.Format("File Path Selected : \"{0}\"", mainFP);
        }
Пример #3
0
        public async Task <string> GetGitIgnoreTemplates()
        {
            //Prefix: I originally created code to pull the file's raw url, save the content, and make a custom ignore template.
            //        That isn't required as the API allows you to just pass the name of the template and it will take care of it
            //        Unfortunately i didn't catch that the first time around otherwise i wouldn't have done that but at least
            //        now i know how to pull any file from github via c#

            //Get the repo that contains the templates
            var ignoreRepoID = await GetRepo("gitignore");

            var repoContent = await client.Repository.Content.GetAllContents(ignoreRepoID);

            //populate first entry into list so we have an escape/no template selection
            var nameList = new List <string>()
            {
                "No Ignore Template"
            };

            //iterate and find all files ending in .gitignore
            foreach (var entry in repoContent)
            {
                if (entry.Path.EndsWith(".gitignore"))
                {
                    //Add those files to the list while removing the .gitignore for later
                    nameList.Add(entry.Name.Replace(".gitignore", ""));
                }
            }
            //send prompt and get response of user, if no template needed, return the value below
            var response = Prompts.ShowDialog_ComboBox(nameList, "Ignore Templates");

            if (response == "No Ignore Template" || response == "")
            {
                return("");
            }
            //return the name of the template we want
            return(response);
        }
Пример #4
0
        public async void HandleRepo(string name, string mainFP, TextBox outputBox)
        {
            await CheckRepo(name);

            if (!await CheckRepo(name))
            {
                var description = Prompts.ShowDialog_TextBox("Enter a Description");
                description = description == "" ? "No Description" : description; //if "" returned, then set description to "No Description"
                await client.Repository.Create(CreateRepo(name, description, await GetGitIgnoreTemplates()));

                outputBox.Text = string.Format("Repo \"{0}\" Created", name);
            }

            var targetRepo = await GetRepo(name);

            if (targetRepo != -1)
            {
                Console.WriteLine("Found Repo");
                var commitComment = Prompts.ShowDialog_TextBox("Enter a Commit Comment");
                commitComment = commitComment == "" ? "No Commit Comment" : commitComment; //if "" returned, then set commitComment to "No Commit Comment"
                PushCommit(targetRepo, mainFP, commitComment);
                outputBox.Text = string.Format("Update to repo \"{0}\" successful", name);
            }
        }