public static PersistantConfig Deserialize(string file)
        {
            XmlSerializer    xs     = new XmlSerializer(typeof(PersistantConfig));
            StreamReader     reader = File.OpenText(file);
            PersistantConfig c      = (PersistantConfig)xs.Deserialize(reader);

            reader.Close();

            StaticExports.SetConfigSetting("Disassembly_FriendlyNaming",
                                           c.ShaderViewer_FriendlyNaming ? "1" : "0");

            foreach (var kv in c.ConfigSettingsValues)
            {
                if (kv.Key != null && kv.Key.Length > 0 &&
                    kv.Value != null)
                {
                    c.SetConfigSetting(kv.Key, kv.Value);
                }
            }

            //external disassemblers
            foreach (var kv in c.ExternalDisassemblersValues)
            {
                if (kv.Key >= 0 && kv.Value != null)
                {
                    c.SetExternalDisassemblers(kv.Key, kv.Value);
                }
            }

            // localhost should always be available
            bool foundLocalhost = false;

            for (int i = 0; i < c.RemoteHosts.Count; i++)
            {
                if (c.RemoteHosts[i].Hostname == "localhost")
                {
                    foundLocalhost = true;
                    break;
                }
            }

            if (!foundLocalhost)
            {
                RemoteHost host = new RemoteHost();
                host.Hostname = "localhost";
                c.RemoteHosts.Add(host);
            }

            return(c);
        }
Exemple #2
0
        public void DisconnectFromRemoteServer()
        {
            if (m_RemoteHost != null)
            {
                m_RemoteHost.Connected = false;
            }

            if (m_Remote != null)
            {
                m_Remote.ShutdownConnection();
            }

            m_RemoteHost = null;
            m_Remote     = null;
        }
Exemple #3
0
        public void ConnectToRemoteServer(RemoteHost host)
        {
            InitException = null;

            try
            {
                m_Remote               = StaticExports.CreateRemoteServer(host.Hostname, 0);
                m_RemoteHost           = host;
                m_RemoteHost.Connected = true;
            }
            catch (ReplayCreateException ex)
            {
                InitException = ex;
            }
        }
        public void AddAndroidHosts()
        {
            for (int i = RemoteHosts.Count - 1; i >= 0; i--)
            {
                if (RemoteHosts[i].Hostname.StartsWith("adb:"))
                {
                    RemoteHosts.RemoveAt(i);
                }
            }

            string adbExePath = File.Exists(AdbExecutablePath) ? AdbExecutablePath : "";

            // Set the config setting as it will be reused when we start the remoteserver etc.
            StaticExports.SetConfigSetting("adbExePath", adbExePath);

            string[] androidHosts = StaticExports.EnumerateAndroidDevices();
            foreach (string hostName in androidHosts)
            {
                RemoteHost host = new RemoteHost();
                host.Hostname = hostName;
                RemoteHosts.Add(host);
            }
        }
Exemple #5
0
        public void DisconnectFromRemoteServer()
        {
            if (m_RemoteHost != null)
                m_RemoteHost.Connected = false;

            if (m_Remote != null)
                m_Remote.ShutdownConnection();

            m_RemoteHost = null;
            m_Remote = null;
        }
Exemple #6
0
        public void ConnectToRemoteServer(RemoteHost host)
        {
            InitException = null;

            try
            {
                m_Remote = StaticExports.CreateRemoteServer(host.Hostname, 0);
                m_RemoteHost = host;
                m_RemoteHost.Connected = true;
            }
            catch (ReplayCreateException ex)
            {
                InitException = ex;
            }
        }
Exemple #7
0
        public void AddAndroidHosts()
        {
            for (int i = RemoteHosts.Count - 1; i >= 0; i--)
            {
                if (RemoteHosts[i].Hostname.StartsWith("adb:"))
                    RemoteHosts.RemoveAt(i);
            }

            string adbExePath = File.Exists(AdbExecutablePath) ? AdbExecutablePath : "";

            // Set the config setting as it will be reused when we start the remoteserver etc.
            StaticExports.SetConfigSetting("adbExePath", adbExePath);

            if (adbExePath.Length == 0)
                return;// adb path must be non-empty in the Options dialog.

            string[] androidHosts = StaticExports.EnumerateAndroidDevices();
            foreach(string hostName in androidHosts)
            {
                RemoteHost host = new RemoteHost();
                host.Hostname = "adb:" + hostName;
                RemoteHosts.Add(host);
            }
        }
Exemple #8
0
        public static PersistantConfig Deserialize(string file)
        {
            XmlSerializer xs = new XmlSerializer(typeof(PersistantConfig));
            StreamReader reader = File.OpenText(file);
            PersistantConfig c = (PersistantConfig)xs.Deserialize(reader);
            reader.Close();

            foreach (var kv in c.ConfigSettingsValues)
            {
                if (kv.Key != null && kv.Key.Length > 0 &&
                    kv.Value != null)
                {
                    c.SetConfigSetting(kv.Key, kv.Value);
                }
            }

            //external disassemblers
            foreach (var kv in c.ExternalDisassemblersValues)
            {
                if (kv.Key >= 0 && kv.Value != null)
                {
                    c.SetExternalDisassemblers(kv.Key, kv.Value);
                }
            }

            // localhost should always be available
            bool foundLocalhost = false;

            for (int i = 0; i < c.RemoteHosts.Count; i++)
            {
                if (c.RemoteHosts[i].Hostname == "localhost")
                {
                    foundLocalhost = true;
                    break;
                }
            }

            if (!foundLocalhost)
            {
                RemoteHost host = new RemoteHost();
                host.Hostname = "localhost";
                c.RemoteHosts.Add(host);
            }

            return c;
        }
Exemple #9
0
        private void AddNewHost()
        {
            string host = hostname.Text.Trim();
            if (host.Length > 0)
            {
                bool found = false;

                StringComparer comp = StringComparer.Create(System.Globalization.CultureInfo.CurrentCulture, true);

                for (int i = 0; i < m_Core.Config.RemoteHosts.Count; i++)
                {
                    if (comp.Compare(m_Core.Config.RemoteHosts[i].Hostname, host.Trim()) == 0)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    RemoteHost h = new RemoteHost();
                    h.Hostname = host;
                    h.RunCommand = runCommand.Text;

                    m_Core.Config.RemoteHosts.Add(h);
                    m_Core.Config.Serialize(Core.ConfigFilename);

                    hosts.BeginUpdate();
                    AddHost(h);
                    hosts.EndUpdate();
                }
            }
            hostname.Text = "";
            hostname.Text = host;
        }
Exemple #10
0
        // we kick off a thread per host to query for any open connections. The
        // interfaces on the C++ side should be thread-safe to cope with this
        private void AddHost(RemoteHost host)
        {
            TreelistView.Node node = new TreelistView.Node(new object[] { host.Hostname, "..." });

            node.Italic = true;
            node.Image = global::renderdocui.Properties.Resources.hourglass;
            node.Tag = host;

            hosts.Nodes.Add(node);

            refreshOne.Enabled = refreshAll.Enabled = false;

            {
                lookupMutex.WaitOne();
                lookupsInProgress++;
                lookupMutex.ReleaseMutex();
            }

            Thread th = Helpers.NewThread(new ParameterizedThreadStart(LookupHostConnections));
            th.Start(node);

            UpdateLookupsStatus();
        }