Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("Name,Position,Category")] Member member)
        {
            ModelState.Remove("Category.Name");
            if (ModelState.IsValid)
            {
                var memberExists = await context.Member.FirstOrDefaultAsync(m => m.Name == member.Name);

                if (memberExists != null)
                {
                    return(ValidationProblem(detail: "Member name already exists."));
                }

                member.Category = (memberService.IsJuniorEditor(member)) ? context.Category
                                  .First(c => c.Name == member.Category.Name) : null;

                context.Add(member);
                await context.SaveChangesAsync();

                logger.Log($"{HttpContext.User.Identity.Name} created member `{member.Name}` with position {member.Position} " +
                           $"(Category = {member.Category.Name}) ");

                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
Esempio n. 2
0
        public async Task <ActionResult <Comment> > PostComment(Comment _comment)
        {
            var user = await identityService.GetUserWithToken(HttpContext);

            var comment = new Comment()
            {
                ArticleID = _comment.ArticleID, Text = _comment.Text, DateTime = DateTime.Now, UserID = user.Id
            };

            context.Comment.Add(comment);
            await context.SaveChangesAsync();

            var article = await context.Article.FindAsync(comment.ArticleID);

            var comments = await context.Comment
                           .Where(c => c.ArticleID == article.Id)
                           .Include(c => c.User)
                           .Select(c => mapper.Map <CommentDto>(c))
                           .ToListAsync();

            foreach (var comment_ in comments)
            {
                var owner = await context.Users.FindAsync(comment_.User.Id);

                comment_.User = owner;
            }

            await articleHub.Clients.All.ArticleCommentChange(article.Id, comments);

            logger.Log($"{user.UserName} posted a comment `{comment.Text}` on the article of title `{article.Title}`");

            return(Ok());
        }
Esempio n. 3
0
        /// <summary>
        /// Logs a string to the console.
        /// </summary>
        /// <param name="message">The message that will be logged.</param>
        private void Log(string message)
        {
            if (message.Contains("Unknown User") || message.Contains("Unknown Guild"))
            {
                _logger.Log(message);
                return;
            }

            _logger.Log(message);
        }
Esempio n. 4
0
        public async Task <IActionResult> Create([Bind("Number,FallYear,SpringYear")] Volume volume)
        {
            if (ModelState.IsValid)
            {
                context.Add(volume);
                await context.SaveChangesAsync();

                logger.Log($"{HttpContext.User.Identity.Name} created Volume {volume.Number}.");

                return(RedirectToAction(nameof(Index), "Home"));
            }
            return(View(volume));
        }
Esempio n. 5
0
        public async Task <ActionResult> Create([Bind("Name,Position")] Member member)
        {
            if (ModelState.IsValid)
            {
                context.Add(member);
                await context.SaveChangesAsync();

                logger.Log($"{HttpContext.User.Identity.Name} created writer `{member.Name}`");

                return(RedirectToAction(nameof(Index)));
            }
            return(View(member));
        }
Esempio n. 6
0
        public async Task <IActionResult> Create([Bind("Name,Tag")] Category category)
        {
            if (ModelState.IsValid)
            {
                context.Add(category);
                category.SetLanguage(Regex.IsMatch(category.Name, @"^[a-zA-Z.\-+\s]*$") ? OutlookConstants.Language.English : OutlookConstants.Language.Arabic);
                await context.SaveChangesAsync();

                logger.Log($"{HttpContext.User.Identity.Name} created Category `{category.Name}` and ID `{category.Id}`.");

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
Esempio n. 7
0
        public ResponseModel setLicenseVariables(out LicenseModel License)
        {
            string        sFunctionName = "setLicenseVariables()";
            ResponseModel Response      = new ResponseModel();

            //LicenseModel License = new LicenseModel();
            License = new LicenseModel();
            try
            {
                License.OrganizationName     = OrganizationModel.Name;
                License.OrganizationMnemonic = OrganizationModel.Mnemonic;
                License.ProductionYear       = OrganizationModel.ProdutionYear;
                License.TotalBranches        = OrganizationModel.TotalBranches;
                Response.SuccessfullyPassed();
            }
            catch (Exception ex)
            {
                #region Text Logging
                oLog.Log(
                    sClassName,
                    sFunctionName,
                    ex.ToString());
                #endregion Text Logging
                Response.FailedWithException();
            }

            return(Response);
        }
Esempio n. 8
0
        public ResponseModel AuthenticateUserLogin(string sLoginID, string sPassword)
        {
            string        sFunctionName = "AuthenticateUserLogin(,)";
            ResponseModel Result        = new ResponseModel();

            try
            {
                SMSCoreData CoreData = new SMSCoreData();
                DataView    oDV      = new DataView();

                CoreData.getUserProfile(sLoginID, out oDV);
                if (oDV != null)
                {
                    Result.isSuccessful  = true;
                    Result.sResponseCode = Constants.ResponseMessages.Success;
                }
            }
            catch (Exception ex)
            {
                #region Text Logging
                oLog.Log(
                    sClassName,
                    sFunctionName,
                    ex.Message);
                #endregion Text Logging
                Result.isSuccessful  = false;
                Result.sResponseCode = Constants.ResponseMessages.Failure;
            }
            return(Result);
        }
        public void SaveMetrics(string path)
        {
            ComputeAlgorithmMetrics();
            var    searchTimeDict   = MetricsDictionary.ElementAt(0);
            string csvFormatMessage = "Algorithm, SearchTime, CustomerNumber";

            foreach (var metrics in searchTimeDict.Value)//writes base csv format message
            {
                var metricName = metrics.Key;
                csvFormatMessage += ", " + metricName;
            }
            var recorder   = new FileRecorder(path, csvFormatMessage);
            var fileLogger = new Logger.Logger(recorder);

            foreach (var currentMetricDictionary in MetricsDictionary)
            {
                string csvMessage = currentMetricDictionary.Key.Item1 + ", " + currentMetricDictionary.Key.Item2 + ", " +
                                    currentMetricDictionary.Key.Item3;
                foreach (var metric in currentMetricDictionary.Value)
                {
                    var metricValue = metric.Value;
                    csvMessage += ", " + metricValue;
                }
                fileLogger.Log(csvMessage);
            }
        }
Esempio n. 10
0
        public void Initialize()
        {
            string   sFunctionName = "Initialize()";
            DataView oDV           = new DataView();

            try
            {
                Data.getOrganizationDetails(out oDV);
                foreach (DataRowView row in oDV)
                {
                    this.Name          = row["Name"].ToString();
                    this.Mnemonic      = row["Organization_Mnemonic"].ToString();
                    this.ProdutionYear = row["Production_Year"].ToString();
                    this.LicenseA      = row["LicenseA"].ToString();
                    this.LicenseB      = row["LicenseB"].ToString();
                }
                Data.getTotalBranches(out oDV);
                foreach (DataRowView row in oDV)
                {
                    this.TotalBranches = Convert.ToInt32(row[0].ToString());
                }
            }
            catch (Exception ex)
            {
                #region Text Logging
                oLog.Log(
                    sClassName,
                    sFunctionName,
                    ex.ToString());
                #endregion Text Logging
            }
        }
Esempio n. 11
0
        public async Task <IActionResult> Register([FromBody] RegisterModel registerModel)
        {
            if (ModelState.IsValid)
            {
                var user = new OutlookUser {
                    UserName = registerModel.Username, Email = registerModel.Email, FirstName = registerModel.FirstName, LastName = registerModel.LastName
                };
                var result = await userManager.CreateAsync(user, registerModel.Password);

                var code = await userManager.GenerateEmailConfirmationTokenAsync(user);

                code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
                var callbackUrl = Url.Page(
                    "/Account/ConfirmEmail",
                    pageHandler: null,
                    values: new { area = "Identity", userId = user.Id, code = code },
                    protocol: Request.Scheme);

                await emailSender.SendEmailAsync(registerModel.Email, "Confirm your AUB Outlook Account", EmailSender.EmailVerificationHtmlMessage(HtmlEncoder.Default.Encode(callbackUrl)));

                logger.Log($"User {user.UserName} was created.");

                return(new JsonResult(result));
            }

            return(BadRequest(ModelState));
        }
Esempio n. 12
0
        static void UnhandledExceptionTrapper(object sender, UnhandledExceptionEventArgs e)
        {
            Console.WriteLine("Unhandled exception! \n \n" + e.ExceptionObject + "\n", ConsoleColor.Red);

            var logger = new Logger.Logger();

            logger.Log("UnhandledException! \n \n" + e.ExceptionObject + "\n");
        }
        public override void PrintView()
        {
            var metricsPath =
                Path.Combine(Path.Combine(Simulation.Params.CurrentSimulationLoggerPath, @"algorithmMetrics.csv"));
            var algorithmsLogger = new Logger.Logger(new FileRecorder(Path.Combine(Path.Combine(Simulation.Params.CurrentSimulationLoggerPath, @"algorithms.csv"))));
            var dataSetLogger    = new Logger.Logger(new FileRecorder(Path.Combine(Simulation.Params.CurrentSimulationLoggerPath, @"algorithmsDataset.csv"), "DataModelId,CustomersNumber,VehicleNumber,MaxRideTimeDurationInMinutes,MaxAllowedUpperBoundLimitInMinutes,Seed"));
            var vehicleNumber    = 20;
            var count            = 0;

            //var algorithmsMetrics = new AlgorithmMetrics();
            Simulation.Params.VehicleNumber = vehicleNumber;
            for (int customersNumber = 25; customersNumber <= 100; customersNumber = customersNumber + 25)
            {
                Simulation.Params.NumberInitialRequests = customersNumber;
                for (int i = 0; i < 10; i++) // tests 10 different data models
                {
                    bool allowDropNodes = false;
                    RandomNumberGenerator.GenerateNewRandomSeed();
                    var dataModel     = DataModelFactory.Instance().CreateInitialSimulationDataModel(allowDropNodes, Simulation);
                    var printableList = dataModel.GetSettingsPrintableList();
                    ConsoleLogger.Log(printableList);
                    dataSetLogger.Log(dataModel.GetCSVSettingsMessage());
                    for (int searchTime = 5; searchTime <= 90; searchTime = searchTime + 5) //test different same datamodel with different search times
                    {
                        AlgorithmContainer algorithmContainer = new AlgorithmContainer();
                        foreach (var searchAlgorithm in algorithmContainer.SearchAlgorithms)
                        {
                            var algorithm = new SearchAlgorithm(searchAlgorithm, searchTime);
                            algorithm.Test(dataModel, allowDropNodes);
                            ConsoleLogger.Log(algorithm.GetResultPrintableList());

                            if (count == 0)
                            {
                                //logs base message type style
                                algorithmsLogger.Log(algorithm.GetCSVMessageStyle());
                            }
                            algorithmsLogger.Log(algorithm.GetCSVResultsMessage());
                            count++;
                        }
                    }
                }
            }

            //algorithmsMetrics.SaveMetrics(metricsPath);
        }
        public void SaveStats(string path)
        {
            IRecorder fileRecorder =
                new FileRecorder(path);
            var myFileLogger       = new Logger.Logger(fileRecorder);
            var statsPrintableList = GetStatsPrintableList();

            myFileLogger.Log(statsPrintableList);
        }
        private void PrintEndGameState()
        {
            var winner        = GoalsBlueLeft == 0 ? TeamColour.blue : TeamColour.red;
            var opponent      = GoalsBlueLeft == 0 ? TeamColour.red : TeamColour.blue;
            var opponentScore = winner == TeamColour.blue ? GoalsRedLeft : GoalsBlueLeft;

            ConsoleWriter.Show("\n\n\n************************\n THE WINNERS IS: " + winner + "\n THE NOOBS ARE: " + opponent + "\n WITH GOALS LEFT: " + opponentScore + "\n \n \n END OF GAME: " + GetGameDefinition.GameName + " \n \n*****************");
            Logger.Logger logger = new Logger.Logger(this);
            logger.Log(GameMasterState.GameResolved);
        }
Esempio n. 16
0
 public void StartServer()
 {
     try {
         this.ServerSocket.Bind(new System.Net.IPEndPoint(System.Net.IPAddress.Any, Port));
         this.ServerSocket.Listen(1);
         logger.Log(">>>Server started at IP: " + IPAddress.ToString() + "   Port: " + Port + " <<<");
         this.ServerSocket.BeginAccept(new AsyncCallback(AcceptCallback), null);
         logger.Log(">>>Server is listening for incoming connections<<<");
     }
     catch (SocketException se) {
         throw se;
     }
     catch (Exception ex) {
         throw ex;
     }
 }
Esempio n. 17
0
        public string sEncrypt(string sPlainText, string sKey)
        {
            string sFunctionName    = "sEncrypt(,)";
            string sEncryptedString = "";

            try
            {
                sEncryptedString = LicenseY.Encrypt(sPlainText, sKey);
            }
            catch (Exception ex)
            {
                #region Text Logging
                oLog.Log(
                    sClassName,
                    sFunctionName,
                    ex.Message);
                #endregion Text Logging
            }
            return(sEncryptedString);
        }
Esempio n. 18
0
        public async Task <IActionResult> Create(int?id, [Bind("Number,ArabicTheme,EnglishTheme")] Issue issue)
        {
            if (ModelState.IsValid)
            {
                if (id == null)
                {
                    return(ValidationProblem(detail: "Volume Id cannot be null"));
                }
                issue.Volume = await context.Volume.FindAsync(id);

                context.Add(issue);
                await context.SaveChangesAsync();

                var Volume = await context.Volume.FindAsync(id);

                logger.Log($"{HttpContext.User.Identity.Name} created Issue `{issue.Number}` in Volume {Volume.Number} ");

                return(RedirectToAction(nameof(Index), new { id = id }));
            }
            return(View(issue));
        }
        //public static void Main(string[] args)
        //{

        //    var obj = new WBSSLStore.Scheduler.OrderUpdation.OrderUpdation(new Data.Infrastructure.DatabaseFactory());
        //    obj.FetchApiOrders();
        //    //obj.FetAPIOrderBySite();

        //}
        public void FetAPIOrderBySite()
        {
            try
            {
                if (Convert.ToBoolean(System.Configuration.ConfigurationManager.AppSettings["isUpdateCustomSite"]))
                {
                    string siteids  = System.Configuration.ConfigurationManager.AppSettings["CustomSiteid"].ToString();
                    var    _cussite = siteids.Split(new char[] { ',' }).ToArray();
                    var    Sites    = (from s in DbContext.Sites
                                       where s.isActive == true && _cussite.Contains(s.ID.ToString())
                                       select s).ToList();
                    foreach (Site s in Sites)
                    {
                        try
                        {
                            logger.Log("-----Start Custom Site Order Updating For :" + s.Alias + "-----", Logger.LogType.STATUSUPDATE);


                            FetchOrderThruRESTAPI(s);


                            logger.Log("-----End Custom Site Order Updating For :" + s.Alias + "-----", Logger.LogType.STATUSUPDATE);
                        }
                        catch (Exception ex)
                        {
                            logger.LogException(ex);
                        }
                    }
                }
            }
            catch (Exception ex)
            { }
        }
        public int GetIntInput(int minVal, int maxVal)
        {
wrongKeyLabel:
            int key = 0;

            try
            {
                key = int.Parse(Console.ReadLine());
                if (key < minVal || key > maxVal)
                {
                    ConsoleLogger.Log("Wrong input, please retype using a valid integer number value needs to be in the range [" + minVal + "," + maxVal + "]");
                    goto wrongKeyLabel;
                }
            }
            catch (Exception)
            {
                ConsoleLogger.Log("Wrong input, please retype using a valid integer number!");
                goto wrongKeyLabel;
            }

            return(key);
        }
Esempio n. 21
0
        /// <summary>
        /// Add to App.config file following lines in appSettings with tags add:
        ///     key = "smtpClient" value="[string]",
        ///     key = "defaultCredentials" value="[true|false]",
        ///     key = "networkCredential" value="[string]",
        ///     key = "password" value="[string]",
        ///     key = "enableSsl" value="[true|false]",
        ///     key = "port" value="[int]"
        ///     key = "dir" value="[path to folder for loggs]"
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool Send(MailModel model)
        {
            Logger.Logger logger = new Logger.Logger();
            logger.Log($"attempt to send an e - mail to {model.MailTo}");

            try
            {
                var message = new MailMessage();
                message.From = new MailAddress(model.MailFrom, model.MailFrom);
                model.MailTo.ForEach(m => message.To.Add(new MailAddress(m)));
                message.Subject = model.Title;
                message.Body    = model.Body;


                try
                {
                    var smtp = new SmtpClient(ConfigurationManager.AppSettings["smtpClient"]);
                    smtp.UseDefaultCredentials = Convert.ToBoolean(ConfigurationManager.AppSettings["defaultCredentials"]);
                    smtp.Credentials           = new NetworkCredential(ConfigurationManager.AppSettings["networkCredential"], ConfigurationManager.AppSettings["networkCredential"]);
                    smtp.EnableSsl             = Convert.ToBoolean(ConfigurationManager.AppSettings["enableSsl"]);
                    smtp.Port = Convert.ToInt32(ConfigurationManager.AppSettings["port"]);

                    smtp.Send(message);
                }
                catch (Exception e)
                {
                    throw new MailServiceException($"Something went wrong.{Environment.NewLine}Can't send e-mail.{Environment.NewLine}Try check if you have an internet connection, or check if you have set the proper values to app.config file");
                }

                logger.Log("Mail sent successfully");
                return(true);
            }
            catch (Exception)
            {
                logger.Log($"unsuccessful sending an e-mail");
                return(false);
            }
        }
Esempio n. 22
0
        public async Task <IActionResult> Create([FromRoute] int?id, string NewWriter, IFormFile Picture, [Bind("Language,Category,Writer,Title,Subtitle,Text")] Article article)
        {
            ModelState.Remove("Category.Name");
            ModelState.Remove("Writer.Name");

            if (ModelState.IsValid)
            {
                if (id == null)
                {
                    return(ValidationProblem(detail: "Issue Id cannot be null"));
                }

                article.Issue = await context.Issue.FindAsync(id);

                article.DateTime = DateTime.Now;

                // Assign value to the MemberID that refers to the writer of the article
                article.Category = context.Category
                                   .First(c => c.Name == article.Category.Name);

                articleService.SetArticleWriter(article,
                                                (article.Writer.Name == "+ NEW WRITER") ? NewWriter : article.Writer.Name);

                if (Picture != null)
                {
                    await articleService.AddArticlePicture(article, Picture, env.WebRootPath);
                }

                context.Add(article);
                await context.SaveChangesAsync();

                logger.Log($"{HttpContext.User.Identity.Name} created article of title `{article.Title}` and ID `{article.Id}`");

                return(RedirectToAction(nameof(Index), new { id = id }));
            }

            return(View(article));
        }
Esempio n. 23
0
 /**
  * Private constructor
  */
 private StretchApp()
 {
     reader_ = new FileReader()
     {
         extensionFilter = EXTENSIONS_FILTER
     };
     parser_   = new TraParser();
     notifier_ = new Notifier();
     logger_   = new Logger.Logger();
     solver_   = new Solving.Solver();
     //Allow debug
     logger_.IsDebug = true;
     logger_.Log("APP Started");
 }
Esempio n. 24
0
 public void Run()
 {
     if (IsStarted)
     {
         return;
     }
     listen    = true;
     IsStarted = true;
     logger.Log("Server started " + DateTime.Now.ToString("dd.MM.yy HH:mm:ss") + " IP = " + settings.ServerIP + ":" + settings.ServerPort.ToString(), Logger.EntryLevel.Server);
     if (commands == null)
     {
         logger.Log("Commands slot is void", Logger.EntryLevel.Server);
     }
     try
     {
         listener = new TcpListener(IPAddress.Parse(settings.ServerIP), settings.ServerPort);
         listener.Start();
         while (listen)
         {
             TcpClient client = null;
             try
             {
                 client = listener.AcceptTcpClient();
                 ClientObject clientObject = new ClientObject(client, commands);
                 Thread       clientThread = new Thread(new ThreadStart(() => { clientObject.Process(logger, settings.MlsOfDelay); }));
                 clientThread.Start();
             } catch (SocketException) { }
         }
     }
     finally
     {
         if (listener != null)
         {
             listener.Stop();
         }
     }
 }
Esempio n. 25
0
        public bool setLicenses()
        {
            string sFunctionName = "setLicenses()";
            bool   LicensesSet   = false;

            try
            {
                GenerateKey();
                GenerateLicense();
                GetHash();
                LicensesSet = true;
            }
            catch (Exception ex)
            {
                #region Text Logging
                oLog.Log(
                    sClassName,
                    sFunctionName,
                    ex.ToString());
                #endregion Text Logging
                LicensesSet = false;
            }
            return(LicensesSet);
        }
Esempio n. 26
0
        public void Logger_AfterFirstLog_CreatesLogFile()
        {
            var fileName       = "logTest";
            var fileExtensions = ".txt";

            _loggingOptions.Value.FileName = fileName + fileExtensions;

            var logger = new Logger.Logger(_loggingOptions);

            logger.Log("test message", LogLevel.Fatal);

            var finalName = $"{fileName}{DateTime.Now:yyyyMMdd}{fileExtensions}";
            var exists    = File.Exists(finalName);

            Assert.True(exists);
            //should delete
        }
Esempio n. 27
0
        private void ConfigureServices(IServiceCollection services)
        {
            var discordClient = new DiscordShardedClient(new DiscordSocketConfig
            {
                LogLevel         = LogSeverity.Verbose,
                MessageCacheSize = 0
            });

            var logger = new Logger.Logger();

            services
            .AddSingleton(discordClient)
            .AddSingleton(new CommandService(new CommandServiceConfig
            {
                LogLevel       = LogSeverity.Verbose,
                DefaultRunMode = RunMode.Async,
            }))
            .AddSingleton <CommandHandler>()
            .AddSingleton <StartupService>()
            .AddSingleton <TimerService>()
            .AddSingleton <IUserIndexQueue, UserIndexQueue>()
            .AddSingleton <IPrefixService, PrefixService>()
            .AddSingleton <IndexService>()
            .AddSingleton(logger)
            .AddSingleton <Random>()          // Add random to the collection
            .AddSingleton(this.Configuration) // Add the configuration to the collection
            .AddHttpClient();

            services
            .AddTransient <ILastfmApi, LastfmApi>();

            using (var context = new FMBotDbContext())
            {
                try
                {
                    logger.Log("Ensuring database is up to date");
                    context.Database.Migrate();
                }
                catch (Exception e)
                {
                    logger.LogError("Migrations", $"Something went wrong while creating/updating the database! \n{e.Message}");
                    throw;
                }
            }
        }
        public static string GetMBUrl(MBOrderData objRequest)
        {
            string strParam    = PrepareMBRequest(objRequest);
            string strResponse = PostDataOnMB(strParam);

            if (!strResponse.StartsWith("Error HTML :"))
            {
                return(strMoneyBookersURL + "?sid=" + strResponse);
            }
            else
            {
                //log error

                Logger.Logger log = new Logger.Logger();
                log.Log(strResponse, Logger.LogType.ERROR);
                return(string.Empty);
            }
        }
        public void EndRead(IAsyncResult result)
        {
            var buffer = (byte[])result.AsyncState;

            if (clientSocket.Connected)
            {
                try
                {
                    var ns             = clientSocket.GetStream();
                    var bytesAvailable = ns.EndRead(result);
                    var messages       = Encoding.ASCII.GetString(buffer).Split((char)23);

                    if (messages != null)
                    {
                        foreach (var message in messages.Select(q => q.Trim('\0')))
                        {
                            logger.Log(message);
                            ConsoleWriter.Show("GameMaster read: \n" + message + "\n");
                            var msgObject = GMReader.GetObjectFromXML(message);
                            if (msgObject != null)
                            {
                                messageManager.ProcessMessage(msgObject);
                            }
                            else
                            {
                                ConsoleWriter.Warning("Could not obtain object from message: \n" + message);
                            }
                        }
                    }
                    BeginRead();
                }
                catch (Exception e)
                {
                    ConsoleWriter.Error("Error while handling message from communication server." + "\n Error message: \n" + e.ToString() + "\n");
                    GameMaster.State = GameMasterState.GameOver;
                }
            }
            else
            {
                ConsoleWriter.Warning("Communication server connection lost\n");
                GameMaster.State = GameMasterState.GameOver;
            }
        }
Esempio n. 30
0
 /// <summary>
 /// Updates the server count and shard count for https://discordbots.org.
 /// </summary>
 private async Task UpdateDiscordBotsDotOrg(ulong botId, int shardCount, IReadOnlyList <int> guildCounts, IEnumerable <int> shardIds)
 {
     foreach (var shardId in shardIds)
     {
         var request = new RestRequest($"bots/{botId}/stats")
         {
             RequestFormat = DataFormat.Json,
             Method        = Method.POST
         };
         request.AddOrUpdateParameter("shard_count", shardCount);
         request.AddOrUpdateParameter("server_count", guildCounts[shardId]);
         request.AddOrUpdateParameter("shard_id", shardId);
         var result = await RestClients["DiscordBotsDotOrg"].ExecutePostTaskAsync(request).ConfigureAwait(false);
         if (result.IsSuccessful)
         {
             return;
         }
         _logger.Log($"Failed to update dblOrg stats reason: {result.ErrorMessage}", ConsoleColor.Red);
     }
 }