mirror of
https://github.com/openziti/desktop-edge-win.git
synced 2026-10-13 00:02:50 +00:00
refactor the checks to a sub-namespace. add some code that will check for the legacy OpenZitiWintunInstaller and remove it
This commit is contained in:
@@ -50,6 +50,6 @@ using System.Windows;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.6.30.0")]
|
||||
[assembly: AssemblyVersion("1.6.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.30.0")]
|
||||
// [assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.0.0")]
|
||||
|
||||
@@ -151,7 +151,6 @@
|
||||
<ROW Property="AI_SETUPEXEPATH" Signature_="AI_EXE_PATH_CU" Builds="DefaultBuild;AnyCPU_Release"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiBinaryComponent">
|
||||
<ROW Name="PowerShellScriptLauncher.dll" SourcePath="<AI_CUSTACTS>PowerShellScriptLauncher.dll"/>
|
||||
<ROW Name="Prereq.dll" SourcePath="<AI_CUSTACTS>Prereq.dll"/>
|
||||
<ROW Name="ResourceCleaner.dll" SourcePath="<AI_CUSTACTS>ResourceCleaner.dll"/>
|
||||
<ROW Name="SoftwareDetector.dll" SourcePath="<AI_CUSTACTS>SoftwareDetector.dll"/>
|
||||
@@ -203,7 +202,6 @@
|
||||
<ROW Action="AI_ConfigFailActions" Type="11265" Source="aicustact.dll" Target="ConfigureServFailActions" WithoutSeq="true"/>
|
||||
<ROW Action="AI_DATA_SETTER" Type="51" Source="CustomActionData" Target="[AI_SETUPEXEPATH]"/>
|
||||
<ROW Action="AI_DATA_SETTER_1" Type="51" Source="CustomActionData" Target="[~]"/>
|
||||
<ROW Action="AI_DATA_SETTER_2" Type="51" Source="CustomActionData" Target="AEQAaQBnAGkAdABhAGwAbAB5AFMAaQBnAG4AUwBjAHIAaQBwAHQAAgABAEYAbABhAGcAcwACADYAAQBQAGEAcgBhAG0AcwACAAEAUwBjAHIAaQBwAHQAAgAkAE8AWgBXAEkAPQBHAGUAdAAtAFcAbQBpAE8AYgBqAGUAYwB0ACAALQBDAGwAYQBzAHMAIABXAGkAbgAzADIAXwBQAHIAbwBkAHUAYwB0ACAAfAAgAFcAaABlAHIAZQAtAE8AYgBqAGUAYwB0AFsAXAB7AF0AJABfAC4ATgBhAG0AZQAgAC0AZQBxACAAIgBPAHAAZQBuAFoAaQB0AGkAVwBpAG4AdAB1AG4ASQBuAHMAdABhAGwAbABlAHIAIgBbAFwAfQBdAA0ACgBlAGMAaABvACAAJABPAFoAVwBJACAAPgA+ACAAYwA6AFwAdABlAG0AcABcAHIAYQBuAC4AdAB4AHQADQAKAGkAZgAoACQATwBaAFcASQApACAAWwBcAHsAXQANAAoAIAAgAGUAYwBoAG8AIAAiAHMAdABhAHIAdABpAG4AZwAgAHUAbgBpAG4AcwB0AGEAbABsACIAIAA+AD4AIABjADoAXAB0AGUAbQBwAFwAcgBhAG4ALgB0AHgAdAANAAoAIAAgACQATwBaAFcASQAuAFUAbgBpAG4AcwB0AGEAbABsACgAKQANAAoAIAAgAGUAYwBoAG8AIAAiAGMAbwBtAHAAbABlAHQAZQBkACAAdQBuAGkAbgBzAHQAYQBsAGwAIgAgAD4APgAgAGMAOgBcAHQAZQBtAHAAXAByAGEAbgAuAHQAeAB0AA0ACgBbAFwAfQBdACAAZQBsAHMAZQAgAFsAXAB7AF0AIAANAAoAIAAgAGUAYwBoAG8AIAAiAE8AWgBXAEkAIABuAG8AdAAgAGYAbwB1AG4AZAA/ACIAIAA+AD4AIABjADoAXAB0AGUAbQBwAFwAcgBhAG4ALgB0AHgAdAANAAoAWwBcAH0AXQANAAoAZQBjAGgAbwAgACIAPQA9AD0APQA9AD0APQA9AD0APQA9AD0APQAgAGMAbwBtAHAAbABlAHQAZQAgAD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0AIgAgAD4APgAgAGMAOgBcAHQAZQBtAHAAXAByAGEAbgAuAHQAeAB0"/>
|
||||
<ROW Action="AI_DOWNGRADE" Type="19" Target="4010"/>
|
||||
<ROW Action="AI_DeleteCadLzma" Type="51" Source="AI_DeleteLzma" Target="[AI_SETUPEXEPATH]"/>
|
||||
<ROW Action="AI_DeleteLzma" Type="1025" Source="lzmaextractor.dll" Target="DeleteLZMAFiles"/>
|
||||
@@ -226,7 +224,6 @@
|
||||
<ROW Action="AI_RunFinishActions" Type="1" Source="aicustact.dll" Target="RunFinishActions" WithoutSeq="true"/>
|
||||
<ROW Action="AI_SHOW_LOG" Type="65" Source="aicustact.dll" Target="LaunchLogFile" WithoutSeq="true"/>
|
||||
<ROW Action="AI_STORE_LOCATION" Type="51" Source="ARPINSTALLLOCATION" Target="[APPDIR]"/>
|
||||
<ROW Action="PowerShellScriptInline" Type="65" Source="PowerShellScriptLauncher.dll" Target="RunPowerShellScript" Options="1" AdditionalSeq="AI_DATA_SETTER_2"/>
|
||||
<ROW Action="SET_APPDIR" Type="307" Source="APPDIR" Target="[ProgramFilesFolder][Manufacturer]\[ProductName]" MultiBuildTarget="DefaultBuild:[ProgramFiles64Folder][Manufacturer]\[ProductName]#AnyCPU_Release:[ProgramFiles64Folder][Manufacturer]\[ProductName]"/>
|
||||
<ROW Action="SET_SHORTCUTDIR" Type="307" Source="SHORTCUTDIR" Target="[ProgramMenuFolder][ProductName]"/>
|
||||
<ROW Action="SET_TARGETDIR_TO_APPDIR" Type="51" Source="TARGETDIR" Target="[APPDIR]"/>
|
||||
@@ -278,8 +275,6 @@
|
||||
<ROW Action="AI_AiBackupRollback" Sequence="1501"/>
|
||||
<ROW Action="AI_AiRestoreDeferredImpersonate" Sequence="6598"/>
|
||||
<ROW Action="AI_AiRestoreDeferred" Sequence="6599"/>
|
||||
<ROW Action="PowerShellScriptInline" Sequence="6602"/>
|
||||
<ROW Action="AI_DATA_SETTER_2" Sequence="6601"/>
|
||||
</COMPONENT>
|
||||
<COMPONENT cid="caphyon.advinst.msicomp.MsiInstallUISequenceComponent">
|
||||
<ROW Action="AI_RESTORE_LOCATION" Condition="APPDIR=""" Sequence="749"/>
|
||||
|
||||
@@ -22,9 +22,6 @@ echo "Updating the version for UI and Installer"
|
||||
echo "Building the UI"
|
||||
msbuild ZitiDesktopEdge.sln /property:Configuration=Release
|
||||
|
||||
echo "Building the Wintun installer"
|
||||
msbuild ZitiWintunInstaller.sln /p:configuration=Release
|
||||
|
||||
Pop-Location
|
||||
|
||||
$ADVINST = "C:\Program Files (x86)\Caphyon\Advanced Installer 17.8\bin\x86\AdvancedInstaller.com"
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace ZitiUpdateService {
|
||||
interface IUpdateCheck {
|
||||
int IsUpdateAvailable(Version current);
|
||||
string FileName();
|
||||
void CopyUpdatePackage(string destinationFolder, string destinationName);
|
||||
bool AlreadyDownloaded(string destinationFolder, string destinationName);
|
||||
bool HashIsValid(string destinationFolder, string destinationName);
|
||||
Version GetNextVersion();
|
||||
}
|
||||
}
|
||||
@@ -30,6 +30,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.6.30.0")]
|
||||
[assembly: AssemblyVersion("1.6.30.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.30.0")]
|
||||
// [assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyVersion("1.7.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.7.0.0")]
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Management;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NLog;
|
||||
|
||||
namespace ZitiUpdateService {
|
||||
internal class UninstallOpenZitiWintun {
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
public static void DetectAndUninstallOpenZitiWintun() {
|
||||
Task.Run(() => {
|
||||
Logger.Debug("Checking to see if the legacy OpenZitiWintunInstaller is installed");
|
||||
try {
|
||||
bool r = UninstallOpenZitiWintunInstaller();
|
||||
if (r) {
|
||||
Logger.Info("removed legacy OpenZitiWintunInstaller");
|
||||
} else {
|
||||
Logger.Debug("OpenZitiWintunInstaller is not installed");
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
Logger.Error(ex, "There was a problem invoking UninstallOpenZitiWintunInstaller!");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static bool UninstallOpenZitiWintunInstaller() {
|
||||
ManagementObjectSearcher mos = new ManagementObjectSearcher("SELECT * FROM Win32_Product WHERE Name = 'OpenZitiWintunInstaller'");
|
||||
foreach (ManagementObject mo in mos.Get()) {
|
||||
var hr = mo.InvokeMethod("Uninstall", null);
|
||||
return hr != null;
|
||||
}
|
||||
//was not found...
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,15 +6,13 @@ using System.IO;
|
||||
using System.Timers;
|
||||
using System.Configuration;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ZitiDesktopEdge.DataStructures;
|
||||
using NLog;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
using NLog;
|
||||
using ZitiDesktopEdge.DataStructures;
|
||||
using ZitiDesktopEdge.ServiceClient;
|
||||
using ZitiDesktopEdge.Server;
|
||||
using System.Security.AccessControl;
|
||||
using System.Security.Principal;
|
||||
using System.IO.Compression;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
@@ -37,6 +35,7 @@ namespace ZitiUpdateService {
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private Timer _updateTimer = new Timer();
|
||||
private Timer openzitiRemovalTimer = new Timer();
|
||||
private bool inUpdateCheck = false;
|
||||
|
||||
private string exeLocation = null;
|
||||
@@ -52,7 +51,7 @@ namespace ZitiUpdateService {
|
||||
IPCServer svr = new IPCServer();
|
||||
Task ipcServer = null;
|
||||
Task eventServer = null;
|
||||
IUpdateCheck check = null;
|
||||
checkers.UpdateCheck check = null;
|
||||
|
||||
public UpdateService() {
|
||||
InitializeComponent();
|
||||
@@ -203,10 +202,10 @@ namespace ZitiUpdateService {
|
||||
//means it doesn't exist
|
||||
}
|
||||
return zipName;
|
||||
} catch(Exception ex) {
|
||||
} catch (Exception ex) {
|
||||
Logger.Error(ex, "Unexpected error {0}", ex.Message);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void outputIpconfigInfo(string destinationFolder) {
|
||||
@@ -328,9 +327,11 @@ namespace ZitiUpdateService {
|
||||
await writer.FlushAsync();
|
||||
}
|
||||
|
||||
#pragma warning disable 1998 //This async method lacks 'await'
|
||||
async private Task onIpcClientAsync(StreamWriter writer) {
|
||||
Logger.Info("a new ipc client was connected");
|
||||
}
|
||||
#pragma warning restore 1998 //This async method lacks 'await'
|
||||
|
||||
private void addLogsFolder(string path) {
|
||||
if (!Directory.Exists(path)) {
|
||||
@@ -393,6 +394,9 @@ namespace ZitiUpdateService {
|
||||
_updateTimer.Start();
|
||||
Logger.Info("Version Checker is running every {0} minutes", upInt.TotalMinutes);
|
||||
|
||||
//on startup - see if the old wintun software was installed and if so ... try to remove it
|
||||
UninstallOpenZitiWintun.DetectAndUninstallOpenZitiWintun();
|
||||
|
||||
string assemblyVersionStr = Assembly.GetExecutingAssembly().GetName().Version.ToString(); //fetch from ziti?
|
||||
assemblyVersion = new Version(assemblyVersionStr);
|
||||
asmDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
@@ -421,9 +425,9 @@ namespace ZitiUpdateService {
|
||||
updateUrl = "https://api.github.com/repos/openziti/desktop-edge-win-beta/releases/latest";
|
||||
}
|
||||
if (useGithubCheck) {
|
||||
check = new GithubCheck(updateUrl);
|
||||
check = new checkers.GithubCheck(updateUrl);
|
||||
} else {
|
||||
check = new FilesystemCheck(1);
|
||||
check = new checkers.FilesystemCheck(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,10 +545,10 @@ namespace ZitiUpdateService {
|
||||
|
||||
private void scanForStaleDownloads(string folder) {
|
||||
try {
|
||||
if (!Directory.Exists(folder)) {
|
||||
if (!Directory.Exists(folder)) {
|
||||
Logger.Debug("folder {0} does not exist. skipping", folder);
|
||||
return;
|
||||
}
|
||||
}
|
||||
Logger.Info("Scanning for stale downloads");
|
||||
foreach (var f in Directory.EnumerateFiles(folder)) {
|
||||
FileInfo fi = new FileInfo(f);
|
||||
@@ -552,7 +556,7 @@ namespace ZitiUpdateService {
|
||||
if (fi.Name.StartsWith(filePrefix)) {
|
||||
Logger.Debug("scanning for staleness: " + f);
|
||||
string ver = Path.GetFileNameWithoutExtension(f).Substring(filePrefix.Length);
|
||||
Version fileVersion = VersionUtil.NormalizeVersion(new Version(ver));
|
||||
Version fileVersion = checkers.UpdateCheck.NormalizeVersion(new Version(ver));
|
||||
if (isOlder(fileVersion)) {
|
||||
Logger.Info("Removing old download: " + fi.Name);
|
||||
fi.Delete();
|
||||
|
||||
@@ -105,7 +105,8 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IUpdateCheck.cs" />
|
||||
<Compile Include="checkers\FilesystemCheck.cs" />
|
||||
<Compile Include="checkers\GithubCheck.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="ProjectInstaller.cs">
|
||||
<SubType>Component</SubType>
|
||||
@@ -113,7 +114,8 @@
|
||||
<Compile Include="ProjectInstaller.Designer.cs">
|
||||
<DependentUpon>ProjectInstaller.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UpdateCheckers.cs" />
|
||||
<Compile Include="checkers\UpdateCheckers.cs" />
|
||||
<Compile Include="UninstallOpenZitiWintun.cs" />
|
||||
<Compile Include="UpdateService.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using NLog;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ZitiUpdateService.checkers {
|
||||
internal class FilesystemCheck : UpdateCheck {
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
string dest = null;
|
||||
|
||||
int isUpdateAvailable = 1;
|
||||
public FilesystemCheck(int updateAvailable) {
|
||||
this.isUpdateAvailable = updateAvailable;
|
||||
}
|
||||
|
||||
override public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
|
||||
return File.Exists(Path.Combine(destinationFolder, destinationName));
|
||||
}
|
||||
|
||||
override public void CopyUpdatePackage(string destinationFolder, string destinationName) {
|
||||
dest = Path.Combine(destinationFolder, destinationName);
|
||||
File.Copy(@"C:\git\github\openziti\desktop-edge-win\Installer\Output\" + FileName(), dest);
|
||||
}
|
||||
|
||||
override public string FileName() {
|
||||
return "Ziti Desktop Edge Client-1.3.0.exe";
|
||||
}
|
||||
|
||||
override public int IsUpdateAvailable(Version current) {
|
||||
return isUpdateAvailable;
|
||||
}
|
||||
|
||||
override public bool HashIsValid(string destinationFolder, string destinationName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
override public Version GetNextVersion() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,16 +7,9 @@ using System.Security.Cryptography;
|
||||
using NLog;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace ZitiUpdateService {
|
||||
internal static class VersionUtil {
|
||||
public static Version NormalizeVersion(Version v) {
|
||||
if (v.Minor < 1) return new Version(v.Major, 0, 0, 0);
|
||||
if (v.Build < 1) return new Version(v.Major, v.Minor, 0, 0);
|
||||
if (v.Revision < 1) return new Version(v.Major, v.Minor, v.Build, 0);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
internal class GithubCheck : IUpdateCheck {
|
||||
namespace ZitiUpdateService.checkers {
|
||||
|
||||
internal class GithubCheck : UpdateCheck {
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
string url;
|
||||
string downloadUrl = null;
|
||||
@@ -28,11 +21,11 @@ namespace ZitiUpdateService {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
|
||||
override public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
|
||||
return File.Exists(Path.Combine(destinationFolder, destinationName));
|
||||
}
|
||||
|
||||
public void CopyUpdatePackage(string destinationFolder, string destinationName) {
|
||||
override public void CopyUpdatePackage(string destinationFolder, string destinationName) {
|
||||
WebClient webClient = new WebClient();
|
||||
string dest = Path.Combine(destinationFolder, destinationName);
|
||||
Logger.Info("download started for: {0} to {1}", downloadUrl, dest);
|
||||
@@ -40,11 +33,11 @@ namespace ZitiUpdateService {
|
||||
Logger.Info("download complete to: {0}", dest);
|
||||
}
|
||||
|
||||
public string FileName() {
|
||||
override public string FileName() {
|
||||
return downloadFileName;
|
||||
}
|
||||
|
||||
public int IsUpdateAvailable(Version currentVersion) {
|
||||
override public int IsUpdateAvailable(Version currentVersion) {
|
||||
Logger.Debug("checking for update begins. current version detected as {0}", currentVersion);
|
||||
Logger.Debug("issuing http get to url: {0}", url);
|
||||
HttpWebRequest httpWebRequest = WebRequest.CreateHttp(url);
|
||||
@@ -66,7 +59,7 @@ namespace ZitiUpdateService {
|
||||
break;
|
||||
} else {
|
||||
Logger.Debug("skipping asset with name: {assetName}", assetName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadUrl == null) {
|
||||
@@ -79,7 +72,7 @@ namespace ZitiUpdateService {
|
||||
|
||||
string releaseVersion = json.Property("tag_name").Value.ToString();
|
||||
string releaseName = json.Property("name").Value.ToString();
|
||||
nextVersion = VersionUtil.NormalizeVersion(new Version(releaseVersion));
|
||||
nextVersion = NormalizeVersion(new Version(releaseVersion));
|
||||
int compare = currentVersion.CompareTo(nextVersion);
|
||||
if (compare < 0) {
|
||||
Logger.Info("upgrade {} is available. Published version: {} is newer than the current version: {}", releaseName, nextVersion, currentVersion);
|
||||
@@ -92,7 +85,7 @@ namespace ZitiUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
public bool HashIsValid(string destinationFolder, string destinationName) {
|
||||
override public bool HashIsValid(string destinationFolder, string destinationName) {
|
||||
WebClient webClient = new WebClient();
|
||||
string sha256dest = Path.Combine(destinationFolder, destinationName + ".sha256");
|
||||
string downloadUrlsha256 = downloadUrl + ".sha256";
|
||||
@@ -101,7 +94,7 @@ namespace ZitiUpdateService {
|
||||
Logger.Info("download complete to: {0}", sha256dest);
|
||||
|
||||
string dest = Path.Combine(destinationFolder, destinationName);
|
||||
string hash = File.ReadAllText(sha256dest);
|
||||
string hash = File.ReadAllText(sha256dest);
|
||||
|
||||
using (SHA256 hasher = SHA256.Create())
|
||||
using (FileStream stream = File.OpenRead(dest)) {
|
||||
@@ -113,43 +106,8 @@ namespace ZitiUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
public Version GetNextVersion() {
|
||||
override public Version GetNextVersion() {
|
||||
return nextVersion;
|
||||
}
|
||||
}
|
||||
|
||||
internal class FilesystemCheck : IUpdateCheck {
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
string dest = null;
|
||||
|
||||
int isUpdateAvailable = 1;
|
||||
public FilesystemCheck(int updateAvailable) {
|
||||
this.isUpdateAvailable = updateAvailable;
|
||||
}
|
||||
|
||||
public bool AlreadyDownloaded(string destinationFolder, string destinationName) {
|
||||
return File.Exists(Path.Combine(destinationFolder, destinationName));
|
||||
}
|
||||
|
||||
public void CopyUpdatePackage(string destinationFolder, string destinationName) {
|
||||
dest = Path.Combine(destinationFolder, destinationName);
|
||||
File.Copy(@"C:\git\github\openziti\desktop-edge-win\Installer\Output\" + FileName(), dest);
|
||||
}
|
||||
|
||||
public string FileName() {
|
||||
return "Ziti Desktop Edge Client-1.3.0.exe";
|
||||
}
|
||||
|
||||
public int IsUpdateAvailable(Version current) {
|
||||
return isUpdateAvailable;
|
||||
}
|
||||
|
||||
public bool HashIsValid(string destinationFolder, string destinationName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public Version GetNextVersion() {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NLog;
|
||||
|
||||
namespace ZitiUpdateService.checkers {
|
||||
|
||||
abstract class UpdateCheck {
|
||||
public abstract int IsUpdateAvailable(Version current);
|
||||
public abstract string FileName();
|
||||
public abstract void CopyUpdatePackage(string destinationFolder, string destinationName);
|
||||
public abstract bool AlreadyDownloaded(string destinationFolder, string destinationName);
|
||||
public abstract bool HashIsValid(string destinationFolder, string destinationName);
|
||||
public abstract Version GetNextVersion();
|
||||
|
||||
public static Version NormalizeVersion(Version v) {
|
||||
if (v.Minor < 1) return new Version(v.Major, 0, 0, 0);
|
||||
if (v.Build < 1) return new Version(v.Major, v.Minor, 0, 0);
|
||||
if (v.Revision < 1) return new Version(v.Major, v.Minor, v.Build, 0);
|
||||
return v;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
wintun*msm
|
||||
@@ -1,33 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
||||
<Product Id="*" Name="OpenZitiWintunInstaller" Language="1033" Version="1.0.0.0" Manufacturer="Ziti" UpgradeCode="1abdbe15-0f36-4633-ba6f-8a32d8cf4838">
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" Platform="x64"/>
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
||||
<MediaTemplate />
|
||||
|
||||
<DirectoryRef Id="INSTALLFOLDER">
|
||||
<Merge Id="WintunMergeModule" Language="0" DiskId="1" SourceFile="wintun-amd64-0.8.1.msm" />
|
||||
</DirectoryRef>
|
||||
<Feature Id="WintunFeature" Title="Wintun" Level="1">
|
||||
<MergeRef Id="WintunMergeModule" />
|
||||
</Feature>
|
||||
</Product>
|
||||
|
||||
<Fragment>
|
||||
<Directory Id="TARGETDIR" Name="SourceDir">
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
<Directory Id="INSTALLFOLDER" Name="OpenZitiWintunInstaller" />
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Fragment>
|
||||
|
||||
<Fragment>
|
||||
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
|
||||
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
|
||||
<!-- <Component Id="ProductComponent"> -->
|
||||
<!-- TODO: Insert files, registry keys, and other resources here. -->
|
||||
<!-- </Component> -->
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>3.10</ProductVersion>
|
||||
<ProjectGuid>1a5d850f-2e38-4524-8745-29a96fa62683</ProjectGuid>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputName>OpenZitiWintunInstaller</OutputName>
|
||||
<OutputType>Package</OutputType>
|
||||
<Name>NFWintunInstaller</Name>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
<DefineConstants>Debug</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Product.wxs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
|
||||
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
|
||||
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>echo Inside Pre-build event about to download wintun
|
||||
echo from: https://www.wintun.net/builds/wintun-amd64-0.8.1.msm
|
||||
echo into $(MSBuildProjectFullPath)\wintun-amd64-0.8.1.msm
|
||||
|
||||
call powershell "Invoke-WebRequest https://www.wintun.net/builds/wintun-amd64-0.8.1.msm -OutFile $(ProjectDir)wintun-amd64-0.8.1.msm"</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!--
|
||||
To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Wix.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user