Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcapp committed Nov 24, 2024
1 parent ac6bae6 commit d26f6ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions KindleMate2/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using KindleMate2.Entities;
using KindleMate2.Properties;
using Markdig;
using Markdig.Helpers;

namespace KindleMate2 {
public partial class FrmMain : Form {
Expand Down Expand Up @@ -840,6 +841,7 @@ .. File.ReadAllLines(clippingsPath)
var delimiterIndex = new List<int>();

for (var i = 0; i < lines.Count; i++) {
lines[i] = RemoveControlChar(lines[i]);
if (lines[i].StartsWith("===") && lines[i - 2].Trim().Equals("") && lines[i].EndsWith("===")) {
delimiterIndex.Add(i);
}
Expand Down Expand Up @@ -897,7 +899,7 @@ .. File.ReadAllLines(clippingsPath)
clippingtypelocation = split_b[0][1..].Trim();
}
var pagenumber = -1;
var pagenPattern = @"#\d+(-\d+)?";
var pagenPattern = @"\d+(-\d+)?";
var isPagenIsMatch = Regex.IsMatch(clippingtypelocation, pagenPattern);
var romanPattern = @"^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$";
var isRomanMatched = Regex.IsMatch(clippingtypelocation, romanPattern);
Expand Down Expand Up @@ -1535,7 +1537,6 @@ private void MenuImportKindle_Click(object sender, EventArgs e) {
private void SetProgressBar(bool isShow) {
progressBar.Enabled = isShow;
progressBar.Visible = isShow;
Enabled = !isShow;
}

private void MenuImportKindleMate_Click(object sender, EventArgs e) {
Expand Down Expand Up @@ -2716,5 +2717,13 @@ private void TreeViewWords_KeyDown(object sender, KeyEventArgs e) {
MenuBooksDelete_Click(sender, e);
}
}

private static string RemoveControlChar(string input) {
var output = new StringBuilder();
foreach (var c in input.Where(c => !c.IsControl() && !c.IsNewLineOrLineFeed() && c != 65279)) {
output.Append(c);
}
return output.ToString();
}
}
}
2 changes: 1 addition & 1 deletion KindleMate2/KindleMate2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<LangVersion>latest</LangVersion>
<PackageLicenseUrl>https://github.com/lzcapp/KindleMate2/blob/main/LICENSE</PackageLicenseUrl>
<TargetFrameworks></TargetFrameworks>
<Version>2024.10.9</Version>
<Version>2024.11.21</Version>
<Deterministic>false</Deterministic>
<AssemblyVersion></AssemblyVersion>
<FileVersion></FileVersion>
Expand Down

0 comments on commit d26f6ec

Please sign in to comment.