コード例 #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));
            }
        }
コード例 #2
0
ファイル: ADB.cs プロジェクト: twenty0ne/UnityDecompiled
        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));
            }
        }
コード例 #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);
        }
コード例 #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);
     }
 }
コード例 #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));
        }
コード例 #6
0
ファイル: ADB.cs プロジェクト: twenty0ne/UnityDecompiled
        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));
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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());
        }
コード例 #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);
        }
コード例 #10
0
ファイル: ADB.cs プロジェクト: twenty0ne/UnityDecompiled
        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);
        }
コード例 #11
0
 public string RunCommand(string[] sdkToolCommand, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg) =>
 this.RunCommand(sdkToolCommand, null, waitingForProcessToExit, errorMsg);
コード例 #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);
        }
コード例 #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. "));
 }
コード例 #14
0
 private static string RunCommandInternal(string javaExe, string sdkToolsDir, string[] sdkToolCommand, int memoryMB, string workingdir, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
コード例 #15
0
ファイル: ADB.cs プロジェクト: twenty0ne/UnityDecompiled
 public static string Run(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {
     StartServer(waitingForProcessToExit);
     return(RunInternal(command, waitingForProcessToExit, errorMsg));
 }
コード例 #16
0
 public string RunCommand(string[] sdkToolCommand, string workingdir, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg) =>
 this.RunCommand(sdkToolCommand, 0x800, workingdir, waitingForProcessToExit, errorMsg);
コード例 #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);
コード例 #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. "));
 }
コード例 #19
0
 public string BuildToolsVersion(Command.WaitingForProcessToExit waitingForProcessToExit) =>
 AndroidComponentVersion.GetComponentVersion(this.SDKBuildToolsDir);
コード例 #20
0
 private string Exec(string[] command, Command.WaitingForProcessToExit waitingForProcessToExit, string errorMsg)
 {