Exemplo n.º 1
0
        static PhpGdImageResource imagercreatefromfile(Context ctx, string filename, IConfigurationModule formatOpt = null)
        {
            if (string.IsNullOrEmpty(filename))
            {
                PhpException.Throw(PhpError.Warning, Resources.filename_cannot_be_empty);
                return(null);
            }

            var configuration = (formatOpt == null)
                ? Configuration.Default
                : new Configuration(formatOpt);

            Image <Rgba32> img    = null;
            IImageFormat   format = null;

            using (var stream = Utils.OpenStream(ctx, filename))
            {
                if (stream != null)
                {
                    try { img = Image.Load(configuration, stream, out format); }
                    catch { }
                }
            }

            return((img != null)
                ? new PhpGdImageResource(img, format)
                : null);
        }
Exemplo n.º 2
0
        public virtual IConfigurator ApplyConfiguration <TEntity>(IConfigurationModule <TEntity> module)
        {
            var action = new Action <IEntityConfiguration <TEntity> >(module.Configure);

            HistoryConfiguration.SetEntityConfig(action);
            return(this);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Add configuration module
        /// </summary>
        /// <param name="module"></param>
        public void AddModule(IConfigurationModule module)
        {
            if (module == null)
            {
                throw new ArgumentNullException(nameof(module));
            }

            module.Configure(this);
        }
Exemplo n.º 4
0
        static PhpGdImageResource imagecreatecommon(int x_size, int y_size, IConfigurationModule configuration, IImageFormat format)
        {
            if (x_size <= 0 || y_size <= 0)
            {
                PhpException.Throw(PhpError.Warning, string.Format(Resources.invalid_image_dimensions));
                return(null);
            }

            return(new PhpGdImageResource(x_size, y_size, configuration, format));
        }
Exemplo n.º 5
0
        static StreamInsightRequestModule()
        {
            _streamInsightCore = ServiceLocator.Current.Resolve<QueriesCore>();
            _domainStatistics = ServiceLocator.Current.Resolve<IDomainStatisticsModule>();
            _requestsRepository = ServiceLocator.Current.Resolve<IRequestRepository>();
            _config = ServiceLocator.Current.Resolve<IConfigurationModule>();

            _streamInsightCore.RegisterCounting();

            _streamInsightCore.DomainStatisticsOutputService.Next += DomainStatisticsHandler;
        }
Exemplo n.º 6
0
        static StreamInsightRequestModule()
        {
            _streamInsightCore  = ServiceLocator.Current.Resolve <QueriesCore>();
            _domainStatistics   = ServiceLocator.Current.Resolve <IDomainStatisticsModule>();
            _requestsRepository = ServiceLocator.Current.Resolve <IRequestRepository>();
            _config             = ServiceLocator.Current.Resolve <IConfigurationModule>();

            _streamInsightCore.RegisterCounting();

            _streamInsightCore.DomainStatisticsOutputService.Next += DomainStatisticsHandler;
        }
Exemplo n.º 7
0
        static RawGatheringRequestModule()
        {
            _config           = ServiceLocator.Current.Resolve <IConfigurationModule>();
            _statisticsModule = ServiceLocator.Current.Resolve <IDomainStatisticsModule>();

            _handlers = Enumerable.Range(0, Environment.ProcessorCount * 2).Select(i => new GatheringRequestThread(i)).ToArray();

            _requestSlots     = Enumerable.Range(1, 5).Select(i => new GatheringRequestSlot(_handlers.Length)).ToArray();
            _currentSlotIndex = 0;
            _currentSlot      = _requestSlots[_currentSlotIndex];
            _timeLine         = DateTime.Now.AddSeconds(_config.CoreDelay / 5.0);
            _statsTimer       = new Timer(CountStats, null, 0, 100);
        }
        static Startup()
        {
            var configuartion = Environment.Configuration.GetSetting("Configuration");

            if (String.IsNullOrWhiteSpace(configuartion))
            {
                return;
            }

            if (configuartion.Equals("Mongo"))
            {
                defaultConfiguration = new Mongo();
            }
        }
        static StreamInsightRequestGatheringModule()
        {
            _streamInsightCore  = ServiceLocator.Current.Resolve <QueriesCore>();
            _domainStatistics   = ServiceLocator.Current.Resolve <IDomainStatisticsModule>();
            _requestsRepository = ServiceLocator.Current.Resolve <IRequestRepository>();
            _config             = ServiceLocator.Current.Resolve <IConfigurationModule>();

            _streamInsightCore.RegisterGathering();

            _streamInsightCore.EventsOutputService.Next += DomainRequestsHandler;
            if (_config.SaveRequestsToDb)
            {
                _streamInsightCore.EventsOutputService.Next += StatInput;
            }
        }
        static StreamInsightRequestGatheringModule()
        {
            _streamInsightCore = ServiceLocator.Current.Resolve<QueriesCore>();
            _domainStatistics = ServiceLocator.Current.Resolve<IDomainStatisticsModule>();
            _requestsRepository = ServiceLocator.Current.Resolve<IRequestRepository>();
            _config = ServiceLocator.Current.Resolve<IConfigurationModule>();

            _streamInsightCore.RegisterGathering();

            _streamInsightCore.EventsOutputService.Next += DomainRequestsHandler;
            if (_config.SaveRequestsToDb)
            {
                _streamInsightCore.EventsOutputService.Next += StatInput;
            }
        }
        public ConfigurationPageViewModel(IViewModelBaseModule baseModule, IConfigurationModule configurationModule) : base(baseModule)
        {
            _configurationModule = configurationModule;

            Title = "Configuration";
            _isEnableNotification = AppSettings.IsEnableNotification;
            _isEnableCache        = AppSettings.IsEnableCache;
            _hoursText            = AppSettings.HoursDay;
            _startupViewText      = AppSettings.StartupView;

            OpenCodeCommand        = new DelegateCommand(OpenCode);
            OpenTwitterCommand     = new DelegateCommand(OpenTwitter);
            OpenStartUpViewCommand = new DelegateCommand(OpenStartUpView);
            OpenHoursViewCommand   = new DelegateCommand(OpenHoursView);
            ClearCacheCommand      = new DelegateCommand(ClearCache);
        }
Exemplo n.º 12
0
        public static void AddModuleOnce(this IExportRegistrationBlock target, IConfigurationModule module)
        {
            lock (_modules)
            {
                var type = module.GetType();

                if (_modules.Contains(type))
                {
                    return;
                }

                if (Attribute.IsDefined(type, typeof(ModuleConfigurationAttribute)) && _config != null)
                {
                    var attribute = (ModuleConfigurationAttribute)Attribute.GetCustomAttribute(type, typeof(ModuleConfigurationAttribute));
                    var section   = _config.GetSection(attribute.SectionName);

                    section.Bind(module);
                }

                _modules.Add(type);
                target.AddModule(module);
            }
        }
Exemplo n.º 13
0
        private void ConfigureModule(IExportRegistrationBlock registrationBlock,
			IConfigurationModule configurationModule,
			IEnumerable<PropetryElement> element)
        {
            foreach (PropetryElement propertyElement in element)
            {
                PropertyInfo propertyInfo =
                    configurationModule.GetType().GetRuntimeProperty(propertyElement.Name);

                if (propertyInfo != null && propertyInfo.CanWrite)
                {
                    object finalValue = null;

                    if (propertyInfo.PropertyType == typeof(string))
                    {
                        finalValue = propertyElement.Value;
                    }
                    else
                    {
                        finalValue = Convert.ChangeType(propertyElement.Value, propertyInfo.PropertyType);
                    }

                    if (finalValue != null)
                    {
                        propertyInfo.SetValue(configurationModule, finalValue);
                    }
                }
            }

            configurationModule.Configure(registrationBlock);
        }
Exemplo n.º 14
0
 internal PhpGdImageResource(int x, int y, IConfigurationModule configuration, IImageFormat format)
     : this(new TImage(new Configuration(configuration), x, y), format)
 {
 }
Exemplo n.º 15
0
 /// <summary>
 /// Registers a new format provider.
 /// </summary>
 /// <param name="configuration">The configuration provider to call configure on.</param>
 public void Configure(IConfigurationModule configuration)
 {
     Guard.NotNull(configuration, nameof(configuration));
     configuration.Configure(this);
 }
Exemplo n.º 16
0
        /// <summary>
        ///     Adds configuration provided by the specified configuration module.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="module">The module.</param>
        /// <returns>The configuration.</returns>
        /// <exception cref="ArgumentNullException">The <paramref name="configuration" /> parameter is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException">The <paramref name="module" /> parameter is <c>null</c>.</exception>
        public static IBuildConfiguration Add(this IBuildConfiguration configuration, IConfigurationModule module)
        {
            configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));

            module = module ?? throw new ArgumentNullException(nameof(module));

            module.Configure(configuration);

            return(configuration);
        }
 public void RegisterConfigurationModule(IConfigurationModule module)
 {
     module.Configure(this);
 }
Exemplo n.º 18
0
 /// <summary>
 /// Configure container
 /// </summary>
 /// <param name="configurationModule"></param>
 public void Configure(IConfigurationModule configurationModule)
 {
     Container.Configure(configurationModule);
 }