Browse Source

chore: bug fixes for when moving program was stopped by some reason

tags/0.1.0
OctaAcid 2 years ago
parent
commit
623655befb
2 changed files with 27 additions and 12 deletions
  1. +3
    -3
      CAPI/cpp/API/src/AI.cpp
  2. +24
    -9
      installer/Installer/Model.cs

+ 3
- 3
CAPI/cpp/API/src/AI.cpp View File

@@ -17,7 +17,7 @@ extern const std::array<THUAI6::StudentType, 4> studentType = {


extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin; extern const THUAI6::TrickerType trickerType = THUAI6::TrickerType::Assassin;


//可以在AI.cpp内部声明变量与函数
// 可以在AI.cpp内部声明变量与函数


void AI::play(IStudentAPI& api) void AI::play(IStudentAPI& api)
{ {
@@ -38,8 +38,8 @@ void AI::play(IStudentAPI& api)
{ {
// 玩家3执行操作 // 玩家3执行操作
} }
//当然可以写成if (this->playerID == 2||this->playerID == 3)之类的操作
// 公共操作
// 当然可以写成if (this->playerID == 2||this->playerID == 3)之类的操作
// 公共操作
} }


void AI::play(ITrickerAPI& api) void AI::play(ITrickerAPI& api)


+ 24
- 9
installer/Installer/Model.cs View File

@@ -1015,29 +1015,44 @@ namespace Downloader
catch (DirectoryNotFoundException) catch (DirectoryNotFoundException)
{ {
Console.WriteLine("原路径未找到!请检查文件是否损坏"); Console.WriteLine("原路径未找到!请检查文件是否损坏");
foreach (DirectoryInfo newdirect in newdi.GetDirectories())
if (newdi.GetDirectories().Length != 0)
{ {
newdirect.MoveTo(System.IO.Path.Combine(Data.FilePath, newdirect.Name));
foreach (DirectoryInfo newdirect in newdi.GetDirectories())
{
newdirect.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", newdirect.Name));
}
} }
foreach (FileInfo file in newdi.GetFiles())
if (newdi.GetFiles().Length != 0)
{ {
file.MoveTo(System.IO.Path.Combine(Data.FilePath, file.Name));
foreach (FileInfo file in newdi.GetFiles())
{
file.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", file.Name));
}
} }
Console.WriteLine("移动失败!"); Console.WriteLine("移动失败!");
newdi.Delete();
if (newdi.Exists)
newdi.Delete();
return -2; return -2;
} }
catch (IOException) catch (IOException)
{ {
Console.WriteLine("文件已打开或者目标路径下有同名文件!"); Console.WriteLine("文件已打开或者目标路径下有同名文件!");
foreach (DirectoryInfo newdirect in newdi.GetDirectories())
if (newdi.GetDirectories().Length != 0)
{ {
newdirect.MoveTo(System.IO.Path.Combine(Data.FilePath, newdirect.Name));
foreach (DirectoryInfo newdirect in newdi.GetDirectories())
{
newdirect.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", newdirect.Name));
}
} }
foreach (FileInfo file in newdi.GetFiles())
if (newdi.GetFiles().Length != 0)
{ {
file.MoveTo(System.IO.Path.Combine(Data.FilePath, file.Name));
foreach (FileInfo file in newdi.GetFiles())
{
file.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", file.Name));
}
} }
if (newdi.Exists)
newdi.Delete();
Console.WriteLine("移动失败!"); Console.WriteLine("移动失败!");
return -1; return -1;
} }


Loading…
Cancel
Save