Example #1
0
        public void Execute()
        {
            var xmlresolver  = new BSharpXmlResolver(Project);
            var xslt         = new XslCompiledTransform();
            var xsltsettings = new XsltSettings(true, true);

            xslt.Load(_resolver.GetPath(TemplateUri), xsltsettings, xmlresolver);
            var classes = _resolver.GetClasses(ClassSelector);

            if (Batch)
            {
                var xml  = new XElement("batch", classes.Select(_ => _.Compiled));
                var args = BuildArgs(classes, null);
                var path = _resolver.GetPath(OutputPath);
                Execute(xslt, xml, args, path);
            }
            else
            {
                foreach (var cls in classes)
                {
                    var xml  = cls.Compiled;
                    var args = BuildArgs(classes, cls);
                    var path =
                        _resolver.GetPath(OutputPath)
                        .Replace("_ns_", cls.Namespace)
                        .Replace("_name_", cls.Name)
                        .Replace("_proto_", cls.Prototype);
                    Execute(xslt, xml, args, path);
                }
            }
        }
Example #2
0
 /// <summary>
 /// When overridden in a derived class, maps a URI to an object that contains the actual resource.
 /// </summary>
 /// <returns>
 /// A stream object or null if a type other than stream is specified.
 /// </returns>
 /// <param name="absoluteUri">The URI returned from <see cref="M:System.Xml.XmlResolver.ResolveUri(System.Uri,System.String)"/>.</param><param name="role">Currently not used.</param><param name="ofObjectToReturn">The type of object to return. The current version only returns System.IO.Stream objects.</param><exception cref="T:System.Xml.XmlException"><paramref name="ofObjectToReturn"/> is not a Stream type.</exception><exception cref="T:System.UriFormatException">The specified URI is not an absolute URI.</exception><exception cref="T:System.ArgumentNullException"><paramref name="absoluteUri"/> is null.</exception><exception cref="T:System.Exception">There is a runtime error (for example, an interrupted server connection).</exception>
 public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
 {
     if (_projectresolver.IsProjectFileReference(absoluteUri))
     {
         return(GetFile(_projectresolver.GetPath(absoluteUri)));
     }
     if (_projectresolver.IsClassesReference(absoluteUri))
     {
         return(WrapClasses(_projectresolver.GetClasses(absoluteUri)));
     }
     return(_nativeresolver.GetEntity(absoluteUri, role, ofObjectToReturn));
 }