Hardly.Library.Twitch.SqlTwitchCommand.GetAll C# (CSharp) Method

GetAll() public static method

public static GetAll ( TwitchConnection connection ) : TwitchCommand[]
connection TwitchConnection
return TwitchCommand[]
        public static TwitchCommand[] GetAll(TwitchConnection connection)
        {
            List<object[]> results = _table.Select(null, null, "ChannelUserId=?a AND BotUserId=?b",
                new object[] { connection.channel.user.id, connection.bot.user.id }, null, 0);
            if(results != null) {
                TwitchCommand[] commands = new TwitchCommand[results.Count];
                for(int i = 0; i < results.Count; i++) {
                    commands[i] = new SqlTwitchCommand(
                        results[i][0].FromSql<uint>(),
                        connection,
                        results[i][3].FromSql<string>(),
                        results[i][4].FromSql<string>(),
                        results[i][5].FromSql<bool>(),
                        TimeSpan.FromSeconds(results[i][6].FromSql<int>()),
                        results[i][7].FromSql<string>());
                }

                return commands;
            } else {
                return null;
            }
        }

Usage Example

コード例 #1
0
 public TwitchCommand[] GetAllCommands(TwitchConnection twitchConnection)
 {
     return(SqlTwitchCommand.GetAll(twitchConnection));
 }