123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Windows;
- using Vinno.AI.CommonSDK.Enums;
- namespace AIFileCopyTool
- {
- /// <summary>
- /// MainWindow.xaml 的交互逻辑
- /// </summary>
- public partial class MainWindow : Window
- {
- private readonly List<AIEnumType> _9EFunctions = new List<AIEnumType>
- {
- AIEnumType.BreastDiagnosis,
- AIEnumType.AbdomenDiagnosis,
- AIEnumType.ThyroidDiagnosis,
- AIEnumType.CarotidDiagnosis,
- AIEnumType.OrganIdentification,
- AIEnumType.AmnioticFluidDiagnosis,
- AIEnumType.AutoEFDiagnosis,
- AIEnumType.CarotidClassification,
- AIEnumType.HepatoRenalRatioDiagnosis,
- AIEnumType.MyocardialDiagnosis,
- AIEnumType.ThyroidClassification,
- AIEnumType.CustomizeDiagnosis,
- };
- private readonly List<AIEnumType> _galsangFunctions = new List<AIEnumType>
- {
- AIEnumType.BreastDiagnosis,
- AIEnumType.AbdomenDiagnosis,
- AIEnumType.ThyroidDiagnosis,
- AIEnumType.CarotidDiagnosis,
- AIEnumType.OrganIdentification,
- AIEnumType.AutoBLineDiagnosis,
- AIEnumType.AutoDFRDiagnosis,
- AIEnumType.AutoEFDiagnosis,
- AIEnumType.AutoIVCDiagnosis,
- AIEnumType.AutoVTIDiagnosis,
- AIEnumType.MyocardialDiagnosis,
- AIEnumType.NerveIdentification,
- AIEnumType.CustomizeDiagnosis,
- };
- private readonly List<AIEnumType> _r700Functions = new List<AIEnumType>
- {
- AIEnumType.BreastDiagnosis,
- AIEnumType.AbdomenDiagnosis,
- AIEnumType.ThyroidDiagnosis,
- AIEnumType.CarotidDiagnosis,
- AIEnumType.OrganIdentification,
- AIEnumType.AutoBLineDiagnosis,
- AIEnumType.AutoEFDiagnosis,
- AIEnumType.MyocardialDiagnosis,
- AIEnumType.CustomizeDiagnosis,
- };
- private readonly List<AIEnumType> _v10Functions = new List<AIEnumType>
- {
- AIEnumType.BreastDiagnosis,
- AIEnumType.AbdomenDiagnosis,
- AIEnumType.ThyroidDiagnosis,
- AIEnumType.CarotidDiagnosis,
- AIEnumType.OrganIdentification,
- AIEnumType.AutoBLineDiagnosis,
- AIEnumType.AutoDFRDiagnosis,
- AIEnumType.AutoEFDiagnosis,
- AIEnumType.AutoIVCDiagnosis,
- AIEnumType.AutoVTIDiagnosis,
- AIEnumType.MyocardialDiagnosis,
- AIEnumType.NerveIdentification,
- AIEnumType.ThyroidClassification,
- AIEnumType.CustomizeDiagnosis,
- };
- private readonly List<AIEnumType> _vetFunctions = new List<AIEnumType>
- {
- AIEnumType.AutoEFDiagnosis,
- AIEnumType.VetHeartDiagnosis,
- AIEnumType.MyocardialDiagnosis,
- AIEnumType.CustomizeDiagnosis,
- };
- public MainWindow()
- {
- InitializeComponent();
- }
- private void TulipCopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- var folderName = Path.GetFileNameWithoutExtension(d);
- if (Enum.TryParse<AIEnumType>(folderName, out var result))
- {
- if (_9EFunctions.Contains(result))
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- else
- {
- DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
- }
- }
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- private void GalsangCopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- var folderName = Path.GetFileNameWithoutExtension(d);
- if (Enum.TryParse<AIEnumType>(folderName, out var result))
- {
- if (_galsangFunctions.Contains(result))
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- else
- {
- DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
- }
- }
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- private void R700CopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- var folderName = Path.GetFileNameWithoutExtension(d);
- if (Enum.TryParse<AIEnumType>(folderName, out var result))
- {
- if (_r700Functions.Contains(result))
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- else
- {
- DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
- }
- }
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- private void V10CopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- var folderName = Path.GetFileNameWithoutExtension(d);
- if (Enum.TryParse<AIEnumType>(folderName, out var result))
- {
- if (_v10Functions.Contains(result))
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- else
- {
- DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
- }
- }
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- private void AllCopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- private void VetCopyBtn_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- var fromPath = FromText.Text.Trim();
- var toPath = ToText.Text.Trim();
- if (string.IsNullOrEmpty(fromPath) || string.IsNullOrEmpty(toPath))
- {
- MessageBox.Show(this, "路径为空,重新填写。");
- return;
- }
- var directories = Directory.GetDirectories(fromPath);
- foreach (var d in directories)
- {
- var folderName = Path.GetFileNameWithoutExtension(d);
- if (Enum.TryParse<AIEnumType>(folderName, out var result))
- {
- if (_vetFunctions.Contains(result))
- {
- DirectoryHelper.CopyDirectoryContent(d, toPath);
- }
- else
- {
- DirectoryHelper.CopyDirectoryContentWithoutDirectory(d, toPath);
- }
- }
- }
- MessageBox.Show(this, "拷贝完成!");
- }
- catch (Exception ex)
- {
- MessageBox.Show(this, $"Copy Error:{ex}");
- }
- }
- }
- }
|