public void Start() { #if !DEBUG var freeSpaceDownload = (long)Util.GetDiskFreeSpace(_patchStore.Root.FullName); if (Downloads.Any(x => x.Patch.Length > freeSpaceDownload)) { OnFinish?.Invoke(this, false); MessageBox.Show(string.Format(Loc.Localize("FreeSpaceError", "There is not enough space on your drive to download patches.\n\nYou can change the location patches are downloaded to in the settings.\n\nRequired:{0}\nFree:{1}"), Util.BytesToString(Downloads.OrderByDescending(x => x.Patch.Length).First().Patch.Length), Util.BytesToString(freeSpaceDownload)), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } var freeSpaceGame = (long)Util.GetDiskFreeSpace(_gamePath.Root.FullName); if (freeSpaceGame < AllDownloadsLength) { OnFinish?.Invoke(this, false); MessageBox.Show(string.Format(Loc.Localize("FreeSpaceGameError", "There is not enough space on your drive to install patches.\n\nYou can change the location the game is installed to in the settings.\n\nRequired:{0}\nFree:{1}"), Util.BytesToString(AllDownloadsLength), Util.BytesToString(freeSpaceGame)), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } #endif _installer.StartIfNeeded(); _installer.WaitOnHello(); Task.Run(RunDownloadQueue, _cancelTokenSource.Token); Task.Run(RunApplyQueue, _cancelTokenSource.Token); }
public void Start() { #if !DEBUG var freeSpaceDownload = (long)Util.GetDiskFreeSpace(_patchStore.Root.FullName); if (Downloads.Any(x => x.Patch.Length > freeSpaceDownload)) { OnFinish?.Invoke(this, false); MessageBox.Show(string.Format(Loc.Localize("FreeSpaceError", "There is not enough space on your drive to download patches.\n\nYou can change the location patches are downloaded to in the settings.\n\nRequired:{0}\nFree:{1}"), Util.BytesToString(Downloads.OrderByDescending(x => x.Patch.Length).First().Patch.Length), Util.BytesToString(freeSpaceDownload)), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } // If the first 6 patches altogether are bigger than the patch drive, we might run out of space if (freeSpaceDownload < GetDownloadLength(6)) { OnFinish?.Invoke(this, false); MessageBox.Show(string.Format(Loc.Localize("FreeSpaceErrorAll", "There is not enough space on your drive to download all patches.\n\nYou can change the location patches are downloaded to in the XIVLauncher settings.\n\nRequired:{0}\nFree:{1}"), Util.BytesToString(AllDownloadsLength), Util.BytesToString(freeSpaceDownload)), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } var freeSpaceGame = (long)Util.GetDiskFreeSpace(_gamePath.Root.FullName); if (freeSpaceGame < AllDownloadsLength) { OnFinish?.Invoke(this, false); MessageBox.Show(string.Format(Loc.Localize("FreeSpaceGameError", "There is not enough space on your drive to install patches.\n\nYou can change the location the game is installed to in the settings.\n\nRequired:{0}\nFree:{1}"), Util.BytesToString(AllDownloadsLength), Util.BytesToString(freeSpaceGame)), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } #endif if (!_installer.StartIfNeeded()) { CustomMessageBox.Show(Loc.Localize("PatchManNoInstaller", "The patch installer could not start correctly.\n\nIf you have denied access to it, please try again. If this issue persists, please contact us via Discord."), "XIVLauncher Error", MessageBoxButton.OK, MessageBoxImage.Error); OnFinish?.Invoke(this, false); return; } _installer.WaitOnHello(); Task.Run(RunDownloadQueue, _cancelTokenSource.Token); Task.Run(RunApplyQueue, _cancelTokenSource.Token); }