Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcapp committed Feb 19, 2024
1 parent e0fbb20 commit db28f67
Show file tree
Hide file tree
Showing 16 changed files with 597 additions and 66 deletions.
101 changes: 81 additions & 20 deletions FrmAboutBox.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 28 additions & 1 deletion FrmAboutBox.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Metadata;

namespace KindleMate2 {
internal partial class FrmAboutBox : Form {
Expand Down Expand Up @@ -31,6 +32,13 @@ private static string AssemblyProduct {
}
}

private static string AssemblyTitle {
get {
var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
return attributes.Length == 0 ? "" : ((AssemblyTitleAttribute)attributes[0]).Title;
}
}

private static string AssemblyCopyright {
get {
var attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
Expand All @@ -45,7 +53,7 @@ private void LblPath_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
private void FrmAboutBox_Load(object sender, EventArgs e) {
Text = "关于 " + AssemblyProduct;

labelProductName.Text = AssemblyProduct;
//lblProductName.Text = AssemblyTitle;
lblVersion.Text = AssemblyVersion;
lblCopyright.Text = AssemblyCopyright;

Expand All @@ -56,5 +64,24 @@ private void FrmAboutBox_Load(object sender, EventArgs e) {
var fileSize = fileInfo.Length;
lblDatabase.Text = "KM2.dat (" + FormatFileSize(fileSize) + ")";
}

private void LblCleanDatabase_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
var programsDirectory = AppDomain.CurrentDomain.BaseDirectory;
lblPath.Text = programsDirectory;
var filePath = Path.Combine(programsDirectory, "KM2.dat");
var fileInfo = new FileInfo(filePath);
var originFileSize = fileInfo.Length;

var staticData = new StaticData();
staticData.VacuumDatabase();

var newFileSize = fileInfo.Length;

if (newFileSize < originFileSize) {
MessageBox.Show("数据库已清理 " + FormatFileSize(originFileSize - newFileSize), "清理数据库", MessageBoxButtons.OK, MessageBoxIcon.Information);
} else {
MessageBox.Show("数据库无需清理", "清理数据库", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
Loading

0 comments on commit db28f67

Please sign in to comment.