Exemple #1
0
        public LuaEngine(IServiceProvider sp, string name)
            : base(sp, name)
        {
            // create the state
            this.propertyScriptCount = new SimpleConfigItemProperty <int>(this, "tw_luaengine_scripts", "Skripte", "Lua-Engine", "Anzahl der aktiven Scripte.", "{0:N0}", 0);

            // create the lists
            this.scripts = new DEList <LuaScript>(this, "tw_scripts", "Scriptlist");
            this.globals = new DEList <LuaAttachedGlobal>(this, "tw_globals", "Attached scripts");

            // Register the service
            var sc = sp.GetService <IServiceContainer>(true);

            sc.AddService(typeof(IDELuaEngine), this);

            // register context extensions
            LuaType.RegisterTypeExtension(typeof(HttpResponseHelper));

            // create the debug options
            debugHook                = new LuaEngineTraceLineDebugger(this);
            debugOptions             = new LuaCompileOptions();
            debugOptions.DebugEngine = debugHook;

            // update lua runtime
            sp.GetService <DEServer>(true).UpdateLuaRuntime(lua);
        }         // ctor
Exemple #2
0
        public DEServer(string configurationFile, IEnumerable <string> properties)
            : base(new ServiceContainer(), "Main")
        {
            if (Current != null)
            {
                throw new InvalidOperationException("Only one instance per process is allowed.");
            }
            Current = this;

            // register resolver
            this.resolveEventHandler = (sender, e) => ResolveAssembly(e.Name, e.RequestingAssembly);
            AddAssemblyPath(".");
            AddAssemblyPath(Path.GetDirectoryName(GetType().Assembly.Location));
            AppDomain.CurrentDomain.AssemblyResolve += resolveEventHandler;

            // register session list
            this.eventSessions = new DEList <EventSession>(this, "tw_eventsessions", "Event sessions");

            // create configurations service
            this.configuration = new DEConfigurationService(this, configurationFile, ConvertProperties(properties));
            this.dumpFiles     = new DEList <DumpFileInfo>(this, "tw_dumpfiles", "Dumps");

            PublishItem(dumpFiles);
            PublishItem(new DEConfigItemPublicAction("dump")
            {
                DisplayName = "Dump"
            });
        } // ctor
Exemple #3
0
        public TcpServer(IServiceProvider sp, string name)
            : base(sp, name)
        {
            this.connections = new DEList <ConnectionTcp>(this, "tw_connections", "Connections");

            var sc = this.GetService <IServiceContainer>(true);

            sc.AddService(typeof(IServerTcp), this);
        }         // ctor
Exemple #4
0
        public DECronEngine(IServiceProvider sp, string name)
            : base(sp, name)
        {
            this.cronItemCacheController = new CronItemCacheController(this);
            this.currentJobs             = new DEList <CurrentRunningJob>(this, "tw_cron_running", "Cron running");

            PublishItem(this.currentJobs);

            // Register Engine
            var sc = sp.GetService <IServiceContainer>(true);

            sc.AddService(typeof(IDECronEngine), this, false);

            // Register Server events
            Server.Queue.RegisterEvent(CancelJobs, DEServerEvent.Shutdown);
            Server.Queue.RegisterEvent(RefreshCronServices, DEServerEvent.Reconfiguration);
        }         // ctor