コード例 #1
0
 private static void StoreResults(Assembly a, string path, AssemblyResolutionResult result, ReferenceAssemblyType assemblyType)
 {
     lock (s_lock) {
         if (!AssemblyLocations.ContainsKey(a))
         {
             AssemblyLocations.Add(a, path);
             AssemblyResolutionResults.Add(a, result);
             ReferenceAssemblyTypes.Add(a, assemblyType);
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Evaluator"/> class. This constructor can be
        /// used by classes that inherit the compiler to change the base type of the compiled
        /// producer class.
        /// </summary>
        /// <param name="compiler">The compiler.</param>
        /// <param name="producerType">Type of the producer.</param>
        protected Evaluator(ICompiler compiler, Type producerType = null)
        {
            if (compiler == null)
            {
                throw new ArgumentNullException(nameof(compiler));
            }

            _compiler = compiler;

            if (producerType != null && this._producerType != producerType)
            {
                if (!typeof(IProducer).IsAssignableFrom(producerType))
                {
                    throw new NotSupportedException("The baseType parameter needs to be an implementation of IProducer.");
                }

                this._producerType = producerType;
                AssemblyLocations.Add(producerType.Assembly.Location);
            }

            Usings.Add("System");
            AssemblyLocations.Add(typeof(object).Assembly.Location);
            AssemblyLocations.Add(typeof(IProducer).Assembly.Location);
        }