Ejemplo n.º 1
0
        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();
        }
        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();
        }
        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();
        }