コード例 #1
0
        /// <summary>
        /// Start the countdown process
        /// </summary>
        public static void StartCountdown()
        {
            //Quit countdown if it is disabled
            if (!Boolean.Parse(Common.IniFile.IniReadValue("countdown", "enabled")))
            {
                return;
            }

            //Load countdown items
            var countdownItems = new List<CountdownItem>();
            int items = int.Parse(Common.IniFile.IniReadValue("countdown", "count"));
            for (int i = 0; i < items; i++)
            {
                var ci = new CountdownItem();
                ci.ConsoleMessage = Common.IniFile.IniReadValue("countdown", string.Format("item{0}console", i));
                ci.UniverseMessage = Common.IniFile.IniReadValue("countdown", string.Format("item{0}universe", i));
                ci.WaitTime = int.Parse(Common.IniFile.IniReadValue("countdown", string.Format("item{0}wait", i)));
                countdownItems.Add(ci);
            }

            //Create a connection to flhook and connect it
            var flhookconnection = new FLHookConnection();
            flhookconnection.Connect();

            //Run Countdown
            foreach (CountdownItem ci in countdownItems)
            {
                Console.WriteLine(ci.ConsoleMessage);
                flhookconnection.SendUniverseMessage(ci.UniverseMessage);
                Wait(ci.WaitTime);
            }

            //Diconnect from FLHook
            flhookconnection.Disconnect();
        }
コード例 #2
0
        /// <summary>
        /// Start the countdown process
        /// </summary>
        public static void StartCountdown()
        {
            //Quit countdown if it is disabled
            if (!Boolean.Parse(Common.IniFile.IniReadValue("countdown", "enabled")))
            {
                return;
            }

            //Load countdown items
            var countdownItems = new List <CountdownItem>();
            int items          = int.Parse(Common.IniFile.IniReadValue("countdown", "count"));

            for (int i = 0; i < items; i++)
            {
                var ci = new CountdownItem();
                ci.ConsoleMessage  = Common.IniFile.IniReadValue("countdown", string.Format("item{0}console", i));
                ci.UniverseMessage = Common.IniFile.IniReadValue("countdown", string.Format("item{0}universe", i));
                ci.WaitTime        = int.Parse(Common.IniFile.IniReadValue("countdown", string.Format("item{0}wait", i)));
                countdownItems.Add(ci);
            }

            //Create a connection to flhook and connect it
            var flhookconnection = new FLHookConnection();

            flhookconnection.Connect();

            //Run Countdown
            foreach (CountdownItem ci in countdownItems)
            {
                Console.WriteLine(ci.ConsoleMessage);
                flhookconnection.SendUniverseMessage(ci.UniverseMessage);
                Wait(ci.WaitTime);
            }

            //Diconnect from FLHook
            flhookconnection.Disconnect();
        }