Exemple #1
0
        private void ListIgnoreStats()
        {
            var data = new ResultRows();

            using (var query = new MySqlCommand("SELECT user_id FROM user_ignore_stats", DbConnection.GetConnection()))
            {
                using (var reader = query.ExecuteReader())
                    data = reader.ReadAll();
            }

            var lines = data.Select(_ =>
            {
                var userId   = _[0] as string;
                var userInfo = _resolveHelper.GetUserById(userId);
                return(userInfo != null ? userInfo.ToString() : $"'{userId}': <unknown>");
            });

            if (!lines.Any())
            {
                SendMessage("No user stats ignored");
                return;
            }

            SendMessage(string.Join(", ", lines));
        }
Exemple #2
0
        public static ResultRows ReadAll(this MySqlDataReader reader)
        {
            var res = new ResultRows();

            while (reader.Read())
            {
                var values = new object[reader.FieldCount];
                reader.GetValues(values);
                res.Add(values);
            }

            return(res);
        }
Exemple #3
0
        protected override bool Execute(CodeActivityContext context)
        {
            DataTable TempTable = null;

            try
            {
                var serverData = ARM_Service.REP_Query_Report(Sql.Get(context), new List <QueryParameter>());

                if (!string.IsNullOrEmpty(serverData.Value))
                {
                    Error.Set(context, serverData.Value);
                }
                else
                {
                    TempTable = serverData.Key;
                }
            }

            catch (Exception ex)
            {
                Error.Set(context, ex.Message);
                if (!HideException.Get(context))
                {
                    throw ex;
                }
            }


            List <DataRow> L = new List <DataRow>();

            if (TempTable != null)
            {
                foreach (DataRow row in TempTable.Rows)
                {
                    L.Add(row);
                }
            }

            ResultRows.Set(context, L);

            return(string.IsNullOrEmpty(Error.Get(context)));
        }
Exemple #4
0
        static ApiPool()
        {
            ResultRows rows = null;

            using (var command = new MySqlCommand("SELECT client_id, access_token FROM api_pool",
                                                  DbConnection.GetConnection()))
            {
                using (var reader = command.ExecuteReader())
                    rows = reader.ReadAll();
            }

            foreach (var row in rows)
            {
                _apiPool.Add(new TwitchAPI()
                {
                    Settings = { ClientId = row[0] as string, AccessToken = row[1] as string }
                });
            }

            ApiEnumerator = ApiEnumerable.GetEnumerator();
        }