Пример #1
0
 //--- Constructors ---
 private Config(XDoc config) {
     var version = config["version"].AsText;
     if(!string.IsNullOrEmpty(version)) {
         Version = new Version(version); 
     }
     _xslts = new List<Xslt>();
     foreach(var doc in config[".//xslts/xslt"]) {
         var xslt = new Xslt(doc["@id"].AsText, doc["type"].AsText, doc["path.xsl"].AsText);
         var embedPath = doc["path.embed"].AsText;
         if(!string.IsNullOrEmpty(embedPath)) {
             xslt.EmbedPath = embedPath;
         }
         var embedFileSearchPattern = doc["embed.search"].AsText;
         if(!string.IsNullOrEmpty(embedFileSearchPattern)) {
             xslt.EmbedFileSearchPattern = embedFileSearchPattern;
         }
         _xslts.Add(xslt);
     }
 }
Пример #2
0
 private static void EmbedResources(Xslt xslt) {
     var path = Path.Combine(Location, xslt.EmbedPath);
     var files = Directory.GetFiles(path, xslt.EmbedFileSearchPattern ?? "*.*", SearchOption.AllDirectories);
     foreach(var stream in files.Select(file => new FileStream(file, FileMode.Open))) {
         EmbeddedFileStreams.Add(stream);
         var name = PathUtil.GetNormalizedFilename(stream.Name);
         _moduleBuilder.DefineManifestResource(name, stream, ResourceAttributes.Public);
     }
 }