public PDFDataProvider(IPDFDataProvider instance, bool required = false) : this(instance.ProviderKey, required) { this.Instance = instance; if (!string.IsNullOrEmpty(instance.DomainRegEx)) { this.Domain = new System.Text.RegularExpressions.Regex(instance.DomainRegEx); } }
public bool TryGetProvider(string key, out IPDFDataProvider provider) { foreach (PDFDataProvider pro in this._items) { if (pro.Key == key) { provider = pro.Instance; return(null != provider); } } provider = null; return(false); }
public void SetInstance(IPDFDataProvider instance) { if (null == instance) { throw new ArgumentNullException("instance"); } this.Instance = instance; if (!string.IsNullOrEmpty(instance.DomainRegEx)) { this.Domain = new System.Text.RegularExpressions.Regex(instance.DomainRegEx); } }
public bool TryGetDomainProvider(string key, string path, out IPDFDataProvider provider) { foreach (PDFDataProvider prov in this._items) { if ((string.IsNullOrEmpty(key) || key == "*") && prov.MatchesDomain(path)) { provider = prov.Instance; return(null != provider); } else if (prov.Key == key && prov.MatchesDomain(path)) { provider = prov.Instance; return(null != provider); } } provider = null; return(false); }
public void AddProvider(IPDFDataProvider provider) { if (null == provider) { throw new ArgumentNullException("provider"); } foreach (PDFDataProvider prov in this._items) { if (prov.Key == provider.ProviderKey) { prov.SetInstance(provider); return; } } PDFDataProvider toAdd = new PDFDataProvider(provider); _items.Add(toAdd); }