Beispiel #1
0
        /// <summary>
        /// Extracts metadata information associtated with the CLR assembly.
        /// </summary>
        /// <exception cref="InvalidScriptAssemblyException">The assembly is invalid.</exception>
        private static ScriptAssemblyAttribute /*!*/ GetAttribute(Assembly /*!*/ realAssembly)
        {
            ScriptAssemblyAttribute result = ScriptAssemblyAttribute.Reflect(realAssembly);

            if (result == null)
            {
                throw new InvalidScriptAssemblyException(realAssembly);
            }

            return(result);
        }
Beispiel #2
0
 internal static ScriptAssembly /*!*/ Create(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                                             ScriptAssemblyAttribute /*!*/ scriptAttribute, string libraryRoot)
 {
     if (scriptAttribute.IsMultiScript)
     {
         return(new MultiScriptAssembly(applicationContext, realAssembly, libraryRoot));
     }
     else
     {
         return(new SingleScriptAssembly(applicationContext, realAssembly, libraryRoot));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Gets a script type stored in a specified single-script assembly.
        /// </summary>
        internal Type /*!*/ GetScriptType()
        {
            if (this.scriptType == null)
            {
                var attr = ScriptAssemblyAttribute.Reflect(RealModule.Assembly);
                Debug.Assert(attr != null);
                Debug.Assert(!attr.IsMultiScript);
                Debug.Assert(attr.SSAScriptType != null);

                this.scriptType = attr.SSAScriptType;
                Debug.Assert(this.scriptType != null);
            }
            return(this.scriptType);
        }
Beispiel #4
0
        /// <summary>
        /// Loads a script assembly using a specified CLR assembly.
        /// </summary>
        /// <param name="assembly">The assembly to be reflected.</param>
        /// <returns>The script assembly.</returns>
        /// <exception cref="InvalidScriptAssemblyException">The assembly is invalid.</exception>
        public static ScriptAssembly LoadFromAssembly(Assembly /*!*/ assembly)
        {
            Debug.Assert(assembly != null);

            ScriptAssembly          result;
            ScriptAssemblyAttribute attr = GetAttribute(assembly);

            if (attr.IsMultiScript)
            {
                result = new MultiScriptAssembly();
            }
            else
            {
                result = new SingleScriptAssembly();
            }

            result.namespacing = attr.Namespacing;
            result.module      = GetModule(assembly);
            result.LoadedFromAssembly(assembly);

            return(result);
        }
Beispiel #5
0
		internal static ScriptAssembly/*!*/ Create(ApplicationContext/*!*/ applicationContext, Assembly/*!*/ realAssembly,
            ScriptAssemblyAttribute/*!*/ scriptAttribute, string libraryRoot)
		{
            if (scriptAttribute.IsMultiScript)
                return new MultiScriptAssembly(applicationContext, realAssembly, libraryRoot);
            else
                return new SingleScriptAssembly(applicationContext, realAssembly, libraryRoot);
		}
Beispiel #6
0
 internal static ScriptAssembly/*!*/ Create(ApplicationContext/*!*/ applicationContext, Assembly/*!*/ realAssembly,
     ScriptAssemblyAttribute/*!*/ scriptAttribute)
 {
     return Create(applicationContext, realAssembly, scriptAttribute, null);
 }
Beispiel #7
0
 internal static ScriptAssembly /*!*/ Create(ApplicationContext /*!*/ applicationContext, Assembly /*!*/ realAssembly,
                                             ScriptAssemblyAttribute /*!*/ scriptAttribute)
 {
     return(Create(applicationContext, realAssembly, scriptAttribute, null));
 }