public void BuildDatabase()
        {
            Debug.Log(IntelliTwitchStringParser.BuildDebugMessage("Manager", "Creating new database..."));
            var dataServ = new IntelliTwitchDataService("HouseOfDungeons.db");

            dataServ.CreateDB();
        }
        private IntelliTwitchUser CreateNewUser(string[] userInfo, int userID)
        {
            var user = new IntelliTwitchUser();

            //We already parsed out the user-id from the message, no need to relocate it. So we just pass it along.
            user.ID = userID;

            user.UserName      = IntelliTwitchStringParser.GetDisplayName(userInfo);
            user.UserNameColor = IntelliTwitchStringParser.GetUserNameColor(userInfo);
            user.IsSubscriber  = IntelliTwitchStringParser.GetSubscriberStatus(userInfo);
            user.IsTurbo       = IntelliTwitchStringParser.GetTurboStatus(userInfo);
            user.IsChannelMod  = IntelliTwitchStringParser.GetChannelModStatus(userInfo);
            user.UserTypeID    = FindUserType(IntelliTwitchStringParser.GetUserType(userInfo));

            user.joinDate = GetCurrentUtcTime();

            CreateUser(user);

            return(user);
        }
        /// <summary>
        /// Updates a user in the database.
        /// Compares the stored twitch user with the info recieved from twitch.
        /// Use GetUser() unless you want to handle this yourself.
        /// </summary>
        /// <param name="user"></param>
        /// <param name="userInfo"></param>
        /// <returns></returns>
        public IntelliTwitchUser UpdateUser(IntelliTwitchUser user, string[] userInfo)
        {
            //Compare old user values, with new userInfo
            //Update if they are different
            var update = false;

            //TODO: Check if twitch user names can change easily, might be unneccessary
            if (user.UserName != IntelliTwitchStringParser.GetDisplayName(userInfo))
            {
                user.UserName = IntelliTwitchStringParser.GetDisplayName(userInfo);
                update        = true;
            }
            if (user.UserNameColor != IntelliTwitchStringParser.GetUserNameColor(userInfo))
            {
                user.UserNameColor = IntelliTwitchStringParser.GetUserNameColor(userInfo);
                update             = true;
            }
            if (user.IsSubscriber != IntelliTwitchStringParser.GetSubscriberStatus(userInfo))
            {
                user.IsSubscriber = IntelliTwitchStringParser.GetSubscriberStatus(userInfo);
                update            = true;
            }
            if (user.IsTurbo != IntelliTwitchStringParser.GetTurboStatus(userInfo))
            {
                user.IsTurbo = IntelliTwitchStringParser.GetTurboStatus(userInfo);
                update       = true;
            }
            if (user.IsChannelMod != IntelliTwitchStringParser.GetChannelModStatus(userInfo))
            {
                user.IsChannelMod = IntelliTwitchStringParser.GetChannelModStatus(userInfo);
                update            = true;
            }

            if (update)
            {
                _connection.Update(user);
            }

            return(user);
        }
 private void SendDebugMessage(string msg)
 {
     Debug.Log(IntelliTwitchStringParser.BuildDebugMessage("DataService", msg));
 }
 private void SendDebugMessage(string msg)
 {
     debugBuffer.Enqueue(IntelliTwitchStringParser.BuildDebugMessage("IRCClient", msg));
 }