Beispiel #1
0
        /// <summary>
        /// Add or change filter, replacing the entire filter set if present
        /// </summary>
        public static void SetFilter <T>(IDocumentFilter <T> filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            lock (Filters)
            {
                Filters[typeof(T)] = new DocumentFilterSet <T>(filter);
            }
        }
        public void Format(Document document, IDocumentFilter filter)
        {
            var currentDoc = dte.ActiveDocument;

            document.Activate();

            if (dte.ActiveWindow.Kind == "Document")
            {
                if (filter.IsAllowed(document))
                    dte.ExecuteCommand(cmd.Command, cmd.Arguments);
            }

            currentDoc.Activate();
        }
        public void Format(Document document, IDocumentFilter filter, string command)
        {
            var currentDoc = dte.ActiveDocument;

            document.Activate();

            if (dte.ActiveWindow.Kind == "Document" && filter.IsAllowed(document))
            {
                if (string.IsNullOrWhiteSpace(command))
                {
                    command = defaultCommand;
                }
                dte.ExecuteCommand(command, string.Empty);
            }

            currentDoc.Activate();
        }
 public int Compare(IDocumentFilter <T> x, IDocumentFilter <T> y)
 {
     return(x.Priority.CompareTo(y.Priority));
 }
        public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer)
        {
            IDocumentFilter realFilter = (IDocumentFilter)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(IDocumentFilter));

            realFilter.Apply(swaggerDoc, schemaRegistry, apiExplorer);
        }