}                                  //Dateipfad

        public Options(ConfigJson c, string origin, string commitspeicher)
        {
            Commitspeicherort = commitspeicher;
            Username          = c.Username;
            ClientId          = c.ClientId;
            ClientSecret      = c.ClientSecret;
            Playlist          = c.Playlist;
            Origin            = origin;
        }
示例#2
0
        public Steuerung(GUI pGUI)
        {
            dieGUI                  = pGUI;
            dieDaten                = new Daten();
            derListener             = new Listener();
            dieOptions              = new OptionsUI();
            derListener.OnFullHour += DerListener_OnFullHour;

            string commitspeicher = dieDaten.Speicherort;

            ConfigJson json = ConfigJson.DeserializeFile(configFilepath);

            _opt = new Options(json, configFilepath, commitspeicher);
        }
        private void changeCommitDir()
        {
            DialogResult d = fileDialog_commitspeicher.ShowDialog();

            if (d == DialogResult.OK)
            {
                string filepath       = tB_configfile.Text;
                string commitspeicher = fileDialog_commitspeicher.SelectedPath;
                bool   dirIsValid     = System.IO.Directory.Exists(commitspeicher);

                if (dirIsValid)
                {
                    ConfigJson attempt = ConfigJson.DeserializeFile(filepath);
                    Options    o       = new Options(attempt, filepath, commitspeicher);
                    LoadOptions(o);
                    b_save.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Fehlerhaftes Verzeichnis ausgewählt.");
                }
            }
        }
        private void changeConfigFile()
        {
            DialogResult d = fileDialog_confjson.ShowDialog();

            if (d == DialogResult.OK)
            {
                try
                {
                    string     filepath       = fileDialog_confjson.FileName;
                    string     commitspeicher = tB_speicherort.Text;
                    ConfigJson attempt        = ConfigJson.DeserializeFile(filepath);
                    Options    o = new Options(attempt, filepath, commitspeicher);
                    LoadOptions(o);
                    b_save.Enabled = true;
                }
                catch
                {
                    MessageBox.Show("No valid .json selected. Please make sure your .json covers the following variables:\n" +
                                    "Username, ClientId, ClientSecret, Playlist");
                    b_save.Enabled = false;
                }
            }
        }