|
@@ -1,33 +1,89 @@
|
|
|
-using System;
|
|
|
+using SAGA.DotNetUtils.Extend;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
-using System.Diagnostics;
|
|
|
+using System.ComponentModel;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
-using System.Text;
|
|
|
-using System.Threading.Tasks;
|
|
|
+using System.Threading;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
-using System.Windows.Data;
|
|
|
-using System.Windows.Documents;
|
|
|
-using System.Windows.Input;
|
|
|
-using System.Windows.Media;
|
|
|
-using System.Windows.Media.Imaging;
|
|
|
-using System.Windows.Navigation;
|
|
|
-using System.IO;
|
|
|
-using System.Threading;
|
|
|
using System.Windows.Threading;
|
|
|
+using WPFTestUpdate.Utils;
|
|
|
|
|
|
namespace WPFTestUpdate
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
- public partial class MainWindow : Window
|
|
|
+ public partial class MainWindow : INotifyPropertyChanged
|
|
|
{
|
|
|
+ public event PropertyChangedEventHandler PropertyChanged;
|
|
|
+
|
|
|
public MainWindow()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
+ LoadSetting();
|
|
|
+ this.DataContext = this;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ #region SavePath LoadPath
|
|
|
+
|
|
|
+ private string m_BasePath;
|
|
|
+
|
|
|
+ public string BasePath
|
|
|
+ {
|
|
|
+ get { return m_BasePath; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ m_BasePath = value;
|
|
|
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(m_BasePathKey));
|
|
|
+
|
|
|
+ FileStoreHandler.SaveData(m_BasePathKey, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private string m_Dirs;
|
|
|
+
|
|
|
+ public string Dirs
|
|
|
+ {
|
|
|
+ get { return m_Dirs; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ m_Dirs = value;
|
|
|
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(m_DirNameKey));
|
|
|
+
|
|
|
+ FileStoreHandler.SaveData(m_DirNameKey, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void SaveBasePath(Control uc, string path)
|
|
|
+ {
|
|
|
+ }
|
|
|
+
|
|
|
+ private string m_BasePathKey = nameof(BasePath);
|
|
|
+ private string m_DirNameKey = nameof(Dirs);
|
|
|
+ private void LoadSetting()
|
|
|
+ {
|
|
|
+ string value = FileStoreHandler.GetData(m_BasePathKey);
|
|
|
+ if (value.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ value = @"D:\Revit\saga\MBI";
|
|
|
+ }
|
|
|
+ BasePath = value;
|
|
|
+
|
|
|
+ value = FileStoreHandler.GetData(m_DirNameKey);
|
|
|
+ if (value.IsNullOrEmpty())
|
|
|
+ {
|
|
|
+ value = @"MBIResource;Menu;OutputDll;RibbonImage";
|
|
|
+ }
|
|
|
+ Dirs = value;
|
|
|
}
|
|
|
|
|
|
+ #endregion
|
|
|
+
|
|
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
string exeBasePath = txtBasePath.Text;
|
|
@@ -56,7 +112,7 @@ namespace WPFTestUpdate
|
|
|
() =>
|
|
|
{
|
|
|
RefrushState("准备");
|
|
|
- string exePath =Path.Combine(exeBasePath,@"OutputDll\SAGA.MBI.exe");
|
|
|
+ string exePath = Path.Combine(exeBasePath, @"OutputDll\SAGA.MBI.exe");
|
|
|
if (!File.Exists(exePath))
|
|
|
{
|
|
|
RefrushState("可执行的Exe文件不存在,请检查");
|
|
@@ -75,16 +131,16 @@ namespace WPFTestUpdate
|
|
|
try
|
|
|
{
|
|
|
string package = $"{Const.Key}";
|
|
|
- string compressName =Untility.GetFileVersion(exePath).ToString().ToCompressKey();
|
|
|
+ string compressName = Untility.GetFileVersion(exePath).ToString().ToCompressKey();
|
|
|
RefrushState("正在进行压缩");
|
|
|
string compressPath = @"C:\VersionsTest";
|
|
|
string compressFullPath = Path.Combine(compressPath, compressName);
|
|
|
-
|
|
|
+
|
|
|
Untility.CompressDir(compressFullPath, dirList.ToArray(), RefrushState);
|
|
|
RefrushState("删除旧的安装包");
|
|
|
Untility.DeleteCompress();
|
|
|
RefrushState("正在进行上传");
|
|
|
- Untility.UploadCompress(compressFullPath,RefrushState);
|
|
|
+ Untility.UploadCompress(compressFullPath, RefrushState);
|
|
|
|
|
|
Untility.SaveVision(package, compressName);
|
|
|
RefrushState("删除压缩");
|
|
@@ -111,7 +167,7 @@ namespace WPFTestUpdate
|
|
|
|
|
|
private void RefrushState(string str)
|
|
|
{
|
|
|
- this.Dispatcher.Invoke(() => { txtDiscription.Text = str ; }, DispatcherPriority.Send);
|
|
|
+ this.Dispatcher.Invoke(() => { txtDiscription.Text = str; }, DispatcherPriority.Send);
|
|
|
}
|
|
|
}
|
|
|
}
|