fasdfsa commited on
Commit
7a7f6ab
·
1 Parent(s): 9be1e74

目录拆解完成

Browse files
src/WpfEditor/MainWindow.xaml.cs CHANGED
@@ -1593,7 +1593,29 @@ namespace WpfEditor
1593
  Editor._lines.Clear();
1594
 
1595
  Editor._lines = Global.loadJsonReviseEdit_FromOriginalPath(pth_json);
1596
- InitializeDirectoryTreeData(Editor._lines);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1597
 
1598
  Editor._undoBuffer.Clear();
1599
  Editor._undoIndex = -1;
@@ -1615,6 +1637,7 @@ namespace WpfEditor
1615
 
1616
  private void InitializeDirectoryTreeData(List<TextLine> lines)
1617
  {
 
1618
 
1619
  List<Tuple<int, string, TextLine>> ls = new List<Tuple<int, string, TextLine>>();
1620
 
@@ -1838,14 +1861,17 @@ namespace WpfEditor
1838
  {
1839
  if (_textChanged)
1840
  {
1841
- var result = MessageBox.Show("当前文件已修改,是否保存?", "保存确认", MessageBoxButton.YesNoCancel);
1842
- if (result == MessageBoxResult.Cancel)
1843
  {
1844
- e.Cancel = true;
1845
- return;
 
 
 
 
 
 
1846
  }
1847
- if (result == MessageBoxResult.Yes)
1848
- SaveFile();
1849
  }
1850
 
1851
  base.OnClosing(e);
 
1593
  Editor._lines.Clear();
1594
 
1595
  Editor._lines = Global.loadJsonReviseEdit_FromOriginalPath(pth_json);
1596
+
1597
+ string dir = Path.GetDirectoryName(_currentFilePath);
1598
+
1599
+ var jpgs = Directory.EnumerateFiles(dir, "*.jpg", SearchOption.TopDirectoryOnly)
1600
+ .Where(file => System.Text.RegularExpressions.Regex.IsMatch(Path.GetFileNameWithoutExtension(file), @"^\d+$"))
1601
+ .OrderBy(f => f)
1602
+ .ToList();
1603
+
1604
+
1605
+ List<TextLine> ls = new List<TextLine>();
1606
+ foreach (var pth in jpgs)
1607
+ {
1608
+ var (jsn_, m5_, pth_img_, pth_json_) = await Global.img_md5_jsn(pth, _ocrMode);
1609
+ List<TextLine> lines = Global.loadJsonReviseEdit_FromOriginalPath(pth_json_);
1610
+ if (lines.Count > 0)
1611
+ {
1612
+ ls.AddRange(lines);
1613
+ }
1614
+
1615
+ }
1616
+
1617
+
1618
+ InitializeDirectoryTreeData(ls);
1619
 
1620
  Editor._undoBuffer.Clear();
1621
  Editor._undoIndex = -1;
 
1637
 
1638
  private void InitializeDirectoryTreeData(List<TextLine> lines)
1639
  {
1640
+ if (lines.Count <= 0) return;
1641
 
1642
  List<Tuple<int, string, TextLine>> ls = new List<Tuple<int, string, TextLine>>();
1643
 
 
1861
  {
1862
  if (_textChanged)
1863
  {
1864
+ if (_mode == EditorMode.ImageOCR || _mode == EditorMode.ReviseEdit)
 
1865
  {
1866
+ var result = MessageBox.Show("当前文件已修改,是否保存?", "保存确认", MessageBoxButton.YesNoCancel);
1867
+ if (result == MessageBoxResult.Cancel)
1868
+ {
1869
+ e.Cancel = true;
1870
+ return;
1871
+ }
1872
+ if (result == MessageBoxResult.Yes)
1873
+ SaveFile();
1874
  }
 
 
1875
  }
1876
 
1877
  base.OnClosing(e);
src/WpfEditor/TextEditorControl.cs CHANGED
@@ -1417,6 +1417,11 @@ namespace WpfEditor
1417
  return false;
1418
  }
1419
 
 
 
 
 
 
1420
 
1421
  var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
1422
 
 
1417
  return false;
1418
  }
1419
 
1420
+ if (_mode == EditorMode.MenuSplit)
1421
+ {
1422
+ return false;
1423
+ }
1424
+
1425
 
1426
  var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
1427