fasdfsa commited on
Commit
9f3cff9
·
1 Parent(s): 76e3d4d

保存整理校对 json

Browse files
src/WpfEditor/MainWindow.xaml.cs CHANGED
@@ -427,6 +427,7 @@ namespace WpfEditor
427
  Editor._jsn_OpenImg = jsn;
428
  Editor._md5_OpenImg = m5;
429
 
 
430
  if (this._mode == EditorMode.ImageOCR)
431
  {
432
  try
@@ -434,7 +435,7 @@ namespace WpfEditor
434
 
435
  Editor.SetText(jsn, m5);
436
 
437
- _currentFilePath = openFileDialog.FileName;
438
  _textChanged = false;
439
  UpdateTitle();
440
  StatusText.Text = $"已打开: {_currentFilePath}";
 
427
  Editor._jsn_OpenImg = jsn;
428
  Editor._md5_OpenImg = m5;
429
 
430
+ _currentFilePath = openFileDialog.FileName;
431
  if (this._mode == EditorMode.ImageOCR)
432
  {
433
  try
 
435
 
436
  Editor.SetText(jsn, m5);
437
 
438
+
439
  _textChanged = false;
440
  UpdateTitle();
441
  StatusText.Text = $"已打开: {_currentFilePath}";
src/WpfEditor/TextEditorControl.cs CHANGED
@@ -1179,17 +1179,25 @@ namespace WpfEditor
1179
 
1180
  public bool saveJson(string pth_img_)
1181
  {
 
1182
  bool isModify = false;
1183
 
1184
  string m5 = MD5.ComputeFileHash(pth_img_);
1185
 
1186
- var (pth_img, pth_json) = Global.get_img_json_pth(m5);
1187
 
1188
  if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
1189
  {
1190
  return false;
 
 
 
 
 
 
1191
  }
1192
 
 
1193
  var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
1194
 
1195
  JObject jsn = null;
 
1179
 
1180
  public bool saveJson(string pth_img_)
1181
  {
1182
+
1183
  bool isModify = false;
1184
 
1185
  string m5 = MD5.ComputeFileHash(pth_img_);
1186
 
1187
+ var (pth_img, pth_json) = Global.get_img_json_pthv2(pth_img_);
1188
 
1189
  if (!Path.Exists(pth_json) || !Path.Exists(pth_img))
1190
  {
1191
  return false;
1192
+ }
1193
+
1194
+ if (_mode == EditorMode.ReviseEdit)
1195
+ {
1196
+ Global.saveJsonReviseEdit(pth_json, _lines);
1197
+ return false;
1198
  }
1199
 
1200
+
1201
  var jsonstr = File.ReadAllText(pth_json, new System.Text.UTF8Encoding(false));
1202
 
1203
  JObject jsn = null;
src/WpfEditor/global.cs CHANGED
@@ -296,6 +296,19 @@ namespace WpfEditor
296
 
297
  }
298
 
 
 
 
 
 
 
 
 
 
 
 
 
 
299
 
300
  }
301
  }
 
296
 
297
  }
298
 
299
+ public static void saveJsonReviseEdit(string pth_json, List<TextLine> lines)
300
+ {
301
+ var dir = Path.GetDirectoryName( Path.GetDirectoryName(pth_json) );
302
+ var name_json = Path.GetFileName(pth_json);
303
+ var dir_new = Path.Combine(dir, "json2");
304
+
305
+ Directory.CreateDirectory(dir_new);
306
+
307
+ var pth_json_reviseEdit = Path.Combine(dir_new, name_json);
308
+
309
+
310
+ int a = 1;
311
+ }
312
 
313
  }
314
  }