void BuildRemoteDeviceList()
        {
            var devices   = new List <DevDevice>();
            var popupList = new List <PopupElement>();

            devices.Add(DevDevice.none);
            popupList.Add(new PopupElement("None"));

            // TODO: move Android stuff to editor extension
            devices.Add(new DevDevice("Any Android Device", "Any Android Device",
                                      "virtual", "Android", DevDeviceState.Connected,
                                      DevDeviceFeatures.RemoteConnection));
            popupList.Add(new PopupElement("Any Android Device"));

            foreach (var device in DevDeviceList.GetDevices())
            {
                bool supportsRemote = (device.features & DevDeviceFeatures.RemoteConnection) != 0;
                if (!device.isConnected || !supportsRemote)
                {
                    continue;
                }

                devices.Add(device);
                popupList.Add(new PopupElement(device.name));
            }

            remoteDeviceList      = devices.ToArray();
            remoteDevicePopupList = popupList.ToArray();
        }
        void AddAvailableDeviceConnections(GenericMenu menuOptions, ref bool hasOpenConnection)
        {
            foreach (var device in DevDeviceList.GetDevices())
            {
                bool supportsPlayerConnection = (device.features & DevDeviceFeatures.PlayerConnection) != 0;
                if (!device.isConnected || !supportsPlayerConnection)
                {
                    continue;
                }

                var  url         = "device://" + device.id;
                bool isConnected = ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID && ProfilerDriver.directConnectionUrl == url;
                hasOpenConnection |= isConnected;
                menuOptions.AddItem(new GUIContent(device.name), isConnected, () => DirectURLConnect(url));
            }
        }
        private void StopLocalConnectionOverUSB()
        {
#if UNITY_IOS
            UnityEditor.iOS.Usbmuxd.StopIosProxy((ushort)standardPort);
            UnityEditor.iOS.Usbmuxd.StopIosProxy((ushort)streamingPort);
            UnityEditor.iOS.Usbmuxd.StopIosProxy((ushort)defferedPort);

            var devices = DevDeviceList.GetDevices();

            if (devices.Length > 1 && devices[1].module == "iOS")
            {
                var id = devices[1].id;
                IDeviceUtils.StopRemoteSupport(id);
            }
#endif
        }
Esempio n. 4
0
        internal static IDevice GetDevice(string deviceId)
        {
            DevDevice devDevice;

            if (!DevDeviceList.FindDevice(deviceId, out devDevice))
            {
                throw new ApplicationException("Couldn't create device API for device: " + deviceId);
            }
            IPlatformSupportModule platformSupportModule = ModuleManager.FindPlatformSupportModule(devDevice.module);

            if (platformSupportModule != null)
            {
                return(platformSupportModule.CreateDevice(deviceId));
            }
            throw new ApplicationException("Couldn't find module for target: " + devDevice.module);
        }
        private void SetupLocalConnectionOverUSB()
        {
#if UNITY_IOS
            var devices = DevDeviceList.GetDevices();

            if (devices.Length > 1 && devices[1].module == "iOS")
            {
                var id            = devices[1].id;
                var remoteAddress = IDeviceUtils.StartRemoteSupport(id);
                m_ipAddress   = remoteAddress.ip;
                standardPort  = remoteAddress.port;
                streamingPort = standardPort + 1;
                defferedPort  = standardPort + 2;

                for (ushort port = (ushort)streamingPort; port < streamingPort + 100; port++)
                {
                    if (UnityEditor.iOS.Usbmuxd.StartIosProxy(port, (ushort)7202, id))
                    {
                        UnityEngine.Debug.Log(port);
                        streamingPort = port;
                        defferedPort  = port + 1;
                        break;
                    }
                }

                for (ushort port = (ushort)defferedPort; port < defferedPort + 100; port++)
                {
                    if (UnityEditor.iOS.Usbmuxd.StartIosProxy(port, (ushort)7203, id))
                    {
                        UnityEngine.Debug.Log(port);
                        defferedPort = port;
                        break;
                    }
                }
            }
#elif UNITY_ANDROID
            AndroidCommandHelper("forward tcp:7201 tcp:7201");
            AndroidCommandHelper("forward tcp:7202 tcp:7202");
            AndroidCommandHelper("forward tcp:7203 tcp:7203");
#endif
        }
Esempio n. 6
0
        private void BuildRemoteDeviceList()
        {
            List <DevDevice> devDeviceList = new List <DevDevice>();
            List <EditorSettingsInspector.PopupElement> popupElementList = new List <EditorSettingsInspector.PopupElement>();

            devDeviceList.Add(DevDevice.none);
            popupElementList.Add(new EditorSettingsInspector.PopupElement("None"));
            devDeviceList.Add(new DevDevice("Any Android Device", "Any Android Device", "Android", "Android", DevDeviceState.Connected, DevDeviceFeatures.RemoteConnection));
            popupElementList.Add(new EditorSettingsInspector.PopupElement("Any Android Device"));
            foreach (DevDevice device in DevDeviceList.GetDevices())
            {
                bool flag = (device.features & DevDeviceFeatures.RemoteConnection) != DevDeviceFeatures.None;
                if (device.isConnected && flag)
                {
                    devDeviceList.Add(device);
                    popupElementList.Add(new EditorSettingsInspector.PopupElement(device.name));
                }
            }
            this.remoteDeviceList      = devDeviceList.ToArray();
            this.remoteDevicePopupList = popupElementList.ToArray();
        }
        private void BuildRemoteDeviceList()
        {
            List <DevDevice>    list  = new List <DevDevice>();
            List <PopupElement> list2 = new List <PopupElement>();

            list.Add(DevDevice.none);
            list2.Add(new PopupElement("None"));
            list.Add(new DevDevice("Any Android Device", "Any Android Device", "Android", "Android", DevDeviceState.Connected, DevDeviceFeatures.RemoteConnection));
            list2.Add(new PopupElement("Any Android Device"));
            foreach (DevDevice device in DevDeviceList.GetDevices())
            {
                bool flag = (device.features & DevDeviceFeatures.RemoteConnection) != DevDeviceFeatures.None;
                if (device.isConnected && flag)
                {
                    list.Add(device);
                    list2.Add(new PopupElement(device.name));
                }
            }
            this.remoteDeviceList      = list.ToArray();
            this.remoteDevicePopupList = list2.ToArray();
        }
        private void BuildRemoteDeviceList()
        {
            List <DevDevice> list = new List <DevDevice>();
            List <EditorSettingsInspector.PopupElement> list2 = new List <EditorSettingsInspector.PopupElement>();

            list.Add(DevDevice.none);
            list2.Add(new EditorSettingsInspector.PopupElement("None"));
            list.Add(new DevDevice("Any Android Device", "Any Android Device", "Android", "Android", DevDeviceState.Connected, DevDeviceFeatures.RemoteConnection));
            list2.Add(new EditorSettingsInspector.PopupElement("Any Android Device"));
            DevDevice[] devices = DevDeviceList.GetDevices();
            for (int i = 0; i < devices.Length; i++)
            {
                DevDevice item = devices[i];
                bool      flag = (item.features & DevDeviceFeatures.RemoteConnection) != DevDeviceFeatures.None;
                if (item.isConnected && flag)
                {
                    list.Add(item);
                    list2.Add(new EditorSettingsInspector.PopupElement(item.name));
                }
            }
            this.remoteDeviceList      = list.ToArray();
            this.remoteDevicePopupList = list2.ToArray();
        }
        void AddAvailableDeviceConnections(ConnectionTreeViewWindow menuOptions, ref bool hasOpenConnection)
        {
            foreach (var device in DevDeviceList.GetDevices())
            {
                bool supportsPlayerConnection = (device.features & DevDeviceFeatures.PlayerConnection) != 0;
                if (!device.isConnected || !supportsPlayerConnection)
                {
                    continue;
                }

                var  url         = "device://" + device.id;
                bool isConnected = ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID && ProfilerDriver.directConnectionUrl == url;
                hasOpenConnection |= isConnected;
                //iphone handles the naming differently to android
                menuOptions.AddItem(new ConnectionDropDownItem(
                                        device.type == "Android"
                    ? device.name.Substring(device.name.IndexOf('(') + 1).TrimEnd(')')
                    : device.name, PLAYER_DIRECT_URL_CONNECT_GUID, "Devices",
                                        ConnectionDropDownItem.ConnectionMajorGroup.Local,
                                        () => ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID &&
                                        ProfilerDriver.directConnectionUrl == url, () => DirectURLConnect(url), true, device.type == "iOS" ? "IPhonePlayer" : device.type));
            }
        }
 private static void AddDeviceProfilers(List <ProfilerChoise> profilers)
 {
     DevDevice[] devices = DevDeviceList.GetDevices();
     for (int i = 0; i < devices.Length; i++)
     {
         DevDevice devDevice = devices[i];
         bool      flag      = (devDevice.features & DevDeviceFeatures.PlayerConnection) != DevDeviceFeatures.None;
         if (devDevice.isConnected && flag)
         {
             string url = "device://" + devDevice.id;
             profilers.Add(new ProfilerChoise
             {
                 Name       = devDevice.name,
                 Enabled    = true,
                 IsSelected = () => ProfilerDriver.connectedProfiler == 65262 && ProfilerDriver.directConnectionUrl == url,
                 ConnectTo  = delegate
                 {
                     AttachProfilerUI.DirectURLConnect(url);
                 }
             });
         }
     }
 }
Esempio n. 11
0
        static void AddDeviceProfilers(List <ProfilerChoise> profilers)
        {
            foreach (var device in DevDeviceList.GetDevices())
            {
                bool supportsPlayerConnection = (device.features & DevDeviceFeatures.PlayerConnection) != 0;
                if (!device.isConnected || !supportsPlayerConnection)
                {
                    continue;
                }

                var url = "device://" + device.id;
                profilers.Add(new ProfilerChoise()
                {
                    Name       = device.name,
                    Enabled    = true,
                    IsSelected = () =>
                    {
                        return((ProfilerDriver.connectedProfiler == PLAYER_DIRECT_URL_CONNECT_GUID) &&
                               (ProfilerDriver.directConnectionUrl == url));
                    },
                    ConnectTo = () => { DirectURLConnect(url); }
                });
            }
        }
Esempio n. 12
0
 private static void AddDeviceProfilers(List <ProfilerChoise> profilers)
 {
     foreach (DevDevice device in DevDeviceList.GetDevices())
     {
         // ISSUE: object of a compiler-generated type is created
         // ISSUE: variable of a compiler-generated type
         AttachProfilerUI.\u003CAddDeviceProfilers\u003Ec__AnonStoreyA9 profilersCAnonStoreyA9 = new AttachProfilerUI.\u003CAddDeviceProfilers\u003Ec__AnonStoreyA9();
         bool flag = (device.features & DevDeviceFeatures.PlayerConnection) != DevDeviceFeatures.None;
         if (device.isConnected && flag)
         {
             // ISSUE: reference to a compiler-generated field
             profilersCAnonStoreyA9.url = "device://" + device.id;
             // ISSUE: reference to a compiler-generated method
             // ISSUE: reference to a compiler-generated method
             profilers.Add(new ProfilerChoise()
             {
                 Name       = device.name,
                 Enabled    = true,
                 IsSelected = new Func <bool>(profilersCAnonStoreyA9.\u003C\u003Em__1ED),
                 ConnectTo  = new System.Action(profilersCAnonStoreyA9.\u003C\u003Em__1EE)
             });
         }
     }
 }
        private void AndroidCommandHelper(string commandToRun)
        {
            var devies = DevDeviceList.GetDevices();

            System.Diagnostics.Process          process   = new System.Diagnostics.Process();
            System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;

            var androidSdkRootPath = EditorPrefs.GetString("AndroidSdkRoot");

            var pathToFile = "\\platform-tools\\adb.exe";

            #if UNITY_EDITOR_OSX
            pathToFile = "/platform-tools/adb";
            #endif

            var platform_tools = androidSdkRootPath + pathToFile;

            startInfo.FileName  = platform_tools;
            startInfo.Arguments = commandToRun;
            process.StartInfo   = startInfo;
            process.Start();
            process.WaitForExit();
        }
 private static void AddDeviceProfilers(List <ProfilerChoise> profilers)
 {
     foreach (DevDevice device in DevDeviceList.GetDevices())
     {