예제 #1
0
 public IEnumerable <CustomFilterDescription> LoadDescriptions()
 {
     try {
         return
             (System.IO.Directory.GetFiles(CustomFilterPath, "*.xml")
              .SelectMany(file => CustomFilterDescription.Load(file)));
     }
     catch (Exception) {
         return(Enumerable.Empty <CustomFilterDescription>());
     }
 }
예제 #2
0
        public static IEnumerable <CustomFilterDescription> Load(string filename)
        {
            filename = System.IO.Path.GetFullPath(filename);
            var doc = XDocument.Load(filename);

            return(doc.Root.Elements(XName.Get("filter"))
                   .Select(filter => {
                var desc = new CustomFilterDescription();
                desc.Name = filter.Attribute(XName.Get("name"))?.Value;
                desc.OutputMIMEType = filter.Attribute(XName.Get("mimetype"))?.Value;
                desc.OutputContentType = filter.Attribute(XName.Get("contenttype"))?.Value;
                desc.OutputContentExt = filter.Attribute(XName.Get("contentext"))?.Value;
                desc.Logging = ToBool(filter.Attribute(XName.Get("logging"))?.Value);
                desc.BasePath = System.IO.Path.GetDirectoryName(filename);
                desc.CommandLine = filter.Value;
                return desc;
            }).ToArray());
        }
예제 #3
0
 public CustomFilterContentSink(CustomFilterDescription desc, IContentSink sink)
 {
     this.Description = desc;
     this.Sink        = sink;
 }
예제 #4
0
 public CustomFilter(CustomFilterDescription desc)
 {
     this.Description = desc;
 }