Example #1
0
        public PluginManager(PRoConClient cpcClient) {
            AppDomainSandbox = null;
            Plugins = new PluginDictionary();
            //this.m_dicLoadedPlugins = new Dictionary<string, IPRoConPluginInterface>();
            //this.m_dicEnabledPlugins = new Dictionary<string, IPRoConPluginInterface>();

            //this.CacheFailCompiledPluginVariables = new Dictionary<string, Dictionary<string, string>>();

            ProconClient = cpcClient;
            //this.LoadedClassNames = new List<string>();
            MatchedInGameCommands = new Dictionary<string, MatchCommand>();
            CommandsNeedingConfirmation = new ConfirmationDictionary();

            // Handle plugin invocation timeouts.
            Invocations = new List<PluginInvocation>();
            IgnoredPluginClassNames = new List<String>();

            InvocationTimeoutThreadRunning = true;
            InvocationTimeoutThread = new Thread(new ThreadStart(InvocationTimeoutLoop));
            InvocationTimeoutThread.Start();

            AssignEventHandler();
        }
Example #2
0
        public PluginManager(PRoConClient cpcClient) {
            AppDomainSandbox = null;
            Plugins = new PluginDictionary();
            //this.m_dicLoadedPlugins = new Dictionary<string, IPRoConPluginInterface>();
            //this.m_dicEnabledPlugins = new Dictionary<string, IPRoConPluginInterface>();

            //this.CacheFailCompiledPluginVariables = new Dictionary<string, Dictionary<string, string>>();

            ProconClient = cpcClient;
            //this.LoadedClassNames = new List<string>();
            MatchedInGameCommands = new Dictionary<string, MatchCommand>();
            CommandsNeedingConfirmation = new ConfirmationDictionary();

            // Handle plugin invocation timeouts.
            Invocations = new List<PluginInvocation>();
            IgnoredPluginClassNames = new List<String>();

            this.InvocationMaxRuntime = ProconClient.PluginMaxRuntimeSpan;

            if (this.InvocationMaxRuntime.TotalMilliseconds < 10) {
                this.InvocationMaxRuntime = PluginInvocation.MaximumRuntime;
            }

            // Default maximum runtime = 5 seconds, divided by 20
            // check every 250 milliseconds.
            this.InvocationTimeoutTimer = new Timer(state => this.InvocationTimeoutCheck(), null, (int)(this.InvocationMaxRuntime.TotalMilliseconds / 20.0), (int)(this.InvocationMaxRuntime.TotalMilliseconds / 20.0));

            AssignEventHandler();
        }