Mono.Debugger.DebuggerConfiguration.LoadConfigurationFromStream C# (CSharp) Method

LoadConfigurationFromStream() private method

private LoadConfigurationFromStream ( Stream stream ) : void
stream Stream
return void
        void LoadConfigurationFromStream(Stream stream)
        {
            XmlReaderSettings settings = new XmlReaderSettings ();
            Assembly ass = Assembly.GetExecutingAssembly ();
            using (Stream schema = ass.GetManifestResourceStream ("DebuggerConfiguration"))
                settings.Schemas.Add (null, new XmlTextReader (schema));

            XmlReader reader = XmlReader.Create (stream, settings);

            XPathDocument doc = new XPathDocument (reader);
            XPathNavigator nav = doc.CreateNavigator ();

            XPathNodeIterator iter = nav.Select ("/DebuggerConfiguration/Configuration/*");
            while (iter.MoveNext ()) {
                if (iter.Current.Name == "LoadNativeSymtabs")
                    LoadNativeSymtabs = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "StayInThread") {
                    ; // ignore, this is no longer in use.
                } else if (iter.Current.Name == "FollowFork")
                    FollowFork = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "OpaqueFileNames")
                    OpaqueFileNames = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "StopOnManagedSignals")
                    StopOnManagedSignals = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "NestedBreakStates")
                    NestedBreakStates = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "RedirectOutput")
                    RedirectOutput = Boolean.Parse (iter.Current.Value);
                else if (iter.Current.Name == "Martin_Boston_07102008") {
                    ; // ignore, this is no longer in use.
                } else if (iter.Current.Name == "BrokenThreading") {
                    ; // ignore, this is no longer in use.
                } else if (iter.Current.Name == "StopDaemonThreads") {
                    if (Boolean.Parse (iter.Current.Value))
                        threading_model |= ThreadingModel.StopDaemonThreads;
                    else
                        threading_model &= ~ThreadingModel.StopDaemonThreads;
                } else if (iter.Current.Name == "StopImmutableThreads") {
                    if (Boolean.Parse (iter.Current.Value))
                        threading_model |= ThreadingModel.StopImmutableThreads;
                    else
                        threading_model &= ~ThreadingModel.StopImmutableThreads;
                } else if (iter.Current.Name == "ThreadingModel") {
                    switch (iter.Current.Value.ToLower ()) {
                    case "single":
                        threading_model |= ThreadingModel.Single;
                        break;
                    case "process":
                        threading_model |= ThreadingModel.Process;
                        break;
                    case "global":
                        threading_model |= ThreadingModel.Global;
                        break;
                    case "default":
                        break;
                    default:
                        Report.Error ("Invalid value `{0}' in 'ThreadingModel'", iter.Current.Value);
                        break;
                    }
                } else if (iter.Current.Name == "UserNotifications") {
                    switch (iter.Current.Value.ToLower ()) {
                    case "+threads":
                    case "threads":
                        user_notifications |= UserNotificationType.Threads;
                        break;
                    case "-threads":
                        user_notifications &= ~UserNotificationType.Threads;
                        break;
                    default:
                        Report.Error ("Invalid value `{0}' in 'UserNotifications'", iter.Current.Value);
                        break;
                    }
                } else {
                    Report.Error ("Invalid configuration item `{0}'", iter.Current.Name);
                }
            }

            iter = nav.Select ("/DebuggerConfiguration/ModuleGroups/ModuleGroup");
            while (iter.MoveNext ()) {
                string name = iter.Current.GetAttribute ("name", "");
                ModuleGroup group = CreateModuleGroup (name);

                group.SetSessionData (iter);
            }

            iter = nav.Select ("/DebuggerConfiguration/DirectoryMap/Map");
            while (iter.MoveNext ()) {
                string from = iter.Current.GetAttribute ("from", "");
                string to = iter.Current.GetAttribute ("to", "");
                directory_maps.Add (from, to);
            }
        }

Same methods

DebuggerConfiguration::LoadConfigurationFromStream ( string filename ) : void