Merge remote-tracking branch 'origin/clint' into jun5

This commit is contained in:
dovholuknf
2020-06-12 08:07:19 -04:00
3 changed files with 18 additions and 6 deletions
+7 -3
View File
@@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<appSettings>
<add key="UpdateUrl" value="https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/maven-metadata.xml"/>
<add key="Version" value="latest"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
+7 -2
View File
@@ -13,13 +13,15 @@ using System.Net;
using System.Timers;
using System.Management.Automation;
using System.Xml;
using System.Configuration;
using System.Collections.Specialized;
namespace ZitiUpdateService {
public partial class UpdateService : ServiceBase {
private string _version = "";
private bool _isNew = true;
private int _majorVersion = 1;
/// private int _majorVersion = 1;
private string _versionUrl = "https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/maven-metadata.xml";
private string _serviceUrl = "https://netfoundry.jfrog.io/netfoundry/ziti-maven-snapshot/ziti-tunnel-win/amd64/windows/ziti-tunnel-win/${version}/ziti-tunnel-win-${version}.zip";
private System.Timers.Timer _checkTimer = new System.Timers.Timer();
@@ -27,6 +29,7 @@ namespace ZitiUpdateService {
private string _rootDirectory = "";
private string _logDirectory = "";
private bool _isJustStopped = true;
private string _versionType = "release";
ServiceController controller;
public UpdateService() {
@@ -34,6 +37,8 @@ namespace ZitiUpdateService {
}
protected override void OnStart(string[] args) {
if (ConfigurationManager.AppSettings.Get("UpdateUrl")!=null) _versionUrl = ConfigurationManager.AppSettings.Get("UpdateUrl");
if (ConfigurationManager.AppSettings.Get("Version") !=null) _versionType = ConfigurationManager.AppSettings.Get("Version");
_rootDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "NetFoundry");
if (!Directory.Exists(_rootDirectory)) Directory.CreateDirectory(_rootDirectory);
_logDirectory = Path.Combine(_rootDirectory, "Logs");
@@ -90,7 +95,7 @@ namespace ZitiUpdateService {
var result = readStream.ReadToEnd();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(result);
XmlNode node = xmlDoc.SelectSingleNode("metadata/versioning/release");
XmlNode node = xmlDoc.SelectSingleNode("metadata/versioning/"+ _versionType);
string version = node.InnerText;
Log("Version Checked: " + version+" on "+_version);
if (version != _version) {
+4 -1
View File
@@ -75,6 +75,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
@@ -108,7 +109,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<Content Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
<None Include="ZitiUpdateService_TemporaryKey.pfx" />