diff --git a/AsmrManage/AsmrManage/Form1.Designer.cs b/AsmrManage/AsmrManage/Form1.Designer.cs index 3b6ce94..5e4423c 100644 --- a/AsmrManage/AsmrManage/Form1.Designer.cs +++ b/AsmrManage/AsmrManage/Form1.Designer.cs @@ -342,6 +342,7 @@ button6.TabIndex = 6; button6.Text = "鎵撳紑鏂囦欢"; button6.UseVisualStyleBackColor = true; + button6.Click += button6_Click; // // button5 // diff --git a/AsmrManage/AsmrManage/Form1.cs b/AsmrManage/AsmrManage/Form1.cs index 62e60de..baf6195 100644 --- a/AsmrManage/AsmrManage/Form1.cs +++ b/AsmrManage/AsmrManage/Form1.cs @@ -270,5 +270,34 @@ namespace AsmrManage textBox5.Text = openFileDialog1.FileName; } } + + private void button6_Click(object sender, EventArgs e) + { + if(Program.config == null) { Program.config = ConfigManager.LoadConfig(); } + string db_path = Program.config.DatabaseFilePath; + string dbb_path = Program.config.DBBrowserPath; + //检查路径是否存在 + if (File.Exists(db_path) && File.Exists(dbb_path)) + { + ProcessStartInfo psi = new ProcessStartInfo + { + FileName = dbb_path, + Arguments = db_path + }; + + try + { + Process.Start(psi); + } + catch (Exception ex) + { + MessageBox.Show("发生错误:" + ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + else + { + MessageBox.Show("指定路径不存在。请检查路径是否正确。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } } } \ No newline at end of file diff --git a/AsmrManage/AsmrManage/Program.cs b/AsmrManage/AsmrManage/Program.cs index ff8bfac..6f9b923 100644 --- a/AsmrManage/AsmrManage/Program.cs +++ b/AsmrManage/AsmrManage/Program.cs @@ -11,6 +11,10 @@ namespace AsmrManage { // To customize application configuration such as set high DPI settings or default font, // see https://aka.ms/applicationconfiguration. + if (!File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json"))) + { + ConfigManager.SaveConfig(new AppConfig()); + } config = ConfigManager.LoadConfig(); //fetch configuration data ApplicationConfiguration.Initialize(); Application.Run(new Form1());