diff --git a/installer/Installer/MainWindow.xaml b/installer/Installer/MainWindow.xaml
index c298ff1..4e74b10 100644
--- a/installer/Installer/MainWindow.xaml
+++ b/installer/Installer/MainWindow.xaml
@@ -39,7 +39,7 @@
-
+
@@ -88,7 +88,7 @@
-
+
diff --git a/installer/Installer/Model.cs b/installer/Installer/Model.cs
index 0a52066..da6488c 100644
--- a/installer/Installer/Model.cs
+++ b/installer/Installer/Model.cs
@@ -31,6 +31,8 @@ using WebConnect;
using System.IO.Compression;
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.GZip;
+using static System.Net.WebRequestMethods;
+using File = System.IO.File;
namespace starter.viewmodel.settings
{
@@ -656,6 +658,7 @@ namespace Downloader
//Console.WriteLine(filename + "下载完毕!" + Environment.NewLine);
updateFile++;
}
+ UpdatePlanned = false;
}
catch (CosClientException clientEx)
{
@@ -808,6 +811,16 @@ namespace Downloader
sw.Write(JsonConvert.SerializeObject(dict));
Check();
Download();
+ if (File.Exists(Data.FilePath + "/THUAI6/AI.cpp"))
+ {
+ FileInfo userCpp = new FileInfo((Data.FilePath + "/THUAI6/AI.cpp").Replace("/", "\\"));
+ userCpp.MoveTo(Data.FilePath + "/THUAI6/win/CAPI/cpp/API/src/AI.cpp", true);
+ }
+ if (File.Exists(Data.FilePath + "/THUAI6/AI.py"))
+ {
+ FileInfo userCpp = new FileInfo((Data.FilePath + "/THUAI6/AI.py").Replace("/", "\\"));
+ userCpp.MoveTo(Data.FilePath + "/THUAI6/win/CAPI/python/PyAPI/AI.cpp", true);
+ }
}
public static void Change_all_hash(string topDir, Dictionary jsonDict) // 更改HASH
@@ -887,7 +900,7 @@ namespace Downloader
public static int DeleteAll()
{
- DirectoryInfo di = new DirectoryInfo(Data.FilePath);
+ DirectoryInfo di = new DirectoryInfo(Data.FilePath + "/THUAI6");
//DirectoryInfo player = new DirectoryInfo(System.IO.Path.GetFullPath(System.IO.Path.Combine(Data.FilePath, playerFolder)));
FileInfo[] allfile = di.GetFiles();
try
@@ -902,10 +915,16 @@ namespace Downloader
//}
file.Delete();
}
+ FileInfo userFileCpp = new FileInfo(Data.FilePath + "/THUAI6/win/CAPI/cpp/API/src/AI.cpp");
+ FileInfo userFilePy = new FileInfo(Data.FilePath + "/THUAI6/win/CAPI/python/PyAPI/AI.py");
+ userFileCpp.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", System.IO.Path.GetFileName(userFileCpp.FullName)));
+ userFilePy.MoveTo(System.IO.Path.Combine(Data.FilePath + "/THUAI6", System.IO.Path.GetFileName(userFilePy.FullName)));
foreach (DirectoryInfo subdi in di.GetDirectories())
{
subdi.Delete(true);
}
+ FileInfo hashFile = new FileInfo(Data.FilePath + "/hash.json");
+ hashFile.Delete();
}
catch (UnauthorizedAccessException)
{
diff --git a/installer/Installer/ViewModel.cs b/installer/Installer/ViewModel.cs
index 115286c..8b735be 100644
--- a/installer/Installer/ViewModel.cs
+++ b/installer/Installer/ViewModel.cs
@@ -12,6 +12,7 @@ using System.ComponentModel;
using Installer;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using System.IO;
+using System.Windows.Automation.Provider;
namespace starter.viewmodel.settings
{
@@ -250,6 +251,20 @@ namespace starter.viewmodel.settings
}
}
}
+ public string AbortOrSelLanguage
+ {
+ get
+ {
+ string ans = "";
+ if (obj.UploadReady)
+ ans = "放弃上传";
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.cpp)
+ ans = "语言:c++";
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.python)
+ ans = "语言:python";
+ return ans;
+ }
+ }
public int PlayerNum
{
get
@@ -504,10 +519,18 @@ namespace starter.viewmodel.settings
}
else if (type == "File")
{
- var openFileDialog = new Microsoft.Win32.OpenFileDialog()
+
+ var openFileDialog = new Microsoft.Win32.OpenFileDialog();
+ if (obj.launchLanguage == SettingsModel.LaunchLanguage.cpp)
+ {
+ openFileDialog.InitialDirectory = (Route + "/THUAI6/win/CAPI/cpp/API/src/").Replace("/", "\\");
+ openFileDialog.Filter = "c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h|python Source File (.py)|*.py";
+ }
+ else if (obj.launchLanguage == SettingsModel.LaunchLanguage.python)
{
- Filter = "c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h|python Source File (.py)|*.py"
- };
+ openFileDialog.InitialDirectory = (Route + "/THUAI6/win/CAPI/python/PyAPI/").Replace("/", "\\");
+ openFileDialog.Filter = "python Source File (.py)|*.py|c++ Source Files (.cpp)|*.cpp|c++ Header File (.h)|*.h";
+ }
var result = openFileDialog.ShowDialog();
if (result == true)
{
@@ -658,7 +681,7 @@ namespace starter.viewmodel.settings
break;
case 0:
Status = SettingsModel.Status.newUser;
- MessageBox.Show($"删除成功!player文件夹中的文件已经放在{Downloader.Program.ProgramName}的根目录下", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
+ MessageBox.Show($"删除成功!player文件夹中的文件已经放在{Downloader.Program.Data.FilePath}/{Downloader.Program.ProgramName}的根目录下", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
break;
default:
Status = SettingsModel.Status.error;
@@ -833,6 +856,7 @@ namespace starter.viewmodel.settings
this.RaisePropertyChanged("UploadBtnCont");
this.RaisePropertyChanged("UploadReadyVis");
this.RaisePropertyChanged("CoverVis");
+ this.RaisePropertyChanged("AbortOrSelLanguage");
}
}
else
@@ -845,6 +869,7 @@ namespace starter.viewmodel.settings
this.RaisePropertyChanged("UploadReadyVis");
this.RaisePropertyChanged("CodeName");
this.RaisePropertyChanged("CoverVis");
+ this.RaisePropertyChanged("AbortOrSelLanguage");
}
else
{
@@ -856,24 +881,38 @@ namespace starter.viewmodel.settings
return clickUploadCommand;
}
}
- private BaseCommand clickReselectCommand;
- public BaseCommand ClickReselectCommand
+ private BaseCommand clickAboutUploadCommand;
+ public BaseCommand ClickAboutUploadCommand
{
get
{
- if (clickReselectCommand == null)
+ if (clickAboutUploadCommand == null)
{
- clickReselectCommand = new BaseCommand(new Action