Example #1
0
        /// <summary>
        /// Compiles an Ultraviolet Style Sheet (UVSS) document from the specified abstract syntax tree.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="tree">A <see cref="UvssDocumentSyntax"/> that represents the
        /// abstract syntax tree to compile.</param>
        /// <returns>A new instance of <see cref="UvssDocument"/> that represents the compiled data.</returns>
        public static UvssDocument Compile(UltravioletContext uv, UvssDocumentSyntax tree)
        {
            Contract.Require(uv, nameof(uv));
            Contract.Require(tree, nameof(tree));

            return(UvssCompiler.Compile(uv, tree));
        }
Example #2
0
        /// <inheritdoc/>
        public override UvssDocument ImportPreprocessed(ContentManager manager,
                                                        IContentProcessorMetadata metadata, BinaryReader reader)
        {
            var version = reader.ReadInt32();

            if (version != 1)
            {
                throw new InvalidDataException();
            }

            var ast = (UvssDocumentSyntax)SyntaxSerializer.FromStream(reader, version);

            return(UvssCompiler.Compile(manager.Ultraviolet, ast));
        }