Ejemplo n.º 1
0
 public static List<TizenDevice> AssertAnyDeviceReady(Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     List<TizenDevice> devices = GetDevices(waitingForProcessToExit);
     if (devices.Count == 0)
     {
         throw new ApplicationException("No connected Tizen devices found! Please connect a device and try deploying again.");
     }
     return devices;
 }
Ejemplo n.º 2
0
 private static List<TizenDevice> GetDevices(Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     int num = 2;
     string str = "";
     List<TizenDevice> list = new List<TizenDevice>();
     while (true)
     {
         string[] command = new string[] { "devices" };
         str = Run(command, waitingForProcessToExit, "Unable to list connected devices. Please make sure the Tizen SDK is installed and is properly configured in the Editor. See the Console for more details. ");
         if (str.Contains("error"))
         {
             string[] textArray2 = new string[] { "devices" };
             str = Run(textArray2, waitingForProcessToExit, "Unable to list connected devices. Please make sure the Tizen SDK is installed and is properly configured in the Editor. See the Console for more details. ");
         }
         char[] separator = new char[] { '\r', '\n' };
         foreach (string str2 in str.Split(separator))
         {
             if (!str2.Trim().EndsWith("attached") && (str2.Length > 0))
             {
                 char[] chArray2 = new char[] { ' ', '\t' };
                 list.Add(new TizenDevice(str2.Split(chArray2)[0]));
             }
         }
         if (list.Count > 0)
         {
             return list;
         }
         KillServer(waitingForProcessToExit);
         if (--num == 0)
         {
             break;
         }
         Console.WriteLine(string.Format("SDB - No device found, will retry {0} time(s).", num));
     }
     UnityEngine.Debug.LogWarning("SDB - No device found - output:\n" + str);
     return list;
 }
Ejemplo n.º 3
0
 public static void StartServer(Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     Process process2 = new Process {
         StartInfo = { 
             FileName = sdb_exe,
             Arguments = "start-server",
             WorkingDirectory = sdk_tools,
             CreateNoWindow = true,
             UseShellExecute = Application.platform == RuntimePlatform.WindowsEditor
         }
     };
     using (Process process = process2)
     {
         process.Start();
         do
         {
             if (waitingForProcessToExit != null)
             {
                 waitingForProcessToExit(null);
             }
         }
         while (!process.WaitForExit(100));
     }
 }
Ejemplo n.º 4
0
 private static string RunInternal(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
     ProcessStartInfo psi = new ProcessStartInfo {
         FileName = sdb_exe,
         Arguments = string.Join(" ", command),
         WorkingDirectory = sdk_tools,
         CreateNoWindow = true,
         StandardOutputEncoding = Encoding.UTF8
     };
     return Command.Run(psi, waitingForProcessToExit, errorMsg);
 }
Ejemplo n.º 5
0
 public static string Run(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
     StartServer(waitingForProcessToExit);
     return RunInternal(command, waitingForProcessToExit, errorMsg);
 }
Ejemplo n.º 6
0
 public static void KillServer(Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     string[] command = new string[] { "kill-server" };
     RunInternal(command, waitingForProcessToExit, "Unable to kill the sdb server. Please make sure the Tizen SDK is installed and is properly configured in the Editor. See the Console for more details. ");
     for (int i = 0; i < 50; i++)
     {
         waitingForProcessToExit(null);
         Thread.Sleep(100);
     }
 }