示例#1
0
        public override Module CreateModule(object[] @params)
        {
            var module = new RegularTweet((string)@params[0]);

            module.stringsetname = ( string )@params[1];
            module.stringset     = StringSetsManager.GetStrings(module.stringsetname);
            module.duration      = ( int )@params[2];
            module.variation     = ( int )@params[3];
            module.IsRunning     = false;
            return(module);
        }
示例#2
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);
        }