Esempio n. 1
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));
            }
        }
Esempio n. 2
0
        public static void StartServer(Command.WaitingForProcessToExit waitingForProcessToExit)
        {
            AndroidSDKTools instance = AndroidSDKTools.GetInstance();
            Process         process2 = new Process {
                StartInfo =
                {
                    FileName         = instance.ADB,
                    Arguments        = "start-server",
                    WorkingDirectory = instance.SDKRootDir,
                    CreateNoWindow   = true,
                    UseShellExecute  = true,
                    WindowStyle      = ProcessWindowStyle.Hidden
                }
            };

            using (Process process = process2)
            {
                process.Start();
                do
                {
                    if (waitingForProcessToExit != null)
                    {
                        waitingForProcessToExit(null);
                    }
                }while (!process.WaitForExit(100));
            }
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
     }
 }
Esempio n. 5
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));
        }
Esempio n. 6
0
        private static string RunInternal(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
        {
            AndroidSDKTools  instance = AndroidSDKTools.GetInstance();
            ProcessStartInfo psi      = new ProcessStartInfo {
                FileName               = instance.ADB,
                Arguments              = string.Join(" ", command),
                WorkingDirectory       = instance.SDKRootDir,
                CreateNoWindow         = true,
                StandardOutputEncoding = Encoding.UTF8
            };

            return(Command.Run(psi, waitingForProcessToExit, errorMsg));
        }
        public int GetTopAndroidPlatformAvailable(Command.WaitingForProcessToExit waitingForProcessToExit)
        {
            int num = -1;

            string[] strArray = this.ListTargetPlatforms(waitingForProcessToExit);
            foreach (string str in strArray)
            {
                int apiLevel = this.ExtractApiLevel(str);
                if ((apiLevel > num) && (this.GetAndroidPlatformPath(apiLevel) != null))
                {
                    num = apiLevel;
                }
            }
            return(num);
        }
        public string[] ListTargetPlatforms(Command.WaitingForProcessToExit waitingForProcessToExit)
        {
            string[]      sdkToolCommand = new string[] { "android", "list", "target", "-c" };
            string        str            = this.RunCommand(sdkToolCommand, waitingForProcessToExit, "Unable to list target platforms. Please make sure the android sdk path is correct. See the Console for more details. ");
            List <string> list           = new List <string>();

            char[] separator = new char[] { '\n', '\r' };
            foreach (string str2 in str.Split(separator))
            {
                if (str2.StartsWith("android-"))
                {
                    list.Add(str2);
                }
            }
            return(list.ToArray());
        }
Esempio n. 9
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($"SDB - No device found, will retry {num} time(s).");
            }
            UnityEngine.Debug.LogWarning("SDB - No device found - output:\n" + str);
            return(list);
        }
Esempio n. 10
0
        public static List <string> Devices(Command.WaitingForProcessToExit waitingForProcessToExit)
        {
            int           num  = 2;
            string        str  = "";
            List <string> list = new List <string>();

            while (true)
            {
                string[] command = new string[] { "devices" };
                str = Run(command, waitingForProcessToExit, "Unable to list connected devices. Please make sure the Android 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 Android 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("device"))
                    {
                        list.Add(str2.Substring(0, str2.IndexOf('\t')));
                    }
                }
                if (list.Count > 0)
                {
                    return(list);
                }
                KillServer(waitingForProcessToExit);
                if (--num == 0)
                {
                    break;
                }
                Console.WriteLine($"ADB - No device found, will retry {num} time(s).");
            }
            UnityEngine.Debug.LogWarning("ADB - No device found - output:\n" + str);
            return(list);
        }
Esempio n. 11
0
 public string RunCommand(string[] sdkToolCommand, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg) =>
 this.RunCommand(sdkToolCommand, null, waitingForProcessToExit, errorMsg);
Esempio n. 12
0
        public void MergeManifests(string target, string mainManifest, string[] libraryManifests, Command.WaitingForProcessToExit waitingForProcessToExit)
        {
            List <string> list         = new List <string>();
            string        tempFileName = Path.GetTempFileName();

            string[] collection = new string[] { "manifmerger", "merge", "--out", tempFileName, "--main", mainManifest };
            list.AddRange(collection);
            foreach (string str2 in libraryManifests)
            {
                list.Add("--libs");
                list.Add(str2);
            }
            this.RunCommand(list.ToArray(), waitingForProcessToExit, "Unable to merge android manifests. See the Console for more details. ");
            File.Move(tempFileName, target);
        }
Esempio n. 13
0
 public string InstallPlatform(int apiLevel, Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     string[] sdkToolCommand = new string[] { "android", "update", "sdk", "-u", "-t", $"android-{apiLevel}" };
     return(this.RunCommand(sdkToolCommand, waitingForProcessToExit, "Unable to install additional SDK platform. Please run the SDK Manager manually to make sure you have the latest set of tools and the required platforms installed. See the Console for more details. "));
 }
Esempio n. 14
0
 private static string RunCommandInternal(string javaExe, string sdkToolsDir, string[] sdkToolCommand, int memoryMB, string workingdir, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
Esempio n. 15
0
 public static string Run(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
     StartServer(waitingForProcessToExit);
     return(RunInternal(command, waitingForProcessToExit, errorMsg));
 }
Esempio n. 16
0
 public string RunCommand(string[] sdkToolCommand, string workingdir, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg) =>
 this.RunCommand(sdkToolCommand, 0x800, workingdir, waitingForProcessToExit, errorMsg);
Esempio n. 17
0
 public string RunCommand(string[] sdkToolCommand, int memoryMB, string workingdir, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg) =>
 RunCommandSafe(AndroidJavaTools.javaPath, this.SDKToolsDir, sdkToolCommand, memoryMB, workingdir, waitingForProcessToExit, errorMsg);
Esempio n. 18
0
 public string Delete(string target, Command.WaitingForProcessToExit waitingForProcessToExit)
 {
     string[] command = new string[] { "shell", "rm", "-f", Quote(target) };
     return(this.Exec(command, waitingForProcessToExit, "Unable to delete file. Please make sure the Android SDK is installed and is properly configured in the Editor. See the Console for more details. "));
 }
Esempio n. 19
0
 public string BuildToolsVersion(Command.WaitingForProcessToExit waitingForProcessToExit) =>
 AndroidComponentVersion.GetComponentVersion(this.SDKBuildToolsDir);
Esempio n. 20
0
 private string Exec(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {