Exemplo n.º 1
0
        private void DeserializeSettings()
        {
            //Get the settings from a local location and deserialize.
            string fileContents = File.ReadAllText("PrivateSettings.json");

            PrivateSettings = JsonConvert.DeserializeObject <PrivateSettings>(fileContents);
        }
Exemplo n.º 2
0
 public static void DeserializeSettings()
 {
     using (var file = File.OpenText(@"C:\Users\rafae\source\repos\EvaluationBot\EvaluationBot\Serialization\PrivateSettings.json"))
     {
         PrivateSettings = JsonConvert.DeserializeObject <PrivateSettings>(file.ReadToEnd());
     }
 }
Exemplo n.º 3
0
        public TTSSettingsForm(MainForm mainFormReference, PrivateSettings settings)
        {
            this.VoiceSynthesizer  = settings.VoiceSynthesizer;
            this.RequiredRight     = settings.TTSRoleRequirement;
            this.CustomRewardID    = settings.TTSRewardID;
            this.TTSLogic          = settings.TTSLogic;
            this.SettingsReference = settings;
            this.mainFormReference = mainFormReference;
            InitializeComponent();
            this.AddComboboxDataSources();

            //Initialization stuff here!
            using (var synthesizer = new SpeechSynthesizer())
            {
                var voices = synthesizer.GetInstalledVoices();
                foreach (var voice in voices)
                {
                    CBox_VoiceSynthesizer.Items.Add(voice.VoiceInfo.Name);
                }
            }

            //bindings
            this.CBox_VoiceSynthesizer.DataBindings.Add("Text", this, "VoiceSynthesizer", false, DataSourceUpdateMode.OnPropertyChanged);
            this.TB_CustomRewardID.DataBindings.Add("Text", this, "CustomRewardID", false, DataSourceUpdateMode.OnPropertyChanged);
            this.CBox_RequiredRole.DataBindings.Add("SelectedValue", this, "RequiredRight", false, DataSourceUpdateMode.OnPropertyChanged);
            this.CBox_TTSLogic.DataBindings.Add("SelectedValue", this, "TTSLogic", false, DataSourceUpdateMode.OnPropertyChanged);
        }
Exemplo n.º 4
0
 protected Settings()
 {
     this.External = new PublicSettings();
     this.Internal = new PrivateSettings();
     this.ParseSettingsJson();
     this.ParseGeoJson();
 }
        public async Task <PrivateSettings> GetPrivateSettings()
        {
            var settings = await _globalConfigurationSettingsRepository.All();

            var privateSettings = new PrivateSettings(new Settings(settings));

            return(privateSettings);
        }
 public DB_Editor(MainForm mainFormReference, List <SoundEntry> Sounds, char PrefixCharacter, PrivateSettings ProgramSettings)
 {
     this.PrefixCharacter   = PrefixCharacter;
     this.Sounds            = Sounds;
     this.spreadsheetId     = ProgramSettings.GoogleSpreadsheetID;
     this.ProgramSettings   = ProgramSettings;
     this.mainFormReference = mainFormReference;
     InitializeComponent();
 }
Exemplo n.º 7
0
 public IRCBot(MainForm parentReference, PrivateSettings programSettings, SoundBase soundDb, char PrefixChar)
 {
     irc = new OldIRCClient(parentReference, programSettings.TwitchServer, programSettings.TwitchUsername, programSettings.TwitchPassword, programSettings.TwitchChannelToJoin, programSettings.SoundRewardID, programSettings.TTSRewardID);
     this.programSettings = programSettings;
     channelToJoin        = programSettings.TwitchChannelToJoin;
     parent          = parentReference;
     this.PrefixChar = PrefixChar;
     SndDB           = soundDb;
 }
        public string getPrivateSettings()
        {
            JSONWriter writer = new JSONWriter();

            writer.WriteStartObject();
            foreach (FieldInfo field in PrivateSettings.GetType().GetFields())
            {
                writer.WritePropertyName(field.Name);
                writer.WriteValue(field.GetValue(PrivateSettings));
            }
            writer.WriteEndObject();

            return(writer.GetString());
        }
Exemplo n.º 9
0
        private IStorageService GetProvider(StorageProviderService storageProvider, PrivateSettings settings)
        {
            switch (storageProvider)
            {
            case StorageProviderService.Azure:
                return(new AzureStorageService(settings.Storage));

            case StorageProviderService.S3:
                return(new AwsStorageService(settings.Storage));

            default:
                return(new LocalStorageService(settings.Storage));
            }
        }
Exemplo n.º 10
0
        public SoundPlaybackSettingsDialog(MainForm mainForm, PrivateSettings programSettings)
        {
            this.SoundRewardID     = programSettings.SoundRewardID;
            this.SoundLogic        = programSettings.SoundRedemptionLogic;
            this.SelectedDevice    = programSettings.OutputDevice;
            this.programSettings   = programSettings;
            this.mainFormReference = mainForm;
            InitializeComponent();

            //Initialization stuff and bindings
            this.AddComboboxDataSources();
            this.FillInOutputDevices();
            this.TB_SoundRewardID.DataBindings.Add("Text", this, "SoundRewardID", false, DataSourceUpdateMode.OnPropertyChanged);
            this.CBox_RedemptionLogic.DataBindings.Add("SelectedValue", this, "SoundLogic", false, DataSourceUpdateMode.OnPropertyChanged);
        }
        public ColorSettingsForm(PrivateSettings _programSettings)
        {
            InitializeComponent();

            FormBackground = _programSettings.Colors.FormBackground;
            FormTextColor  = _programSettings.Colors.FormTextColor;

            MenuStripBarBackground = _programSettings.Colors.MenuStripBarBackground;
            MenuStripBarText       = _programSettings.Colors.MenuStripBarText;

            MenuStripBackground         = _programSettings.Colors.MenuStripBackground;
            MenuStripText               = _programSettings.Colors.MenuStripText;
            MenuStripBackgroundSelected = _programSettings.Colors.MenuStripBackgroundSelected;

            LineColorBackground    = _programSettings.Colors.LineColorBackground;
            LineColorGeneric       = _programSettings.Colors.LineColorGeneric;
            LineColorIrcCommand    = _programSettings.Colors.LineColorIrcCommand;
            LineColorModeration    = _programSettings.Colors.LineColorModeration;
            LineColorSoundPlayback = _programSettings.Colors.LineColorSoundPlayback;

            CustomColorTable = new Extensions.OverridenColorTable();

            //Form Generic
            B_ColorFormBackground.DataBindings.Add("BackColor", this, "FormBackground");
            B_ColorFormText.DataBindings.Add("BackColor", this, "FormTextColor");

            //MenuStripBar
            B_ColorMenuBarBackground.DataBindings.Add("BackColor", this, "MenuStripBarBackground");
            B_ColorMenuBarText.DataBindings.Add("BackColor", this, "MenuStripBarText");

            //MenuStripElements
            B_ColorMenuStripBackground.DataBindings.Add("BackColor", this, "MenuStripBackground");
            B_ColorMenuStriptTextColor.DataBindings.Add("BackColor", this, "MenuStripText");
            B_ColorMenuStripSelectedBackground.DataBindings.Add("BackColor", this, "MenuStripBackgroundSelected");

            //Lines
            B_ColorLinesBackground.DataBindings.Add("BackColor", this, "LineColorBackground");
            B_ColorLinesGeneric.DataBindings.Add("BackColor", this, "LineColorGeneric");
            B_ColorLinesIrcCommand.DataBindings.Add("BackColor", this, "LineColorIrcCommand");
            B_ColorLinesModeration.DataBindings.Add("BackColor", this, "LineColorModeration");
            B_ColorLinesSoundPlayback.DataBindings.Add("BackColor", this, "LineColorSoundPlayback");

            //Overriding renderers
            UpdatePreviewColors();

            CB_Preset.SelectedIndex = 0;
        }
Exemplo n.º 12
0
        public ConnectionSettingsForm(MainForm _parent, PrivateSettings _settingsRef)
        {
            InitializeComponent();
            this._parent      = _parent;
            this._settingsRef = _settingsRef;

            this.TB_Server.DataBindings.Add("Text", this, "Server", false, DataSourceUpdateMode.OnPropertyChanged);
            this.TB_Username.DataBindings.Add("Text", this, "Username", false, DataSourceUpdateMode.OnPropertyChanged);
            this.TB_Password.DataBindings.Add("Text", this, "Password", false, DataSourceUpdateMode.OnPropertyChanged);
            this.TB_ChannelToJoin.DataBindings.Add("Text", this, "ChannelToJoin", false, DataSourceUpdateMode.OnPropertyChanged);
            this.TB_GoogleSpreadsheetID.DataBindings.Add("Text", this, "SpreadsheetID", false, DataSourceUpdateMode.OnPropertyChanged);

            this.Server        = _settingsRef.TwitchServer;
            this.Username      = _settingsRef.TwitchUsername;
            this.Password      = _settingsRef.TwitchPassword;
            this.ChannelToJoin = _settingsRef.TwitchChannelToJoin;
            this.SpreadsheetID = _settingsRef.GoogleSpreadsheetID;
        }
        public object getPrivateSetting(string settingname)
        {
            FieldInfo field = PrivateSettings.GetType().GetField(settingname);

            return(field.GetValue(PrivateSettings));
        }
Exemplo n.º 14
0
 public UserRepository(ApplicationDbContext context, IOptions <PrivateSettings> settings)
 {
     Init(context);
     _context  = context;
     _settings = settings.Value;
 }
Exemplo n.º 15
0
 public UserRepository(ApplicationDbContext context, IOptions <PrivateSettings> settings)
 {
     this.context  = context;
     this.settings = settings.Value;
 }