auto updater. Done live on dev stream 1!

This commit is contained in:
Bitl 2020-02-16 20:48:26 -07:00
parent 1fca349c1d
commit a1e4a157b5
7 changed files with 78 additions and 0 deletions

View File

@ -51,12 +51,24 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GitHubUpdate, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GitHubUpdate.1.2.0.0\lib\net45\GitHubUpdate.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CSharp">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Mono.Nat">
<HintPath>..\packages\Mono.Nat.1.2.24.0\lib\net40\Mono.Nat.dll</HintPath>
</Reference>
<Reference Include="Octokit, Version=0.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Octokit.0.3.4\lib\net45\Octokit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -68,6 +80,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitHubUpdate" version="1.2.0.0" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net40" />
<package id="Octokit" version="0.3.4" targetFramework="net45" />
<package id="semver" version="1.1.2" targetFramework="net45" />
</packages>

View File

@ -27,6 +27,7 @@
<Compile Include="$(MSBuildThisFileDirectory)SplashReader.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TextLineRemover.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TreeNodeHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Updater.cs" />
<Compile Include="$(MSBuildThisFileDirectory)UPnP.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WebServer.cs" />
</ItemGroup>

View File

@ -0,0 +1,44 @@
using GitHubUpdate;
using System.Windows.Forms;
public class Updater
{
private string GitHubName = "";
private string GitHubRepo = "";
public Updater()
{
}
public void setName(string text)
{
GitHubName = text;
}
public void setRepo(string text)
{
GitHubRepo = text;
}
public async void UpdateNovetus()
{
var checker = new UpdateChecker(GitHubName, GitHubRepo, GlobalVars.Version);
UpdateType update = await checker.CheckUpdate();
if (update != UpdateType.None)
{
// Ask the user if he wants to update
// You can use the prebuilt form for this if you want (it's really pretty!)
var result = new UpdateNotifyDialog(checker).ShowDialog();
if (result == DialogResult.Yes)
{
checker.DownloadAsset("Release-" + checker.getCurrentRelease().TagName + ".zip"); // opens it in the user's browser
if (!string.IsNullOrWhiteSpace(checker.getDownloadOutcome()))
{
MessageBox.Show(checker.getDownloadOutcome(), "Novetus Updater", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
}

View File

@ -55,9 +55,21 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GitHubUpdate, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\GitHubUpdate.1.2.0.0\lib\net45\GitHubUpdate.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Mono.Nat">
<HintPath>..\packages\Mono.Nat.1.2.24.0\lib\net40\Mono.Nat.dll</HintPath>
</Reference>
<Reference Include="Octokit, Version=0.3.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Octokit.0.3.4\lib\net45\Octokit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@ -69,6 +81,7 @@
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />

View File

@ -1,4 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitHubUpdate" version="1.2.0.0" targetFramework="net45" />
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net40" />
<package id="Octokit" version="0.3.4" targetFramework="net45" />
<package id="semver" version="1.1.2" targetFramework="net45" />
</packages>

View File

@ -1,5 +1,6 @@
![Logo](https://github.com/Bitl/Novetus_src/raw/master/Graphics/NOVETUS_small.png)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/492ffef06085409ab50b73522e31be4c)](https://www.codacy.com/manual/Bitl/Novetus_src?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Bitl/Novetus_src&amp;utm_campaign=Badge_Grade)
[![Project Status: Active The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
Source code for Novetus' launcher, installer, LUA scripts, and server.