Ejemplo n.º 1
0
 public Full(bool includestatus)
 {
     if (includestatus)
     {
         Status = new FullStatus();
     }
 }
Ejemplo n.º 2
0
        private FullStatus GenerateNewStatus(ulong Id, DateTimeOffset online = new DateTimeOffset(), DateTimeOffset offline = new DateTimeOffset())
        {
            var tempStats = new UptimeStats();

            var temp = new FullStatus()
            {
                BotId = Id, JsonStats = tempStats
            };

            return(temp);
        }
 protected void ImportJobOnProcessProgress(FullStatus status)
 {
     this.context.PublishProcessProgress(
         status.ProcessID,
         status.StartTime,
         status.EndTime,
         status.TotalRecords,
         status.TotalRecordsProcessed,
         status.TotalRecordsProcessedWithWarnings,
         status.TotalRecordsProcessedWithErrors,
         status.MetadataThroughput,
         status.FilesThroughput,
         status.StatusSuffixEntries);
 }
Ejemplo n.º 4
0
        private async Task <FullStatus> GetStats(ulong Id)
        {
            FullStatus temp = null;

            try
            {
                using (MySqlConnection db = new MySqlConnection(config.UptimeDB))
                {
                    await db.OpenAsync();

                    using (var cmd = new MySqlCommand($"SELECT * FROM `status_{DateTimeOffset.Now.StartOfWeek(DayOfWeek.Sunday).ToString("yyyy-MM-dd")}` WHERE botid = @1;", db))
                    {
                        cmd.Parameters.AddWithValue("@1", Id);

                        using (var reader = await cmd.ExecuteReaderAsync())
                        {
                            while (await reader.ReadAsync())
                            {
                                temp = new FullStatus {
                                    BotId = (ulong)reader["botid"], JsonStats = new UptimeStats((string)reader["stats"]), LastUpdated = new DateTimeOffset(((DateTime)reader["lastupdated"]).Ticks, Offset)
                                };
                            }

                            reader.Close();
                        }

                        cmd.Dispose();
                    }

                    await db.CloseAsync();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}\n{ex.StackTrace}");
            }

            return(temp);
        }