private void Verify_Click(object sender, RoutedEventArgs e)
        {
            string torrentUrl;
            if (!GameUpdater.HttpGet("http://www.zombies.nu/dayzerotorrent.txt", out torrentUrl))
            {
                InfoPopup popup = new InfoPopup();
                popup.Headline.Content = "An Error occured.";
                popup.Message.Content = "Could not contact Zombies.nu.\nPlease try again.";
                popup.Owner = popup.Owner = MainWindow.GetWindow(this.Parent);
                popup.Title = "Error";
                popup.Show();
                return;
            }
            else
            {
                TorrentState state = TorrentUpdater.CurrentState();
                if (state == TorrentState.Stopped)
                {
                    TorrentUpdater verifier = new TorrentUpdater(torrentUrl); // Sets up launcher to start checking files.
                    verifier.StartTorrents(1);
                }
                FileVerifierPopup popup = new FileVerifierPopup();
                popup.Owner = MainWindow.GetWindow(this.Parent);
                popup.Headline.Content = "Please Wait";
                popup.Title = "Please Wait";

                popup.Show();
            }
        }
Exemple #2
0
        public DayZUpdater()
        {
            Installer = new DayZInstaller();
            Installer.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "IsRunning")
                {
                    PropertyHasChanged("InstallButtonVisible");
                }
                else if (args.PropertyName == "Status")
                {
                    if (Installer.Status == "Install complete")
                    {
                        CheckForUpdates();
                    }
                }
            };
            string responseBody;

            if (!GameUpdater.HttpGet(dayZeroVersionUrl, out responseBody))
            {
                Status = "Zombies.nu not responding";
                return;
            }
            Version version;

            if (Version.TryParse(responseBody, out version))
            {
                if (version.Equals(CalculatedGameSettings.Current.DayZVersion)) // If version is up to date. Seed.
                {
                    string torrentUrl;
                    if (!GameUpdater.HttpGet(dayZeroTorrentFileUrl, out torrentUrl))
                    {
                        Status = "Zombies.nu not responding";
                        return;
                    }
                    TorrentUpdater seeder = new TorrentUpdater(torrentUrl); // Sets up launcher to start seeding current build.
                    seeder.StartTorrents(1);
                }
            }
        }
 public DayZUpdater()
 {
     Installer = new DayZInstaller();
     Installer.PropertyChanged += (sender, args) =>
                                  	{
                                         if(args.PropertyName == "IsRunning")
                                         {
                                             PropertyHasChanged("InstallButtonVisible");
                                         }
                                         else if(args.PropertyName == "Status")
                                         {
                                             if(Installer.Status == "Install complete")
                                             {
                                                 CheckForUpdates();
                                             }
                                         }
                                  	};
     string responseBody;
     if (!GameUpdater.HttpGet(dayZeroVersionUrl, out responseBody))
     {
         Status = "Zombies.nu not responding";
         return;
     }
     Version version;
     if (Version.TryParse(responseBody, out version))
     {
         if (version.Equals(CalculatedGameSettings.Current.DayZVersion)) // If version is up to date. Seed.
         {
             string torrentUrl;
             if (!GameUpdater.HttpGet(dayZeroTorrentFileUrl, out torrentUrl))
             {
                 Status = "Zombies.nu not responding";
                 return;
             }
             TorrentUpdater seeder = new TorrentUpdater(torrentUrl); // Sets up launcher to start seeding current build.
             seeder.StartTorrents(1);
         }
     }
 }
        private void GetDayZFiles(DayZUpdater updater)
        {
            TorrentUpdater tu = new TorrentUpdater(_latestDownloadUrl, this, updater);

            tu.StartTorrents(1000);
        }
        private void ContinueFromContentFile(string versionString, string metaJsonFilename, bool forceFullSystemsCheck,
			DayZUpdater updater, bool errorMsgsOnly)
        {
            MetaModDetails modDetails = null;
            bool fullSystemCheck = true;
            try
            {
                modDetails = MetaModDetails.LoadFromFile(metaJsonFilename);
                if (!forceFullSystemsCheck)
                {
                    CalculatedGameSettings.Current.Update();
                    if (versionString.Equals(CalculatedGameSettings.Current.ModContentVersion, StringComparison.OrdinalIgnoreCase))
                        fullSystemCheck = false;
                }
            }
            catch (Exception ex)
            {
                updater.Status = "Error parsing content index file";
                Status = ex.Message;
                IsRunning = false;
                _gameLauncher.SetModDetails(null, false, ex);
            }

            //start new torrents if needed
            if (modDetails != null)
            {
                _gameLauncher.SetModDetails(modDetails);

                //stop existing torrents going on
                if (_torrentUpdater != null)
                {
                    TorrentUpdater.StopAllTorrents();
                    _torrentUpdater = null;
                }
                _torrentUpdater = new TorrentUpdater(versionString, modDetails.AddOns, fullSystemCheck, this, updater, errorMsgsOnly);
                    //this automatically starts it's async thread
            }
        }
 private void GetDayZFiles(DayZUpdater updater)
 {
     TorrentUpdater tu = new TorrentUpdater(_latestDownloadUrl, this, updater);
     tu.StartTorrents(1000);
 }