using System;
using System.Collections.Generic;
using System.IO;
using System.Windows;
using Vinno.AI.CommonSDK.Enums;
namespace AIFileCopyTool
{
///
/// MainWindow.xaml 的交互逻辑
///
public partial class MainWindow : Window
{
private readonly List _9EFunctions = new List
{
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 _galsangFunctions = new List
{
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 _r700Functions = new List
{
AIEnumType.BreastDiagnosis,
AIEnumType.AbdomenDiagnosis,
AIEnumType.ThyroidDiagnosis,
AIEnumType.CarotidDiagnosis,
AIEnumType.OrganIdentification,
AIEnumType.AutoBLineDiagnosis,
AIEnumType.AutoEFDiagnosis,
AIEnumType.MyocardialDiagnosis,
AIEnumType.CustomizeDiagnosis,
};
private readonly List _v10Functions = new List
{
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 _vetFunctions = new List
{
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(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(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(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(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(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}");
}
}
}
}