using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

// Ooganizer Namespaces
using Foo.Platform;
using Foo.Platform.Interacters;

namespace Foo.Hooks.CaptionButton
{
    static class Program
    {
        static string DEBUG_ONLY_SETTING_STARTBUTTONHOOK_CMD_STRING = "/StartButtonHook";
        static internal bool DEBUG_ONLY_SETTING_STARTBUTTONHOOK = false;
        static internal bool DEBUG_ONLY_SETTING_STARTBUTTONHOOK_IS_STARTED = false;

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {            
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ////
            // We want to make sure that we are getting the correct command line params
            // otherwise we won't allow this .exe to start
            ////
            bool bStartButtonHook = false;
            string[] args = Environment.GetCommandLineArgs();
            foreach (string arg in args)
            {
                if(!bStartButtonHook)
                    bStartButtonHook = (arg == BHInteracter.CAPTIONBUTTON_CMDLINE);

                if(!DEBUG_ONLY_SETTING_STARTBUTTONHOOK)
                    DEBUG_ONLY_SETTING_STARTBUTTONHOOK = (arg == DEBUG_ONLY_SETTING_STARTBUTTONHOOK_CMD_STRING);
            }

            // Should only start if this exe is called through Platform's BHInteracter
            if (bStartButtonHook)
            {
                Application.Run(new CaptionButton());
            }
        }
    }
}
