TowerMigrator/ViewModels/Migrator/ServerTableMigrator.cs
2024-11-16 23:58:14 +08:00

34 lines
1011 B
C#

namespace H5MotaUpdate.ViewModels
{
internal class ServerTableMigrator
{
string sourcePath, destPath;
Version version;
readonly string FILENAME = "_server/table";
public ServerTableMigrator(string oldRootDirectory, string newRootDirectory, Version ver)
{
sourcePath = System.IO.Path.Combine(oldRootDirectory, FILENAME);
destPath = System.IO.Path.Combine(newRootDirectory, FILENAME);
this.version = ver;
}
public void Migrate()
{
try
{
MigrateDirect();
ErrorLogger.LogError("迁移" + FILENAME + "文件夹完成。");
}
catch (Exception e)
{
ErrorLogger.LogError("迁移" + FILENAME + $"过程中出现错误: {e.Message}", "red");
}
}
void MigrateDirect()
{
FileUtils.CopyFolderContentsAndSubFolders(sourcePath, destPath);
}
}
}