/platform/wp8/RhoAppRunner/Program.cs
C# | 117 lines | 61 code | 17 blank | 39 comment | 10 complexity | 7e82f8a7d215a7cb8c8517b0a179d0ee MD5 | raw file
Possible License(s): GPL-2.0, CC-BY-SA-3.0, MIT
- /*------------------------------------------------------------------------
- * (The MIT License)
- *
- * Copyright (c) 2008-2011 Rhomobile, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- *
- * http://rhomobile.com
- *------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.IO;
- using System.Threading;
- using System.Reflection;
- using Microsoft.SmartDevice.Connectivity;
- namespace RhoAppRunner
- {
- class Program
- {
- static void Main(string[] args)
- {
- DatastoreManager dsmgrObj = new DatastoreManager(1033);
- Platform WP8SDK = dsmgrObj.GetPlatforms().Single(p => p.Name == "Windows Phone 8");
- bool useEmulator = true;
- Device WP8Device = null;
- if (args.Length < 5)
- {
- Console.WriteLine("Invalid parameters");
- return;
- }
- if (args[4] == "dev")
- useEmulator = false;
- if (useEmulator)
- // WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Emulator") || d.Name.StartsWith("Windows Phone 8 Emulator"));
- WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Emulator WVGA"));
- else
- WP8Device = WP8SDK.GetDevices().First(d => d.Name.StartsWith("Windows Phone Device") || d.Name.StartsWith("Windows Phone 8 Device") || d.Name.StartsWith("Device"));
- Console.WriteLine("Connecting to Windows Phone 8 Emulator/Device...");
- WP8Device.Connect();
- Console.WriteLine("Windows Phone 8 Emulator/Device Connected...");
- Guid appID = new Guid(args[0]);
- RemoteApplication app;
- if (WP8Device.IsApplicationInstalled(appID))
- {
- Console.WriteLine("Updating sample XAP to Windows Phone 8 Emulator/Device...");
- app = WP8Device.GetApplication(appID);
- if (args.Length == 6)
- {
- var remoteIso = app.GetIsolatedStore();
- string targetDesktopFilePath = @args[5];
- remoteIso.ReceiveFile("rho/rholog.txt", targetDesktopFilePath, true);
- return;
- }
- app.Uninstall();
- /* app.UpdateApplication(args[1],
- args[2],
- args[3]);
- Console.WriteLine("Sample XAP Updated on Windows Phone 8 Emulator/Device...");
- Console.WriteLine("Launching sample app on Windows Phone 8 Emulator...");
- //app.Launch();
- Console.WriteLine("Launched sample app on Windows Phone 8 Emulator...");*/
- //var remoteIso = app.GetIsolatedStore();
- //bool result = remoteIso.FileExists("rholog.txt");
- //result = remoteIso.FileExists("rho/apps/app/loading.png");
- //return;
- }
- Console.WriteLine("Installing sample XAP to Windows Phone 8 Emulator/Device...");
- app = WP8Device.InstallApplication(
- appID,
- appID,
- args[1],
- args[2],
- args[3]);
- Console.WriteLine("Sample XAP installed to Windows Phone 8 Emulator...");
- Console.WriteLine("Launching sample app on Windows Phone 8 Emulator...");
- app.Launch();
- Console.WriteLine("Launched sample app on Windows Phone 8 Emulator...");
- }
- }
- }