internal XapDeployer.DeployState Deploy(XapDeployer.DeviceInfoClass device, XapDeployer.DeployBehaviourType DeployBehaviourType, ref Exception Exception) { XapDeployer.DeployState Deploy; Exception = null; bool flag = !File.Exists(XapPath); if (flag) { Deploy = XapDeployer.DeployState.NotFound; } else { flag = !IsValid; if (flag) { Deploy = XapDeployer.DeployState.InvalidXap; } else { string tmpXapFile = Path.GetTempFileName(); File.Copy(XapPath, tmpXapFile, true); File.SetAttributes(tmpXapFile, FileAttributes.Normal); XapDeployer.DeviceInfoClass devinfo = device; XapDeployer.DeployResult Result = XapDeployer.InstallApplication(devinfo, Info.Guid, Info.PlatformVersion, "NormalApp", Info.TempIconFileName, tmpXapFile, DeployBehaviourType, ref Exception); File.Delete(tmpXapFile); flag = (Result == XapDeployer.DeployResult.DeployError) | (Result == XapDeployer.DeployResult.NoConnect) | (Result == XapDeployer.DeployResult.NotSupported); if (flag) { Deploy = XapDeployer.DeployState.DeployError; } else { Deploy = XapDeployer.DeployState.Success; } } } return(Deploy); }
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; }
internal XapDeployer.DeployState Deploy(XapDeployer.DeviceInfoClass device, XapDeployer.DeployBehaviourType DeployBehaviourType, ref Exception Exception) { XapDeployer.DeployState Deploy; Exception = null; bool flag = !File.Exists(XapPath); if (flag) { Deploy = XapDeployer.DeployState.NotFound; } else { flag = !IsValid; if (flag) { Deploy = XapDeployer.DeployState.InvalidXap; } else { string tmpXapFile = Path.GetTempFileName(); File.Copy(XapPath, tmpXapFile, true); File.SetAttributes(tmpXapFile, FileAttributes.Normal); XapDeployer.DeviceInfoClass devinfo = device; XapDeployer.DeployResult Result = XapDeployer.InstallApplication(devinfo, Info.Guid, Info.PlatformVersion, "NormalApp", Info.TempIconFileName, tmpXapFile, DeployBehaviourType, ref Exception); File.Delete(tmpXapFile); flag = (Result == XapDeployer.DeployResult.DeployError) | (Result == XapDeployer.DeployResult.NoConnect) | (Result == XapDeployer.DeployResult.NotSupported); if (flag) Deploy = XapDeployer.DeployState.DeployError; else Deploy = XapDeployer.DeployState.Success; } } return Deploy; }