private string GetDebugeeTpkPath(string appId, Project proj)
            {
                if (pkgTracer.IsAppIdOnWaiting(appId))
                {
                    string waitingTpkPath  = pkgTracer.GetTpkPathByAppId(appId);
                    string waitingTpkPkgId = projHelper.GetPackageId(waitingTpkPath);

                    if (SDBLauncher.Create(null).IsPackageDetected(_device, waitingTpkPkgId))
                    {
                        return(waitingTpkPath);
                    }
                }

                return(projHelper.GetTizenPackagePath(proj));
            }
        private bool InstallTizenPackage(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions)
        {
            SDBLauncher.Create(VsPackage.outputPaneTizen).TerminateApplication(device, tDebugLaunchOptions.AppId);

            InstallResult installResult = Launcher.Create().InstallTizenPackage(device, tDebugLaunchOptions.TpkPath,
                                                                                null, VsPackage.dialogFactory, false, out lastErrorMessage);

            bool isInstallSucceeded = (installResult == InstallResult.OK);

            if (!isInstallSucceeded)
            {
                OutputDebugLaunchMessage(lastErrorMessage);
                ShowInstallError(installResult);
                TizenPackageTracer.CleanTpiFiles();
            }

            return(isInstallSucceeded);
        }
Exemplo n.º 3
0
        private bool NeedToInstall(SDBDeviceInfo device, string pathTpkFile, bool forceInstall)
        {
            string fileInstall = Path.GetFileNameWithoutExtension(pathTpkFile) + ".tpi";
            string pathInstall = Path.Combine(Path.GetDirectoryName(pathTpkFile), fileInstall);

            //check whether the package is installed on target/emulator or not.
            var             sdbLauncher   = SDBLauncher.Create(outputPane);
            VsProjectHelper projectHelper = VsProjectHelper.GetInstance;

            if (!sdbLauncher.ConnectBridge())
            {
                return(false);
            }

            string curPkgId = projectHelper.GetPackageId(pathTpkFile);//.GetAppId(curProject);

            if (forceInstall || !sdbLauncher.IsPackageDetected(device, curPkgId))
            {
                ClearInstallCheckFile(pathInstall);
            }

            if (!File.Exists(pathInstall))
            {
                TouchInstallCheckFile(pathInstall);
                return(true);
            }

            DateTime tpkTime = File.GetLastWriteTime(pathTpkFile);
            DateTime insTime = File.GetLastWriteTime(pathInstall);

            if (tpkTime <= insTime)
            {
                return(false);
            }

            TouchInstallCheckFile(pathInstall);
            return(true);
        }
        private bool LaunchDebugModeApplication(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions)
        {
            #region W/A launch due to not-implemented parameter(for debug) of runapp protocol
            switch (tDebugLaunchOptions.AppType)
            {
            case "watch-application":
            case "widget-application":
                SDBLauncher.Create(VsPackage.outputPaneTizen).LaunchApplication(device, DebugLaunchDataStore.WidgetViewerSdkAppId);
                break;
            }
            var  cap = new SDBCapability(device);
            bool startLiveProfiler = tDebugLaunchOptions.IsDebugMode && cap.GetAvailabilityByKey("netcoredbg_support") && DebuggerInfo.UseLiveProfiler;
            if (startLiveProfiler)
            {
                switch (tDebugLaunchOptions.AppType)
                {
                case "ui-application":
                case "service-application":
                    if (tDebugLaunchOptions is SecuredTizenDebugLaunchOptions)
                    {
                        startLiveProfiler = false;
                    }
                    break;

                default:
                    startLiveProfiler = false;
                    break;
                }
            }

            bool ok = true;
            if (startLiveProfiler)
            {
                var proc = StartSdbProcess("-s " + device.Serial + " forward --remove tcp:4712",
                                           "Removing port forward...", false);
                WaitProcessExit(proc, 5000);
                proc = StartSdbProcess("-s " + device.Serial + " forward tcp:4712 tcp:4711",
                                       "Forwarding port...");
                WaitProcessExit(proc, 5000);
                ok = ProfilerPlugin.Instance.StartProfiler(true); // StartProfiler checks whether the root mode is off
            }
            else
            {
                if (ProfilerPlugin.EnsureRootOff(device, ProfilerPlugin.RunMode.Debug)) // check the root mode is off
                {
                    foreach (var arg in tDebugLaunchOptions.LaunchSequence)
                    {
                        var proc = StartSdbProcess(arg.Args, arg.Message);
                        if (arg.Timeout != 0)
                        {
                            if (!WaitProcessExit(proc, arg.Timeout))
                            {
                                // TODO!! show diagnostics
                                ok = false;
                                break;
                            }
                        }
                    }
                }
            }

            return(ok);

            #endregion
        }
 private bool LaunchApplication(SDBDeviceInfo device, TizenDebugLaunchOptions tDebugLaunchOptions)
 {
     return(tDebugLaunchOptions.IsDebugMode ?
            LaunchDebugModeApplication(device, tDebugLaunchOptions) :
            SDBLauncher.Create(VsPackage.outputPaneTizen).LaunchApplication(device, tDebugLaunchOptions.AppId));
 }