コード例 #1
0
        public static void Initialize(Stream configuration)
        {
            Lock();
            try
            {
                LoadConfiguration(configuration);

                if (Binder == null)
                {
                    Binder = new DefaultBinder();
                }

                if (Activator == null)
                {
                    Activator = new DefaultActivator();
                }

                InitializeSettingItems();
                RegisterOperators();

                if (ScopeFactory == null)
                {
                    ScopeFactory = Activator.CreateInstance(GetNativeType(GetSettingsItem <string>(ConfigSchema.ScopeFactoryAttribute))) as IScopeFactory;
                }
                RegisterScopes();

                if (AssemblyManager == null)
                {
                    AssemblyManager = new DefaultAssemblyManager();
                }
                OnInitializingTypes(AssemblyManager);
                AssemblyManager.Initialize(Configuration);

                if (!string.IsNullOrEmpty(Configuration.Initialization))
                {
                    InitializationScript = Script.Compile(Configuration.Initialization);
                }

                RegisterOperatorHandler("+=", new EventOperatorHandler(true));
                RegisterOperatorHandler("-=", new EventOperatorHandler(false));

                ScriptNET.Ast.ScriptExpr.HandleOperator += HandleOperator;
            }
            finally
            {
                UnLock();
            }
        }
コード例 #2
0
 public static object CreateInstance(this IObjectActivator activator, Type type)
 {
     return(activator.CreateInstance(type, null));
 }
コード例 #3
0
 public static T CreateInstance <T>(this IObjectActivator activator, object[] args)
 {
     return((T)activator.CreateInstance(typeof(T), args));
 }
コード例 #4
0
 public static object CreateInstance(this IObjectActivator activator, IScriptContext context, IObjectBind bind)
 {
     return(activator.CreateInstance(null, bind));
 }