Loads .xshd files, version 2.0. Version 2.0 files are recognized by the namespace.
 internal static XshdSyntaxDefinition LoadXshd(XmlReader reader, bool skipValidation)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     try
     {
         reader.MoveToContent();
         if (reader.NamespaceURI == V2Loader.Namespace)
         {
             return(V2Loader.LoadDefinition(reader, skipValidation));
         }
         else
         {
             return(V1Loader.LoadDefinition(reader, skipValidation));
         }
     }
     catch (XmlSchemaException ex)
     {
         throw WrapException(ex, ex.LineNumber, ex.LinePosition);
     }
     catch (XmlException ex)
     {
         throw WrapException(ex, ex.LineNumber, ex.LinePosition);
     }
 }
Exemple #2
0
        static HighlightingBrush ParseColor(string c)
        {
            if (c.StartsWith("#", StringComparison.Ordinal))
            {
                int a      = 255;
                int offset = 0;
                if (c.Length > 7)
                {
                    offset = 2;
                    a      = Int32.Parse(c.Substring(1, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
                }

                int r = Int32.Parse(c.Substring(1 + offset, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
                int g = Int32.Parse(c.Substring(3 + offset, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
                int b = Int32.Parse(c.Substring(5 + offset, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
                return(new SimpleHighlightingBrush(Color.FromArgb((byte)a, (byte)r, (byte)g, (byte)b)));
            }
            else if (c.StartsWith("SystemColors.", StringComparison.Ordinal))
            {
                return(V2Loader.GetSystemColorBrush(null, c));
            }
            else
            {
                return(new SimpleHighlightingBrush((Color)V2Loader.ColorConverter.ConvertFromInvariantString(c)));
            }
        }