static void UpdateWork(object state) { int mode = (int)state; // update var algo = new Actor(mode, VesselHost.LogPath[mode], true); algo.Update(); }
static void Update(int mode) { // update var algo = new Actor(mode, VesselHost.LogPath[mode], true); var text = algo.Update(); // show update info Far.Api.Message(text, "Update", MessageOptions.LeftAligned); }
static void Update() { // update var algo = new Actor(VesselHost.LogPath); var text = algo.Update(); // retrain StartFastTraining(); // show update info Far.Api.Message(text, "Update", MessageOptions.LeftAligned); }
static void UpdateWork(object state) { int mode = (int)state; // update var algo = new Actor(mode, VesselHost.LogPath[mode], mode == 1); algo.Update(); // train StartTraining(mode); }
static void UpdateOnce() { var now = DateTime.Now; if (now.Date == Settings.Default.LastUpdateTime.Date) { return; } Settings.Default.LastUpdateTime = now; Settings.Default.Save(); var thread = new Thread(() => { // update var algo = new Actor(VesselHost.LogPath); algo.Update(); // retrain StartFastTraining(); }); thread.Start(); }
static void ShowHistory(bool smart) { var Factor1 = Settings.Default.Factor1; var Factor2 = Settings.Default.Factor2; var Limit0 = Settings.Default.Limit0; // drop smart for the negative factor if (smart && Factor1 < 0) { smart = false; } IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "FileHistory"; menu.SelectLast = true; menu.UsualMargins = true; if (smart) { menu.Title = string.Format("File history ({0}/{1}/{2})", Limit0, Factor1, Factor2); } else { menu.Title = "File history (plain)"; } menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.F3); menu.AddKey(KeyCode.F3, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.F4); menu.AddKey(KeyCode.F4, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { int group1 = -1; int indexLimit0 = int.MaxValue; foreach (var it in Record.GetHistory(null, DateTime.Now, (smart ? Factor1 : -1), Factor2)) { // separator if (smart) { int group2 = it.Group(Limit0, Factor1, Factor2); if (group1 != group2) { if (group1 >= 0) { menu.Add("").IsSeparator = true; if (group2 == 0) { indexLimit0 = menu.Items.Count; } } group1 = group2; } } // item menu.Add(it.Path).Checked = it.Evidence > 0; } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(VesselHost.LogPath); algo.Update(); continue; } // the file int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Record.Remove(VesselHost.LogPath, path); continue; } goto show; } // go to: if (menu.Key.IsCtrl(KeyCode.Enter)) { Far.Api.Panel.GoToPath(path); } // view: else if (menu.Key.VirtualKeyCode == KeyCode.F3) { if (!File.Exists(path)) { continue; } IViewer viewer = Far.Api.CreateViewer(); viewer.FileName = path; if (menu.Key.IsCtrl()) { viewer.DisableHistory = true; viewer.Open(OpenMode.Modal); goto show; } viewer.Open(); // post fast training if (smart && indexSelected < indexLimit0) { VesselHost.PathToTrain = path; } } // edit: else { IEditor editor = Far.Api.CreateEditor(); editor.FileName = path; if (menu.Key.IsCtrl(KeyCode.F4)) { editor.DisableHistory = true; editor.Open(OpenMode.Modal); goto show; } editor.Open(); if (menu.Key.IsShift(KeyCode.Enter)) { goto show; } // post fast training if (smart && indexSelected < indexLimit0) { VesselHost.PathToTrain = path; } } UpdateOnce(); return; } }
static void UpdateOnce() { var now = DateTime.Now; if (now.Date == Settings.Default.LastUpdateTime.Date) return; Settings.Default.LastUpdateTime = now; Settings.Default.Save(); var thread = new Thread(() => { // update var algo = new Actor(VesselHost.LogPath); algo.Update(); // retrain StartFastTraining(); }); thread.Start(); }
static void ShowHistory(bool smart) { var Factor1 = Settings.Default.Factor1; var Factor2 = Settings.Default.Factor2; var Limit0 = Settings.Default.Limit0; // drop smart for the negative factor if (smart && Factor1 < 0) smart = false; IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "FileHistory"; menu.SelectLast = true; menu.UsualMargins = true; if (smart) menu.Title = string.Format("File history ({0}/{1}/{2})", Limit0, Factor1, Factor2); else menu.Title = "File history (plain)"; menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.F3); menu.AddKey(KeyCode.F3, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.F4); menu.AddKey(KeyCode.F4, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { int group1 = -1; int indexLimit0 = int.MaxValue; foreach (var it in Record.GetHistory(null, DateTime.Now, (smart ? Factor1 : -1), Factor2)) { // separator if (smart) { int group2 = it.Group(Limit0, Factor1, Factor2); if (group1 != group2) { if (group1 >= 0) { menu.Add("").IsSeparator = true; if (group2 == 0) indexLimit0 = menu.Items.Count; } group1 = group2; } } // item menu.Add(it.Path).Checked = it.Evidence > 0; } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) return; // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(VesselHost.LogPath); algo.Update(); continue; } // the file int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Record.Remove(VesselHost.LogPath, path); continue; } goto show; } // go to: if (menu.Key.IsCtrl(KeyCode.Enter)) { Far.Api.Panel.GoToPath(path); } // view: else if (menu.Key.VirtualKeyCode == KeyCode.F3) { if (!File.Exists(path)) continue; IViewer viewer = Far.Api.CreateViewer(); viewer.FileName = path; if (menu.Key.IsCtrl()) { viewer.DisableHistory = true; viewer.Open(OpenMode.Modal); goto show; } viewer.Open(); // post fast training if (smart && indexSelected < indexLimit0) VesselHost.PathToTrain = path; } // edit: else { IEditor editor = Far.Api.CreateEditor(); editor.FileName = path; if (menu.Key.IsCtrl(KeyCode.F4)) { editor.DisableHistory = true; editor.Open(OpenMode.Modal); goto show; } editor.Open(); if (menu.Key.IsShift(KeyCode.Enter)) goto show; // post fast training if (smart && indexSelected < indexLimit0) VesselHost.PathToTrain = path; } UpdateOnce(); return; } }
static void ShowFolders() { var limit = Settings.Default.Limit0; var factor = Settings.Default.Factor2; IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "FolderHistory"; menu.SelectLast = true; menu.UsualMargins = true; menu.Title = string.Format("Folder history ({0}/{1})", limit, factor); menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { int lastGroup = -1; foreach (var it in Store.GetHistory(1, null, DateTime.Now, factor)) { // separator int nextGroup = it.Group(limit, factor); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item menu.Add(it.Path).Checked = it.Evidence > 0; } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(1, VesselHost.LogPath[1], true); algo.Update(); continue; } // the folder int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Store.Remove(1, VesselHost.LogPath[1], path); continue; } goto show; } // Enter: if (Far.Api.Window.Kind != WindowKind.Panels && !Far.Api.Window.IsModal) { Far.Api.Window.SetCurrentAt(-1); } Far.Api.Panel.CurrentDirectory = path; Store.Append(VesselHost.LogPath[1], DateTime.Now, Record.OPEN, path); UpdatePeriodically(1); return; } }
static void ShowHistory() { var factor0 = Settings.Default.Limit0; var factor1 = Settings.Default.Factor1; IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "FileHistory"; menu.SelectLast = true; menu.UsualMargins = true; menu.Title = string.Format("File history ({0}/{1})", factor0, factor1); menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.F3); menu.AddKey(KeyCode.F3, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.F4); menu.AddKey(KeyCode.F4, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { int lastGroup = -1; foreach (var it in Store.GetHistory(0, null, DateTime.Now, factor1)) { // separator int nextGroup = it.Group(factor0, factor1); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item menu.Add(it.Path).Checked = it.Evidence > 0; } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(0, VesselHost.LogPath[0]); algo.Update(); continue; } // the file int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Store.Remove(0, VesselHost.LogPath[0], path); continue; } goto show; } // go to: if (menu.Key.IsCtrl(KeyCode.Enter)) { Far.Api.Panel.GoToPath(path); } // view: else if (menu.Key.VirtualKeyCode == KeyCode.F3) { if (!File.Exists(path)) { continue; } IViewer viewer = Far.Api.CreateViewer(); viewer.FileName = path; if (menu.Key.IsCtrl()) { viewer.DisableHistory = true; viewer.Open(OpenMode.Modal); goto show; } viewer.Open(); } // edit: else { IEditor editor = Far.Api.CreateEditor(); editor.FileName = path; if (menu.Key.IsCtrl(KeyCode.F4)) { editor.DisableHistory = true; editor.Open(OpenMode.Modal); goto show; } editor.Open(); if (menu.Key.IsShift(KeyCode.Enter)) { goto show; } } UpdatePeriodically(0); return; } }
static void ShowHistory() { var limit = Settings.Default.Limit0; var factor = Settings.Default.Factor1; IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "FileHistory"; menu.SelectLast = true; menu.UsualMargins = true; menu.Title = string.Format("File history ({0}/{1})", limit, factor); menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.F3); menu.AddKey(KeyCode.F3, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.F4); menu.AddKey(KeyCode.F4, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { var actor = new Actor(0, null); int lastGroup = -1; foreach (var it in actor.GetHistory(DateTime.Now, factor)) { // separator int nextGroup = it.Group(limit, factor); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item var item = menu.Add(it.Path); item.Data = it; if (it.Evidence > 0) { item.Checked = true; } } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(0, VesselHost.LogPath[0], true); algo.Update(); continue; } // the file int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Store.Remove(0, VesselHost.LogPath[0], path); continue; } goto show; } // missing? if (!File.Exists(path)) { Far.Api.Message("File does not exist."); goto show; } // if it is not logged yet, log the existing Far record(s) if (!actor.IsLoggedPath(path)) { var info = menu.Items[indexSelected].Data as Info; Store.Append(VesselHost.LogPath[0], info.Head, Record.GOTO, path); if (info.Head != info.Tail) { Store.Append(VesselHost.LogPath[0], info.Tail, Record.GOTO, path); } } // go to: if (menu.Key.IsCtrl(KeyCode.Enter)) { Far.Api.Panel.GoToPath(path); Store.Append(VesselHost.LogPath[0], DateTime.Now, Record.GOTO, path); } // view: else if (menu.Key.VirtualKeyCode == KeyCode.F3) { IViewer viewer = Far.Api.CreateViewer(); viewer.FileName = path; viewer.Closed += delegate { Store.Append(VesselHost.LogPath[0], DateTime.Now, Record.VIEW, path); }; if (menu.Key.IsCtrl()) { viewer.Open(OpenMode.Modal); goto show; } viewer.Open(); } // edit: else { IEditor editor = Far.Api.CreateEditor(); editor.FileName = path; editor.Closed += delegate { Store.Append(VesselHost.LogPath[0], DateTime.Now, Record.EDIT, path); }; if (menu.Key.IsCtrl(KeyCode.F4)) { editor.Open(OpenMode.Modal); goto show; } editor.Open(); if (menu.Key.IsShift(KeyCode.Enter)) { goto show; } } UpdatePeriodically(0); return; } }
static void ShowCommands() { var mode = 2; var store = VesselHost.LogPath[mode]; var limit = Settings.Default.Limit0; var menu = CreateListMenu(); menu.HelpTopic = My.HelpTopic("command-history"); menu.Title = $"Command history ({limit})"; menu.TypeId = new Guid("1baa6870-4d49-40e5-8d20-19ff4b8ac5e6"); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); if (Far.Api.Window.Kind == WindowKind.Panels) { menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); } for (; ; menu.Items.Clear()) { var actor = new Actor(mode, store); int lastGroup = -1; foreach (var it in actor.GetHistory(DateTime.Now)) { // separator int nextGroup = it.Group(limit); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item var item = menu.Add(it.Path); item.Data = it; if (it.Evidence > 0) { item.Checked = true; } } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(mode, store, true); algo.Update(); continue; } // the command int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (My.AskDiscard(path)) { Store.Remove(store, path, StringComparison.Ordinal); Far.Api.PostMacro($"Keys 'AltF8'; if Menu.Select({Lua.StringLiteral(path)}) > 0 then Keys 'ShiftDel' end; if Area.Menu then Keys 'Esc' end"); return; //! } goto show; } // Enter | CtrlEnter: if (Far.Api.Window.Kind != WindowKind.Panels && !Far.Api.Window.IsModal) { Far.Api.Window.SetCurrentAt(-1); } // put/post command if (Far.Api.Window.Kind == WindowKind.Panels) { Far.Api.CommandLine.Text = path; if (!menu.Key.IsCtrl()) { Far.Api.PostMacro("Keys'Enter'"); } } else { My.BadWindow(); } // if it is not logged yet, log the existing Far record if (!actor.IsLoggedPath(path)) { var info = menu.Items[indexSelected].Data as Info; Store.Append(store, info.Head, Record.OPEN, path); } // then log the current record Store.Append(store, DateTime.Now, Record.OPEN, path); UpdatePeriodically(mode); return; } }
static void ShowHistory() { var mode = 0; var store = VesselHost.LogPath[mode]; var limit = Settings.Default.Limit0; var menu = CreateListMenu(); menu.HelpTopic = My.HelpTopic("file-history"); menu.Title = $"File history ({limit})"; menu.TypeId = new Guid("23b390e8-d91d-4ff1-a9ab-de0ceffdc0ac"); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.F3); menu.AddKey(KeyCode.F3, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.F4); menu.AddKey(KeyCode.F4, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); var area = Far.Api.Window.Kind; if (area == WindowKind.Panels || area == WindowKind.Editor || area == WindowKind.Viewer) { menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); } for (; ; menu.Items.Clear()) { var actor = new Actor(mode, store); int lastGroup = -1; foreach (var it in actor.GetHistory(DateTime.Now)) { // separator int nextGroup = it.Group(limit); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item var item = menu.Add(it.Path); item.Data = it; if (it.Evidence > 0) { item.Checked = true; } } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(mode, store, true); algo.Update(); continue; } // the file int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (My.AskDiscard(path)) { Store.Remove(store, path, StringComparison.OrdinalIgnoreCase); // Known far history items: Edit: PATH | Edit:-PATH | View: PATH | Ext.: ... // Remove 1-3 and 4 if 4 ends with PATH (note, proper commands use "PATH", i.e. do not end with PATH) Far.Api.PostMacro($"Keys 'AltF11'; while Menu.Select({Lua.StringLiteral(path)}, 2) > 0 do Keys 'ShiftDel' end; if Area.Menu then Keys 'Esc' end"); return; //! } goto show; } // missing? if (!File.Exists(path)) { Far.Api.Message("File does not exist."); goto show; } // if it is not logged yet, log the existing Far record(s) if (!actor.IsLoggedPath(path)) { var info = menu.Items[indexSelected].Data as Info; Store.Append(store, info.Head, Record.GOTO, path); if (info.Head != info.Tail) { Store.Append(store, info.Tail, Record.GOTO, path); } } // go to: if (menu.Key.IsCtrl(KeyCode.Enter)) { Far.Api.Panel.GoToPath(path); Store.Append(store, DateTime.Now, Record.GOTO, path); } // view: else if (menu.Key.VirtualKeyCode == KeyCode.F3) { IViewer viewer = Far.Api.CreateViewer(); viewer.FileName = path; viewer.Closed += delegate { Store.Append(store, DateTime.Now, Record.VIEW, path); }; if (menu.Key.IsCtrl()) { viewer.Open(OpenMode.Modal); goto show; } viewer.Open(); } // edit: else { IEditor editor = Far.Api.CreateEditor(); editor.FileName = path; editor.Closed += delegate { Store.Append(store, DateTime.Now, Record.EDIT, path); }; if (menu.Key.IsCtrl(KeyCode.F4)) { editor.Open(OpenMode.Modal); goto show; } editor.Open(); if (menu.Key.IsShift(KeyCode.Enter)) { goto show; } } UpdatePeriodically(mode); return; } }
static void ShowCommands() { var mode = 2; var store = VesselHost.LogPath[mode]; var limit = Settings.Default.Limit0; IListMenu menu = Far.Api.CreateListMenu(); menu.HelpTopic = HelpTopic + "command-history"; menu.SelectLast = true; menu.UsualMargins = true; menu.Title = $"Command history ({limit})"; menu.IncrementalOptions = PatternOptions.Substring; menu.AddKey(KeyCode.Delete, ControlKeyStates.ShiftPressed); menu.AddKey(KeyCode.R, ControlKeyStates.LeftCtrlPressed); menu.AddKey(KeyCode.Enter, ControlKeyStates.LeftCtrlPressed); for (; ; menu.Items.Clear()) { var actor = new Actor(mode, store); int lastGroup = -1; foreach (var it in actor.GetHistory(DateTime.Now)) { // separator int nextGroup = it.Group(limit); if (lastGroup != nextGroup) { if (lastGroup > 0) { menu.Add("").IsSeparator = true; } lastGroup = nextGroup; } // item var item = menu.Add(it.Path); item.Data = it; if (it.Evidence > 0) { item.Checked = true; } } show: //! show and check the result or after Esc index may be > 0 //! e.g. ShiftDel the last record + Esc == index out of range if (!menu.Show() || menu.Selected < 0) { return; } // update: if (menu.Key.IsCtrl(KeyCode.R)) { var algo = new Actor(mode, store, true); algo.Update(); continue; } // the command int indexSelected = menu.Selected; string path = menu.Items[indexSelected].Text; // delete: if (menu.Key.IsShift(KeyCode.Delete)) { if (0 == Far.Api.Message("Discard " + path, "Confirm", MessageOptions.OkCancel)) { Store.Remove(store, path, StringComparison.Ordinal); continue; } goto show; } // Enter | CtrlEnter: if (Far.Api.Window.Kind != WindowKind.Panels && !Far.Api.Window.IsModal) { Far.Api.Window.SetCurrentAt(-1); } // put command Far.Api.CommandLine.Text = path; // invoke command if (!menu.Key.IsCtrl()) { Far.Api.PostMacro("Keys'Enter'"); } // if it is not logged yet, log the existing Far record if (!actor.IsLoggedPath(path)) { var info = menu.Items[indexSelected].Data as Info; Store.Append(store, info.Head, Record.OPEN, path); } // then log the current record Store.Append(store, DateTime.Now, Record.OPEN, path); UpdatePeriodically(mode); return; } }