Exemplo n.º 1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
            Version version        = Assembly.GetExecutingAssembly().GetName().Version;
            string  currentVersion = $"{version.Major}.{version.Minor}.{version.Revision}";

            Console.WriteLine("Hello World! :) You are currently running " + currentVersion);

            // check for updates
            CincinnatiClient cincinnatiClient = CincinnatiClientBuilder.GetBuilder()
                                                .WithServerUrl(updateServer)
                                                .WithReleaseChannel("stable")
                                                .Build(new HttpClient());
            var availableUpgrades = cincinnatiClient.GetNextApplicationVersions(currentVersion).GetAwaiter().GetResult();

            if (availableUpgrades.Count == 1)
            {
                isUpdateAvailable = true;
                string newVersion           = availableUpgrades[0].Version;
                string installerWebLocation = availableUpgrades[0].Metadata["installer"];
                Console.WriteLine("Downloading update for version " + newVersion);
                installerLocation = Path.Join(Path.GetTempPath(), $"AutoUpdateSample.{newVersion}.msi");
                using var client  = new WebClient();
                client.DownloadFile(installerWebLocation, installerLocation);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CincinnatiClient cincinnatiClient = CincinnatiClientBuilder.GetBuilder()
                                                .WithServerUrl("http://localhost:8081")
                                                .WithReleaseChannel("stable")
                                                .Build(new HttpClient());
            List <Node> nextVersions = cincinnatiClient.GetNextApplicationVersions("1.0.0").GetAwaiter().GetResult();

            foreach (var nextVersion in nextVersions)
            {
                Console.WriteLine("Next version is " + nextVersion.Version);
            }
        }