Exemple #1
0
    /// <inheritdoc />
    public bool Take(string path)
    {
        // If Allowlist is empty take everything
        if (!_allowAny)
        {
            return(true);
        }

        return(WildcardHelper.IsMatch(path, _allowPatterns));
    }
Exemple #2
0
    /// <inheritdoc />
    public bool Skip(string path)
    {
        // If Blocklist is empty don't skip anything
        if (!_blockAny)
        {
            return(false);
        }

        return(WildcardHelper.IsMatch(path, _blockPatterns));
    }
Exemple #3
0
 public List <IVisio.Master> GetMastersByName(string name, IVisio.Document doc)
 {
     if (name == null || name == "*")
     {
         // return all masters
         var masters = doc.Masters.ToEnumerable().ToList();
         return(masters);
     }
     else
     {
         // return masters matching the name
         var masters2 = doc.Masters.ToEnumerable();
         var masters3 = WildcardHelper.FilterObjectsByNames(masters2, new[] { name }, p => p.Name, true, WildcardHelper.FilterAction.Include).ToList();
         return(masters3);
     }
 }
        public List <IVisio.Document> GetDocumentsByName(string name)
        {
            var application = this._client.Application.Get();
            var documents   = application.Documents;

            if (name == null || name == "*")
            {
                // return all documents
                var docs1 = documents.ToEnumerable().ToList();
                return(docs1);
            }

            // get the named document
            var docs2 = WildcardHelper.FilterObjectsByNames(documents.ToEnumerable(), new[] { name }, d => d.Name, true, WildcardHelper.FilterAction.Include).ToList();

            return(docs2);
        }
Exemple #5
0
        public List <IVisio.Page> GetPagesByName(string Name)
        {
            var application     = this._client.Application.Get();
            var active_document = application.ActiveDocument;

            if (Name == null || Name == "*")
            {
                // return all pages
                var pages = active_document.Pages.ToEnumerable().ToList();
                return(pages);
            }
            else
            {
                // return the named page
                var pages  = active_document.Pages.ToEnumerable();
                var pages2 = WildcardHelper.FilterObjectsByNames(pages, new[] { Name }, p => p.Name, true, WildcardHelper.FilterAction.Include).ToList();
                return(pages2);
            }
        }
Exemple #6
0
        public List <IVisio.Shape> GetShapesByName(string[] shapenames, bool ignore_bad_names)
        {
            this._client.Application.AssertApplicationAvailable();
            this._client.Document.AssertDocumentAvailable();

            var page   = this._client.Page.Get();
            var shapes = page.Shapes;

            var cached_shapes_list = new List <IVisio.Shape>(shapes.Count);

            cached_shapes_list.AddRange(shapes.ToEnumerable());

            if (shapenames.Contains("*"))
            {
                // if any of the shape names contains a simple wildcard then return all the shapes
                return(cached_shapes_list);
            }

            // otherwise we start checking for each name
            var shapes_list = WildcardHelper.FilterObjectsByNames(cached_shapes_list, shapenames, s => s.Name, true, WildcardHelper.FilterAction.Include).ToList();

            return(shapes_list);
        }
Exemple #7
0
        public bool Match(string pat, string text)
        {
            var regex = WildcardHelper.GetRegexForWildcardPattern(pat, true);

            return(regex.IsMatch(text));
        }