Example #1
0
        public bool TryGetMatch(string path, out IPDFImageDataFactory factory)
        {
            foreach (PDFImageFactory item in this)
            {
                if (item.IsMatch(path, out factory))
                {
                    return(true);
                }
            }

            factory = null;
            return(false);
        }
Example #2
0
 public bool IsMatch(string path, out IPDFImageDataFactory factory)
 {
     if (this.Matcher.IsMatch(path))
     {
         factory = this.Factory;
         return(true);
     }
     else
     {
         factory = null;
         return(false);
     }
 }
        public IPDFImageDataFactory GetRegisterdFactory(string path)
        {
            IPDFImageDataFactory       found = null;
            ImageDataFactoryCollection facts = this.Factories;

            if (null != facts && facts.Count > 0)
            {
                foreach (ImageFactoryElement fact in facts)
                {
                    if (fact.IsMatch(path, out found))
                    {
                        break;
                    }
                }
            }
            return(found);
        }
Example #4
0
 public bool IsMatch(string path, out IPDFImageDataFactory factory)
 {
     if (null == this._expr)
     {
         _expr = new System.Text.RegularExpressions.Regex(this.MatchPath);
     }
     if (this._expr.IsMatch(path))
     {
         factory = this.GetFactory();
         return(true);
     }
     else
     {
         factory = null;
         return(false);
     }
 }
Example #5
0
 protected virtual IPDFImageDataFactory GetFactory()
 {
     if (null == this._factory)
     {
         try
         {
             Type   t        = Scryber.Utilities.TypeHelper.GetType(this.FactoryType);
             object instance = System.Activator.CreateInstance(t);
             IPDFImageDataFactory factory = (IPDFImageDataFactory)instance;
             _factory = factory;
         }
         catch (Exception ex)
         {
             throw new Scryber.PDFException(string.Format("Could not load the imaging factory '{0}'", this.FactoryType), ex);
         }
     }
     return(_factory);
 }
Example #6
0
        public static bool IsFactoryRegisterd(string path, out IPDFImageDataFactory factory)
        {
            object section = ConfigurationManager.GetSection(ImagingSectionPath);

            if (null == section)
            {
                factory = null;
                return(false);
            }
            else if (section is ImagingConfigurationSection)
            {
                factory = ((ImagingConfigurationSection)section).GetRegisterdFactory(path);
                return(null != factory);
            }
            else
            {
                string msg = String.Format(Errors.CannotCastObjectToType, section.GetType(), typeof(ImagingConfigurationSection));
                throw new ConfigurationErrorsException(msg);
            }
        }
Example #7
0
 public PDFImageFactory(string name, System.Text.RegularExpressions.Regex match, IPDFImageDataFactory factory)
 {
     this.Matcher = match;
     this.Factory = factory;
 }