public override bool Probe(string sentence) { var thesaurus = StaticResources.GetInstance()?.Database?.Thesaurus; var m = GetR3MShareEntity(sentence); if (m == null) { m = GetMonthlyShareEntity(sentence); } if (m == null) { m = GetR2MShareEntity(sentence); } if (m != null) { this.ruleEngine = new CASharesRuleEngine(m); this.chartEngine = new CASharesChartEngine(); return(true); } else { var entity = new R2MShare(); m = new RecognizedEntity { Entity = entity, //default Index = -1, //a -1 index indicates the entity is added virtually RecognizedName = entity.DomainName, RecognizedValue = entity.DomainName }; this.ruleEngine = new CASharesRuleEngine(m); this.chartEngine = new CASharesChartEngine(); return(false); //yes, return false to let the caller know that it is not identified } }
public async Task EmojiRefreshAsync() { if (!StaticResources.ValidateAdminUser(Context)) { await ReplyAsync($"I'm sorry, {Context.User.Mention}; I'm afraid I can't let you do that."); return; } foreach (var f in Directory.GetFiles("emoji")) { var file = Path.GetFileNameWithoutExtension(f); if (!StaticResources.GetRole(Context, new string[] { $"{file}emoji" }).Any()) { await Context.Guild.CreateRoleAsync($"{file}emoji", isMentionable : false); } if ((Context.Guild.Emotes.Select(x => x.Name == file).Any())) { await Context.Guild.CreateEmoteAsync(file, new Image(f), new Optional <IEnumerable <IRole> >(StaticResources.GetRole(Context, new string[] { "Bot", $"{file}emoji" }))); } } await ReplyAsync("Refreshed emoji!"); }
public static Embed Help() { var retval = new EmbedBuilder() { Title = "SuperSlots5000 - Help", Description = "Super basic slots game.", Color = Color.Gold }; retval.AddField("Rules", $" • You bet coins to play - default is 10, use `slots <bet>` to bet a different amount, e.g. `slots 50`\n" + $" • Three of a kind pays bet x 100\n" + $" • Two of a kind pays bet x 5\n" + $" • A `{StaticResources.GetSlotsEmoji(7)}` in the first slot pays bet x 10\n\n" + $"Only the highest paying prize is paid out. Winning will refund your bet on top of your winnings."); retval.AddField("Examples", $"With a bet of 10 coins\n\n" + $"`{StaticResources.GetSlotsEmoji(14)} | {StaticResources.GetSlotsEmoji(14)} | {StaticResources.GetSlotsEmoji(14)}`\n" + $"Pays 1000 coins (`{StaticResources.GetSlotsEmoji(14)}` in all three slots)\n\n" + $"`{StaticResources.GetSlotsEmoji(2)} | {StaticResources.GetSlotsEmoji(4)} | {StaticResources.GetSlotsEmoji(2)}`\n" + $"Pays 50 coins (`{StaticResources.GetSlotsEmoji(2)}` in two slots)\n\n" + $"`{StaticResources.GetSlotsEmoji(7)} | {StaticResources.GetSlotsEmoji(12)} | {StaticResources.GetSlotsEmoji(12)}`\n" + $"Pays 100 coins (`{StaticResources.GetSlotsEmoji(7)}` in the first slot - the two `{StaticResources.GetSlotsEmoji(12)}` are ignored, as two of a kind pays less)\n\n" + $"`{StaticResources.GetSlotsEmoji(0)} | {StaticResources.GetSlotsEmoji(7)} | {StaticResources.GetSlotsEmoji(2)}`\n" + $"Pays nothing (you lose... good day, sir!)"); retval.AddField("Multislots", $"Use `multislots <times> <bet>` to play, e.g. `multislots 10 50` to play 10 games with a bet of 50 coins each.\n" + $"Default is `multislot 3 10.`"); return(retval.Build()); }
public override bool Probe(string sentence) { var thesaurus = StaticResources.GetInstance()?.Database?.Thesaurus; var measureREs = new List <RecognizedEntity> { new RecognizedEntity { Entity = new Share() } }; var m = GetR3MTREntity(sentence); if (m == null) { m = GetMonthlyTREntity(sentence); } if (m == null) { m = GetR2MTREntity(sentence); } if (m != null) { this.ruleEngine = new CATRRuleEngine(m); this.chartEngine = new CATRChartEngine(); return(true); } return(false); }
/// <summary> /// Gets the prompt window. /// </summary> /// <param name="title">The title.</param> /// <param name="header">The header.</param> /// <param name="message">The message.</param> /// <param name="icon">The icon.</param> /// <param name="promptType">Type of the prompt.</param> /// <returns>IMsBoxWindow<ButtonResult>.</returns> public static IMsBoxWindow <ButtonResult> GetPromptWindow(string title, string header, string message, Icon icon, PromptType promptType) { var buttonEnum = promptType switch { PromptType.ConfirmCancel => ButtonEnum.OkCancel, PromptType.OK => ButtonEnum.Ok, _ => ButtonEnum.YesNo, }; var font = ResolveFont(); var parameters = new MessageBoxStandardParams() { CanResize = false, ShowInCenter = true, ContentTitle = title, ContentHeader = header, ContentMessage = message, Icon = icon, ButtonDefinitions = buttonEnum, WindowStartupLocation = WindowStartupLocation.CenterOwner, FontFamily = font.GetFontFamily(), WindowIcon = StaticResources.GetAppIcon() }; var window = new Controls.Themes.StandardMessageBox(buttonEnum); window.DataContext = new MsBoxStandardViewModel(parameters, window); return(new StandardMessageBox(window)); }
static private void LoadResources(String from) { StaticResources.Init(); if (Directory.Exists(from)) { System.String[] archs = Directory.GetFiles(from); foreach (System.String arch in archs) { if (Path.GetExtension(arch).Equals(".cs", System.StringComparison.InvariantCultureIgnoreCase)) { ScriptResource script = new ScriptResource(); script.FileName = arch; } else if (Path.GetExtension(arch).Equals(".png", System.StringComparison.InvariantCultureIgnoreCase)) { Texture2D texture = new Texture2D(); texture.FileName = arch; } else if (Path.GetExtension(arch).Equals(".dae", System.StringComparison.InvariantCultureIgnoreCase)) { Mesh mesh = new Mesh(); mesh.FileName = arch; } } } }
public async Task <IActionResult> GenerateAddOrEditTodoItemForm(int itemId = 0) { var model = new ToDoItemViewModel { AccountId = Context.CurrentAccount.AccountId }; if (itemId > 0) { var result = await EzTask.ToDoList.GetTodoItem(itemId); if (result.Status == ActionStatus.Ok) { model.CompleteOn = result.Data.CompleteOn.ToDateString(); model.Status = result.Data.Status.ToInt16 <ToDoItemStatus>(); model.Priority = result.Data.Priority.ToInt16 <ToDoItemPriority>(); model.Id = result.Data.Id; model.Title = result.Data.Title; model.ManagedCode = result.Data.ManagedCode; } else { return(NotFound(Context.GetStringResource("ItemNotExist", StringResourceType.DashboardPage))); } } model.PriorityList = StaticResources.BuildToDoItemPrioritySelectList(model.Priority); model.StatusList = StaticResources.BuildToDoItemStatusSelectList(model.Status); return(PartialView("_CreateOrEditTotoItem", model)); }
public async Task LatestAsync() { if (!StaticResources.ValidateAdminUser(Context)) { await ReplyAsync($"I'm sorry, {Context.User.Mention}; I'm afraid I can't let you do that."); return; } var proc = new Process { StartInfo = new ProcessStartInfo { FileName = "git", Arguments = "log -1 --format=%h%n%aN%x20%x3c%ae%x3e%n%ad%n%s", UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true } }; proc.Start(); var output = new StringBuilder(); while (!proc.StandardOutput.EndOfStream) { output.AppendLine(proc.StandardOutput.ReadLine()); } await ReplyAsync(StaticResources.GitFormat(output.ToString())); }
public async Task <IActionResult> GeneratePhaseView(int phaseId, int projectId) { PhaseViewModel viewModel = new PhaseViewModel(); PhaseModel phase = await EzTask.Phase.GetPhaseById(phaseId); if (phase == null) { phase = new PhaseModel(); } viewModel.Status = phase.Status.ToInt16 <PhaseStatus>(); viewModel.PhaseId = phaseId; viewModel.ProjectId = projectId; viewModel.IsDefault = phase.IsDefault; viewModel.PhaseName = phase.PhaseName; viewModel.PhaseGoal = phase.PhaseGoal; if (!viewModel.IsDefault) { viewModel.StartDate = phase.StartDate.Value.ToString("dd/MM/yyyy"); viewModel.EndDate = phase.EndDate.Value.ToString("dd/MM/yyyy"); } viewModel.StatusList = StaticResources.BuildPhaseStatusSelectList(viewModel.Status); return(PartialView("_CreateOrUpdatePhase", viewModel)); }
public async Task <IActionResult> GenerateTaskView(TaskFormDataModel model) { var task = new TaskItemViewModel(); if (model.TaskId == 0) { task.ProjectId = model.ProjectId; task.AccountId = Context.CurrentAccount.AccountId; task.PhaseId = model.PhaseId; } else { var iResult = await EzTask.Task.GetTask(model.TaskId); UpdateTaskFromExist(task, iResult); } var phases = await EzTask.Phase.GetPhases(task.ProjectId); task.PhaseList = StaticResources.BuildPhaseSelectList(phases, task.PhaseId); var assignees = await EzTask.Project.GetAccountList(task.ProjectId); task.AssigneeList = StaticResources.BuildAssigneeSelectList(assignees, task.Assignee); task.StatusList = StaticResources.BuildTaskStatusSelectList(task.Status); task.PriorityList = StaticResources.BuildPrioritySelectList(task.Priority); return(PartialView("_CreateOrUpdateTask", task)); }
public async Task PullAsync() { if (!StaticResources.ValidateAdminUser(Context)) { await ReplyAsync($"I'm sorry, {Context.User.Mention}; I'm afraid I can't let you do that."); return; } try { var sw = File.CreateText("pullmyfile"); sw.WriteLine(Context.Channel.Id); sw.Close(); } catch (Exception e) { await ReplyAsync(e.Message); } await Context.Client.SetStatusAsync(UserStatus.DoNotDisturb); await ReplyAsync("Alright, stand by!"); Process.Start("../../../../../../buildnrun2.sh"); }
public ActionResult EditStaticText(StaticResources model) { if (ModelState.IsValid) { try { var tbl = db.tblStaticResources.Find(model.IdStaticResource, model.IdLanguage, model.idStaticText); tbl.Description = model.Description; tbl.tblStaticTexts.StaticText = model.Text; tbl.DateChanged = DateTime.Now; tbl.tblStaticTexts.DateChanged = DateTime.Now; db.SaveChanges(); TempData["ResultSuccess"] = "Success in edditing static resource"; return(RedirectToAction("ViewAllStaticTexts")); } catch (Exception ex) { SendExceptionToAdmin(ex.ToString()); TempData["ResultError"] = "Error in updating static text!"; return(RedirectToAction("ViewAllStaticTexts")); } } TempData["ResultError"] = "Error in updating static text!"; return(View(model)); }
/// <summary> /// download update as an asynchronous operation. /// </summary> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public async Task <bool> DownloadUpdateAsync() { if (busy) { return(false); } busy = true; if (updateInfo != null && updateInfo.Updates.Count > 0) { lastException = null; updatePath = string.Empty; await updater.InitAndBeginDownload(updateInfo.Updates.FirstOrDefault()); while (updater.UpdateDownloader.IsDownloading) { // Sigh await Task.Delay(25); } busy = false; var updateSettings = new UpdateSettings() { IsInstaller = isInstallerVersion, Path = AppDomain.CurrentDomain.BaseDirectory }; await File.WriteAllTextAsync(Path.Combine(StaticResources.GetUpdaterPath().FirstOrDefault(), Constants.UpdateSettings), JsonConvert.SerializeObject(updateSettings)); return(!string.IsNullOrWhiteSpace(updatePath) || lastException == null); // In case file is already downloaded } busy = false; return(false); }
public ActionResult EditStaticText(int id, int idLang, int idCont) { var model = new StaticResources(); try { var tblStatic = db.tblStaticResources .Include(t => t.tblStaticTexts) .Include(t => t.tblLanguages) .Where(t => t.IdStatic == id) .Where(s => s.IdLanguage == idLang) .Where(s => s.IdStaticText == idCont) .Select(s => new { s.tblStaticTexts.StaticText, s.Description, s.IdLanguage, s.tblLanguages.Language }).ToList(); model.Description = tblStatic[0].Description; model.Text = tblStatic[0].StaticText; model.Language = tblStatic[0].Language; model.IdLanguage = tblStatic[0].IdLanguage; model.idStaticText = idCont; model.IdStaticResource = id; } catch (Exception ex) { SendExceptionToAdmin(ex.ToString()); TempData["ResultError"] = "Error in loading for editing static text!"; return(RedirectToAction("ViewAllStaticTexts")); } return(View(model)); }
public static Embed Play(SocketCommandContext context, long bet) { var retval = new EmbedBuilder() { Title = $"SuperSlots5000" }; User user = UserList.GetUserList().GetUser(context.User); if (user.Balance < bet) { retval.AddField("Error!", $"You cannot afford!"); return(retval.Build()); } user.SubtractCoins(bet); user.LastPlayed = DateTime.Now; var vals = GetProperSlots(); retval.WithDescription($"{StaticResources.GetSlotsEmoji(vals.Item1)} | {StaticResources.GetSlotsEmoji(vals.Item2)} | {StaticResources.GetSlotsEmoji(vals.Item3)}"); long winnings = -bet; string foot; if (vals.Item1 == vals.Item2 && vals.Item2 == vals.Item3) { winnings += (bet * 100) + bet; user.AddCoins(winnings); user.Bank.GamblingEarned += winnings; foot = $"A winner is you! (+{winnings:N0} coins)"; } else if (vals.Item1 == 7) //diamond in first slot { winnings += (bet * 10) + bet; user.AddCoins(winnings); user.Bank.GamblingEarned += winnings; foot = $"{StaticResources.GetSlotsEmoji(7)} in first slot! (+{winnings:N0} coins)"; } else if (vals.Item1 == vals.Item2 || vals.Item1 == vals.Item3 || vals.Item2 == vals.Item3) { winnings += (bet * 5) + bet; user.AddCoins(winnings); user.Bank.GamblingEarned += winnings; foot = $"Two of a kind! (+{winnings:N0} coins)"; } else { foot = $"Better luck next time! ({winnings:N0} coins)"; user.Bank.GamblingSpent -= winnings; } retval.WithFooter($"{foot}\nYour balance is {user.GetBalance()} coins"); return(retval.Build()); }
public ResponseBuilder(NaturalLanguageQuestion questionModel) { this.staticResources = StaticResources.GetInstance(); this.questionModel = questionModel; DimensionFactory dimFactory = Prober.Probe(questionModel?.Question); ruleEngine = dimFactory.RuleEngine; chartEngine = dimFactory.ChartEngine; }
public void List_Click(StoreLink item) { var shareIntent = new Intent(Intent.ActionSend); var text = StaticResources.FormatShareMessage(); shareIntent.PutExtra(Intent.ExtraText, text); shareIntent.SetType("text/plain"); StartActivity(Intent.CreateChooser(shareIntent, Resources.GetString(Resource.String.share))); }
private static void TestFilenameWithDate() { var tests = new[] { @"c:\hapy horses\myfile.txt", @"c:\hapy horses\myfile_{date}.txt", @"c:\hapy horses\myfile{MM/dd/yyyy}.txt" }; foreach (var test in tests) { Debug.WriteLine(StaticResources.FilenameWithDate(test)); } }
public ActionResult AddNewStaticText(StaticResources model) { if (ModelState.IsValid) { try { using (var dataContext = new MultiLanguageModel()) using (var transaction = dataContext.Database.BeginTransaction()) { var tblCon = new tblStaticTexts(); tblCon.StaticText = model.Text; tblCon.UserName = User.Identity.Name; tblCon.DateChanged = DateTime.Now; tblCon.DateCreated = DateTime.Now; db.tblStaticTexts.Add(tblCon); db.SaveChanges(); var IdCont = (from tblStaticTexts in db.tblStaticTexts orderby tblStaticTexts.DateCreated descending select tblStaticTexts).First(); int intIdt = db.tblStaticResources.Max(u => u.IdStatic); var tblRes = new tblStaticResources() { IdStatic = intIdt + 1, IdLanguage = Convert.ToInt32(model.IdLanguage), IdStaticText = IdCont.IdStaticText, Description = model.Description, UserName = User.Identity.Name, DateChanged = DateTime.Now, DateCreated = DateTime.Now }; dataContext.Set <tblStaticResources>().Add(tblRes); dataContext.Database.ExecuteSqlCommand("SET IDENTITY_INSERT tblStaticResources ON"); dataContext.SaveChanges(); dataContext.Database.ExecuteSqlCommand("SET IDENTITY_INSERT tblStaticResources OFF"); transaction.Commit(); TempData["ResultSuccess"] = "Succes in adding new resource!"; } return(RedirectToAction("ViewAllStaticTexts")); } catch (Exception ex) { SendExceptionToAdmin(ex.ToString()); } } else { TempData["ResultError"] = "Error in adding new translation!"; } model.IdLanguages = new SelectList(db.tblLanguages, "IdLanguage", "Language"); return(View(model)); }
public ActionResult AddNewStaticText() { var model = new StaticResources() { IdLanguages = new SelectList(db.tblLanguages, "IdLanguage", "Language") }; return(View(model)); }
protected override void OnStop() { _serviceLoop.StopRequested = true; while (!_serviceLoop.Stopped) { Thread.Sleep(5000); } StaticResources.LogMessage(null, EventMessageSeverity.Fatal, null, "Service Stopped", null); base.OnStop(); }
public async Task <IActionResult> GenerateAssignTaskView(TaskFormDataModel model) { TaskItemViewModel task = new TaskItemViewModel(); IList <ProjectMemberModel> assignees = await EzTask.Project.GetAccountList(model.ProjectId); task.AssigneeList = StaticResources.BuildAssigneeSelectList(assignees); return(PartialView("_AssignTask", task)); }
internal static Person Randomize(GameObject _object) { CellphoneApp a1 = new CellphoneApp(); CellphoneApp a2 = new CellphoneApp(); CellphoneApp a3 = new CellphoneApp(); List <CellphoneApp> list = new List <CellphoneApp>(); a1.Name = "SocNet"; a2.Name = "CarApp"; a3.Name = "SupChr"; list.Add(a1); list.Add(a2); list.Add(a3); System.Random rnd = new System.Random((int)(UnityEngine.Random.value * 1000)); string[] names = JsonHelper.getJsonArray <string>(Resources.Load <TextAsset>("RandomSource/MaleNameSource").text); string[] surnames = JsonHelper.getJsonArray <string>(Resources.Load <TextAsset>("RandomSource/SurnameSource").text); var rangeChance = rnd.Next(1, 100); Person result = new Person { Age = StaticResources.Randomize((int)(UnityEngine.Random.value * 1000), rnd.Next(1, 100), 70, 17, 45, 85, 46, 59, 100, 60, 78), Apps = list, Name = string.Concat(names[rnd.Next(1, 1000)], " ", surnames[rnd.Next(1, 1000)]).ToTitleCase(), Friends = StaticResources.Randomize((int)(UnityEngine.Random.value * 1000), rnd.Next(1, 100), 70, 17, 220, 85, 221, 5050, 100, 5050, 200000), DestinationX = StaticResources.Randomize((int)(UnityEngine.Random.value * 1000), rnd.Next(1, 100), 100, -11, 11), GameObject = _object }; switch (rnd.Next(1, 4)) { case 1: result.Thougths = "HOJE EU VOU FUDER ATÈ O TALO"; break; case 2: result.Thougths = "Tenho que comprar o leite das crianças guatemaltecas"; break; case 3: result.Thougths = "HOje eu vou fude muito"; break; default: result.Thougths = "Nem adianta botar"; break; } return(result); }
public async Task GuildAsync() { if (!StaticResources.ValidateAdminUser(Context)) { await ReplyAsync($"I'm sorry, {Context.User.Mention}; I'm afraid I can't let you do that."); return; } await ReplyAsync($"{Context.Guild.Name} - {Context.Guild.Id}"); }
private void ChangeStyleButtonClick(object sender, RoutedEventArgs e) { #if NETFX_CORE MyListView.Style = Resources["MyStyle"] as Style; #else MyListView.Style = StaticResources.FindResource("MyStyle") as Style; #endif var scrollViewer = MyListView.FindFirstChild <ScrollViewer>(); MyListView.ItemsSource = CreateItems(); }
static OptionSetParserV1XsdTestFixture() { OptionInformant = new Lazy <IOptionInformant>(() => { using (var reader = new XmlTextReader(StaticResources.GetStream("OptionSetV1.xsd"))) { var xmlSchema = XmlSchema.Read(reader, null); return(TraverseXmlSchema(xmlSchema)); } }); }
private int GetTableID(object entry) { int result; result = StaticResources.GetTableID(entry.GetType().Name); if (result == 0 && entry.GetType().BaseType != null) { return(StaticResources.GetTableID(entry.GetType().BaseType.Name)); } return(result); }
public async Task WtfAsync() { if (!StaticResources.ValidateAdminUser(Context)) { await ReplyAsync($"I'm sorry, {Context.User.Mention}; I'm afraid I can't let you do that."); return; } await ReplyAsync("wat?"); }
public MainWindow() { _staticResources = new StaticResources(); _mappingEngine = Mapper.Engine; _integralEquationSolver = new IntegralEquationSolver(); Settings = _mappingEngine.Mapper.Map <Settings>(_staticResources.DefaultSettings.Value[GetEquationType()]); ViewModel = _mappingEngine.Mapper.Map <MainWindowViewModel>(Settings); DataContext = ViewModel; InitializeComponent(); }
public ChartAuditNLIDBTest() { contentPath = @"..\..\..\PharmaACE.NLP.QuestionAnswerService\Content\Store\"; databasePath = contentPath + "chartaudit_shmeasure.sql"; //"ChartAudit.sql"; thesaurusPaths = new List <string> { contentPath + "th_english.dat", contentPath + "th_chartaudit.dat" }; langPath = contentPath + "english.csv"; stopwordsPath = "english.txt"; StaticResources.GetInstance(databasePath, langPath, thesaurusPaths, null); }