This commit is contained in:
Chenx221 2023-10-05 20:04:03 +08:00
parent 859b2839a4
commit aebdc68bce
3 changed files with 34 additions and 0 deletions

View File

@ -342,6 +342,7 @@
button6.TabIndex = 6;
button6.Text = "打开文件";
button6.UseVisualStyleBackColor = true;
button6.Click += button6_Click;
//
// button5
//

View File

@ -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);
}
}
}
}

View File

@ -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());