MainWindow.xaml.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Windows;
  5. using Vinno.AI.CommonSDK.Enums;
  6. namespace AIFileCopyTool
  7. {
  8. /// <summary>
  9. /// MainWindow.xaml 的交互逻辑
  10. /// </summary>
  11. public partial class MainWindow : Window
  12. {
  13. private readonly List<AIEnumType> _9EFunctions = new List<AIEnumType>
  14. {
  15. AIEnumType.BreastDiagnosis,
  16. AIEnumType.AbdomenDiagnosis,
  17. AIEnumType.ThyroidDiagnosis,
  18. AIEnumType.CarotidDiagnosis,
  19. AIEnumType.OrganIdentification,
  20. AIEnumType.AmnioticFluidDiagnosis,
  21. AIEnumType.AutoEFDiagnosis,
  22. AIEnumType.CarotidClassification,
  23. AIEnumType.HepatoRenalRatioDiagnosis,
  24. AIEnumType.MyocardialDiagnosis,
  25. AIEnumType.ThyroidClassification,
  26. AIEnumType.CustomizeDiagnosis,
  27. };
  28. private readonly List<AIEnumType> _galsangFunctions = new List<AIEnumType>
  29. {
  30. AIEnumType.BreastDiagnosis,
  31. AIEnumType.AbdomenDiagnosis,
  32. AIEnumType.ThyroidDiagnosis,
  33. AIEnumType.CarotidDiagnosis,
  34. AIEnumType.OrganIdentification,
  35. AIEnumType.AutoBLineDiagnosis,
  36. AIEnumType.AutoDFRDiagnosis,
  37. AIEnumType.AutoEFDiagnosis,
  38. AIEnumType.AutoIVCDiagnosis,
  39. AIEnumType.AutoVTIDiagnosis,
  40. AIEnumType.MyocardialDiagnosis,
  41. AIEnumType.NerveIdentification,
  42. AIEnumType.CustomizeDiagnosis,
  43. };
  44. private readonly List<AIEnumType> _r700Functions = new List<AIEnumType>
  45. {
  46. AIEnumType.BreastDiagnosis,
  47. AIEnumType.AbdomenDiagnosis,
  48. AIEnumType.ThyroidDiagnosis,
  49. AIEnumType.CarotidDiagnosis,
  50. AIEnumType.OrganIdentification,
  51. AIEnumType.AutoBLineDiagnosis,
  52. AIEnumType.AutoEFDiagnosis,
  53. AIEnumType.MyocardialDiagnosis,
  54. AIEnumType.CustomizeDiagnosis,
  55. };
  56. private readonly List<AIEnumType> _v10Functions = new List<AIEnumType>
  57. {
  58. AIEnumType.BreastDiagnosis,
  59. AIEnumType.AbdomenDiagnosis,
  60. AIEnumType.ThyroidDiagnosis,
  61. AIEnumType.CarotidDiagnosis,
  62. AIEnumType.OrganIdentification,
  63. AIEnumType.AutoBLineDiagnosis,
  64. AIEnumType.AutoDFRDiagnosis,
  65. AIEnumType.AutoEFDiagnosis,
  66. AIEnumType.AutoIVCDiagnosis,
  67. AIEnumType.AutoVTIDiagnosis,
  68. AIEnumType.MyocardialDiagnosis,
  69. AIEnumType.NerveIdentification,
  70. AIEnumType.ThyroidClassification,
  71. AIEnumType.CustomizeDiagnosis,
  72. };
  73. private readonly List<AIEnumType> _vetFunctions = new List<AIEnumType>
  74. {
  75. AIEnumType.AutoEFDiagnosis,
  76. AIEnumType.VetHeartDiagnosis,
  77. AIEnumType.MyocardialDiagnosis,
  78. AIEnumType.CustomizeDiagnosis,
  79. };
  80. public MainWindow()
  81. {
  82. InitializeComponent();
  83. }
  84. private void TulipCopyBtn_Click(object sender, RoutedEventArgs e)
  85. {
  86. try
  87. {
  88. var fromPath = FromText.Text.Trim();
  89. var toPath = ToText.Text.Trim();
  90. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  91. {
  92. MessageBox.Show(this, "路径为空,重新填写。");
  93. return;
  94. }
  95. var directories = Directory.GetDirectories(fromPath);
  96. foreach (var d in directories)
  97. {
  98. var folderName = Path.GetFileNameWithoutExtension(d);
  99. if (Enum.TryParse<AIEnumType>(folderName, out var result))
  100. {
  101. if (_9EFunctions.Contains(result))
  102. {
  103. DirectoryHelper.CopyDirectoryContent(d, toPath);
  104. }
  105. else
  106. {
  107. DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
  108. }
  109. }
  110. }
  111. MessageBox.Show(this, "拷贝完成!");
  112. }
  113. catch (Exception ex)
  114. {
  115. MessageBox.Show(this, $"Copy Error:{ex}");
  116. }
  117. }
  118. private void GalsangCopyBtn_Click(object sender, RoutedEventArgs e)
  119. {
  120. try
  121. {
  122. var fromPath = FromText.Text.Trim();
  123. var toPath = ToText.Text.Trim();
  124. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  125. {
  126. MessageBox.Show(this, "路径为空,重新填写。");
  127. return;
  128. }
  129. var directories = Directory.GetDirectories(fromPath);
  130. foreach (var d in directories)
  131. {
  132. var folderName = Path.GetFileNameWithoutExtension(d);
  133. if (Enum.TryParse<AIEnumType>(folderName, out var result))
  134. {
  135. if (_galsangFunctions.Contains(result))
  136. {
  137. DirectoryHelper.CopyDirectoryContent(d, toPath);
  138. }
  139. else
  140. {
  141. DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
  142. }
  143. }
  144. }
  145. MessageBox.Show(this, "拷贝完成!");
  146. }
  147. catch (Exception ex)
  148. {
  149. MessageBox.Show(this, $"Copy Error:{ex}");
  150. }
  151. }
  152. private void R700CopyBtn_Click(object sender, RoutedEventArgs e)
  153. {
  154. try
  155. {
  156. var fromPath = FromText.Text.Trim();
  157. var toPath = ToText.Text.Trim();
  158. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  159. {
  160. MessageBox.Show(this, "路径为空,重新填写。");
  161. return;
  162. }
  163. var directories = Directory.GetDirectories(fromPath);
  164. foreach (var d in directories)
  165. {
  166. var folderName = Path.GetFileNameWithoutExtension(d);
  167. if (Enum.TryParse<AIEnumType>(folderName, out var result))
  168. {
  169. if (_r700Functions.Contains(result))
  170. {
  171. DirectoryHelper.CopyDirectoryContent(d, toPath);
  172. }
  173. else
  174. {
  175. DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
  176. }
  177. }
  178. }
  179. MessageBox.Show(this, "拷贝完成!");
  180. }
  181. catch (Exception ex)
  182. {
  183. MessageBox.Show(this, $"Copy Error:{ex}");
  184. }
  185. }
  186. private void V10CopyBtn_Click(object sender, RoutedEventArgs e)
  187. {
  188. try
  189. {
  190. var fromPath = FromText.Text.Trim();
  191. var toPath = ToText.Text.Trim();
  192. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  193. {
  194. MessageBox.Show(this, "路径为空,重新填写。");
  195. return;
  196. }
  197. var directories = Directory.GetDirectories(fromPath);
  198. foreach (var d in directories)
  199. {
  200. var folderName = Path.GetFileNameWithoutExtension(d);
  201. if (Enum.TryParse<AIEnumType>(folderName, out var result))
  202. {
  203. if (_v10Functions.Contains(result))
  204. {
  205. DirectoryHelper.CopyDirectoryContent(d, toPath);
  206. }
  207. else
  208. {
  209. DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
  210. }
  211. }
  212. }
  213. MessageBox.Show(this, "拷贝完成!");
  214. }
  215. catch (Exception ex)
  216. {
  217. MessageBox.Show(this, $"Copy Error:{ex}");
  218. }
  219. }
  220. private void AllCopyBtn_Click(object sender, RoutedEventArgs e)
  221. {
  222. try
  223. {
  224. var fromPath = FromText.Text.Trim();
  225. var toPath = ToText.Text.Trim();
  226. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  227. {
  228. MessageBox.Show(this, "路径为空,重新填写。");
  229. return;
  230. }
  231. var directories = Directory.GetDirectories(fromPath);
  232. foreach (var d in directories)
  233. {
  234. DirectoryHelper.CopyDirectoryContent(d, toPath);
  235. }
  236. MessageBox.Show(this, "拷贝完成!");
  237. }
  238. catch (Exception ex)
  239. {
  240. MessageBox.Show(this, $"Copy Error:{ex}");
  241. }
  242. }
  243. private void VetCopyBtn_Click(object sender, RoutedEventArgs e)
  244. {
  245. try
  246. {
  247. var fromPath = FromText.Text.Trim();
  248. var toPath = ToText.Text.Trim();
  249. if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
  250. {
  251. MessageBox.Show(this, "路径为空,重新填写。");
  252. return;
  253. }
  254. var directories = Directory.GetDirectories(fromPath);
  255. foreach (var d in directories)
  256. {
  257. var folderName = Path.GetFileNameWithoutExtension(d);
  258. if (Enum.TryParse<AIEnumType>(folderName, out var result))
  259. {
  260. if (_vetFunctions.Contains(result))
  261. {
  262. DirectoryHelper.CopyDirectoryContent(d, toPath);
  263. }
  264. else
  265. {
  266. DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
  267. }
  268. }
  269. }
  270. MessageBox.Show(this, "拷贝完成!");
  271. }
  272. catch (Exception ex)
  273. {
  274. MessageBox.Show(this, $"Copy Error:{ex}");
  275. }
  276. }
  277. }
  278. }