public string GetFolder() { CharChanged = false; navs = new Navigators(); string[] cc = rb.Text.Split("\n".ToCharArray()); string s = cc[cc.Length - 1]; cc = s.Split(">".ToCharArray()); s = cc[0]; if (cc.Length <= 1) { return(""); } string b = cc[1]; if (s == "") { return(""); } string[] dd = Directory.GetDirectories(s); foreach (string g in dd) { string d = g; string[] bb = d.Split("\\".ToCharArray()); navs.Add(bb[bb.Length - 1]); } string[] ff = Directory.GetFiles(s); foreach (string g in ff) { string d = Path.GetFileName(g); navs.Add(d); } navs.Sort(); s = navs.Get(b); return(s); }
private void Rb_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Up) { string c = nav.Prev(); //cmd.SendCommand(c); AddText(c); e.Handled = true; } if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Back) { //string c = nav.Next(); //cmd.SendCommand(c); //AddText(c); CharChanged = true; int p = rb.SelectionStart; //if (rb.Text[p] == '>') // e.Handled = true; if (rb.Text[p - 1] == '>') { e.Handled = true; } } if (e.KeyCode == Keys.Down) { string c = nav.Next(); AddText(c); e.Handled = true; } if (e.KeyCode == Keys.Tab) { RemoveWhitespaces(); string s = ""; if (HasChanged == true) { s = GetFolder(); HasChanged = false; } else { s = GetNext(); } if (s != "") { AddText(s); } RemoveWhitespaces(); rb.Select(rb.Text.Length, 0); e.Handled = true; } if (e.KeyCode == Keys.Return) { _enterPressed = true; HasChanged = true; CharChanged = false; if (_cmd.running == false) { return; } string[] cc = rb.Text.Split("\n".ToCharArray()); _input = cc[cc.Length - 1]; if (_input == "") { _input = cc[cc.Length - 2]; } cc = _input.Split(">".ToCharArray()); string cs = ""; if (cc.Length == 1) { cs = cc[0]; } else if (cc.Length > 1) { cs = cc[1]; } _cmd.SendCommand(cs); if (cs != "") { nav.Add(cs); } } }