Esempio n. 1
0
        public static bool ConfigWrite()
        {
            bool    status = false;
            IniData data   = null;

            data["Profile"]["UserName"] = Instance.ConfUserName;
            data["Profile"]["Website"]  = Instance.ConfWebsite;

            data["Configuration"]["Language"] = Instance.ConfLanguage;

            data["Configuration"]["DiscordUser"] = Instance.ConfDiscordSDK.ToString();
            data["Configuration"]["DiscordBot"]  = Instance.ConfDiscordBot.ToString();
            data["Configuration"]["TwitchUser"]  = Instance.ConfTwitchSDK.ToString();
            data["Configuration"]["TwitchBot"]   = Instance.ConfTwitchBot.ToString();

            data["Configuration"]["ComputerRank"] = Instance.ConfComputerRank.ToString();

            data["Configuration"]["UserBlackListString"] = HEVText.ToString(Instance.UserBlackList.ToArray()).ToString();
            data["Configuration"]["BotBlackListString"]  = HEVText.ToString(Instance.BotBlackList.ToArray()).ToString();

            data["Configuration"]["RPGGame"] = Instance.ConfRPGGame.ToString();


            status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            return(status);
        }
Esempio n. 2
0
        public static bool ConfigRead()
        {
            bool    status = false;
            IniData data   = null;

            (data, status) = HEVIO.FileINIRead(Instance.FileConfig);
            if (!status)
            {
                if (!ConfigWrite())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }


            if (!data.DataINIReadWrite("Twitch", "Guild", ref Instance.TwitchGuild))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "Channel", ref Instance.TwitchChannel))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "UserName", ref Instance.TwitchUserName))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "BotName", ref Instance.TwitchBotName))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "BotToken", ref Instance.TwitchBotToken))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "UserBlackList", ref Instance.TwitchUserBlackList))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Twitch", "BotBlackList", ref Instance.TwitchBotBlackList))
            {
                status = false;
            }

            if (!status)
            {
                status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            }
            return(status);
        }
Esempio n. 3
0
        public static bool ConfigWrite()
        {
            bool    status = false;
            IniData data   = null;

            data["Discord"]["Guild"]    = Instance.DiscordGuild;
            data["Discord"]["Channel"]  = Instance.DiscordChannel;
            data["Discord"]["UserName"] = Instance.DiscordUserName;

            status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            return(status);
        }
Esempio n. 4
0
        public static bool ConfigWrite()
        {
            bool    status = false;
            IniData data   = null;

            data["Discord"]["Guild"]         = Instance.DiscordGuild;
            data["Discord"]["Channel"]       = Instance.DiscordChannel;
            data["Discord"]["UserName"]      = Instance.DiscordUserName;
            data["Discord"]["BotName"]       = Instance.DiscordBotName;
            data["Discord"]["BotToken"]      = Instance.DiscordBotToken;
            data["Discord"]["UserBlackList"] = HEVText.ToString(Instance.DiscordUserBlackList);
            data["Discord"]["BotBlackList"]  = HEVText.ToString(Instance.DiscordBotBlackList);

            status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            return(status);
        }
Esempio n. 5
0
        public static bool SetupConfig()
        {
            bool status = false;

            // Get defaults texts
            if (!HEVIO.ResourcesTextReadString(Instance.DefaultFileConfigURL, out Instance.DefaultFileConfigText))
            {
                return(false);
            }
            // Create new files if missing
            if (!HEVIO.FileValidate(Instance.FileConfig))
            {
                if (!HEVIO.FileTextWriteString(Instance.FileConfig, Instance.DefaultFileConfigText))
                {
                    HEVConsole.Print("Cannot write a new file for Config.", EPrintType.eError);
                    return(false);
                }
            }
            status = true;
            return(status);
        }
Esempio n. 6
0
        public static bool ConfigRead()
        {
            bool    status = false;
            IniData data   = null;

            (data, status) = HEVIO.FileINIRead(Instance.FileConfig);
            if (!status)
            {
                if (!ConfigWrite())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            if (!data.DataINIReadWrite("Discord", "Guild", ref Instance.DiscordGuild))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Discord", "Channel", ref Instance.DiscordChannel))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Discord", "UserName", ref Instance.DiscordUserName))
            {
                status = false;
            }


            if (!status)
            {
                status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            }
            return(status);
        }
Esempio n. 7
0
        public static bool ConfigRead()
        {
            bool    status = false;
            IniData data   = null;

            if (!SetupConfig())
            {
                return(false);
            }
            (data, status) = HEVIO.FileINIRead(Instance.FileConfig);
            if (!status)
            {
                if (!ConfigWrite())
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }

            HEVConsole.Print("1");


            if (!data.DataINIReadWrite("Profile", "UserName", ref Instance.ConfUserName))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Profile", "Website", ref Instance.ConfWebsite))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "Language", ref Instance.ConfLanguage))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "DiscordUser", ref Instance.ConfDiscordSDK))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "DiscordBot", ref Instance.ConfDiscordBot))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "TwitchUser", ref Instance.ConfTwitchSDK))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "TwitchBot", ref Instance.ConfTwitchBot))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "ComputerRank", ref Instance.ConfComputerRank))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "UserBlackListString", ref Instance.UserBlackList))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "BotBlackListString", ref Instance.BotBlackList))
            {
                status = false;
            }
            if (!data.DataINIReadWrite("Configuration", "RPGGame", ref Instance.ConfRPGGame))
            {
                status = false;
            }

            if (!status)
            {
                status = HEVIO.FileINIWrite(Instance.FileConfig, data);
            }

            // Get the settings of every system
            if (!DiscordSDK.ConfigRead())
            {
                return(false);
            }
            if (!DiscordBot.ConfigRead())
            {
                return(false);
            }
            if (!TwitchSDK.ConfigRead())
            {
                return(false);
            }
            if (!TwitchBot.ConfigRead())
            {
                return(false);
            }
            return(status);
        }