Exemplo n.º 1
0
 public SourceScope(SourceFile source, string[] content, IResourceFilter filter, Dictionary <string, object> configuration)
 {
     File = source;
     SourceContentCache = content;
     Filter             = filter;
     Configuration      = configuration;
 }
        public bool IsApplicable(IResourceFilter filter)
        {
            if(filter is HostingEnvironmentFilter envFilter)
            {
                return ((envFilter.PlatformType & this.PlatformType) > 0) &&
                    ((envFilter.HostingEnvironmentType & this.HostingEnvironmentType) > 0);
            }

            return false;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Determines whether the app resource is applicable after filtering.
        /// </summary>
        /// <param name="filter">App Resource Filter</param>
        /// <returns>True, if app resource passes the filter. False otherwise</returns>
        public bool IsApplicable(IResourceFilter filter)
        {
            if (filter is AppFilter appFilter)
            {
                return(((appFilter.AppType & this.AppType) > 0) &&
                       ((appFilter.PlatformType & this.PlatformType) > 0) &&
                       ((this.StackType == StackType.None) || (appFilter.StackType & this.StackType) > 0) &&
                       ((appFilter.StampType & this.StampType) > 0));
            }

            return(false);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Determines whether the current arm resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">App Resource Filter</param>
 /// <returns>True, if app resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     if (filter is ArmResourceFilter)
     {
         ArmResourceFilter armFilter = filter as ArmResourceFilter;
         return((string.Compare(armFilter.Provider, this.Provider, true) == 0) && (string.Compare(armFilter.ResourceTypeName, this.ResourceTypeName, true) == 0));
     }
     else
     {
         return(false);
     }
 }
        public static void AfterOnResourceExecuted(
            this DiagnosticListener diagnosticListener,
            ResourceExecutedContext resourceExecutedContext,
            IResourceFilter filter)
        {
            Debug.Assert(diagnosticListener != null);
            Debug.Assert(resourceExecutedContext != null);
            Debug.Assert(filter != null);

            // Inlinable fast-path check if diagnostic listener is enabled
            if (diagnosticListener.IsEnabled())
            {
                AfterOnResourceExecutedImpl(diagnosticListener, resourceExecutedContext, filter);
            }
        }
        private void InitializeAttributes()
        {
            if (_entryPointMethodInfo == null)
            {
                return;
            }

            _entryPointDefinitionAttribute = _entryPointMethodInfo.GetCustomAttribute <Definition>();
            if (_entryPointDefinitionAttribute != null)
            {
                _entryPointDefinitionAttribute.SupportTopicList = _entryPointMethodInfo.GetCustomAttributes <SupportTopic>();
            }

            _resourceFilter = _entryPointMethodInfo.GetCustomAttribute <ResourceFilterBase>();
        }
        public static void BeforeOnResourceExecuting(
            this DiagnosticListener diagnosticListener,
            ResourceExecutingContext resourceExecutingContext,
            IResourceFilter filter)
        {
            Debug.Assert(diagnosticListener != null);
            Debug.Assert(resourceExecutingContext != null);
            Debug.Assert(filter != null);

            // Inlinable fast-path check if Diagnositcs is enabled
            if (diagnosticListener.IsEnabled())
            {
                BeforeOnResourceExecutingImpl(diagnosticListener, resourceExecutingContext, filter);
            }
        }
Exemplo n.º 8
0
 public static void AfterOnResourceExecuting(
     this DiagnosticSource diagnosticSource,
     ResourceExecutingContext resourceExecutingContext,
     IResourceFilter filter)
 {
     if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting"))
     {
         diagnosticSource.Write(
             "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuting",
             new
         {
             actionDescriptor         = resourceExecutingContext.ActionDescriptor,
             resourceExecutingContext = resourceExecutingContext,
             filter = filter
         });
     }
 }
Exemplo n.º 9
0
        public ClientResourcesManager(IPresentationSource presenter,
            IResourceFilter resourceFilter,
            IResourceComparator resourceComparator)
        {
            _presenter = presenter;
            _resourceFilter = resourceFilter;
            _resourceComparator = resourceComparator;

            _trigger = new object[]
            {
                resourceFilter, resourceComparator
            }.OfType<IObservableResource>().Aggregate(Observable.Return(Unit.Default), (agg, next) => agg.Merge(next.Trigger));

            ActiveResources.Add(_nullResource);
            PopulateResources();
            Update();
        }
Exemplo n.º 10
0
 public static void BeforeOnResourceExecuted(
     this DiagnosticSource diagnosticSource,
     ActionDescriptor actionDescriptor,
     ResourceExecutedContext resourceExecutedContext,
     IResourceFilter filter)
 {
     if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
     {
         diagnosticSource.Write(
             "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
             new
         {
             actionDescriptor        = actionDescriptor,
             resourceExecutedContext = resourceExecutedContext,
             filter = filter
         });
     }
 }
Exemplo n.º 11
0
        public static void AfterOnResourceExecuted(
            this DiagnosticSource diagnosticSource,
            ResourceExecutedContext resourceExecutedContext,
            IResourceFilter filter)
        {
            Debug.Assert(diagnosticSource != null);
            Debug.Assert(resourceExecutedContext != null);
            Debug.Assert(filter != null);

            if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
            {
                diagnosticSource.Write(
                    "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
                    new
                {
                    actionDescriptor        = resourceExecutedContext.ActionDescriptor,
                    resourceExecutedContext = resourceExecutedContext,
                    filter = filter
                });
            }
        }
Exemplo n.º 12
0
 public Dictionary <string, string> GetResourceParams(IResourceFilter gResourceFilter)
 {
     try
     {
         var resourceParams = new Dictionary <string, string>();
         resourceParams.Add("ResourceType", gResourceFilter.ResourceType.ToString());
         if (gResourceFilter.ResourceType.ToString() == "App")
         {
             var     appFilter    = JsonConvert.DeserializeObject <AppFilter>(JsonConvert.SerializeObject(gResourceFilter));
             AppType appType      = appFilter.AppType;
             var     appTypesList = Enum.GetValues(typeof(AppType)).Cast <AppType>().Where(p => appType.HasFlag(p)).Select(x => Enum.GetName(typeof(AppType), x));
             resourceParams.Add("AppType", String.Join(",", appTypesList));
             PlatformType platformType      = appFilter.PlatformType;
             var          platformTypesList = Enum.GetValues(typeof(PlatformType)).Cast <PlatformType>().Where(p => platformType.HasFlag(p)).Select(x => Enum.GetName(typeof(PlatformType), x));
             resourceParams.Add("PlatformType", String.Join(",", platformTypesList));
         }
         return(resourceParams);
     }
     catch
     {
         return(new Dictionary <string, string>());
     }
 }
Exemplo n.º 13
0
 public NotResourceFilter(IResourceFilter filter)
 {
     _filter = filter;
 }
Exemplo n.º 14
0
 public static GroupTemplateContext WithContext(this IResourceGroupTemplate groupTemplate, IResourceFilter excludeFilter)
 {
     return(new GroupTemplateContext(groupTemplate, excludeFilter));
 }
Exemplo n.º 15
0
 internal GroupTemplateContext(IResourceGroupTemplate groupTemplate, IResourceFilter excludeFilter)
 {
     GroupTemplate  = groupTemplate;
     _excludeFilter = excludeFilter;
 }
 private static void AfterOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
 {
     if (diagnosticListener.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
     {
         diagnosticListener.Write(
             "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
             new
         {
             actionDescriptor        = resourceExecutedContext.ActionDescriptor,
             resourceExecutedContext = resourceExecutedContext,
             filter = filter
         });
     }
 }
 /// <summary>
 /// Determines whether the Azure Kubernetes Service resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">Resource Filter</param>
 /// <returns>True, if resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     return(filter is AzureKubernetesServiceFilter);
 }
Exemplo n.º 18
0
 public static IResourceFilter Not(IResourceFilter filter)
 {
     return new NotResourceFilter(filter);
 }
 /// <summary>
 /// Determines whether the APIM resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">Resource Filter</param>
 /// <returns>True, if resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     return(filter is ApiManagementServiceFilter);
 }
Exemplo n.º 20
0
 public static GroupTemplateContext WithContext(this IResourceGroupTemplate groupTemplate, IResourceFilter excludeFilter)
 {
     return new GroupTemplateContext(groupTemplate, excludeFilter);
 }
Exemplo n.º 21
0
 public static IEnumerable <IResource> Where(this IEnumerable <IResource> resources, IResourceFilter filter)
 {
     return(resources.Where(filter.IsMatch));
 }
Exemplo n.º 22
0
 public static IEnumerable <IResource> Exclude(this IEnumerable <IResource> resources, IResourceFilter excludeFilter)
 {
     return(resources.Where(ResourceFilters.Not(excludeFilter)));
 }
Exemplo n.º 23
0
 internal static bool Match(this IResourceFilter filter, Baseline resource)
 {
     return(filter.Match(resource.Name, null));
 }
        public static void BeforeOnResourceExecuted(
            this DiagnosticSource diagnosticSource,
            ResourceExecutedContext resourceExecutedContext,
            IResourceFilter filter)
        {
            Debug.Assert(diagnosticSource != null);
            Debug.Assert(resourceExecutedContext != null);
            Debug.Assert(filter != null);

            if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted"))
            {
                diagnosticSource.Write(
                    "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuted",
                    new
                    {
                        actionDescriptor = resourceExecutedContext.ActionDescriptor,
                        resourceExecutedContext = resourceExecutedContext,
                        filter = filter
                    });
            }
        }
 public static void BeforeOnResourceExecuting(
     this DiagnosticSource diagnosticSource,
     ResourceExecutingContext resourceExecutingContext,
     IResourceFilter filter)
 {
     if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting"))
     {
         diagnosticSource.Write(
             "Microsoft.AspNetCore.Mvc.BeforeOnResourceExecuting",
             new
             {
                 actionDescriptor = resourceExecutingContext.ActionDescriptor,
                 resourceExecutingContext = resourceExecutingContext,
                 filter = filter
             });
     }
 }
 public static void AfterOnResourceExecuted(
     this DiagnosticSource diagnosticSource,
     ActionDescriptor actionDescriptor,
     ResourceExecutedContext resourceExecutedContext,
     IResourceFilter filter)
 {
     if (diagnosticSource.IsEnabled("Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted"))
     {
         diagnosticSource.Write(
             "Microsoft.AspNetCore.Mvc.AfterOnResourceExecuted",
             new
             {
                 actionDescriptor = actionDescriptor,
                 resourceExecutedContext = resourceExecutedContext,
                 filter = filter
             });
     }
 }
Exemplo n.º 27
0
 public static IResourceFilter Not(IResourceFilter filter)
 {
     return(new NotResourceFilter(filter));
 }
Exemplo n.º 28
0
 public void AddFilter(IResourceFilter filter)
 {
     _filters.Add(filter);
 }
Exemplo n.º 29
0
 public void AddFilter(IResourceFilter filter)
 {
     _filters.Add(filter);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Determines whether the App Service certificate resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">Resource Filter</param>
 /// <returns>True, if resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     return(filter is AppServiceCertificateFilter);
 }
Exemplo n.º 31
0
 internal GroupTemplateContext(IResourceGroupTemplate groupTemplate, IResourceFilter excludeFilter)
 {
     GroupTemplate = groupTemplate;
     _excludeFilter = excludeFilter;
 }
 private static void BeforeOnResourceExecutingImpl(DiagnosticListener diagnosticListener, ResourceExecutingContext resourceExecutingContext, IResourceFilter filter)
 {
     if (diagnosticListener.IsEnabled(Diagnostics.BeforeResourceFilterOnResourceExecutingEventData.EventName))
     {
         diagnosticListener.Write(
             Diagnostics.BeforeResourceFilterOnResourceExecutingEventData.EventName,
             new BeforeResourceFilterOnResourceExecutingEventData(
                 resourceExecutingContext.ActionDescriptor,
                 resourceExecutingContext,
                 filter
                 ));
     }
 }
 /// <summary>
 /// Determines whether the logic app resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">Resource Filter</param>
 /// <returns>True, if resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     return(filter is LogicAppFilter);
 }
 private static void AfterOnResourceExecutedImpl(DiagnosticListener diagnosticListener, ResourceExecutedContext resourceExecutedContext, IResourceFilter filter)
 {
     if (diagnosticListener.IsEnabled(Diagnostics.AfterResourceFilterOnResourceExecutedEventData.EventName))
     {
         diagnosticListener.Write(
             Diagnostics.AfterResourceFilterOnResourceExecutedEventData.EventName,
             new AfterResourceFilterOnResourceExecutedEventData(
                 resourceExecutedContext.ActionDescriptor,
                 resourceExecutedContext,
                 filter
                 ));
     }
 }
Exemplo n.º 35
0
 public static IEnumerable<IResource> Where(this IEnumerable<IResource> resources, IResourceFilter filter)
 {
     return resources.Where(filter.IsMatch);
 }
Exemplo n.º 36
0
 internal GetBaselinePipeline(PipelineContext pipeline, Source[] source, PipelineReader reader, PipelineWriter writer, IResourceFilter filter)
     : base(pipeline, source, reader, writer)
 {
     _Filter = filter;
 }
Exemplo n.º 37
0
 public static IEnumerable<IResource> Exclude(this IEnumerable<IResource> resources, IResourceFilter excludeFilter)
 {
     return resources.Where(ResourceFilters.Not(excludeFilter));
 }
Exemplo n.º 38
0
 public NotResourceFilter(IResourceFilter filter)
 {
     _filter = filter;
 }
 /// <summary>
 /// Determines whether the App Service domain resource is applicable after filtering.
 /// </summary>
 /// <param name="filter">Resource Filter</param>
 /// <returns>True, if resource passes the filter. False otherwise</returns>
 public bool IsApplicable(IResourceFilter filter)
 {
     return(filter is AppServiceDomainFilter);
 }