private void BackupThread_DoWork(
            object sender,
            DoWorkEventArgs e,
            string dataDir,
            string path,
            ref string destination)
        {
            Logger.Info("In Do Work");
            string           dirPath = path;
            DataManagerCodes flag    = DataManagerCodes.DEFAULT;

            if (path == null)
            {
                this.progress.Dispatcher.Invoke((Delegate)(() =>
                {
                    this.progress.mLastRow.Height = new GridLength(20.0, GridUnitType.Star);
                    this.progress.mProgressHeader.Text = LocaleStrings.GetLocalizedString("STRING_CREATING_BACKUP", "");
                    this.progress.mProgressText.Text = LocaleStrings.GetLocalizedString("STRING_BACKUP_PLEASE_WAIT", "");
                    flag = this.SelectBackupFolder(ref dirPath);
                    if (flag != DataManagerCodes.CANCEL)
                    {
                        return;
                    }
                    e.Result = (object)flag;
                }));
                try
                {
                    if (new DriveInfo(Path.GetPathRoot(dirPath)).AvailableFreeSpace < 5368709120L)
                    {
                        this.progress.Dispatcher.Invoke((Delegate)(() =>
                        {
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            customMessageWindow.TitleTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_INSUFFICIENT_SPACE", "");
                            customMessageWindow.AddAboveBodyWarning(LocaleStrings.GetLocalizedString("STRING_BACKUP_DISK_SPACE_FULL_WARNING", ""));
                            customMessageWindow.BodyTextBlock.Text = LocaleStrings.GetLocalizedString("STRING_BACKUP_DISK_SPACE_FULL_MESSAGE", "");
                            customMessageWindow.AboveBodyWarningTextBlock.Visibility = Visibility.Visible;
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CHANGE_LOCATION", (EventHandler)((obj, e1) =>
                            {
                                flag = this.SelectBackupFolder(ref dirPath);
                                if (flag != DataManagerCodes.CANCEL)
                                {
                                    return;
                                }
                                e.Result = (object)flag;
                            }), (string)null, false, (object)null, true);
                            customMessageWindow.AddButton(ButtonColors.White, "STRING_CONTINUE", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.Owner = (Window)this.progress;
                            customMessageWindow.ShowInTaskbar = true;
                            customMessageWindow.Title = Strings.ProductDisplayName;
                            customMessageWindow.ShowDialog();
                        }));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Warning("Exception while checking available space in the backup directory: " + ex.ToString());
                    throw;
                }
            }
            if (!string.IsNullOrEmpty(dirPath))
            {
                if (this.CheckForValidBackupPath(dirPath))
                {
                    Stats.SendMiscellaneousStatsAsync("BackupAndRestoreStats", nameof(Backup), RegistryManager.Instance.UserGuid, RegistryManager.Instance.ClientVersion, RegistryManager.Instance.Version, "Backup Started", (string)null, (string)null, (string)null, "Android", 0);
                    e.Result = (object)this.ActualBackup(dataDir, dirPath, ref destination);
                    if ((int)e.Result != -4)
                    {
                        return;
                    }
                    e.Cancel = true;
                }
                else
                {
                    Logger.Error("Invalid Path selected path = " + dirPath);
                    DataManagerUtils.ShowErrorMsg(LocaleStrings.GetLocalizedString("STRING_BACKUP_ERROR_INVALID_PATH_SELECTED", ""), LocaleStrings.GetLocalizedString("STRING_BACKUP_FAILURE", ""), this.progress);
                    e.Result = (object)DataManagerCodes.ERROR_IN_CREATING_BACKUP_INVALID_PATH_SELECTED;
                }
            }
            else
            {
                Logger.Error("Path is empty");
                DataManagerUtils.ShowErrorMsg(LocaleStrings.GetLocalizedString("STRING_BACKUP_ERROR_INVALID_PATH_SELECTED", ""), LocaleStrings.GetLocalizedString("STRING_BACKUP_FAILURE", ""), this.progress);
                e.Result = (object)DataManagerCodes.NO_PATH_CHOSEN;
            }
        }
        internal void StartFrontend()
        {
            ThreadPool.QueueUserWorkItem((WaitCallback)(obj =>
            {
                Logger.Info("BOOT_STAGE: Starting player");
                if (ProcessUtils.IsLockInUse(Strings.GetPlayerLockName(this.mVmName, "bgp")))
                {
                    this.KillFrontend(true);
                }
                this.mEventOnFrontendClosed = (EventHandler)null;
                this.mIsSufficientRAMAvailable = true;
                this.IsRestartFrontendWhenClosed = true;
                this.mFrontendStartTime = DateTime.Now;
                int num = BluestacksProcessHelper.StartFrontend(this.mVmName);
                if (this.ParentWindow == null)
                {
                    this.WaitForParentWindowInit();
                }
                if (this.ParentWindow != null)
                {
                    switch (num)
                    {
                    case -10:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            string url = (string)null;
                            url = WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null);
                            url = string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}&article={1}", (object)url, (object)"enable_virtualization");
                            string path = "STRING_VTX_DISABLED_ENABLEIT_BODY";
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_RESTART_UTILITY_CANNOT_START", "");
                            customMessageWindow.AddAboveBodyWarning(LocaleStrings.GetLocalizedString("STRING_VTX_DISABLED_WARNING", ""));
                            customMessageWindow.AboveBodyWarningTextBlock.Visibility = Visibility.Visible;
                            customMessageWindow.MessageIcon.VerticalAlignment = VerticalAlignment.Center;
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, path, "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CHECK_FAQ", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(url)), (string)null, false, (object)null, true);
                            customMessageWindow.AddButton(ButtonColors.White, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -7:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("VBox couldn't detect driver");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_ENGINE_FAIL_HEADER", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_COULDNT_BOOT_TRY_RESTART", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_RESTART_PC", new EventHandler(this.RestartPCEvent), (string)null, false, (object)null, true);
                            customMessageWindow.AddButton(ButtonColors.White, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -6:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Unable to initialise audio on this machine");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            customMessageWindow.ImageName = "sound_error";
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_AUDIO_SERVICE_FAILURE", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlockTitle, "STRING_AUDIO_SERVICE_FAILUE_FIX", "");
                            customMessageWindow.BodyTextBlockTitle.Visibility = Visibility.Visible;
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_AUDIO_SERVICE_FAILURE_ALTERNATE_FIX", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_READ_MORE", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null) + "&article=audio_service_issue")), "external_link", true, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -5:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Hyper v enabled on this machine");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_RESTART_UTILITY_CANNOT_START", "");
                            customMessageWindow.AddWarning(LocaleStrings.GetLocalizedString("STRING_HYPERV_ENABLED_WARNING", ""), "message_error");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_HYPERV_ENABLED_MESSAGE", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_CHECK_FAQ", (EventHandler)((sender1, e1) => BlueStacksUIUtils.OpenUrl(WebHelper.GetUrlWithParams(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "{0}/{1}", (object)WebHelper.GetServerHost(), (object)"help_articles"), (string)null, (string)null, (string)null) + "&article=disable_hypervisor")), (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    case -2:
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            Logger.Error("Android File Integrity check failed");
                            CustomMessageWindow customMessageWindow = new CustomMessageWindow();
                            BlueStacksUIBinding.Bind(customMessageWindow.TitleTextBlock, "STRING_CORRUPT_INSTALLATION", "");
                            BlueStacksUIBinding.Bind(customMessageWindow.BodyTextBlock, "STRING_CORRUPT_INSTALLATION_MESSAGE", "");
                            customMessageWindow.AddButton(ButtonColors.Blue, "STRING_EXIT", (EventHandler)null, (string)null, false, (object)null, true);
                            customMessageWindow.ShowDialog();
                            App.ExitApplication();
                        }));
                        break;

                    default:
                        if (!this.IsRestartFrontendWhenClosed)
                        {
                            break;
                        }
                        this.ParentWindow.Dispatcher.Invoke((Delegate)(() =>
                        {
                            if (this.frontendRestartAttempts >= 2)
                            {
                                return;
                            }
                            ++this.frontendRestartAttempts;
                            this.ParentWindow.RestartFrontend();
                        }));
                        break;
                    }
                }
                else
                {
                    Logger.Error("parent window is null for vmName: {0} and frontend Exit code: {1}", (object)this.mVmName, (object)num);
                }
            }));
        }