public ModuleActionInvoker( ActionContext actionContext, IReadOnlyList <IFilterProvider> filterProviders, IModuleFactory moduleFactory, ModuleActionDescriptor descriptor, IReadOnlyList <IInputFormatter> inputFormatters, IReadOnlyList <IOutputFormatter> outputFormatters, IReadOnlyList <IModelBinder> modelBinders, IReadOnlyList <IModelValidatorProvider> modelValidatorProviders, IReadOnlyList <IValueProviderFactory> valueProviderFactories, IActionBindingContextAccessor actionBindingContextAccessor, ILogger logger, DiagnosticSource diagnostic, int maxModelValidationErrors) : base( actionContext, filterProviders, inputFormatters, outputFormatters, modelBinders, modelValidatorProviders, valueProviderFactories, actionBindingContextAccessor, logger, diagnostic, maxModelValidationErrors) { _descriptor = descriptor; _moduleFactory = moduleFactory; }
public ModuleActionInvokerProvider( IEnumerable<IFilterProvider> filterProviders, IModuleFactory moduleFactory) { _moduleFactory = moduleFactory; _filterProviders = filterProviders.OrderBy(p => p.Order).ToList(); }
public ModuleActionInvoker( ActionContext actionContext, IReadOnlyList<IFilterProvider> filterProviders, IModuleFactory moduleFactory, ModuleActionDescriptor descriptor, IReadOnlyList<IInputFormatter> inputFormatters, IReadOnlyList<IOutputFormatter> outputFormatters, IReadOnlyList<IModelBinder> modelBinders, IReadOnlyList<IModelValidatorProvider> modelValidatorProviders, IReadOnlyList<IValueProviderFactory> valueProviderFactories, IActionBindingContextAccessor actionBindingContextAccessor, ILogger logger, DiagnosticSource diagnostic, int maxModelValidationErrors) : base( actionContext, filterProviders, inputFormatters, outputFormatters, modelBinders, modelValidatorProviders, valueProviderFactories, actionBindingContextAccessor, logger, diagnostic, maxModelValidationErrors) { _descriptor = descriptor; _moduleFactory = moduleFactory; }
public ModuleActionInvokerProvider( IEnumerable <IFilterProvider> filterProviders, IModuleFactory moduleFactory) { _moduleFactory = moduleFactory; _filterProviders = filterProviders.OrderBy(p => p.Order).ToList(); }
public ModuleActionInvokerProvider( IModuleFactory moduleFactory, IEnumerable <IFilterProvider> filterProviders, IReadOnlyList <IInputFormatter> inputFormatters, IReadOnlyList <IOutputFormatter> outputFormatters, IReadOnlyList <IModelBinder> modelBinders, IReadOnlyList <IModelValidatorProvider> modelValidatorProviders, IReadOnlyList <IValueProviderFactory> valueProviderFactories, IActionBindingContextAccessor actionBindingContextAccessor, IOptions <MvcOptions> optionsAccessor, ILogger logger, DiagnosticSource diagnostic, IServiceProvider serviceProvider) { _moduleFactory = moduleFactory; _filterProviders = filterProviders.OrderBy(p => p.Order).ToList(); _inputFormatters = inputFormatters; _outputFormatters = outputFormatters; _modelBinders = modelBinders; _modelValidatorProviders = modelValidatorProviders; _valueProviderFactories = valueProviderFactories; _actionBindingContextAccessor = actionBindingContextAccessor; _optionsAccessor = optionsAccessor; _logger = logger; _diagnostic = diagnostic; _serviceProvider = serviceProvider; }
public ModuleActionInvokerProvider( IModuleFactory moduleFactory, IEnumerable<IFilterProvider> filterProviders, IReadOnlyList<IInputFormatter> inputFormatters, IReadOnlyList<IOutputFormatter> outputFormatters, IReadOnlyList<IModelBinder> modelBinders, IReadOnlyList<IModelValidatorProvider> modelValidatorProviders, IReadOnlyList<IValueProviderFactory> valueProviderFactories, IActionBindingContextAccessor actionBindingContextAccessor, IOptions<MvcOptions> optionsAccessor, ILogger logger, DiagnosticSource diagnostic, IServiceProvider serviceProvider) { _moduleFactory = moduleFactory; _filterProviders = filterProviders.OrderBy(p => p.Order).ToList(); _inputFormatters = inputFormatters; _outputFormatters = outputFormatters; _modelBinders = modelBinders; _modelValidatorProviders = modelValidatorProviders; _valueProviderFactories = valueProviderFactories; _actionBindingContextAccessor = actionBindingContextAccessor; _optionsAccessor = optionsAccessor; _logger = logger; _diagnostic = diagnostic; _serviceProvider = serviceProvider; }
public static void RegisterAllModules(this IModuleFactory moduleFactory, Assembly assembly) { var foundTypes = assembly .GetTypes() .Where(t => t.GetCustomAttribute <ModuleAttribute>() != null) .ToList(); foreach (var type in foundTypes) { ModuleAttribute attribute = type.GetCustomAttribute <ModuleAttribute>(); var description = FillDescriptionFromAttribute(type, attribute); moduleFactory.Register(description.ModuleType, description, (runtime, s) => (IModule)s.GetInstance(type), type); } var typeAliases = assembly .GetTypes() .Where(t => t.GetCustomAttribute <ModuleTypeAliasAttribute>() != null) .ToList(); foreach (var type in typeAliases) { ModuleAttribute moduleAttribute = type.GetCustomAttribute <ModuleAttribute>(); ModuleTypeAliasAttribute aliasAttribute = type.GetCustomAttribute <ModuleTypeAliasAttribute>(); if (moduleAttribute == null || aliasAttribute == null) { continue; } moduleFactory.RegisterAlias(aliasAttribute.AliasType, moduleAttribute.ModuleType, aliasAttribute.IncludeInCatalog); } }
public List <Module> GetModules(IModuleFactory moduleFactory) { List <Module> ml = new List <Module>(); if (JSONFile.TryGetValue("topology_file", out JsonValue topologyFile)) { JSONParser jSONParser = new JSONParser(JSONParser.ReadJSONFile((string)topologyFile)); ml.AddRange(jSONParser.GetModules(moduleFactory)); } if (JSONFile.TryGetValue(ModuleKey, out JsonValue jsonModules)) { foreach (JsonValue jm in jsonModules) { JsonObject jo = (JsonObject)JsonValue.Parse(jm.ToString()); int number = jo.TryGetValue(ModuleNumber, out JsonValue value) ? (int)value : 1; for (int i = 0; i < number; i++) { ml.Add(CreateModule(jm.ToString(), moduleFactory)); } } } if (ml.Count == 0) { throw new Exceptions.JSONnotValidException("JSON file does not contain any modules"); } return(ml); }
/// <summary> /// Given a scene find the module factory in that scene. Useful for finding modules when there a are multiples of the same type, but only one per scene. /// </summary> /// <param name="scene">The scene we expect to find the module in.</param> /// <param name="sceneFactory">The found factory, if found. else null.</param> /// <returns>True if a factory was found in the scene. Else false and sceneFactory will be null.</returns> public static bool TryFindFactoryInScene(Scene scene, out IModuleFactory sceneFactory) { //if asset bundle scene check against scene path if (scene.buildIndex == -1) { foreach (DefaultModuleFactory factory in _all) { if (factory._scenePath == scene.path) { sceneFactory = factory; return(true); } } } else //if scene included in build check against scene id { foreach (DefaultModuleFactory factory in _all) { if (factory._sceneIndex == scene.buildIndex) { sceneFactory = factory; return(true); } } } sceneFactory = null; return(false); }
public static void RegisterAll(IModuleFactory factory) { foreach (var op in operations) { op.Register(factory); } }
public static void ClassInit(TestContext context) { if (_MODULE_FACTORY == null) _MODULE_FACTORY = ModuleFactory.GetFactory(); if (_DECK_BUILDER == null) _DECK_BUILDER = Deck.GetBuilder(); }
public ReactorManager() { moduleFactory = new ModuleFactory(); reactorFactory = new ReactorFactory(); this.currentId = Constants.StartingId; this.reactors = new Dictionary <int, IReactor>(); this.modules = new Dictionary <int, IModule>(); }
public void RegisterModuleFactory(IModuleFactory factory) { if (_RegisteredFactories.ContainsKey(factory.ModuleTypeName)) { throw new Exception($"Factory for control: {factory.ModuleTypeName} is already registered!"); } _RegisteredFactories.Add(factory.ModuleTypeName, factory); }
public static void AddModule( IModuleFactory factory ) { foreach( ModulePreset preset in factory.Presets ) { Presets.Add( preset.Name, preset ); } FactoriesByType.Add( factory.ModuleType, factory ); FactoriesById.Add( factory.ID, factory ); }
public ModuleSourceTestBase() { root = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(root); application = StubApplication(); moduleFactory = StubModuleFactory(); }
public ReactorManager(IReactorFactory reactorFactory, IModuleFactory moduleFactory) { this.identifiableObjects = new Dictionary <int, IIdentifiable>(); this.reactors = new Dictionary <int, IReactor>(); this.modules = new Dictionary <int, IModule>(); currentId = Constants.StartingId; this.reactorFactory = reactorFactory; this.moduleFactory = moduleFactory; }
Module CreateModule(string jsonString, IModuleFactory moduleFactory) { JsonObject jo = (JsonObject)JsonValue.Parse(jsonString); string type = GetValueFromObjectOrDie(jo, ModuleType); int gates = GetValueFromObjectOrDie(jo, ModuleGates); return(moduleFactory.CreateModule(type, jsonString)); }
public static void AddModule(IModuleFactory factory) { foreach (ModulePreset preset in factory.Presets) { Presets.Add(preset.Name, preset); } FactoriesByType.Add(factory.ModuleType, factory); FactoriesById.Add(factory.ID, factory); }
public ModuleActionInvoker( IReadOnlyList <IFilterProvider> filterProviders, IModuleFactory moduleFactory, ActionContext actionContext) { _filterProviders = filterProviders; _moduleFactory = moduleFactory; Context = new ModuleContext(actionContext); }
public void TestInitialize() { // Reset the static singleton inside the module factory: Type type = typeof(ModuleFactory); FieldInfo info = type.GetField("moduleFactory", BindingFlags.NonPublic | BindingFlags.Static); info.SetValue(null, null); this.factoryUnderTest = ModuleFactory.ModuleFactorySingleton; }
public VkApi(IModuleFactory moduleFactory) { ModuleFactory = moduleFactory; LazyAccount = new Lazy <IAccount>(() => ModuleFactory.Get <Account>(Environment)); LazyAds = new Lazy <IAds>(() => ModuleFactory.Get <Ads>(Environment)); LazyApps = new Lazy <IApps>(() => ModuleFactory.Get <Apps>(Environment)); LazyBoard = new Lazy <IBoard>(() => ModuleFactory.Get <Board>(Environment)); LazyDatabase = new Lazy <IDatabase>(() => ModuleFactory.Get <Database>(Environment)); }
public SimulationEnvironment(string configFilename, IModuleFactory moduleFactory, IUserInterface userInterface) { EventQueue = new EventQueue(); DictModules = new Dictionary<string, List<Module>>(); UI = userInterface; ModuleFactory = moduleFactory; Time = 0; ConfigurationFileName = configFilename; }
public Device(IModuleFactory moduleFactory) { this.moduleFactory = moduleFactory; Handle = new Random().Next(); Version = 3; Description = "Эмулятор CAPD v1.0.0.0"; Modules = new List<IModule>(); active = false; quantumsQueue = new ConcurrentQueue<IQuantumDevice>(); moduleFactory.TryCreate(ModuleType.Null, quantumsQueue, out nullModule); }
public XrcService(IPageProviderService pageProvider, IViewFactory viewFactory, IModuleFactory moduleFactory, IPageScriptService scriptService, Configuration.IHostingConfig hostingConfig, Configuration.IEnvironmentConfig environmentConfig) { _hostingConfig = hostingConfig; _environmentConfig = environmentConfig; _pageProvider = pageProvider; _viewFactory = viewFactory; _moduleFactory = moduleFactory; _scriptService = scriptService; }
public void RegisterModule <Tinterface>(IModuleFactory <Tinterface> moduleFactory) where Tinterface : ICodeFirstEntityModule { FreezeCheck(false); if (_modules.ContainsKey(typeof(Tinterface))) { throw new CodeFirstResolverException(typeof(Tinterface).Name + " already has a registered factory"); } if (moduleFactory.GetPrerequisites().Except(_order).Any()) { throw new CodeFirstResolverException(typeof(Tinterface).Name + " has dependencies which are not satisfied."); } _modules.TryAdd(typeof(Tinterface), moduleFactory); _order.Add(typeof(Tinterface)); _pristine = false; }
public static IModule ReadModule(Stream stream) { BinaryReader reader = new BinaryReader(stream); string moduleID = reader.ReadString(); int settingsLength = reader.ReadInt32(); if (FactoriesById.ContainsKey(moduleID)) { IModuleFactory factory = GetFactoryByID(moduleID); IModule module = factory.GetInstance(); //module.ReadSettings( reader, settingsLength ); return(module); } else { stream.Seek(settingsLength, SeekOrigin.Current); return(null); } }
public ModuleActionInvokerProvider( IModuleFactory moduleFactory, IEnumerable<IFilterProvider> filterProviders, IInputFormattersProvider inputFormattersProvider, IModelBinderProvider modelBinderProvider, IModelValidatorProviderProvider modelValidatorProviderProvider, IValueProviderFactoryProvider valueProviderFactoryProvider, IScopedInstance<ActionBindingContext> actionBindingContextAccessor, IServiceProvider serviceProvider) { _moduleFactory = moduleFactory; _filterProviders = filterProviders.OrderBy(p => p.Order).ToList(); _inputFormattersProvider = inputFormattersProvider; _modelBinderProvider = modelBinderProvider; _modelValidatorProviderProvider = modelValidatorProviderProvider; _valueProviderFactoryProvider = valueProviderFactoryProvider; _actionBindingContextAccessor = actionBindingContextAccessor; _serviceProvider = serviceProvider; }
public static IModule ReadModule(NBTag tag) { string moduleID = tag["ID"].GetString(); if (!FactoriesById.ContainsKey(moduleID)) { return(null); } IModuleFactory factory = GetFactoryByID(moduleID); IModule module = factory.GetInstance(); if (tag.Contains("Properties")) { } module.ReadSettings(tag["Settings"]); return(module); }
public static NBTag WriteModule(string tagName, IModule module) { NBTCompound root = new NBTCompound(tagName); IModuleFactory factory = GetFactoryByType(module.GetType()); root.Append("ID", factory.ID); bool auto = !factory.ModuleType.GetCustomAttributes(typeof(DisableAutoSerializationAttribute), true).Any(); if (auto) { root.Append(WriteModuleProperties(module)); } NBTag customSettings = new NBTCompound("Settings"); module.WriteSettings(customSettings); root.Append(customSettings); return(root); }
public static ModuleUserControl GetControlFromModuleData(Domain.Modules module) { var moduleType = (ModuleType)module.ModuleType; IModuleFactory <ModuleUserControl> factory = null; switch (moduleType) { case ModuleType.Text: factory = new TextFactory(); break; case ModuleType.Heading: factory = new HeadingFactory(); break; case ModuleType.Image: factory = new ImageFactory(); break; case ModuleType.Login: factory = new LoginFactory(); break; case ModuleType.Register: factory = new RegisterFactory(); break; case ModuleType.Logout: factory = new DefaultModuleFactory("~/Module/Login/Logout.ascx"); break; default: throw new Exception("Unkown module type!"); } return(factory?.GetControl(module)); }
public static void ClassInit(TestContext context) { if (_MODULE_FACTORY == null) _MODULE_FACTORY = ModuleFactory .GetFactory(); }
public GameBuilder(IModuleFactory moduleFactory, ILogicBuilder logicBuilder, IDealerBuilder dealerBuilder, IDeckBuilder deckBuilder, ITableBuilder tableBuilder, IPlayerBuilder playerBuilder) { _moduleFactory = moduleFactory; _logicBuilder = logicBuilder; _dealerBuilder = dealerBuilder; _deckBuilder = deckBuilder; _tableBuilder = tableBuilder; _playerBuilder = playerBuilder; }
public ModuleContainer(IModuleCache cache, IModuleFactory factory) { moduleCache = cache; moduleFactory = factory; }
public static void ClassCleanup() { _MODULE_FACTORY = null; }
public XsltView(IModuleFactory moduleFactory, IModuleCatalogService moduleCatalog, IResourceProviderService resourceProvider) { _moduleFactory = moduleFactory; _moduleCatalog = moduleCatalog; _resourceProvider = resourceProvider; }
private static void RunProgram() { // Scanner Scanner scan = null; try { scan = new Scanner(inputFile); scan.Scan(); } catch (IOException) { Console.WriteLine("The specified input file {0} was not found.", inputFile); return; } catch (XmlException e) { Console.WriteLine("The specified input file is not well-formed Xaml."); Console.WriteLine(); if (debugMode) { Console.WriteLine("Debug: {0}", e.Message); Console.WriteLine(); } return; } // Parser IActivity ast = null; try { Parser pars = new Parser(scan.Token()); // ModuleFactory IModuleFactory modules = ModuleFactory.Instance; pars.ModuleFactory = modules; ast = pars.Parse(); } catch (DirectoryNotFoundException e) { Console.WriteLine("Error: {0}", e.Message); return; } catch (ParseException e) { Console.WriteLine("Error while parsing the Xaml:"); Console.WriteLine(e.Message); if (debugMode) { Console.WriteLine("Debug: activity '{0}', queue element near or at '{1}', ", e.Activity, e.ElementNumber); Console.WriteLine(); } return; } // Generation try { Generation gen = new Generation(ast); gen.Compile(); // Format string format = formatFile.ToString(); if (Path.GetFileNameWithoutExtension(outputFile).Equals(String.Empty)) { gen.WriteOutput(Path.ChangeExtension(inputFile, format), format); if (File.Exists(Path.ChangeExtension(inputFile, format))) { Console.WriteLine("Output file '{0}' sucessfully written", Path.GetFileNameWithoutExtension(inputFile) + "." + format); } } else { gen.WriteOutput(Path.ChangeExtension(outputFile, format), format); if (File.Exists(Path.ChangeExtension(outputFile, format))) { Console.WriteLine("Output file '{0}' sucessfully written", Path.GetFileNameWithoutExtension(outputFile) + "." + format); } } } catch (SecurityException e) { Console.WriteLine(e.Message); } catch (Win32Exception e) { Console.WriteLine(e.Message); } catch (IOException e) { Console.WriteLine(e.Message); } }
public Device(IDeviceApi deviceApi, IModuleFactory moduleFactory, int handle, byte version, string description) { this.deviceApi = deviceApi; this.moduleFactory = moduleFactory; Handle = handle; Version = version; Description = description; Active = false; Modules = new ObservableCollection<IModule>(); modulesDictionary = new Dictionary<byte, IModule>(); }
public ModulePreset(string name, ModuleInstanceCallback _callback, IModuleFactory factory) { Name = name; callback = _callback; Factory = factory; }
public IGameBuilder ModuleFactoryIs(IModuleFactory factory) { _moduleFactory = factory; return this; }
/// <summary> /// Initializes a new instance of the <see cref="DefaultIrcClient"/> class. /// </summary> /// <param name="userService"> /// The user service. /// </param> /// <param name="moduleFactory"> /// The module factory. /// </param> public DefaultIrcClient(IUserService userService, IModuleFactory moduleFactory) : base(moduleFactory) { this.userService = userService; this.ircClient = new IrcClient(); this.ctcpClient = new CtcpClient(this.ircClient); }
public static NBTag WriteModuleProperties(IModule module) { IModuleFactory factory = GetFactoryByType(module.GetType()); NBTag root = new NBTCompound("Properties"); foreach (PropertyInfo p in factory.ModuleType.GetProperties()) { object val = p.GetValue(module, null); if (p.PropertyType == typeof(byte)) { root.Append(p.Name, (byte)val); } else if (p.PropertyType == typeof(short)) { root.Append(p.Name, (short)val); } else if (p.PropertyType == typeof(int)) { root.Append(p.Name, (int)val); } else if (p.PropertyType == typeof(long)) { root.Append(p.Name, (long)val); } else if (p.PropertyType == typeof(float)) { root.Append(p.Name, (float)val); } else if (p.PropertyType == typeof(double)) { root.Append(p.Name, (double)val); } else if (p.PropertyType == typeof(byte[])) { root.Append(p.Name, (byte[])val); } else if (p.PropertyType == typeof(string)) { root.Append(p.Name, (string)val); } else if (p.PropertyType == typeof(bool)) { root.Append(p.Name, (bool)val); } else if (p.PropertyType == typeof(Color)) { root.Append(p.Name, (Color)val); } else if (p.PropertyType == typeof(Point)) { root.Append(p.Name, (Point)val); } else if (p.PropertyType == typeof(PointF)) { root.Append(p.Name, (PointF)val); } else { throw new NotSupportedException("Unknown property type."); } } return(root); }
public ModulePreset( string name, ModuleInstanceCallback _callback, IModuleFactory factory ) { Name = name; callback = _callback; Factory = factory; }
public static void ReadModuleProperties(IModule module, NBTag tag) { IModuleFactory factory = GetFactoryByType(module.GetType()); foreach (PropertyInfo p in factory.ModuleType.GetProperties()) { if (!tag.Contains(p.Name)) { continue; } if (p.PropertyType == typeof(byte)) { p.SetValue(module, tag.GetByte(), null); } else if (p.PropertyType == typeof(short)) { p.SetValue(module, tag.GetShort(), null); } else if (p.PropertyType == typeof(int)) { p.SetValue(module, tag.GetInt(), null); } else if (p.PropertyType == typeof(long)) { p.SetValue(module, tag.GetLong(), null); } else if (p.PropertyType == typeof(float)) { p.SetValue(module, tag.GetFloat(), null); } else if (p.PropertyType == typeof(double)) { p.SetValue(module, tag.GetDouble(), null); } else if (p.PropertyType == typeof(byte[])) { p.SetValue(module, tag.GetBytes(), null); } else if (p.PropertyType == typeof(string)) { p.SetValue(module, tag.GetString(), null); } else if (p.PropertyType == typeof(bool)) { p.SetValue(module, tag.GetBool(), null); } else if (p.PropertyType == typeof(Color)) { p.SetValue(module, tag.GetColor(), null); } else if (p.PropertyType == typeof(Point)) { p.SetValue(module, tag.GetBool(), null); } else if (p.PropertyType == typeof(PointF)) { p.SetValue(module, tag.GetPointF(), null); } else { throw new NotSupportedException("Unknown property type."); } } }
/// <summary> /// Creates a new instance of <see cref="ModuleConfigurer" /> /// </summary> /// <param name="options">The current command app options.</param> /// <param name="moduleCache">The module cache to save the added modules.</param> /// <param name="moduleFactory">The factory to create modules.</param> public ModuleConfigurer(IOptions <MariCommandsOptions> options, IModuleCache moduleCache, IModuleFactory moduleFactory) { Options = options.Value; _moduleCache = moduleCache; _moduleFactory = moduleFactory; }
public static void ClassCleanup() { _MODULE_FACTORY = null; _DECK_BUILDER = null; }
public DevicesManager(IDeviceSearchApi api, IDeviceApi deviceApi, IModuleFactory moduleFactory) { this.api = api; this.deviceApi = deviceApi; this.moduleFactory = moduleFactory; }
public abstract void Register(IModuleFactory factory);
public override void Register(IModuleFactory factory) { factory.Register(moduleType, new ModuleDescription { ModuleType = moduleType, HelpText = description }, (runtime, s) => (IModule) new BinaryOperation(runtime, moduleType, operation, resultPinId, operand1PinId, operand2PinId), null); }
public TypedMessageHandlerFacade(IHandlerTypeResolver resolver, IModuleFactory moduleFactory) { _resolver = resolver; _moduleFactory = moduleFactory; }
/// <summary> /// Initializes a new instance of the <see cref="FakeIrcClient"/> class. /// </summary> /// <param name="moduleFactory"> /// The module factory. /// </param> public FakeIrcClient(IModuleFactory moduleFactory) : base(moduleFactory) { Console.WriteLine("{0} : {1}", this.GetType().Name, this.GetHashCode()); }
/// <summary> /// Initializes a new instance of the <see cref="AbstractIrcClient"/> class. /// </summary> /// <param name="moduleFactory"> /// The module factory. /// </param> protected AbstractIrcClient(IModuleFactory moduleFactory) { this.modules = moduleFactory.Create(this); }