From ba94d36a80f7a1a195196f8cc19aa8247a0ce336 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Wed, 12 Oct 2016 22:58:48 +0200 Subject: Added auto-update for WindowsService and Service. Needs some work otherwise the service will auto-update with a new sub-folder instead of autoupdate from the source folder. --- Duplicati/Service/Program.cs | 10 ++++++++-- Duplicati/WindowsService/Program.cs | 10 ++++++++-- Duplicati/WindowsService/WindowsService.csproj | 6 ++++++ 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'Duplicati') diff --git a/Duplicati/Service/Program.cs b/Duplicati/Service/Program.cs index a7fdc7ca6..17a01c82b 100644 --- a/Duplicati/Service/Program.cs +++ b/Duplicati/Service/Program.cs @@ -19,9 +19,15 @@ using System; namespace Duplicati.Service { - class MainClass + public class Program { - public static void Main(string[] args) + [STAThread] + public static int Main(string[] args) + { + return Duplicati.Library.AutoUpdater.UpdaterManager.RunFromMostRecent(typeof(Program).GetMethod("RealMain"), args, Duplicati.Library.AutoUpdater.AutoUpdateStrategy.Never); + } + + public static void RealMain(string[] args) { using(var runner = new Runner(args)) runner.Wait(); diff --git a/Duplicati/WindowsService/Program.cs b/Duplicati/WindowsService/Program.cs index ee0fc6ca9..9decd6f4e 100644 --- a/Duplicati/WindowsService/Program.cs +++ b/Duplicati/WindowsService/Program.cs @@ -9,9 +9,15 @@ using System.Threading.Tasks; namespace Duplicati.WindowsService { - class Program + public class Program { - public static void Main(string[] args) + [STAThread] + public static int Main(string[] args) + { + return Duplicati.Library.AutoUpdater.UpdaterManager.RunFromMostRecent(typeof(Program).GetMethod("RealMain"), args, Duplicati.Library.AutoUpdater.AutoUpdateStrategy.Never); + } + + public static void RealMain(string[] args) { var install = args != null && args.Where(x => string.Equals("install", x, StringComparison.OrdinalIgnoreCase)).Any(); var uninstall = args != null && args.Where(x => string.Equals("uninstall", x, StringComparison.OrdinalIgnoreCase)).Any(); diff --git a/Duplicati/WindowsService/WindowsService.csproj b/Duplicati/WindowsService/WindowsService.csproj index 8903bf209..0d0b15a46 100644 --- a/Duplicati/WindowsService/WindowsService.csproj +++ b/Duplicati/WindowsService/WindowsService.csproj @@ -73,6 +73,12 @@ + + + {7E119745-1F62-43F0-936C-F312A1912C0B} + Duplicati.Library.AutoUpdater + +