Пример #1
0
        protected void InitWorld()
        {
            // Load the master config
            LoadConfig();

            // Find and load all projects
            DirectoryInfo ProjectRoot = new DirectoryInfo(MasterConfig.ProjectRoot);

            if (Directory.Exists(ProjectRoot.ToString()))
            {
                DirectoryInfo[] children = ProjectRoot.GetDirectories();
                foreach (DirectoryInfo child in children)
                {
                    LoadProject(child.Name);
                }
            }
            else
            {
                Directory.CreateDirectory(ProjectRoot.ToString());
            }
            //-initialize listeners
            foreach (string name in Projects.Keys)
            {
                InitProject(name);
            }

            // Sometime, I need to make this a switchable option.
            // I also need to provide a better plugin mechanism for new listeners.
            if (MasterConfig.UseGithubListener)
            {
                ListenAgent agent = new ListenAgent();
                agent.Logger = ((message, type) => WriteEvent(message, type, 0, 1));
                if (agent.Start())
                {
                    Daemons.Add(agent);
                }
                else
                {
                    agent.Stop();
                    WriteEvent("ListenAgent failed to start properly.", EventLogEntryType.Error, 0, 0);
                }
            }

            ////-start timers as appropriate
        }
Пример #2
0
        protected void InitWorld()
        {
            // Load the master config
            LoadConfig();

            // Find and load all projects
            DirectoryInfo ProjectRoot = new DirectoryInfo(MasterConfig.ProjectRoot);
            if (Directory.Exists(ProjectRoot.ToString()))
            {
                DirectoryInfo[] children = ProjectRoot.GetDirectories();
                foreach (DirectoryInfo child in children)
                {
                    LoadProject(child.Name);
                }
            }
            else
            {
                Directory.CreateDirectory(ProjectRoot.ToString());
            }
            //-initialize listeners
            foreach (string name in Projects.Keys)
            {
                InitProject(name);
            }

            // Sometime, I need to make this a switchable option.
            // I also need to provide a better plugin mechanism for new listeners.
            if (MasterConfig.UseGithubListener)
            {
                ListenAgent agent = new ListenAgent();
                agent.Logger = ((message, type) => WriteEvent(message, type, 0, 1));
                if (agent.Start())
                {
                    Daemons.Add(agent);
                }
                else
                {
                    agent.Stop();
                    WriteEvent("ListenAgent failed to start properly.", EventLogEntryType.Error, 0, 0);
                }
            }

            ////-start timers as appropriate
        }