Ejemplo n.º 1
0
        async Task CheckAndDownloadLatestPackage(IWurmAssistantService wurmAssistantService, Launcher launcher,
            LauncherData launcherData)
        {
            Version remoteVersion = null;
            try
            {
                remoteVersion = await wurmAssistantService.GetLatestVersionAsync(gui);
            }
            catch (Exception exception)
            {
                launcher.WriteErrorFile(
                    string.Format("Launcher failed to check latest WA version. Error: {0}",
                        exception.ToString()));
            }

            if (remoteVersion != null && launcherData.WurmAssistantInstalledVersion < remoteVersion)
            {
                try
                {
                    await wurmAssistantService.GetPackageAsync(gui, remoteVersion);
                    // done - next run will install this staged version
                }
                catch (Exception exception)
                {
                    launcher.WriteErrorFile(
                        string.Format("Launcher failed to download latest WA version. Error: {0}",
                            exception.ToString()));
                }
            }
        }