示例#1
0
        private void modinfo_config_FileSelectCueComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (CurrentMod == null)
            {
                return;
            }

            // Invalid selection, somehow
            if (modinfo_config_FileSelectCueComboBox.SelectedIndex <= -1)
            {
                return;
            }

            string filePath = modinfo_config_FileSelectCueComboBox.Text;

            using (var sr = new StreamReader(CurrentMod.GetPathFull(filePath)))
            {
                modinfo_ConfigFCTB.Text = sr.ReadToEnd();
            }

            // Check if this file has values saved, and enable/disable load button
            bool exists = CurrentMod.GetSetting(filePath) != null;

            modinfo_config_LoadButton.Enabled    = exists;
            modinfo_config_RemoveButton.Enabled  = exists;
            modinfo_config_CompareButton.Enabled = exists;
        }
        private void modinfo_config_FileSelectCueComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (CurrentMod == null)
            {
                return;
            }

            // Invalid selection, somehow
            if (modinfo_config_FileSelectCueComboBox.SelectedIndex <= -1)
            {
                return;
            }

            string filePath = modinfo_config_FileSelectCueComboBox.Text;
            bool   exists   = false;

            try
            {
                using (var sr = new StreamReader(CurrentMod.GetPathFull(filePath)))
                {
                    modinfo_ConfigFCTB.Text = sr.ReadToEnd();
                }

                // Check if this file has values saved, and enable/disable load button
                exists = CurrentMod.GetSetting(filePath) != null;
                modinfo_ConfigFCTB.ReadOnly = false;
            }
            catch (Exception ex)
            {
                Log.Warn("Failed to read selected ini file", ex);
                modinfo_ConfigFCTB.Text     = ex.Message;
                modinfo_ConfigFCTB.ReadOnly = true;
            }

            modinfo_config_LoadButton.Enabled    = exists;
            modinfo_config_RemoveButton.Enabled  = exists;
            modinfo_config_CompareButton.Enabled = exists;
        }