Example #1
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);
            }
        }
Example #2
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();

            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);
        }
Example #3
0
        public void Serialize(string file)
        {
            if (ReadOnly)
            {
                return;
            }

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

            try
            {
                ConfigSettingsValues.Clear();
                foreach (var kv in ConfigSettings)
                {
                    ConfigSettingsValues.Add(new SerializableKeyValuePair <string, string>(kv.Key, kv.Value));
                }

                //external disassemblers
                ExternalDisassemblersValues.Clear();
                foreach (var kv in ExternalDisassemblers)
                {
                    ExternalDisassemblersValues.Add(new SerializableKeyValuePair <int, ExternalDisassembler>(kv.Key, kv.Value));
                }

                XmlSerializer xs     = new XmlSerializer(this.GetType());
                StreamWriter  writer = File.CreateText(file);
                xs.Serialize(writer, this);
                writer.Flush();
                writer.Close();
            }
            catch (System.IO.IOException ex)
            {
                // Can't recover, but let user know that we couldn't save their settings.
                MessageBox.Show(String.Format("Error saving config file: {1}\n{0}", file, ex.Message));
            }
        }
Example #4
0
 public void SetConfigSetting(string name, string value)
 {
     ConfigSettings[name] = value;
     StaticExports.SetConfigSetting(name, value);
 }