コード例 #1
0
        internal int InstallFLEApk(string packageName, string apkPath)
        {
            Logger.Info("Installing apk: {0}", (object)apkPath);
            int num = BluestacksProcessHelper.RunApkInstaller(apkPath, true, this.ParentWindow.mVmName);

            Logger.Info("Apk installer exit code: {0}", (object)num);
            if (num == 0)
            {
                if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install_from_download", "success", "app_install", packageName, "", "");
                    DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                    this.UpdateCdnAppEntry(true, packageName, "");
                }
                else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install", "success", "app_install", packageName, "", "");
                    DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
                }
                this.ParentWindow.Utils.RunAppOrCreateTabButton(packageName);
                Logger.Info("Installation successful.");
                File.Delete(apkPath);
            }
            else
            {
                if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install_from_download", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                    DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                }
                else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
                {
                    ClientStats.SendClientStatsAsync("install", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                    DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
                }
                ClientStats.SendGeneralStats("apk_inst_error", new Dictionary <string, string>()
                {
                    {
                        "errcode",
                        Convert.ToString(num, (IFormatProvider)CultureInfo.InvariantCulture)
                    },
                    {
                        "precode",
                        "0"
                    },
                    {
                        "app_pkg",
                        packageName
                    }
                });
            }
            Logger.Info("Install Completed : " + packageName);
            return(num);
        }
コード例 #2
0
 internal void InstallApk(
     string packageName,
     string apkPath,
     bool isLaunchAfterInstall,
     bool isDeleteApk,
     string timestamp = "")
 {
     this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallStart(packageName, apkPath);
     DownloadInstallApk.SerialWorkQueueInstaller(this.ParentWindow.mVmName).Enqueue((SerialWorkQueue.Work)(() =>
     {
         Logger.Info("Installing apk: {0}", (object)apkPath);
         int num = BluestacksProcessHelper.RunApkInstaller(apkPath, true, this.ParentWindow.mVmName);
         Logger.Info("Apk installer exit code: {0}", (object)num);
         if (num == 0)
         {
             if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install_from_download", "success", "app_install", packageName, "", "");
                 DownloadInstallApk.sDownloadedApkList.Remove(packageName);
                 this.UpdateCdnAppEntry(true, packageName, timestamp);
             }
             else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install", "success", "app_install", packageName, "", "");
                 DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
             }
             this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallCompleted(packageName);
             if (isLaunchAfterInstall)
             {
                 this.ParentWindow.Utils.RunAppOrCreateTabButton(packageName);
             }
             Logger.Info("Installation successful.");
             if (isDeleteApk)
             {
                 File.Delete(apkPath);
             }
             Logger.Info("Install Completed : " + packageName);
         }
         else
         {
             if (DownloadInstallApk.sDownloadedApkList.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install_from_download", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                 DownloadInstallApk.sDownloadedApkList.Remove(packageName);
             }
             else if (DownloadInstallApk.sApkInstalledFromChooser.Contains(packageName))
             {
                 ClientStats.SendClientStatsAsync("install", "fail", "app_install", packageName, num.ToString((IFormatProvider)CultureInfo.InvariantCulture), "");
                 DownloadInstallApk.sApkInstalledFromChooser.Remove(packageName);
             }
             ClientStats.SendGeneralStats("apk_inst_error", new Dictionary <string, string>()
             {
                 {
                     "errcode",
                     Convert.ToString(num, (IFormatProvider)CultureInfo.InvariantCulture)
                 },
                 {
                     "precode",
                     "0"
                 },
                 {
                     "app_pkg",
                     packageName
                 }
             });
             this.ParentWindow.mWelcomeTab.mHomeAppManager.ApkInstallFailed(packageName);
         }
     }));
 }