private void plComboBox_SelectedIndexChanged(object sender, EventArgs e) { string selectedName = (string)this.plComboBox.SelectedItem; var pl = ProgrammingLanguageRegistry.GetOrNull(selectedName); if (pl != null) { this.setting.ProgrammingLanguage = pl; } }
static void Main() { foreach (var jsonFile in FileSystem.EnumerateFiles(References.ProgrammingLanguagesFolderName, "*.json")) { var json = FileSystem.ReadFileToEnd(jsonFile); var language = ProgrammingLanguageLoader.LoadFromJson(json); try { ProgrammingLanguageRegistry.Register(language); } catch (ArgumentException) { MessageBox.Show($"言語処理系「{language.Name}」の定義が重複しています。\r\n\r\nError at \"{jsonFile}\"", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } Setting.ProgrammingLanguage = ProgrammingLanguageRegistry.GetOrNull(Settings.Default.ProgrammingLanguage); if (Setting.ProgrammingLanguage == null) { MessageBox.Show($"言語処理系「{Settings.Default.ProgrammingLanguage}」の設定ファイルが見つかりません", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }