Ejemplo n.º 1
0
        /// <summary>
        /// 새 모듈을 생성합니다.
        /// </summary>
        /// <param name="parser">모듈 INI</param>
        /// <returns></returns>
        public static Module Create(INIParser parser)
        {
            var running = parser.GetValue("Module", "IsRunning");
            var type    = parser.GetValue("Module", "Type");
            var name    = parser.GetValue("Module", "Name");

            Module module = null;

            if (type == typeof(ReactorModule).FullName)
            {
                module = new ReactorModule(name);
            }
            else if (type == typeof(ControllerModule).FullName)
            {
                module = new ControllerModule(name);
            }
            else if (type == typeof(ReflectorModule).FullName)
            {
                module = new ReflectorModule(name);
            }
            else if (type == typeof(SchedulerModule).FullName)
            {
                module = new SchedulerModule(name);
            }
            else if (type == typeof(WeatherModule).FullName)
            {
                module = new WeatherModule(name);
            }
            else if (type == typeof(RegularTweet).FullName)
            {
                module = new RegularTweet(name);
            }
            else
            {
                return(null);
            }

            module.OpenSettings(parser);

            if (!string.IsNullOrEmpty(running))
            {
                module.IsRunning = bool.Parse(running);
            }
            else
            {
                module.IsRunning = true;
            }

            return(module);
        }
Ejemplo n.º 2
0
        public override Module CreateModule(object[] @params)
        {
            var moduleName = (string)@params[0];
            var StringSet  = (string)@params[0];
            var Time       = (int)@params[0];
            var Delay      = (int)@params[0];
            var StartTime  = (string)@params[0];
            var EndTime    = (string)@params[0];

            var module = new ReactorModule(moduleName);

            module.stringset = StringSet;
            module.LoadStringsets(StringSet);
            module.ExpireTime   = Time;
            module.ExpireDelay  = Delay;
            module.moduleWakeup = TimeSet.FromString(StartTime);
            module.moduleSleep  = TimeSet.FromString(EndTime);
            return(module);
        }