示例#1
0
        public void Start()
        {
            var platform = manager.GetPlatform(new ObjectId(deviceInfo.PlatformId));

            currentDevice = platform.GetDevice(new ObjectId(deviceInfo.DeviceId));

            currentDevice.Connect();
        }
示例#2
0
        public static Device GetDevice()
        {
            DatastoreManager dsm        = new DatastoreManager(1033);
            ObjectId         pocketPCId = new ObjectId(POCKET_PC_PLATFORM_ID);
            Platform         platform   = dsm.GetPlatform(pocketPCId);

            ObjectId pocketPC2003VGA = new ObjectId("E282E6BE-C7C3-4ece-916A-88FB1CF8AF3C");

            return(platform.GetDevice(pocketPC2003VGA));
        }
示例#3
0
        static int Main(string[] args)
        {
            try
            {
                if (args.Length != 4)
                {
                    Usage();
                    return 1;
                }

                string platformId = args[0];
                string deviceId = args[1];
                string packageID;

                switch (args[2])
                {
                    case "2.0":
                        packageID = NetCf20PackageId;
                        break;

                    case "3.5":
                        packageID = NetCf35PackageId;
                        break;

                    default:
                        packageID = args[2];
                        break;
                }

                string cabName = args[3];

                // Get the datastore object
                var dsmgr = new DatastoreManager(1033);

                var platform = dsmgr.GetPlatform(new ObjectId(platformId));
                var device = platform.GetDevice(new ObjectId(deviceId));

                Console.WriteLine("Connecting to device...");
                device.Connect();

                FileDeployer fileDeployer = device.GetFileDeployer();

                Console.WriteLine("Deploying package...");
                fileDeployer.DownloadPackage(new ObjectId(packageID));

                Console.WriteLine("Installing package...");
                RemoteProcess installer = device.GetRemoteProcess();
                installer.Start("wceload.exe", cabName);
                while (installer.HasExited() != true)
                {
                    System.Threading.Thread.Sleep(1000);
                }
                var exitCode = installer.GetExitCode();
                if (exitCode != 0)
                {
                    Console.WriteLine("Installation failed. Exit code: {0}", exitCode);
                }
                else
                {
                    Console.WriteLine("Installation succeeded.");
                }
                return exitCode;
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: {0}", ex);
                return 1;
            }
        }
示例#4
0
		public static Device GetDevice()
		{
			DatastoreManager dsm = new DatastoreManager(1033);
			ObjectId pocketPCId = new ObjectId(POCKET_PC_PLATFORM_ID);
			Platform platform = dsm.GetPlatform(pocketPCId);

			ObjectId pocketPC2003VGA = new ObjectId("E282E6BE-C7C3-4ece-916A-88FB1CF8AF3C");
			return platform.GetDevice(pocketPC2003VGA);
		}
示例#5
0
 internal static XapDeployer.DeployResult InstallApplication(XapDeployer.DeviceInfoClass DeviceInfoClass, Guid appGuid, Version appVersion, string applicationGenre, string iconFile, string xapFile, XapDeployer.DeployBehaviourType DeployBehaviourType, ref Exception Exception)
 {
     Exception = null;
     try
     {
         DatastoreManager datastoreManager1 = new DatastoreManager(CultureInfo.CurrentUICulture.LCID);
         if (datastoreManager1 != null)
         {
             Platform platform1 = datastoreManager1.GetPlatform(new ObjectId(DeviceInfoClass.PlatformId));
             if (platform1 != null)
             {
                 Device device1 = platform1.GetDevice(new ObjectId(DeviceInfoClass.DeviceId));
                 if (device1 != null)
                 {
                     device1.Connect();
                     SystemInfo systemInfo1 = device1.GetSystemInfo();
                     Version    version1    = new Version(systemInfo1.OSMajor, systemInfo1.OSMinor);
                     bool       flag1       = appVersion.CompareTo(version1) > 0;
                     if (flag1)
                     {
                         device1.Disconnect();
                         return(XapDeployer.DeployResult.NotSupported);
                     }
                     flag1 = device1.IsApplicationInstalled(appGuid);
                     if (flag1)
                     {
                         bool flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.SkipApplication;
                         if (flag2)
                         {
                             device1.Disconnect();
                             return(XapDeployer.DeployResult.Success);
                         }
                         else
                         {
                             RemoteApplication remoteApplication1 = device1.GetApplication(appGuid);
                             flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.ForceUninstall;
                             if (flag2)
                             {
                                 remoteApplication1.Uninstall();
                             }
                             else
                             {
                                 flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.UpdateApplication;
                                 if (flag2)
                                 {
                                     remoteApplication1.UpdateApplication(applicationGenre, iconFile, xapFile);
                                     device1.Disconnect();
                                     return(XapDeployer.DeployResult.Success);
                                 }
                             }
                         }
                     }
                     device1.InstallApplication(appGuid, appGuid, applicationGenre, iconFile, xapFile);
                     device1.Disconnect();
                     return(XapDeployer.DeployResult.Success);
                 }
             }
         }
     }
     catch (Exception e)
     {
         return(XapDeployer.DeployResult.DeployError);
     }
     return(XapDeployer.DeployResult.DeployError);
 }
示例#6
0
        static int Main(string[] args)
        {
            try
            {
                if (args.Length != 4)
                {
                    Usage();
                    return(1);
                }

                string platformId = args[0];
                string deviceId   = args[1];
                string packageID;

                switch (args[2])
                {
                case "2.0":
                    packageID = NetCf20PackageId;
                    break;

                case "3.5":
                    packageID = NetCf35PackageId;
                    break;

                default:
                    packageID = args[2];
                    break;
                }

                string cabName = args[3];

                // Get the datastore object
                var dsmgr = new DatastoreManager(1033);

                var platform = dsmgr.GetPlatform(new ObjectId(platformId));
                var device   = platform.GetDevice(new ObjectId(deviceId));

                Console.WriteLine("Connecting to device...");
                device.Connect();

                FileDeployer fileDeployer = device.GetFileDeployer();

                Console.WriteLine("Deploying package...");
                fileDeployer.DownloadPackage(new ObjectId(packageID));

                Console.WriteLine("Installing package...");
                RemoteProcess installer = device.GetRemoteProcess();
                installer.Start("wceload.exe", cabName);
                while (installer.HasExited() != true)
                {
                    System.Threading.Thread.Sleep(1000);
                }
                var exitCode = installer.GetExitCode();
                if (exitCode != 0)
                {
                    Console.WriteLine("Installation failed. Exit code: {0}", exitCode);
                }
                else
                {
                    Console.WriteLine("Installation succeeded.");
                }
                return(exitCode);
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: {0}", ex);
                return(1);
            }
        }
示例#7
0
 internal static XapDeployer.DeployResult InstallApplication(XapDeployer.DeviceInfoClass DeviceInfoClass, Guid appGuid, Version appVersion, string applicationGenre, string iconFile, string xapFile, XapDeployer.DeployBehaviourType DeployBehaviourType, ref Exception Exception)
 {
     Exception = null;
     try
     {
         DatastoreManager datastoreManager1 = new DatastoreManager(CultureInfo.CurrentUICulture.LCID);
         if (datastoreManager1 != null)
         {
             Platform platform1 = datastoreManager1.GetPlatform(new ObjectId(DeviceInfoClass.PlatformId));
             if (platform1 != null)
             {
                 Device device1 = platform1.GetDevice(new ObjectId(DeviceInfoClass.DeviceId));
                 if (device1 != null)
                 {
                     device1.Connect();
                     SystemInfo systemInfo1 = device1.GetSystemInfo();
                     Version version1 = new Version(systemInfo1.OSMajor, systemInfo1.OSMinor);
                     bool flag1 = appVersion.CompareTo(version1) > 0;
                     if (flag1)
                     {
                         device1.Disconnect();
                         return XapDeployer.DeployResult.NotSupported;
                     }
                     flag1 = device1.IsApplicationInstalled(appGuid);
                     if (flag1)
                     {
                         bool flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.SkipApplication;
                         if (flag2)
                         {
                             device1.Disconnect();
                             return XapDeployer.DeployResult.Success;
                         }
                         else
                         {
                             RemoteApplication remoteApplication1 = device1.GetApplication(appGuid);
                             flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.ForceUninstall;
                             if (flag2)
                             {
                                 remoteApplication1.Uninstall();
                             }
                             else
                             {
                                 flag2 = DeployBehaviourType == XapDeployer.DeployBehaviourType.UpdateApplication;
                                 if (flag2)
                                 {
                                     remoteApplication1.UpdateApplication(applicationGenre, iconFile, xapFile);
                                     device1.Disconnect();
                                     return XapDeployer.DeployResult.Success;
                                 }
                             }
                         }
                     }
                     device1.InstallApplication(appGuid, appGuid, applicationGenre, iconFile, xapFile);
                     device1.Disconnect();
                     return XapDeployer.DeployResult.Success;
                 }
             }
         }
     }
     catch (Exception e)
     {
         return XapDeployer.DeployResult.DeployError;
     }
     return XapDeployer.DeployResult.DeployError;
 }