|
@@ -28,6 +28,7 @@ namespace fis.Managers
|
|
|
{
|
|
|
private UpgradeTypeEnum _currentUpdataType;
|
|
|
private UpgradeUpdateTypeEnum _currentUpdateWay;
|
|
|
+ private string _currentVersion;
|
|
|
private bool _runningFakeProgress;
|
|
|
private double _fakePrgoress;
|
|
|
private string _fileDownloadName;
|
|
@@ -51,12 +52,13 @@ namespace fis.Managers
|
|
|
_currentUpdataType = dataObj.UpgradeType;
|
|
|
|
|
|
_currentUpdateWay= dataObj.UpgradeUpdateType;
|
|
|
+ _currentVersion = dataObj.NewVersion;
|
|
|
var fileName = Path.GetFileName(dataObj.UpgradeCDNUrl);
|
|
|
if (!Directory.Exists(_upgadeDir))
|
|
|
{
|
|
|
Directory.CreateDirectory(_upgadeDir);
|
|
|
}
|
|
|
-
|
|
|
+ fileName = _currentUpdateWay == UpgradeUpdateTypeEnum.Part ? "flyinsono.zip" : "fis_package.zip";
|
|
|
var fileDownloadName = Path.Combine(_upgadeDir, fileName);
|
|
|
|
|
|
HttpHelper.OnDownloadProgressChanged += OnDowloadProgressChanged;
|
|
@@ -75,6 +77,7 @@ namespace fis.Managers
|
|
|
{
|
|
|
if (e)
|
|
|
{
|
|
|
+ VersionInfo.Instance.UpdateVersion(_currentVersion);
|
|
|
AppRestartHelper.RestartToUpgrade();
|
|
|
var args = new List<string>(){
|
|
|
"1.0",
|
|
@@ -119,16 +122,17 @@ namespace fis.Managers
|
|
|
private string _flyinsonoVersionStr;
|
|
|
private string _shellVersionStr;
|
|
|
private bool _noVersion;
|
|
|
+ private string _versionFilePath;
|
|
|
|
|
|
private VersionInfo()
|
|
|
{
|
|
|
- var versionFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Versions.txt");
|
|
|
- if (!File.Exists(versionFilePath))
|
|
|
+ _versionFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Versions.txt");
|
|
|
+ if (!File.Exists(_versionFilePath))
|
|
|
{
|
|
|
_noVersion = true;
|
|
|
return;
|
|
|
}
|
|
|
- var versionLines = File.ReadAllLines(versionFilePath);
|
|
|
+ var versionLines = File.ReadAllLines(_versionFilePath);
|
|
|
if (versionLines.Length >= 3)
|
|
|
{
|
|
|
_flyinsonoVersionStr = versionLines[1].Split("+")[0];
|
|
@@ -176,8 +180,16 @@ namespace fis.Managers
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public void UpdateVersion(string newVersion)
|
|
|
+ {
|
|
|
+ var versionStr = File.ReadAllText(_versionFilePath);
|
|
|
+ var newFullversion = $"Flyinsono={newVersion}";
|
|
|
+ var newVersionStrToWrited=versionStr.Replace(_flyinsonoVersionStr, newFullversion);
|
|
|
+ File.WriteAllText(_versionFilePath, newVersionStrToWrited);
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
- ///
|
|
|
+ /// 版本信息实例
|
|
|
/// </summary>
|
|
|
public static VersionInfo Instance
|
|
|
{
|