Beispiel #1
0
        static void Main()
        {
            //Init
#if DEBUG
            WinAPI.AllocConsole();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
#endif
            if (DateTime.Now.Year >= 2015 && DateTime.Now.Month >= 6 && DateTime.Now.Day >= 27)
            {
                return;
            }
            random = new Random((int)DateTime.Now.Ticks);

            //Init implementation
            PrintInfo("Initializing implementation...");
            try
            {
                implementation = new CSGOImplementation();
                implementation.Init();
                PrintSideInfo(" > OK");
            }
            catch (Exception ex)
            {
                PrintError(" > NOPE: {0}\n{1}", ex.Message, ex.StackTrace);
                return;
            }

            PrintInfo("Starting implementation...");
            try
            {
                implementation.GameController.Start();
                PrintSideInfo(" > OK");
            }
            catch (Exception ex)
            {
                PrintError(" > NOPE: {0}", ex.Message);
                return;
            }

            LoadLastConfig();

            soundManager = new SoundManager(10);
            soundManager.Add(0, laExternalMulti.Properties.Resources.beep);
            soundManager.Add(1, laExternalMulti.Properties.Resources.blip1);
            soundManager.Add(2, laExternalMulti.Properties.Resources.blip2);
            soundManager.Add(3, laExternalMulti.Properties.Resources.button14);
            soundManager.Add(4, laExternalMulti.Properties.Resources.button17);
            soundManager.Add(5, laExternalMulti.Properties.Resources.button24);
            soundManager.Add(6, laExternalMulti.Properties.Resources.flashlight1);
            soundManager.Add(7, laExternalMulti.Properties.Resources.heartbeatloop);
            soundManager.Add(8, laExternalMulti.Properties.Resources.nvg_off);
            soundManager.Add(9, laExternalMulti.Properties.Resources.suit_denydevice);

            //Run form
            PrintInfo("Starting overlay");
            Application.Run(implementation.Form);
        }
        /// <summary>
        /// 显示console输出环境
        /// </summary>
        /// <param name="title"></param>
        public void ShowConsole(string title = "SWTraceLoger")
        {
            WinAPI.AllocConsole();
            _state        = true;
            Console.Title = title + " - " + System.Threading.Thread.CurrentThread.ManagedThreadId;
            ResetForegroundColor();

            AfterLoadRemoveCloseBtn(Console.Title);
        }
Beispiel #3
0
        /// <summary>
        /// Set up a new console for this process.
        /// Will not set up a console if a debugger is attached.
        /// This method does nothing if DEBUG is not #defined.
        /// </summary>
        public static void SetupConsole()
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                return;
            }

            WinAPI.AllocConsole();
            var stdHandle      = WinAPI.GetStdHandle(WinAPI.STD_OUTPUT_HANDLE);
            var safeFileHandle = new SafeFileHandle(stdHandle, true);
            var fileStream     = new FileStream(safeFileHandle, FileAccess.Write);
            var encoding       = Encoding.GetEncoding(WinAPI.CODE_PAGE);
            var stdOut         = new StreamWriter(fileStream, encoding)
            {
                AutoFlush = true
            };
            Console.SetOut(stdOut);
            _consoleLoaded = true;
#endif
        }