Ejemplo n.º 1
0
        /// <summary>
        /// Sets the page's DataContext, initializes it, and begins the update process.
        /// </summary>
        public UpdatingView()
        {
            DataContext = UpdatingViewModel.GetInstance;
            InitializeComponent();

            LoaderSetup settingUp = new LoaderSetup();

            Task.Run(() => UpdateHelpers.UpdateAll());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets the page's DataContext, initializes it, and begins the update process.
        /// </summary>
        public UpdatingView()
        {
            theViewModel = new UpdatingViewModel();
            DataContext  = theViewModel;
            InitializeComponent();

            LoaderSetup settingUp = new LoaderSetup(theViewModel);

            Task.Run(() => UpdateHelpers.UpdateAll(theViewModel));
        }
        /// <summary>
        /// Sets the page's DataContext, initializes it, and begins the update process.
        /// </summary>
        public UpdatingView()
        {
            DataContext = UpdatingViewModel.GetInstance;
            InitializeComponent();

            LoaderSetup settingUp = new LoaderSetup();

            Task.Run(() => UpdateHelpers.UpdateAll());

            launchOnClose.IsChecked = Configuration.getConfigAsYAML().launch_game;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sets the page's DataContext, initializes it, and begins the update process.
        /// </summary>
        public UpdatingView()
        {
            _configurationManager = new ConfigurationManager();
            DataContext           = UpdatingViewModel.GetInstance;
            InitializeComponent();

            LoaderSetup settingUp = new LoaderSetup(new ConfigurationManager());

            Task.Run(() => UpdateHelpers.UpdateAll());

            launchOnClose.IsChecked = _configurationManager.UserConfig.LaunchGame;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Checks if there is a new version of the application available.
        /// </summary>
        public void CheckSelfUpdates()
        {
            var release_info  = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);
            var latestVersion = release_info.tag_name;

            if (latestVersion == _configurationManager.ApplicationVersion)
            {
                return;
            }

            OpeningViewModel.GetInstance.UpdateAvailable      = $"{latestVersion} {StaticText.Available.ToLower()}!";
            OpeningViewModel.GetInstance.UpdateLinkVisibility = Visibility.Visible;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Checks for update to addon loader and downloads if a new release is available
        /// </summary>
        /// <returns></returns>
        public async Task handleLoaderInstall()
        {
            dynamic releaseInfo = UpdateHelpers.GitReleaseInfo(loader_git_url);

            latestLoaderVersion = releaseInfo.tag_name;

            if (userConfig.loader_version == latestLoaderVersion)
            {
                return;
            }

            string downloadLink = releaseInfo.assets[0].browser_download_url;

            await Download(downloadLink);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Checks if there is a new version of the application available.
        /// </summary>
        public static void CheckSelfUpdates()
        {
            string thisVersion = getConfigAsYAML().application_version;
            string latestVersion;

            dynamic release_info = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);

            latestVersion = release_info.tag_name;

            if (latestVersion != thisVersion)
            {
                OpeningViewModel.GetInstance.UpdateAvailable      = latestVersion + " available!";
                OpeningViewModel.GetInstance.UpdateLinkVisibility = Visibility.Visible;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Checks for update to addon loader and downloads if a new release is available
        /// </summary>
        /// <returns></returns>
        public async Task HandleLoaderUpdate()
        {
            dynamic releaseInfo = UpdateHelpers.GitReleaseInfo(loader_git_url);

            loader_destination = Path.Combine(loader_game_path, "d3d9.dll");

            latestLoaderVersion = releaseInfo.tag_name;

            if (File.Exists(loader_destination) && _configurationManager.UserConfig.LoaderVersion == latestLoaderVersion)
            {
                return;
            }

            string downloadLink = releaseInfo.assets[0].browser_download_url;

            await Download(downloadLink);
        }
        /***** UPDATE CHECK *****/

        /// <summary>
        /// Checks whether an update is required and performs it for an add-on hosted on Github.
        /// </summary>
        private async Task GitCheckUpdate()
        {
            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");

            dynamic release_info = UpdateHelpers.GitReleaseInfo(addon_info.host_url);

            latestVersion = release_info.tag_name;

            if (userConfig.version.ContainsKey(addon_name) && userConfig.version[addon_name] != null && latestVersion == userConfig.version[addon_name])
            {
                return;
            }

            string download_link = release_info.assets[0].browser_download_url;

            viewModel.ProgBarLabel = "Downloading " + addon_info.addon_name + " " + latestVersion;
            await Download(download_link, client);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Downloads the latest application release.
        /// </summary>
        /// <returns></returns>
        public async Task downloadLatestRelease()
        {
            //perhaps change this to check if downloaded update is latest or not
            if (Directory.Exists(update_folder))
            {
                Directory.Delete(update_folder, true);
            }

            dynamic latestInfo  = UpdateHelpers.GitReleaseInfo(applicationRepoUrl);
            string  downloadUrl = latestInfo.assets[0].browser_download_url;

            viewModel.UpdateAvailable = "Downloading " + latestInfo.tag_name;

            Directory.CreateDirectory(update_folder);
            WebClient client = new WebClient();

            client.Headers.Add("User-Agent", "request");
            client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(selfUpdate_DownloadProgress);
            client.DownloadFileCompleted   += new AsyncCompletedEventHandler(selfUpdate_DownloadCompleted);
            await client.DownloadFileTaskAsync(new System.Uri(downloadUrl), Path.Combine(update_folder, update_name));
        }
Ejemplo n.º 11
0
        /***** UPDATE CHECK *****/

        /// <summary>
        /// Checks whether an update is required and performs it for an add-on hosted on Github.
        /// </summary>
        private async Task GitCheckUpdate()
        {
            var client = new WebClient();

            client.Headers.Add("User-Agent", "request");

            dynamic release_info = UpdateHelpers.GitReleaseInfo(addon_info.host_url);

            latestVersion = release_info.tag_name;

            var currentAddonVersion = _configurationManager.UserConfig.AddonsList.FirstOrDefault(a => a.Name == addon_name);

            if (currentAddonVersion != null && currentAddonVersion.Version == latestVersion)
            {
                return;
            }

            string download_link = release_info.assets[0].browser_download_url;

            viewModel.ProgBarLabel = "Downloading " + addon_info.addon_name + " " + latestVersion;
            await Download(download_link, client);
        }