public virtual void Register(ITypeImporter importer)
 {
     if (importer == null)
         throw new ArgumentNullException("importer");
     
     Importers.Put(importer);
 }
 public void Add(ITypeImporter importer)
 {
     if (importer == null)
         throw new ArgumentNullException("importer");
     
     ImporterByType.Add(importer.OutputType, importer);
 }
 public void Add(ITypeImporter exporter)
 {
     if (exporter == null)
         throw new ArgumentNullException("exporter");
     
     base.Add(exporter);
 }
Esempio n. 4
0
        public CommandProxies(ITypeDiscoverer typeDiscoverer, ITypeImporter typeImporter, ICodeGenerator codeGenerator, WebConfiguration configuration)
        {
            _typeDiscoverer = typeDiscoverer;
            _typeImporter   = typeImporter;
            _codeGenerator  = codeGenerator;

            _configuration = configuration;
        }
 public void Put(ITypeImporter exporter)
 {
     if (exporter == null)
         throw new ArgumentNullException("exporter");
     
     Remove(exporter.OutputType);
     Add(exporter);
 }
Esempio n. 6
0
 public CommandProxies(ITypeDiscoverer typeDiscoverer, ITypeImporter typeImporter, ICodeGenerator codeGenerator, WebConfiguration configuration)
 {
     _typeDiscoverer = typeDiscoverer;
     _typeImporter = typeImporter;
     _codeGenerator = codeGenerator;
     
     _configuration = configuration;
 }
Esempio n. 7
0
        private TypeReference TestSomeType(TypeReference key,
                                           ITypeSuggestor patcher, ITypeImporter importer)
        {
            Console.Write($" got '{WithoutNamespace(key)}'");
            var newKey = patcher[key, importer];

            Console.WriteLine($" --> '{WithoutNamespace(newKey)}'");
            return(newKey);
        }
Esempio n. 8
0
        private TypeReference TestSomeType(TypeReference key,
                                           ITypePatcher patcher, ITypeImporter importer)
        {
            var field = new FieldDefinition("test", FieldAttributes.Private, key)
            {
                DeclaringType = _ass.GetAllTypes().First()
            };
            var result = new List <TypeReference>();

            Console.Write($" got '{WithoutNamespace(field.FieldType)}'");
            patcher.Patch(field, o => result.Add(o));
            Console.WriteLine($" --> '{WithoutNamespace(field.FieldType)}'");
            return(field.FieldType ?? result.FirstOrDefault());
        }
Esempio n. 9
0
 public CommandSecurityProxies(
         ITypeDiscoverer typeDiscoverer, 
         ITypeImporter typeImporter, 
         ICodeGenerator codeGenerator,
         ICommandSecurityManager commandSecurityManager,
         IContainer container,
         WebConfiguration configuration)
 {
     _typeDiscoverer = typeDiscoverer;
     _typeImporter = typeImporter;
     _codeGenerator = codeGenerator;
     _configuration = configuration;
     _container = container;
     _commandSecurityManager = commandSecurityManager;
 }
Esempio n. 10
0
 public CommandSecurityProxies(
     ITypeDiscoverer typeDiscoverer,
     ITypeImporter typeImporter,
     ICodeGenerator codeGenerator,
     ICommandSecurityManager commandSecurityManager,
     IContainer container,
     WebConfiguration configuration)
 {
     _typeDiscoverer         = typeDiscoverer;
     _typeImporter           = typeImporter;
     _codeGenerator          = codeGenerator;
     _configuration          = configuration;
     _container              = container;
     _commandSecurityManager = commandSecurityManager;
 }
Esempio n. 11
0
 public TypeReference this[TypeReference type, ITypeImporter import]
 {
     get
     {
         TypeReference tNew;
         if (_dict.TryGetValue(type, out tNew))
         {
             return(import.Import(tNew));
         }
         var altKey = _dict.Keys.FirstOrDefault(r => r.FullName == type.FullName);
         if (altKey != null && _dict.TryGetValue(altKey, out tNew))
         {
             return(import.Import(tNew));
         }
         ByReferenceType byRef;
         if ((byRef = type as ByReferenceType) != null)
         {
             return(this[byRef.ElementType, import].MakeByReferenceType());
         }
         ArrayType arType;
         if ((arType = type as ArrayType) != null)
         {
             return(this[arType.ElementType, import].MakeArrayType(arType.Rank).ApplyDims(arType));
         }
         GenericInstanceType gnType;
         if ((gnType = type as GenericInstanceType) != null)
         {
             var args = gnType.GenericArguments.Select(a => this[a, import]).ToArray();
             return(this[gnType.ElementType, import].MakeGenericInstanceType(args));
         }
         if (type.IsInStandardLib())
         {
             return(import.Import(type));
         }
         return(type);
     }
 }
Esempio n. 12
0
		/// <summary>
		/// Initializes a new instance of a <see cref="CommandHandlerManager">CommandHandlerManager</see>
		/// </summary>
		/// <param name="importer">
		/// <see cref="ITypeImporter">TypeImporter</see> to use for discovering the 
		/// <see cref="ICommandHandlerInvoker">ICommandHandlerInvoker</see>'s to use
		/// </param>
		public CommandHandlerManager(ITypeImporter importer)
		{
			_importer = importer;
			Initialize();
		}
Esempio n. 13
0
        private TypeReference TestSomeType(TypeReference key,
                                           Tuple <TypeSuggestor, TypePatcher> patcher, ITypeImporter importer)
        {
            var newKey = TestSomeType(key, patcher.Item1, importer);
            var newVal = TestSomeType(key, patcher.Item2, importer);

            if (!(newKey + "").Equals(newVal + ""))
            {
                throw new InvalidOperationException($"{WithoutNamespace(newKey)} != {WithoutNamespace(newVal)}");
            }
            return(newKey ?? newVal);
        }
Esempio n. 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TaskManager"/>
 /// </summary>
 /// <param name="taskRepository">A <see cref="ITaskRepository"/> to load / save <see cref="Task">tasks</see></param>
 /// <param name="taskScheduler">A <see cref="ITaskScheduler"/> for executing tasks and their operations</param>
 /// <param name="typeImporter">A <see cref="ITypeImporter"/> used for importing <see cref="ITaskStatusReporter"/></param>
 /// <param name="container">A <see cref="IContainer"/> to use for getting instances</param>
 public TaskManager(ITaskRepository taskRepository, ITaskScheduler taskScheduler, ITypeImporter typeImporter, IContainer container)
 {
     _taskRepository = taskRepository;
     _taskScheduler  = taskScheduler;
     _container      = container;
     _reporters      = typeImporter.ImportMany <ITaskStatusReporter>();
 }
 public TestImporterFamily(ITypeImporter importer)
 {
     _importer = importer;
 }
Esempio n. 16
0
 /// <summary>
 /// Initializes a new instance of a <see cref="CommandHandlerManager">CommandHandlerManager</see>
 /// </summary>
 /// <param name="importer">
 /// <see cref="ITypeImporter">TypeImporter</see> to use for discovering the
 /// <see cref="ICommandHandlerInvoker">ICommandHandlerInvoker</see>'s to use
 /// </param>
 public CommandHandlerManager(ITypeImporter importer)
 {
     _importer = importer;
     Initialize();
 }