Beispiel #1
0
 public UpdateSourceUpdater([NotNull] IWurmAssistantService wurmAssistantMainService,
                            [NotNull] UserSettings userSettings)
 {
     if (wurmAssistantMainService == null)
     {
         throw new ArgumentNullException("wurmAssistantMainService");
     }
     if (userSettings == null)
     {
         throw new ArgumentNullException("userSettings");
     }
     this.wurmAssistantMainService = wurmAssistantMainService;
     this.userSettings             = userSettings;
 }
Beispiel #2
0
        public UpdateService([NotNull] ControllerConfig controllerConfig, IStagingLocation stagingLocation)
        {
            if (controllerConfig == null)
            {
                throw new ArgumentNullException("controllerConfig");
            }
            if (stagingLocation == null)
            {
                throw new ArgumentNullException("stagingLocation");
            }

            this.webServiceRootUrl = controllerConfig.WebServiceRootUrl;
            if (webServiceRootUrl.EndsWith("/"))
            {
                webServiceRootUrl = webServiceRootUrl.Substring(0, webServiceRootUrl.Length - 1);
            }

            this.stagingLocation      = stagingLocation;
            this.wurmAssistantService = new WurmAssistantService(webServiceRootUrl);
        }
Beispiel #3
0
        public ChooseApp([NotNull] IWurmAssistantService wurmAssistantService,
                         [NotNull] UserSettings settings)
        {
            if (wurmAssistantService == null)
            {
                throw new ArgumentNullException("wurmAssistantService");
            }
            if (settings == null)
            {
                throw new ArgumentNullException("settings");
            }
            this.wurmAssistantService = wurmAssistantService;
            this.settings             = settings;

            InitializeComponent();

            if (!string.IsNullOrWhiteSpace(settings.SpecificBuildNumber))
            {
                useSpecificBuildNumberCb.Checked = true;
                decimal value;
                if (decimal.TryParse(settings.SpecificBuildNumber, NumberStyles.Any, CultureInfo.InvariantCulture, out value))
                {
                    specificBuildNumberNb.Value = value;
                }
                else
                {
                    settings.SpecificBuildNumber = null;
                }
            }

            relativeDataDirPathCb.Checked = settings.UseRelativeDataDir;

            UpdateControls();

            timer1.Enabled = true;
        }
        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()));
                }
            }
        }