Exemplo n.º 1
0
        public ICustomXmlSerializer ReadFrom(XmlReader x)
        {
            if (!x.Read())
            {
                return(this);
            }

            while (x.Read())
            {
                switch (x.LocalName)
                {
                case "DefaultCompiler":
                    if (x.MoveToAttribute("Name"))
                    {
                        DefaultCompiler = x.ReadContentAsString();
                    }
                    else
                    {
                        DefaultCompiler = x.ReadString();
                    }
                    break;

                case "Compiler":
                    var vendor = "";

                    if (x.MoveToAttribute("Name"))
                    {
                        vendor = x.ReadContentAsString();

                        x.MoveToElement();
                    }

                    var cmp = GetCompiler(vendor) ?? new DCompilerConfiguration {
                        Vendor = vendor
                    };

                    cmp.ReadFrom(x.ReadSubtree());

                    Compilers.Add(cmp);
                    break;

                case "ResCmp":
                    Win32ResourceCompiler.Instance.Load(x.ReadSubtree());
                    break;

                case "DDocBaseUrl":
                    MonoDevelop.D.Refactoring.DDocumentationLauncher.DigitalMarsUrl = x.ReadString();
                    break;

                case "CompletionOptions":
                    CompletionOptions.Load(x.ReadSubtree());
                    break;
                }
            }

            return(this);
        }
Exemplo n.º 2
0
        public ICustomXmlSerializer ReadFrom(XmlReader x)
        {
            if (!x.Read())
            {
                return(this);
            }

            while (x.Read())
            {
                switch (x.LocalName)
                {
                case "DefaultCompiler":
                    if (x.MoveToAttribute("Name"))
                    {
                        DefaultCompiler = x.ReadContentAsString();
                    }
                    else
                    {
                        DefaultCompiler = x.ReadString();
                    }
                    break;

                case "Compiler":
                    var vendor = "";

                    if (x.MoveToAttribute("Name"))
                    {
                        vendor = x.ReadContentAsString();

                        x.MoveToElement();
                    }

                    var cmp = GetCompiler(vendor) ?? new DCompilerConfiguration(vendor);

                    cmp.ReadFrom(x.ReadSubtree());

                    Compilers.Add(cmp);
                    break;

                case "ResCmp":
                    Win32ResourceCompiler.Instance.Load(x.ReadSubtree());
                    break;

                case "DDocBaseUrl":
                    MonoDevelop.D.Refactoring.DDocumentationLauncher.DigitalMarsUrl = x.ReadString();
                    break;

                case "DocumentOutline":
                    x.MoveToAttribute("ShowParameters");
                    Outline.ShowFuncParams = Boolean.Parse(x.ReadContentAsString());
                    x.MoveToAttribute("ShowVariables");
                    Outline.ShowFuncVariables = Boolean.Parse(x.ReadContentAsString());
                    x.MoveToAttribute("ShowTypes");
                    Outline.ShowTypes = Boolean.Parse(x.ReadContentAsString());
                    x.MoveToAttribute("GrayOutNonPublic");
                    Outline.GrayOutNonPublic = Boolean.Parse(x.ReadContentAsString());
                    x.MoveToAttribute("ExpandTree");
                    Outline.ExpandAll = Boolean.Parse(x.ReadContentAsString());
                    break;

                case "CompletionOptions":
                    CompletionOptions.Load(x.ReadSubtree());
                    break;
                }
            }

            return(this);
        }