保存校对后 json 是 ok 的
Browse files
data/data/img/3d1f89e6169021f8f5789ca842e050d4.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9c5dc04a692203e43f3fbb946f0eec24bf8e8d0b3cd75324844cc142e8b04ffa
|
| 3 |
+
size 495612
|
data/data/json/3d1f89e6169021f8f5789ca842e050d4.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/data/json2/3d1f89e6169021f8f5789ca842e050d4.json
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"pos": [],
|
| 4 |
+
"selected_rectange": {},
|
| 5 |
+
"Characters": []
|
| 6 |
+
},
|
| 7 |
+
{
|
| 8 |
+
"pos": [
|
| 9 |
+
{
|
| 10 |
+
"x": 595,
|
| 11 |
+
"y": 54
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"x": 720,
|
| 15 |
+
"y": 54
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"x": 720,
|
| 19 |
+
"y": 79
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"x": 595,
|
| 23 |
+
"y": 79
|
| 24 |
+
}
|
| 25 |
+
],
|
| 26 |
+
"selected_rectange": {
|
| 27 |
+
"Id": 1,
|
| 28 |
+
"lft": 489,
|
| 29 |
+
"tp": 10,
|
| 30 |
+
"wdth": 312,
|
| 31 |
+
"hght": 146
|
| 32 |
+
},
|
| 33 |
+
"Characters": [
|
| 34 |
+
{
|
| 35 |
+
"Character": 31616,
|
| 36 |
+
"Foreground": "#FF000000",
|
| 37 |
+
"x": 595,
|
| 38 |
+
"y": 54,
|
| 39 |
+
"w": 43,
|
| 40 |
+
"h": 25,
|
| 41 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 42 |
+
"guid": "b7fa65cc-c91d-4d98-a7fa-049d52453c36"
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"Character": 26131,
|
| 46 |
+
"Foreground": "#FF000000",
|
| 47 |
+
"x": 638,
|
| 48 |
+
"y": 54,
|
| 49 |
+
"w": 36,
|
| 50 |
+
"h": 25,
|
| 51 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 52 |
+
"guid": "36dd755e-a83e-44d9-93e4-dbd6136623d3"
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"Character": 23398,
|
| 56 |
+
"Foreground": "#FF000000",
|
| 57 |
+
"x": 674,
|
| 58 |
+
"y": 54,
|
| 59 |
+
"w": 46,
|
| 60 |
+
"h": 25,
|
| 61 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 62 |
+
"guid": "a517490b-bdda-4078-9464-54bf042fc8ed"
|
| 63 |
+
}
|
| 64 |
+
]
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"pos": [
|
| 68 |
+
{
|
| 69 |
+
"x": 590,
|
| 70 |
+
"y": 76
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"x": 719,
|
| 74 |
+
"y": 76
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"x": 719,
|
| 78 |
+
"y": 123
|
| 79 |
+
},
|
| 80 |
+
{
|
| 81 |
+
"x": 590,
|
| 82 |
+
"y": 123
|
| 83 |
+
}
|
| 84 |
+
],
|
| 85 |
+
"selected_rectange": {
|
| 86 |
+
"Id": 1,
|
| 87 |
+
"lft": 489,
|
| 88 |
+
"tp": 10,
|
| 89 |
+
"wdth": 312,
|
| 90 |
+
"hght": 146
|
| 91 |
+
},
|
| 92 |
+
"Characters": [
|
| 93 |
+
{
|
| 94 |
+
"Character": 24418,
|
| 95 |
+
"Foreground": "#FF000000",
|
| 96 |
+
"x": 590,
|
| 97 |
+
"y": 76,
|
| 98 |
+
"w": 12,
|
| 99 |
+
"h": 47,
|
| 100 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 101 |
+
"guid": "b958de07-4128-462d-a725-eaa01f25c14d"
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"Character": 23481,
|
| 105 |
+
"Foreground": "#FF000000",
|
| 106 |
+
"x": 602,
|
| 107 |
+
"y": 76,
|
| 108 |
+
"w": 17,
|
| 109 |
+
"h": 47,
|
| 110 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 111 |
+
"guid": "358a836c-ee5f-453c-94b3-ad5ab867d688"
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"Character": 35422,
|
| 115 |
+
"Foreground": "#FF000000",
|
| 116 |
+
"x": 619,
|
| 117 |
+
"y": 76,
|
| 118 |
+
"w": 35,
|
| 119 |
+
"h": 47,
|
| 120 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 121 |
+
"guid": "0411c1b8-a23a-4c31-82e8-e0f7cca98bb6"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"Character": 47,
|
| 125 |
+
"Foreground": "#FF000000",
|
| 126 |
+
"x": 654,
|
| 127 |
+
"y": 76,
|
| 128 |
+
"w": 6,
|
| 129 |
+
"h": 47,
|
| 130 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 131 |
+
"guid": "414278f9-b44a-4a46-ab4c-455575b24549"
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"Character": 21103,
|
| 135 |
+
"Foreground": "#FF000000",
|
| 136 |
+
"x": 660,
|
| 137 |
+
"y": 76,
|
| 138 |
+
"w": 17,
|
| 139 |
+
"h": 47,
|
| 140 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 141 |
+
"guid": "715782cf-81f8-4198-bf82-9a54b981cf73"
|
| 142 |
+
},
|
| 143 |
+
{
|
| 144 |
+
"Character": 32792,
|
| 145 |
+
"Foreground": "#FF000000",
|
| 146 |
+
"x": 677,
|
| 147 |
+
"y": 76,
|
| 148 |
+
"w": 42,
|
| 149 |
+
"h": 47,
|
| 150 |
+
"ImageMD5": "3d1f89e6169021f8f5789ca842e050d4",
|
| 151 |
+
"guid": "964f2cf9-5ccd-435b-8dc0-62c3c77772f8"
|
| 152 |
+
}
|
| 153 |
+
]
|
| 154 |
+
}
|
| 155 |
+
]
|
src/WpfEditor/global.cs
CHANGED
|
@@ -322,6 +322,7 @@ namespace WpfEditor
|
|
| 322 |
};
|
| 323 |
|
| 324 |
string jsonString = JsonConvert.SerializeObject(lines, settings);
|
|
|
|
| 325 |
File.WriteAllText(pth_json_reviseEdit, jsonString, Encoding.UTF8);
|
| 326 |
}
|
| 327 |
catch (Exception ex)
|
|
@@ -330,26 +331,18 @@ namespace WpfEditor
|
|
| 330 |
}
|
| 331 |
}
|
| 332 |
|
| 333 |
-
|
| 334 |
-
public static List<TextLine> loadJsonReviseEdit(string pth_json_reviseEdit)
|
| 335 |
{
|
| 336 |
try
|
| 337 |
{
|
| 338 |
-
if (!File.Exists(pth_json_reviseEdit))
|
| 339 |
-
{
|
| 340 |
-
throw new FileNotFoundException($"JSON 文件不存在: {pth_json_reviseEdit}");
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
string jsonString = File.ReadAllText(pth_json_reviseEdit, Encoding.UTF8);
|
| 344 |
-
|
| 345 |
var settings = new JsonSerializerSettings
|
| 346 |
{
|
| 347 |
NullValueHandling = NullValueHandling.Ignore,
|
| 348 |
DefaultValueHandling = DefaultValueHandling.Ignore
|
| 349 |
};
|
| 350 |
-
|
| 351 |
List<TextLine> lines = JsonConvert.DeserializeObject<List<TextLine>>(jsonString, settings);
|
| 352 |
-
|
| 353 |
// 确保返回的不是 null,并重新初始化 Brush 属性
|
| 354 |
if (lines != null)
|
| 355 |
{
|
|
@@ -362,10 +355,53 @@ namespace WpfEditor
|
|
| 362 |
}
|
| 363 |
}
|
| 364 |
}
|
| 365 |
-
|
| 366 |
return lines ?? new List<TextLine>();
|
| 367 |
}
|
| 368 |
catch (Exception ex)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
{
|
| 370 |
throw new Exception($"加载 JSON 文件失败: {ex.Message}", ex);
|
| 371 |
}
|
|
|
|
| 322 |
};
|
| 323 |
|
| 324 |
string jsonString = JsonConvert.SerializeObject(lines, settings);
|
| 325 |
+
//List<TextLine> lines2 = loadJsonReviseEdit_(jsonString);
|
| 326 |
File.WriteAllText(pth_json_reviseEdit, jsonString, Encoding.UTF8);
|
| 327 |
}
|
| 328 |
catch (Exception ex)
|
|
|
|
| 331 |
}
|
| 332 |
}
|
| 333 |
|
| 334 |
+
public static List<TextLine> loadJsonReviseEdit_(string jsonString)
|
|
|
|
| 335 |
{
|
| 336 |
try
|
| 337 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
var settings = new JsonSerializerSettings
|
| 339 |
{
|
| 340 |
NullValueHandling = NullValueHandling.Ignore,
|
| 341 |
DefaultValueHandling = DefaultValueHandling.Ignore
|
| 342 |
};
|
| 343 |
+
|
| 344 |
List<TextLine> lines = JsonConvert.DeserializeObject<List<TextLine>>(jsonString, settings);
|
| 345 |
+
|
| 346 |
// 确保返回的不是 null,并重新初始化 Brush 属性
|
| 347 |
if (lines != null)
|
| 348 |
{
|
|
|
|
| 355 |
}
|
| 356 |
}
|
| 357 |
}
|
| 358 |
+
|
| 359 |
return lines ?? new List<TextLine>();
|
| 360 |
}
|
| 361 |
catch (Exception ex)
|
| 362 |
+
{
|
| 363 |
+
throw new Exception($"反序列化 JSON 失败: {ex.Message}", ex);
|
| 364 |
+
}
|
| 365 |
+
}
|
| 366 |
+
|
| 367 |
+
// 从 JSON 恢复 lines 的方法
|
| 368 |
+
public static List<TextLine> loadJsonReviseEdit(string pth_json_reviseEdit)
|
| 369 |
+
{
|
| 370 |
+
try
|
| 371 |
+
{
|
| 372 |
+
if (!File.Exists(pth_json_reviseEdit))
|
| 373 |
+
{
|
| 374 |
+
throw new FileNotFoundException($"JSON 文件不存在: {pth_json_reviseEdit}");
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
string jsonString = File.ReadAllText(pth_json_reviseEdit, Encoding.UTF8);
|
| 378 |
+
|
| 379 |
+
return loadJsonReviseEdit_(jsonString);
|
| 380 |
+
|
| 381 |
+
//var settings = new JsonSerializerSettings
|
| 382 |
+
//{
|
| 383 |
+
// NullValueHandling = NullValueHandling.Ignore,
|
| 384 |
+
// DefaultValueHandling = DefaultValueHandling.Ignore
|
| 385 |
+
//};
|
| 386 |
+
|
| 387 |
+
//List<TextLine> lines = JsonConvert.DeserializeObject<List<TextLine>>(jsonString, settings);
|
| 388 |
+
|
| 389 |
+
//// 确保返回的不是 null,并重新初始化 Brush 属性
|
| 390 |
+
//if (lines != null)
|
| 391 |
+
//{
|
| 392 |
+
// foreach (var line in lines)
|
| 393 |
+
// {
|
| 394 |
+
// foreach (var character in line.Characters)
|
| 395 |
+
// {
|
| 396 |
+
// if (character.Foreground == null)
|
| 397 |
+
// character.Foreground = System.Windows.Media.Brushes.Black;
|
| 398 |
+
// }
|
| 399 |
+
// }
|
| 400 |
+
//}
|
| 401 |
+
|
| 402 |
+
//return lines ?? new List<TextLine>();
|
| 403 |
+
}
|
| 404 |
+
catch (Exception ex)
|
| 405 |
{
|
| 406 |
throw new Exception($"加载 JSON 文件失败: {ex.Message}", ex);
|
| 407 |
}
|