static void Main(string[] args) { if ((args.Length == 2) && (args[0].Equals("-iphonepackager"))) { // We were run as a 'child' process, quit when our 'parent' process exits // There is no parent-child relationship WRT windows, it's self-imposed. int ParentPID = int.Parse(args[1]); IpcServerChannel Channel = new IpcServerChannel("iPhonePackager"); ChannelServices.RegisterChannel(Channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentImplementation), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton); Process ParentProcess = Process.GetProcessById(ParentPID); while (!ParentProcess.HasExited) { System.Threading.Thread.Sleep(1000); } } else { // Run directly by some intrepid explorer Console.WriteLine("Note: This program should only be started by iPhonePackager"); Console.WriteLine(" This program cannot be used on it's own."); DeploymentImplementation Deployer = new DeploymentImplementation(); var DeviceList = Deployer.EnumerateConnectedDevices(); foreach (var Device in DeviceList) { Console.WriteLine(" - Found device named {0} of type {1} with UDID {2}", Device.DeviceName, Device.DeviceType, Device.UDID); } Console.WriteLine("Exiting."); } }
static int Main(string[] args) { if ((args.Length == 2) && (args[0].Equals("-iphonepackager"))) { try { // We were run as a 'child' process, quit when our 'parent' process exits // There is no parent-child relationship WRT windows, it's self-imposed. int ParentPID = int.Parse(args[1]); DeploymentProxy.Deployer = new DeploymentImplementation(); IpcServerChannel Channel = new IpcServerChannel("iPhonePackager"); ChannelServices.RegisterChannel(Channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentProxy), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton); Process ParentProcess = Process.GetProcessById(ParentPID); while (!ParentProcess.HasExited) { CoreFoundation.RunLoopRunInMode(CoreFoundation.kCFRunLoopDefaultMode(), 1.0, 0); } } catch (System.Exception Ex) { Console.WriteLine(Ex.Message); } } else { // Parse the command if (ParseCommand(args)) { Deployer = new DeploymentImplementation(); bool bCommandComplete = false; System.Threading.Thread enumerateLoop = new System.Threading.Thread(delegate() { RunCommand(); bCommandComplete = true; }); enumerateLoop.Start(); while (!bCommandComplete) { CoreFoundation.RunLoopRunInMode(CoreFoundation.kCFRunLoopDefaultMode(), 1.0, 0); } } Console.WriteLine("Exiting."); } Environment.ExitCode = Program.ExitCode; return(Program.ExitCode); }
static int Main(string[] args) { if ((args.Length == 2) && (args[0].Equals("-iphonepackager"))) { try { // We were run as a 'child' process, quit when our 'parent' process exits // There is no parent-child relationship WRT windows, it's self-imposed. int ParentPID = int.Parse(args[1]); DeploymentProxy.Deployer = new DeploymentImplementation(); IpcServerChannel Channel = new IpcServerChannel("iPhonePackager"); ChannelServices.RegisterChannel(Channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentProxy), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton); Process ParentProcess = Process.GetProcessById(ParentPID); while (!ParentProcess.HasExited) { CoreFoundationRunLoop.RunLoopRunInMode(CoreFoundationRunLoop.kCFRunLoopDefaultMode(), 1.0, 0); } } catch (System.Exception Ex) { Console.WriteLine(Ex.Message); } } else { // Parse the command if (ParseCommand(args)) { Deployer = new DeploymentImplementation(); bool bCommandComplete = false; System.Threading.Thread enumerateLoop = new System.Threading.Thread(delegate() { RunCommand(); bCommandComplete = true; }); enumerateLoop.Start(); while (!bCommandComplete) { CoreFoundationRunLoop.RunLoopRunInMode(CoreFoundationRunLoop.kCFRunLoopDefaultMode(), 1.0, 0); } } Console.WriteLine("Exiting."); } Environment.ExitCode = Program.ExitCode; return Program.ExitCode; }
static void Main(string[] args) { if ((args.Length == 2) && (args[0].Equals("-iphonepackager"))) { try { // We were run as a 'child' process, quit when our 'parent' process exits // There is no parent-child relationship WRT windows, it's self-imposed. int ParentPID = int.Parse(args[1]); IpcServerChannel Channel = new IpcServerChannel("iPhonePackager"); ChannelServices.RegisterChannel(Channel, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(DeploymentImplementation), "DeploymentServer_PID" + ParentPID.ToString(), WellKnownObjectMode.Singleton); Process ParentProcess = Process.GetProcessById(ParentPID); while (!ParentProcess.HasExited) { System.Threading.Thread.Sleep(1000); } } catch (System.Exception) { } } else { // Run directly by some intrepid explorer Console.WriteLine("Note: This program should only be started by iPhonePackager"); Console.WriteLine(" This program cannot be used on it's own."); DeploymentImplementation Deployer = new DeploymentImplementation(); var DeviceList = Deployer.EnumerateConnectedDevices(); foreach (var Device in DeviceList) { Console.WriteLine(" - Found device named {0} of type {1} with UDID {2}", Device.DeviceName, Device.DeviceType, Device.UDID); } Console.WriteLine("Exiting."); } }