private void Button_Allow_Click(object sender, EventArgs e) { if (m_Base == null) { return; } FileFolderHolder ffh = getFfhFromNode(TreeViewFolders.SelectedNode); if (ffh == null) { return; } string text = "!"; text += ffh.m_RelativePath + ffh.m_Filename; if (!ffh.m_IsFile) { text += "/"; } GitIgnoreLine gil = new GitIgnoreLine(); gil.setLine(text.Replace('\\', '/')); m_GitLines.Add(gil); remakeEverything(); }
private void Ignore_EditLine_Click(object sender, EventArgs e) { if (GitIgnore_Contents.SelectedIndex == -1) { return; } int index = GitIgnore_Contents.SelectedIndex; GitIgnoreLine gil = m_GitLines[index]; string result = m_GitLineEditForm.openForm(gil.m_BaseLine, index); if (result == "") { return; } gil.setLine(result); remakeEverything(); m_RemoveOtherSelectedListBox = false; GitIgnore_Contents.SelectedIndex = index; m_RemoveOtherSelectedListBox = true; }
private void moveGitIgnoreElement(bool a_MoveUp) { //if not selected if (GitIgnore_Contents.SelectedIndex == -1) { return; } int increment = a_MoveUp ? -1 : 1; //if out of bounds if (GitIgnore_Contents.SelectedIndex + increment > GitIgnore_Contents.Items.Count - 1) { return; } if (GitIgnore_Contents.SelectedIndex + increment < 0) { return; } int index = GitIgnore_Contents.SelectedIndex; GitIgnoreLine element = m_GitLines[index]; m_GitLines.RemoveAt(index); m_GitLines.Insert(index + increment, element); remakeEverything(); m_RemoveOtherSelectedListBox = false; GitIgnore_Contents.SelectedIndex = index + increment; m_RemoveOtherSelectedListBox = true; }
private void remakeIgnoreContents() { if (m_Selected == null) { return; } Info_FileName.Text = m_Selected.m_Filename; Info_RelPath.Text = m_Selected.m_RelativePath; Info_Path.Text = m_Selected.m_Path; Info_IsExcluded.Checked = m_Selected.m_IsExcluded; Info_IsFile.Checked = m_Selected.m_IsFile; Info_IgnoreList.Items.Clear(); if (m_Selected.m_Effects == null || m_Selected.m_Effects.Count == 0) { Info_IgnoreList.Items.Add("Nothing."); } else { for (int i = 0; i < m_Selected.m_Effects.Count; i++) { string text = ""; GitIgnoreLine gil = m_Selected.m_Effects[i]; if (gil.m_Type == GitIgnoreLine.LineType.Ignore) { text = "Exluded: "; } else if (gil.m_Type == GitIgnoreLine.LineType.Allow) { text = "Included: "; } else { text = ""; break; } text += "L(" + gil.m_LineIndex + "): " + gil.m_BaseLine + "\n"; Info_IgnoreList.Items.Add(text); } } }
private bool loadGitFile() { string[] gitIgnore; try { gitIgnore = File.ReadAllLines(m_Dir + "\\.gitignore"); } catch { Label_CurrPath.Text = "Folder does not have .gitignore"; return(false); } m_GitLines = new List <GitIgnoreLine>(); m_GitLines.Capacity = gitIgnore.Length; for (int i = 0; i < gitIgnore.Length; i++) { GitIgnoreLine gil = new GitIgnoreLine(); gil.setLine(gitIgnore[i]); m_GitLines.Add(gil); //if (m_GitIgnore[i].Length >= 2) { // if (m_GitIgnore[i][0] == '/') { // m_GitIgnore[i] = m_GitIgnore[i].Remove(0, 1); // } //} } //add a empty line to the end if (m_GitLines[m_GitLines.Count - 1].m_Type != GitIgnoreLine.LineType.Empty) { GitIgnoreLine gil = new GitIgnoreLine(); gil.setLine(""); m_GitLines.Add(gil); } return(true); }
private void Ignore_NewLine_Click(object sender, EventArgs e) { //if not selected if (GitIgnore_Contents.SelectedIndex == -1) { return; } int index = GitIgnore_Contents.SelectedIndex; GitIgnoreLine gil = new GitIgnoreLine(); gil.setLine(""); m_GitLines.Insert(index, gil); remakeEverything(); m_RemoveOtherSelectedListBox = false; GitIgnore_Contents.SelectedIndex = index; m_RemoveOtherSelectedListBox = true; }