Exemple #1
0
        ///<summary>
        /// Adds resource source in specific culture name. 
        ///</summary>
        /// <remarks>
        /// <para>
        /// The same resource may be added many times to vary culture names</para>
        /// <para>
        /// Resources for the same language may be added many times - they will be used in random order
        /// </para>
        /// </remarks>
        ///<param name="cultureName">culture name for which resource should be used</param>
        ///<param name="resourceSource">source to use for specified language</param>
        public void AddSource(string cultureName, IResourceSource resourceSource)
        {
            if (!_resourceSources.ContainsKey(cultureName))
                _resourceSources[cultureName] = new List<IResourceSource>();

            _resourceSources[cultureName].Add(resourceSource);
        }
Exemple #2
0
 public DynamoAlarmGenerator(
     IAlarmLogger logger,
     TableNamePopulator populator,
     ITableAlarmCreator tableAlarmCreator,
     IIndexAlarmCreator indexAlarmCreator,
     SnsCreator snsCreator,
     IResourceSource <TableDescription> tableSource)
 {
     _logger            = logger;
     _populator         = populator;
     _tableAlarmCreator = tableAlarmCreator;
     _indexAlarmCreator = indexAlarmCreator;
     _snsCreator        = snsCreator;
     _tableSource       = tableSource;
 }
Exemple #3
0
        public static AlarmLoaderAndGenerator CreateSystemUnderTest <T, TAlarmConfig>(
            IResourceSource <T> source,
            IAlarmDimensionProvider <T> dimensionProvider,
            IResourceAttributesProvider <T, TAlarmConfig> attributeProvider,
            Func <WatchmanConfiguration, WatchmanServiceConfiguration <TAlarmConfig> > mapper,
            IAlarmCreator creator,
            IConfigLoader loader
            )
            where T : class
            where TAlarmConfig : class, IServiceAlarmConfig <TAlarmConfig>, new()
        {
            var builder = new Builder(loader, creator);

            builder.AddService(source, dimensionProvider, attributeProvider, mapper);
            return(builder.Build());
        }
        public override IResource GetNew(IResourceSource resourceSource)
        {
            var cSource  = (Source)resourceSource;
            var vertices = new[]
            {
                new VertexPosTanNormTex(new Vector3(-1, 0, 1), new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector2(0, 1)),
                new VertexPosTanNormTex(new Vector3(-1, 0, -1), new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector2(0, 0)),
                new VertexPosTanNormTex(new Vector3(1, 0, -1), new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector2(1, 0)),
                new VertexPosTanNormTex(new Vector3(1, 0, 1), new Vector3(1, 0, 0), new Vector3(0, 0, 1), new Vector2(1, 1)),
            };
            var indices = new int[]
            {
                0, 1, 2, 0, 2, 3
            };

            return(ExplicitModel.FromVertices(vertices, indices, ExplicitModelPrimitiveTopology.TriangleList).WithSource(cSource));
        }
Exemple #5
0
        public override IResource GetNew(IResourceSource resourceSource)
        {
            var cSource  = (Source)resourceSource;
            var vertices = new[]
            {
                new VertexPos(-1, -1, 0),
                new VertexPos(-1, 1, 0),
                new VertexPos(1, 1, 0),
                new VertexPos(1, -1, 0),
            };
            var indices = new[]
            {
                0, 1, 2, 3, 0
            };

            return(ExplicitModel.FromVertices(vertices, indices, ExplicitModelPrimitiveTopology.LineStrip).WithSource(cSource));
        }
Exemple #6
0
        public void AddService <T, TAlarmConfig>(IResourceSource <T> source,
                                                 IAlarmDimensionProvider <T> dimensionProvider,
                                                 IResourceAttributesProvider <T, TAlarmConfig> attributeProvider,
                                                 Func <WatchmanConfiguration, WatchmanServiceConfiguration <TAlarmConfig> > mapper)
            where T : class
            where TAlarmConfig : class, IServiceAlarmConfig <TAlarmConfig>, new()
        {
            var task = new ServiceAlarmTasks <T, TAlarmConfig>(
                _logger,
                new ResourceNamePopulator <T, TAlarmConfig>(_logger, source),
                new OrphanResourcesReporter <T>(
                    new OrphanResourcesFinder <T>(source),
                    new OrphansLogger(_logger)),
                _creator,
                new ServiceAlarmBuilder <T, TAlarmConfig>(source, dimensionProvider, attributeProvider),
                mapper
                );

            _serviceAlarmTasks.Add(task);
        }
        public override IResource GetNew(IResourceSource resourceSource)
        {
            var cSource  = (Source)resourceSource;
            var distance = 1f / MathHelper.Tan(MathHelper.Pi / 8);
            var vertices = new[]
            {
                new VertexPos(-1, -1, 0),
                new VertexPos(-1, 1, 0),
                new VertexPos(1, 1, 0),
                new VertexPos(1, -1, 0),
                new VertexPos(-2, -2, -distance),
                new VertexPos(-2, 2, -distance),
                new VertexPos(2, 2, -distance),
                new VertexPos(2, -2, -distance)
            };
            var indices = new[]
            {
                0, 1, 1, 2, 2, 3, 3, 0,
                4, 5, 5, 6, 6, 7, 7, 4,
                0, 4, 1, 5, 2, 6, 3, 7
            };

            return(ExplicitModel.FromVertices(vertices, indices, ExplicitModelPrimitiveTopology.LineList).WithSource(cSource));
        }
Exemple #8
0
 public IObjectRef TryGetCachedResource(IResourceSource resourceSource, Type interfaceType) =>
 this.TryGetCachedResource(resourceSource, interfaceType, false);
Exemple #9
0
 public IObjectRef GetCachedOrCreateResource(IResourceSource resourceSource, Type interfaceType) =>
 this.GetCachedOrCreateResource(resourceSource, interfaceType, false);
Exemple #10
0
 public IObjectRef TryGetCachedResource(IResourceSource resourceSource, Type interfaceType) =>
 null;
Exemple #11
0
 public void AddSource(IResourceSource source)
 {
     sources.Add(source);
 }
Exemple #12
0
 public OrphanTablesFinder(IResourceSource <TableDescription> tableSource)
 {
     _tableSource = tableSource;
 }
 public IObjectRef GetCachedOrCreateResource(IResourceSource resourceSource, Type interfaceType) =>
 base.innerRefT.GetCachedOrCreateResource(resourceSource, interfaceType);
Exemple #14
0
 public TableNamePopulator(IAlarmLogger logger,
                           IResourceSource <TableDescription> tableSource)
 {
     _logger      = logger;
     _tableSource = tableSource;
 }
Exemple #15
0
 public HtmlResourceLocalizer(IResourceSource resources) => this.resources = resources;
 public OrphanQueuesFinder(IResourceSource <QueueData> queueSource)
 {
     _queueSource = queueSource;
 }
 public static TResource GetCachedOrCreateResource <TResource>(this IResourceCache resourceCache, IResourceSource <TResource> resourceSource) where TResource : class, IObjectRef =>
 ((TResource)resourceCache.GetCachedOrCreateResource(resourceSource, typeof(TResource)));
 public static TResource SafeGetCachedOrCreateResource <TResource>(this IResourceCache resourceCache, IResourceSource <TResource> resourceSource) where TResource : class, IObjectRef
 {
     if (resourceSource == null)
     {
         return(default(TResource));
     }
     return((TResource)resourceCache.GetCachedOrCreateResource(resourceSource, typeof(TResource)));
 }
Exemple #19
0
 public override IResource GetNew(IResourceSource resourceSource)
 {
     return(GenerateNew().WithSource(resourceSource));
 }
Exemple #20
0
 public OrphanResourcesFinder(IResourceSource <T> source)
 {
     _source = source;
 }
Exemple #21
0
 public ResourceNamePopulator(IAlarmLogger logger,
                              IResourceSource <T> resourceSource)
 {
     _logger         = logger;
     _resourceSource = resourceSource;
 }
Exemple #22
0
 public static T WithSource <T>(this T resource, IResourceSource source)
     where T : IResource
 {
     resource.Source = source;
     return(resource);
 }
Exemple #23
0
 static Texture2D GetTexture(IResourceSource <Texture2D> source)
 {
     return(source != null?source.GetResourceValue() : null);
 }
 public StringResourceLocalizerFactory(IResourceSource resources) => this.resources = resources;
 public IObjectRef TryGetCachedResource(IResourceSource resourceSource, Type interfaceType) =>
 base.innerRefT.TryGetCachedResource(resourceSource, interfaceType);
Exemple #26
0
 public abstract IResource GetNew(IResourceSource resourceSource);