private static async Task <bool> OnSearchHistoryTmuxModeAsync(ConsoleImproved prompt, ConsoleKeyEx key) { ProcessEx tmuxPopup = null; var result = HistoryAPI.ListenForSearchResultAsync((port, token) => { var cssCommand = string.Format(Settings.Default.HistoryPopupCommand, API.Shell.AssemblyLocation, port, token); var tmuxCommand = string.Format(Settings.Default.PopupCommand, cssCommand); // start tmux prompt tmuxPopup = OS.Exec(tmuxCommand); }); await tmuxPopup.WaitForExitAsync(); tmuxPopup.Dispose(); await Task.WhenAny(result, Task.Delay(1000)); if (result.IsCompletedSuccessfully) { prompt.DisplayPrompt(await result); } else { prompt.DisplayPrompt("Error"); } return(false); }
public void CannotUseInJSEnginee() { string jsFormat = "var f = function() {var i = 30; #replace# var j = 10; return i + j;}; f();"; var engine = new ScriptEngine(); IBrowserAPI api = new HistoryAPI(); var result = engine.Evaluate <int>(jsFormat.Replace("#replace#", api.GetAPIJSCode())); Assert.AreNotEqual(result, 40); }
public void BrowserEnable() { IBrowserAPI api = new HistoryAPI(); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE6())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE7())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE8())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE9())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE10())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE11())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Chrome())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Firefox())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Opera())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Safari())); }
public acegiak_PatriotPreference(acegiak_Romancable romancable) { Romancable = romancable; List <HistoricEntity> villages = HistoryAPI.GetVillages(); // .Name.Contains("villagers") int high = 0; foreach (KeyValuePair <string, int> item in romancable.ParentObject.pBrain.FactionMembership) { if (item.Key.Contains("villagers")) { if (item.Value > high && villages.Select(v => v.GetCurrentSnapshot()).Where(v => item.Key.Contains(v.Name)).Count() > 0) { village = villages.Select(v => v.GetCurrentSnapshot()).Where(v => item.Key.Contains(v.Name)).FirstOrDefault(); high = item.Value; faction = Factions.get(item.Key); } } } amount = (float)((Stat.Rnd2.NextDouble() * 1.5) - 0.5); if (village == null || faction == null) { throw new Exception("Not a villager."); } //IPart.AddPlayerMessage("They "+(amount>0?"like":"dislike")+" "+this.interestedFaction); List <JournalVillageNote> notesForVillage = JournalAPI.GetNotesForVillage(village.entity.id); while (this.historytales.Count < 2) { this.historytales.Add(notesForVillage[Stat.Rnd2.Next(0, notesForVillage.Count)]); } }