Example #1
0
        internal static void Export()
        {
            BotSettings botSettings = new BotSettings
            {
                Username              = _settings.Username,
                OAuth                 = _settings.OAuth,
                Channel               = _settings.Channel,
                ClientID              = _settings.ClientID,
                ChannelAccessToken    = _settings.ChannelAccessToken,
                LinkModEnabled        = _settings.LinkModEnabled,
                PurgeEnabled          = _settings.PurgeEnabled,
                SongEnabled           = _settings.SongEnabled,
                SongFile              = _settings.SongFile,
                FollowGreetingEnabled = _settings.FollowGreetingEnabled,
                SubGreetingEnabled    = _settings.SubGreetingEnabled,
                FollowGreeting        = _settings.FollowGreeting,
                SubGreeting           = _settings.SubGreeting,
                HostAutoThank         = _settings.HostAutoThank,
                SubsCanLink           = _settings.SubsCanLink,
                RegularsCanLink       = _settings.RegularsCanLink,
                QuotesEnabled         = _settings.QuotesEnabled
            };

            UISettings uiSettings = new UISettings
            {
                SelectedAccentColor      = _uiSettings.SelectedAccentColor,
                SelectedThemeSource      = _uiSettings.SelectedThemeSource,
                SelectedThemeDisplayName = _uiSettings.SelectedThemeDisplayName,
                SelectedFontSize         = _uiSettings.SelectedFontSize
            };

            Task.Factory.StartNew(async() => await JsonFileService.SaveToFileAsync(botSettings, @".\Settings\botSettings.json"));
            //Task.Factory.StartNew(async () => await JsonFileService.SaveToFileAsync(uiSettings, @".\Settings\uiSettings.json"));
        }
Example #2
0
        internal async static Task Import()
        {
            BotSettings botSettings = await JsonFileService.LoadFromFileAsync <BotSettings>(@".\Settings\botSettings.json");

            //UISettings uiSettings = await JsonFileService.LoadFromFileAsync<UISettings>(@".\Settings\uiSettings.json");

            //_uiSettings.SelectedAccentColor = uiSettings.SelectedAccentColor;
            //_uiSettings.SelectedThemeSource = uiSettings.SelectedThemeSource;
            //_uiSettings.SelectedThemeDisplayName = uiSettings.SelectedThemeDisplayName;
            //_uiSettings.SelectedFontSize = uiSettings.SelectedFontSize;
            //_uiSettings.Save();
            //_uiSettings.Reload();

            _settings.Username              = botSettings.Username;
            _settings.OAuth                 = botSettings.OAuth;
            _settings.ChannelAccessToken    = botSettings.ChannelAccessToken;
            _settings.Channel               = botSettings.Channel;
            _settings.ClientID              = botSettings.ClientID;
            _settings.LinkModEnabled        = botSettings.LinkModEnabled;
            _settings.PurgeEnabled          = botSettings.PurgeEnabled;
            _settings.SongEnabled           = botSettings.SongEnabled;
            _settings.SongFile              = botSettings.SongFile;
            _settings.FollowGreetingEnabled = botSettings.FollowGreetingEnabled;
            _settings.SubGreetingEnabled    = botSettings.SubGreetingEnabled;
            _settings.FollowGreeting        = botSettings.FollowGreeting;
            _settings.SubGreeting           = botSettings.SubGreeting;
            _settings.HostAutoThank         = botSettings.HostAutoThank;
            _settings.SubsCanLink           = botSettings.SubsCanLink;
            _settings.RegularsCanLink       = botSettings.RegularsCanLink;
            _settings.QuotesEnabled         = botSettings.QuotesEnabled;
            _settings.Save();
            _settings.Reload();

            _username              = _settings.Username;
            _oauth                 = _settings.OAuth;
            _channelAccessToken    = _settings.ChannelAccessToken;
            _channel               = _settings.Channel;
            _linkModEnabled        = _settings.LinkModEnabled;
            _purgeEnabled          = _settings.PurgeEnabled;
            _songEnabled           = _settings.SongEnabled;
            _songFile              = _settings.SongFile;
            _followGreetingEnabled = _settings.FollowGreetingEnabled;
            _subGreetingEnabled    = _settings.SubGreetingEnabled;
            _followGreeting        = _settings.FollowGreeting;
            _subGreeting           = _settings.SubGreeting;
            _hostAutoThank         = _settings.HostAutoThank;
            _subsCanLink           = _settings.SubsCanLink;
            _regularsCanLink       = _settings.RegularsCanLink;
            _quotesEnabled         = _settings.QuotesEnabled;
        }