protected override void StartInternal() { string destFolder = game.GameFolder; if (Directory.Exists(destFolder)) // assume it's already there { status = ITaskStatus.SUCCESS; } else { unpacker = new UnpackerTask(game.PackedFilePath, destFolder, game.ExeFile); if (File.Exists(unpacker.Filename)) { unpacker.Start(); status = unpacker.Status(); statusMsg = unpacker.StatusMsg(); } else { status = ITaskStatus.FAIL; statusMsg = "Missing file " + unpacker.Filename; } } game.Refresh(); }
protected override void StartInternal() { // do the checking if already installed game.Refresh(); if (game.IsInstalled) { status = ITaskStatus.SUCCESS; return; } // start the download task downloadTask = new GameDownloader(game); downloadTask.Start(); if (downloadTask.IsSuccess()) { Thread.Sleep(100); // check if folder already there // if download ready and OK, start install installTask = new InstallTask(game); installTask.Start(); status = installTask.Status(); statusMsg = installTask.StatusMsg(); // remove the zip file string fn = GardenConfig.Instance.GetPackedFilepath(game); if (fn != null && fn.Length > 0) { try { File.Delete(fn); } catch (Exception) { ; // TODO? } } } else { // error in downloading process - no install status = ITaskStatus.FAIL; statusMsg = downloadTask.StatusMsg(); } game.Refresh(); }
// shorthand method to select the game currently indicated by cursor protected void SelectGameBelowCursor() { if (gl != null) { GardenItem g = gl.FindGameAt(cursor.GridPosition); SelectedGame = g; infoBox.ClearProgressBar(); if (g != null && !g.IsVisible) // reset back to null for invisible items. Not selectable. { SelectedGame = null; } if (g != null) { g.Refresh(); } } }
protected override void StartInternal() { // do the checking if already installed game.Refresh(); if (game.IsInstalled) { status = ITaskStatus.SUCCESS; return; } // start the download task downloadTask = new GameDownloader(game); downloadTask.Start(); if (downloadTask.IsSuccess()) { Thread.Sleep(100); // check if folder already there // if download ready and OK, start install installTask = new InstallTask(game); installTask.Start(); status = installTask.Status(); statusMsg = installTask.StatusMsg(); // install failed? remove the zip file and the game dir if (status == ITaskStatus.FAIL) { string fn = game.PackedFilePath; if (fn != null && fn.Length > 0) { try { File.Delete(fn); } catch (Exception) { ; // TODO? } } if (!game.IsBundleItem) { fn = game.GameFolder; if (fn != null && fn.Length > 0) { try { Directory.Delete(fn, true); } catch (Exception) { ; // TODO? } } } } } else { // error in downloading process - no install status = ITaskStatus.FAIL; statusMsg = downloadTask.StatusMsg(); } game.Refresh(); }