示例#1
0
        protected override bool GetPkgInstalledStatus(out bool isInstalled)
        {
            isInstalled  = false;
            ErrorMessage = string.Empty;

            PkgInstalledStatusWaiter waiter = new PkgInstalledStatusWaiter();
            string  argument = DeviceManager.AdjustSdbArgument("shell 0 vs_lldbversion");
            Process process  = SDBLib.CreateSdbProcess(true, true);
            var     result   = (process == null) ? null : SDBLib.RunSdbProcessAsync(process, argument, true, waiter);

            if (!waiter.Waiter.WaitOne(30000))
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: Timeout");
                return(false);
            }

            try
            {
                Version installedLldbVersion = new Version(waiter.InstalledStatus);
                Version lldbRpmFileVersion   = new Version(lldbVersion);

                if (installedLldbVersion >= lldbRpmFileVersion)
                {
                    OutputDeviceErrorMsg("GetPkgInstalledStatus (already installed): " + lldbPkgName);
                    isInstalled = true;
                }

                return(true);
            }
            catch (Exception e)
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: " + e.Message);
                return(false);
            }
        }
示例#2
0
        protected virtual bool GetPkgInstalledStatus(out bool isInstalled)
        {
            isInstalled  = false;
            ErrorMessage = string.Empty;

            PkgInstalledStatusWaiter waiter2 = new PkgInstalledStatusWaiter();
            string argument = DeviceManager.AdjustSdbArgument(
                "shell \"rpm -qa | grep " + lldbPkgName + "\"");
            Process process = SDBLib.CreateSdbProcess(true, true);
            var     result  = (process == null) ? null : SDBLib.RunSdbProcessAsync(process, argument, true, waiter2);

            if (!waiter2.Waiter.WaitOne(30000))
            {
                OutputDeviceErrorMsg("GetPkgInstalledStatus failed: " + lldbPkgName);
                return(false);
            }

            if (!string.IsNullOrEmpty(waiter2.InstalledStatus))
            {
                Version installedLldbVersion = new Version(waiter2.InstalledStatus.Split('-')[1]);
                Version lldbRpmFileVersion   = new Version(lldbVersion);

                if (installedLldbVersion >= lldbRpmFileVersion)
                {
                    OutputDeviceErrorMsg("GetPkgInstalledStatus (already installed): " + lldbPkgName);
                    isInstalled = true;
                }
            }

            return(true);
        }