public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { Consoler.Logger = log; Consoler.Information("ExtractLogicAppFunction started"); var authHeader = req.Headers.Single(x => x.Key == "Authorization"); if (string.IsNullOrEmpty(authHeader.Value)) { return(new UnauthorizedObjectResult("Invalid Token")); // return HTTP 401 Unauthorized } var token = authHeader.Value.ToString().Replace("Bearer", "").Trim(); string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); log.LogInformation(requestBody); var data = JsonConvert.DeserializeObject <ExtractLogicAppPayload>(requestBody); try { Extractor = new Extractor(); Extractor.Authenticate(token); await Extractor.ExtractLogicApp(data.ResourceGroup, data.LogicAppName, data.FailedOnly, data.Export, data.StartDateTime, data.EndDateTime); } catch (Exception e) { log.LogError("ERROR ExtractLogicAppFunction", e); throw; } return(new OkObjectResult(Extractor.Data)); }
public static void ShowHeader() { var sb = new StringBuilder(); sb.AppendLine("This utility performs actions such as."); sb.AppendLine("Database flash/seed"); Consoler.ShowHeader("Vita Build Tools", sb.ToString()); }
static void Main() { Target target = new Adapter(); target.Request(); Consoler.ReadKey(); }
public static void ShowHelpAndExit(bool prompt = false) { Consoler.Title("Usage:"); Consoler.Write("/help\t\t\tShow help"); Consoler.Write("Examples:"); Consoler.Write(@"see scripts/database folder"); Consoler.Write(""); ShowPauseAndExit(prompt); }
public async Task <AzureLogicAppWorkflowRuns> WorkflowRunListAsync(string subscriptionId, string resourceGroupName, string logicAppName, bool failedOnly = false, DateTime?startTimeBegin = null, DateTime?startTimeEnd = null) { LogicAppName = logicAppName; //Console.Clear(); var runs = new List <LogicAppWorkflowRunValue>(); string search = $"$filter="; if (failedOnly) { search = $"$filter=status eq 'failed' and"; } if (startTimeBegin != null) { search += $" startTime ge {startTimeBegin.Value.ToUniversalTime():yyyy-MM-ddTHH:mm:ssZ}"; } if (startTimeEnd != null) { search += $" and startTime le {startTimeEnd.Value.ToUniversalTime():yyyy-MM-ddTHH:mm:ssZ}"; } search += "&orderby=startTime desc"; var url = $"https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/runs?api-version=2016-06-01&{search}"; var breaker = 0; var result = await Utility.GetResourceAsync <AzureLogicAppWorkflowRuns>(url, Token); result.Value.ToList().ForEach(runs.Add); var link = result.NextLink; while (!string.IsNullOrWhiteSpace(link) && breaker < PageCountToRetrieve) { Consoler.Write("Logic app runs for page " + breaker); Consoler.Write(link); result = await Utility.GetResourceAsync <AzureLogicAppWorkflowRuns>(link, Token); link = result.NextLink; foreach (var x in result.Value) { runs.Add(x); } breaker++; } return(new AzureLogicAppWorkflowRuns { Value = runs }); }
public static string Dump <T>(this T obj, string description = null, bool indent = false) { var content = JsonConvert.SerializeObject(obj, indent ? Formatting.Indented : Formatting.None, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); Consoler.Information($"{description} : {content}"); return(content); }
// resubmit a logic app run // https://docs.microsoft.com/en-us/rest/api/logic/workflowtriggerhistories/resubmit public async Task <LogicAppResubmittedRun> ResubmitAsync(string subscriptionId, string resourceGroupName, string logicAppName, string triggerHistoryRunId, string triggerName = "manual") { var url = $"https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{triggerName}/histories/{triggerHistoryRunId}/resubmit?api-version=2016-06-01"; Consoler.Write($"Resubmit ${url}"); using (var client = new HttpClient()) { var logicAppResubmittedRun = new LogicAppResubmittedRun() { SubscriptionId = subscriptionId, ResourceGroupName = resourceGroupName, LogicAppName = logicAppName, Trigger = triggerName, OldRunId = triggerHistoryRunId }; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token); var postData = new StringContent("{}", Encoding.UTF8, "application/json"); var response = await client.PostAsync(url, postData); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { //try to get the replay run id if (response.Headers.Contains("x-ms-workflow-run-id")) { var newRunId = response.Headers.GetValues("x-ms-workflow-run-id").FirstOrDefault(); var correlationId = response.Headers.GetValues("x-ms-correlation-id").FirstOrDefault(); if (!string.IsNullOrEmpty(newRunId)) { logicAppResubmittedRun.NewRunId = newRunId; } logicAppResubmittedRun.Correlation = correlationId; } var content = await response.Content.ReadAsStringAsync(); logicAppResubmittedRun.Content = content.Dump(); } else { throw new HttpRequestException(response.ReasonPhrase); } logicAppResubmittedRun.Status = response.StatusCode; logicAppResubmittedRun.IsSuccessStatusCode = response.IsSuccessStatusCode; return(logicAppResubmittedRun); } }
private static void ShowParseError(IEnumerable <Error> errs) { Consoler.TitleStart("ARGS ERRORS"); foreach (var error in errs) { Consoler.Warn(error.Tag.ToString()); Consoler.Warn(error.ToString()); } Consoler.TitleEnd("ARGS ERRORS"); }
/// <summary> /// build script coming in from powershell was keeping the ,,,,,,, so having to strip them /// </summary> /// <param name="args"></param> /// <returns></returns> public static IEnumerable <string> CleanArgs(IEnumerable <string> args) { var cleaned = new List <string>(); foreach (var s in args) { Consoler.Write(s); cleaned.Add(s.Replace(",", "")); } Consoler.Write("{0}{0}", Environment.NewLine); return(cleaned); }
public void Authenticate(string token = null) { if (_hasAuthenticated) { return; } Consoler.TitleStart("Authenticating..."); Token = !string.IsNullOrEmpty(token) ? token : AuthUtil.GetTokenFromConsole(); Client = new ApiClient(AzureEnvVars.TenantId, AzureEnvVars.SubscriptionId, Token); _hasAuthenticated = true; Consoler.TitleEnd("Authenticating..."); }
/// <summary> /// eg manual or When_a_message_is_received_in_topic_subscription /// /// https://docs.microsoft.com/en-us/rest/api/logic/workflowtriggerhistories/list /// </summary> /// <param name="subscriptionId"></param> /// <param name="trigger"></param> /// <param name="resourceGroupName"></param> /// <param name="logicAppName"></param> /// <returns></returns> public async Task <AzureLogicAppWorkflowTriggerHistoryRun> WorkflowTriggerHistoryListAsync(string subscriptionId, string trigger, string resourceGroupName, string logicAppName) { LogicAppName = logicAppName; var url = $"https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Logic/workflows/{logicAppName}/triggers/{trigger}/histories?api-version=2016-06-01"; Consoler.Write(url); return(await Utility.GetResourceAsync <AzureLogicAppWorkflowTriggerHistoryRun>(url, Token)); }
public string Walk(string args) { IParseTree context; var parsed = Parse(args, out context); ParseTreeWalker walker = new ParseTreeWalker(); walker.Walk(new ShortToUnicodeString(), context); string read = Consoler.Read(); return(read); }
public static async Task Main(string[] args) { Consoler.TitleStart("Auxilium"); await Run(args).ConfigureAwait(true); Console.WriteLine("--------- Completed ---------"); if (Debugger.IsAttached) { Console.ReadLine(); } }
private static void Logo() //prints application name,version etc { //get application Settings var appSettings = applicationSettings.Get(); Version version = Assembly.GetEntryAssembly().GetName().Version; Consoler.WriteLineInColor(string.Format("{0} - {1}", appSettings.GeneralSettings.ApplicationName, appSettings.GeneralSettings.Environment), ConsoleColor.DarkYellow); Consoler.WriteLineInColor(string.Format("Application Version : {0}", version), ConsoleColor.DarkYellow); Consoler.WriteLineInColor(string.Format("Json Version : {0}", appSettings.GeneralSettings.JsonSettingsVersion), ConsoleColor.DarkYellow); Console.Title = string.Format("{0} - version {1}", appSettings.GeneralSettings.ApplicationName, version); Console.WriteLine(); Console.WriteLine(); }
//public async Task MessageReceived(SocketGuildUser user) //{ // var channel = client.GetChannel(370581837560676354) as SocketTextChannel; // await channel.SendMessageAsync("safsgasgags"); //} //public async Task UserJoined(SocketGuildUser user) //{ // var channel = client.GetChannel(370581837560676354) as SocketTextChannel; // await channel.SendMessageAsync("safsgasgags"); //} private async Task HandleCommandAsync(SocketMessage arg) { // Bail out if it's a System Message. var msg = arg as SocketUserMessage; if (msg == null) { return; } // We don't want the bot to respond to itself or other bots. // NOTE: Selfbots should invert this first check and remove the second // as they should ONLY be allowed to respond to messages from the same account. if (msg.Author.Id == client.CurrentUser.Id || msg.Author.IsBot) { return; } // Create a number to track where the prefix ends and the command begins int pos = 0; // Uncomment the second half if you also want // commands to be invoked by mentioning the bot instead. var prefix = applicationSettings.GetTripleZeroBotSettings().DiscordSettings.Prefix; if (msg.HasCharPrefix(Convert.ToChar(prefix), ref pos) || msg.HasMentionPrefix(client.CurrentUser, ref pos)) { // Create a Command Context. var context = new SocketCommandContext(client, msg); Consoler.WriteLineInColor(string.Format("User : '******' sent the following command : '{1}'", context.Message.Author.ToString(), context.Message.ToString()), ConsoleColor.Green); // Execute the command. (result does not indicate a return value, // rather an object stating if the command executed succesfully). var result = await commands.ExecuteAsync(context, pos, services); // Uncomment the following lines if you want the bot // to send a message if it failed (not advised for most situations). if (!result.IsSuccess && result.Error != CommandError.UnknownCommand) { Consoler.WriteLineInColor(string.Format("error : '{0}' ", result.ErrorReason), ConsoleColor.Green); await msg.Channel.SendMessageAsync(result.ErrorReason); } if (result.Error == CommandError.UnknownCommand) { var message = msg.Channel.SendMessageAsync($"I am pretty sure that there is no command `{msg}`!!!\nTry `{prefix}help` to get an idea!").Result; await Task.Delay(3000); await message.DeleteAsync(); } } }
/// <summary> /// Collect a JSON log to Azure Log Analytics /// </summary> /// <param name="logType">Name of the Type of Log. Can be any name you want to appear on Azure Log Analytics.</param> /// <param name="json">JSON string. Can be an array or single object.</param> /// <param name="apiVersion">Optional. Api Version.</param> /// <param name="timeGeneratedPropertyName"></param> public async Task Collect(string json, string logType = "ApplicationLog", string apiVersion = "2016-04-01", string timeGeneratedPropertyName = null) { if (!json.Contains("{")) { await Collect(LogMessage.Log(json)); return; // dont double log } string logUri = $"https://{_workspaceId}.ods.opinsights.azure.com/api/logs?api-version={apiVersion}"; var dateTimeNow = DateTime.UtcNow.ToString("r"); var authSignature = GetAuthSignature(json, dateTimeNow); try { await SendLog(json, logType, authSignature, dateTimeNow, logUri); } catch (Exception excep) { Consoler.Error("API Post Exception", excep); int breaker = 0; bool success = false; while (!success && breaker < 10) { try { System.Threading.Thread.Sleep(1000); await SendLog(json, logType, authSignature, dateTimeNow, logUri); success = true; } catch (Exception e) { Consoler.Error("API Post Exception 2", excep); } finally { breaker++; } } if (!success) { throw new ApplicationException("LogAnalyticsDataCollector failed over 10 times to record log", excep); } } }
public async Task <bool> Handle(SeedCommand request, CancellationToken cancellationToken) { Consoler.TitleStart("seed database start"); var companies = CompanySpreadsheet.Import(); //var chance = new ChanceNET.Chance(); //var companies = new List<Company> {chance.Object<Company>()}; var bus = IocContainer.Container.Resolve <ICommandBus>(); /* * * DRGD - De-registered. * EXAD - External administration (in receivership/liquidation). * NOAC - Not active. * NRGD - Not registered. * PROV - Provisional (mentioned only under charges and refers * to those which have not been fully registered). * REGD – Registered. * SOFF - Strike-off action in progress. * DISS - Dissolved by Special Act of Parliament. * DIV3 - Organisation Transferred Registration via DIV3. * PEND - Pending - Schemes. * */ foreach (var company in companies)//.Where(x=>x.Status =="REGD")) { var command = new CreateCompanyCommand(CompanyId.New) { Company = company }; try { AsyncUtil.RunSync(() => bus.PublishAsync(command, cancellationToken)); await Task.CompletedTask; } catch (Exception e) { Console.WriteLine(e); throw; } } Consoler.TitleEnd("seed database finished"); return(true); }
private static async Task Extract(int minutesAgo, int minutesToExtract = 1) { // DateTime? startDate = DateTime.UtcNow.AddMinutes(minutesAgo); // DateTime? endDate = DateTime.UtcNow.AddMinutes(minutesAgo+ minutesToExtract); DateTime?startDate = DateTime.Parse("16/04/2021 6:13:50 AM"); DateTime?endDate = DateTime.Parse("16/04/2021 6:15:03 AM"); ////if (!startDate.HasValue) startDate = _extractor.Data.Select(x => x.StartTimeUtc).Max(); Consoler.Information($"start {startDate}"); Consoler.Information($"end {endDate}"); //await _extractor.Run(startDate, endDate); var list = new List <string>() { }; var tasks = new List <Task>(); var extractor = new Extractor(); await extractor.Load(); foreach (var la in list) { var item = extractor.LogicApps.SingleOrDefault(x => x.Value == la); await extractor.ExtractLogicApp(item.Key, item.Value, false, true, startDate, endDate); //var task = Task.Run(async () => { // //while (startDate > endDate && rg.Value!=null) // //{ // // var dt = startDate.Value.AddMinutes(5); // // startDate = dt; // //} //}); //tasks.Add(task); } // await Task.WhenAll(tasks); //await _extractor.Run(startDate, endDate); await Export(extractor); }
public async Task <bool> Handle(FlashCommand request, CancellationToken cancellationToken) { Consoler.TitleStart("flash database start"); var connectionString = ConfigurationManager.ConnectionStrings["Vita"].ConnectionString; if (DatabaseUtil.CheckDatabaseExists(connectionString.Replace("Vita", "master"), "Vita")) { DatabaseUtil.DeleteAllTables(connectionString); } Consoler.TitleStart("Create Database if not exist ..."); EnsureDatabase.For.SqlDatabase(connectionString); Consoler.TitleEnd("Completed"); Consoler.Write("EventFlow Schema Created..."); // EventFlow Schema EventFlowEventStoresMsSql.MigrateDatabase(IocContainer.Container.Resolve <IMsSqlDatabaseMigrator>()); Consoler.Write("EventFlow Schema Created..."); // Schema var result = DeployChanges.To .SqlDatabase(connectionString) .WithTransaction() .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly()) .LogToConsole() .Build() .PerformUpgrade(); foreach (var script in result.Scripts) { Consoler.Write($"script: {script.Name}"); } if (result.Error != null) { Consoler.ShowError(result.Error); } await Task.CompletedTask; Consoler.TitleEnd("flash database finished"); return(result.Successful); }
//public async Task MessageReceived(SocketGuildUser user) //{ // var channel = client.GetChannel(370581837560676354) as SocketTextChannel; // await channel.SendMessageAsync("safsgasgags"); //} //public async Task UserJoined(SocketGuildUser user) //{ // var channel = client.GetChannel(370581837560676354) as SocketTextChannel; // await channel.SendMessageAsync("safsgasgags"); //} private async Task HandleCommandAsync(SocketMessage arg) { // Bail out if it's a System Message. var msg = arg as SocketUserMessage; if (msg == null) { return; } // We don't want the bot to respond to itself or other bots. // NOTE: Selfbots should invert this first check and remove the second // as they should ONLY be allowed to respond to messages from the same account. if (msg.Author.Id == client.CurrentUser.Id || msg.Author.IsBot) { return; } // Create a number to track where the prefix ends and the command begins int pos = 0; // Replace the '!' with whatever character // you want to prefix your commands with. // Uncomment the second half if you also want // commands to be invoked by mentioning the bot instead. if (msg.HasCharPrefix('^', ref pos) /* || msg.HasMentionPrefix(_client.CurrentUser, ref pos) */) { // Create a Command Context. var context = new SocketCommandContext(client, msg); // Execute the command. (result does not indicate a return value, // rather an object stating if the command executed succesfully). var result = await commands.ExecuteAsync(context, pos, services); Consoler.WriteLineInColor(string.Format("User : '******' sent the following command : '{1}'", context.Message.Author.ToString(), context.Message.ToString()), ConsoleColor.Green); // Uncomment the following lines if you want the bot // to send a message if it failed (not advised for most situations). if (!result.IsSuccess && result.Error != CommandError.UnknownCommand) { await msg.Channel.SendMessageAsync(result.ErrorReason); } } }
public async Task MainAsync() { ///////////initialize autofac SettingsTripleZeroBot settingsTripleZeroBot = null; autoFacContainer = AutofacConfig.ConfigureContainer(); using (var scope = autoFacContainer.BeginLifetimeScope()) { applicationSettings = scope.Resolve <ApplicationSettings>(); commands = scope.Resolve <CommandService>(); client = scope.Resolve <DiscordSocketClient>(); logo = scope.Resolve <Logo>(); //memoryCache = scope.Resolve<MemoryCache>(); settingsTripleZeroBot = applicationSettings.GetTripleZeroBotSettings(); await InstallCommands(); await client.LoginAsync(TokenType.Bot, settingsTripleZeroBot.DiscordSettings.Token); await client.StartAsync(); await client.SetGameAsync(string.Format("{0}help", settingsTripleZeroBot.DiscordSettings.Prefix)); } //client.MessageReceived += MessageReceived; while (client.ConnectionState != ConnectionState.Connected) { Consoler.WriteLineInColor(string.Format("Still not connected... {0}", DateTime.Now), ConsoleColor.Yellow); await Task.Delay(2000); } logo.ConsolePrintLogo(); //prints application name,version etc //await TestCharAliasesDelete(); //await TestDelete(); //await TestGuildPlayers("41st"); //await TestPlayerReport("tsitas_66"); //await TestGuildModule("41s", "gk"); //await TestCharacterModule("tsitas_66", "cls"); await client.GetUser("TSiTaS", "1984").SendMessageAsync(logo.GetLogo()); await Task.Delay(-1); }
/// <summary> /// Execute multiple sql statments in transaction (use <see cref="ScriptToSqls" /> to split script first) /// </summary> /// <param name="connectionString"></param> /// <param name="sqls"></param> public static void ExecuteSqlsWithTrans(string connectionString, params string[] sqls) { using (var connection = new SqlConnection(connectionString)) using (var command = connection.CreateCommand()) { connection.Open(); using (var transaction = connection.BeginTransaction()) { command.Connection = connection; command.Transaction = transaction; try { foreach (var query in sqls) { command.CommandText = query; command.ExecuteNonQuery(); } transaction.Commit(); Consoler.Write("DB sqls executed ..."); } catch (Exception ex) { Consoler.ShowError(ex); try { transaction.Rollback(); throw; } catch (Exception ex2) { // This catch block will handle any errors that may have occurred // on the server that would cause the rollback to fail, such as // a closed connection. Consoler.ShowError(ex2, true); throw; } } } } }
private static async Task ParseOptions(Options opts) { if (opts.FlashDatabase) { var result = await _mediator.Send(new FlashCommand()); if (result) { Consoler.Success(false); } } if (opts.SeedDatabase) { var result = await _mediator.Send(new SeedCommand()); if (result) { Consoler.Success(false); } } }
private async Task <string> GetContent(string uri) { if (string.IsNullOrEmpty(uri)) { return(null); } using (var client = new HttpClient()) { // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token); --> this causes an ERROR ??? var response = await client.GetAsync(uri); response.EnsureSuccessStatusCode(); if (response.IsSuccessStatusCode) { return(await response.Content.ReadAsStringAsync()); } Consoler.Write("-----------------------------------------"); Consoler.Write("GetContent"); Consoler.Write(uri); Consoler.Write("-----------------------------------------"); throw new ApplicationException(response.ReasonPhrase); } }
void permutation(int k, ref int[] S, int cnt, ref int[] ans, ref bool[] visit) { if(cnt == 6) { for(int i = 0; i < k; ++i) Console.Write(ans[i] + ' '); Consoler.WriteLine(); } for(int i = 0; i < k; ++i) { if(visit[i]) continue; visit[i] = true; ans[i] = } int Main() { while(1){ var tmp = Console.ReadLine().Split(' ').Select(int.Parse).ToList(); k = tmp[0]; if(k == 0) break; int[] S = new int[k]; bool[] visit = new bool[k]; S = tmp[0..];
public static void DeleteAllTables(string connectionString) { try { ExecuteSqlsWithTrans(connectionString, DropTables); ExecuteSqlsWithTrans(connectionString, DropViews); } catch (Exception ex) { Consoler.Warn(ex.ToString()); } try { SetupMsSpForEach(connectionString); const string sql = @"DECLARE @Sql NVARCHAR(500) DECLARE @Cursor CURSOR SET @Cursor = CURSOR FAST_FORWARD FOR SELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + ']' FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1 LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAME OPEN @Cursor FETCH NEXT FROM @Cursor INTO @Sql WHILE (@@FETCH_STATUS = 0) BEGIN Exec SP_EXECUTESQL @Sql FETCH NEXT FROM @Cursor INTO @Sql END CLOSE @Cursor DEALLOCATE @Cursor EXEC sp_MSForEachTable 'DROP TABLE ?' "; ExecuteSqlsWithTrans(connectionString, sql); } catch (Exception ex) { Consoler.Error(ex.ToString()); } }
public static void ShowErrorAndExit(Exception e, bool prompt = false) { Consoler.ShowError(e, prompt); Environment.Exit(1); }
public async Task GetSlackersLevel(string guildAlias) { guildAlias = guildAlias.Trim(); string retStr = ""; var guildConfig = IResolver.Current.GuildSettings.GetGuildConfigByAlias(guildAlias).Result; if (guildConfig == null) { await ReplyAsync($"I couldn't find any guild with alias ***{guildAlias}***"); return; } var res = await IResolver.Current.SWGoHRepository.GetGuildUnits(guildConfig.SWGoHId); if (res.FirstOrDefault().LoadedFromCache) { await ReplyAsync($"{cacheClient.GetCachedDataRepositoryMessage()}"); } int counter = 1; int totalRows = 300; try { for (int level = 1; level < 50; level++) { //var list = res.SelectMany(p => p.Players.Where(t => t.CombatType == UnitCombatType.Character && t.Level == level).ToList()); //var a = 1; var characters = (from character in res from players in character.Players.Where(t => t.CombatType == UnitCombatType.Character && t.Level == level) select new { character.Name, players } ).ToList().OrderBy(p => p.players.PlayerName); var listCharacters = characters.Select(x => new Tuple <string, GuildPlayerUnit>(x.Name, x.players)).ToList(); if (listCharacters.Count() == 0) { continue; } retStr += $"\n\n-------**Level {level}**-------"; foreach (var row in listCharacters.ToList()) { retStr += $"\n**{row.Item2.PlayerName}** : {row.Item1}"; if (retStr.Length > 1900) { await ReplyAsync($"{retStr}"); retStr = ""; } } //foreach (var guildCharacter in res) //{ // foreach (var player in guildCharacter.Players.Where(p => p.CombatType == UnitCombatType.Character)) // { // if (player.Level == level) // { // retStr += "\n"; // retStr += string.Format("{0} - {1} - level:{2}", player.PlayerName, guildCharacter.CharacterName, player.Level); // if (retStr.Length > 1800) // { // await ReplyAsync($"{retStr}"); // retStr = ""; // } // counter += 1; // if (counter > totalRows) break; // } // } //} if (counter > totalRows) { break; } } } catch (Exception ex) { Consoler.WriteLineInColor(string.Format("Slackers say : {0}", ex.Message), ConsoleColor.Red); } if (retStr.Length > 0) { await ReplyAsync($"{retStr}"); } }
public static void ShowCompletedAndExit(bool prompt = false) { Consoler.Success(prompt); Environment.Exit(0); }
public static void ShowPauseAndExit(bool prompt = false) { Consoler.Pause(prompt); Environment.Exit(0); }