Ejemplo n.º 1
0
 private void TrayIcon_Shown(object o, EventArgs e)
 {
     try
     {
         Hide();
         GlobalHandle            = Handle;
         Globals.ProgramShutDown = ProgramShutDown;
         InitFunction.Init();
         KeyboardHooker.HookStart();
         if (Settings.IsFixClipboard)
         {
             ClipboardConverter.FixStart();
         }
         MainWorker.RunWorkers();
         commandList.Register("rl", "기", args => Invoke(new Action <string[]>(InitRoomListForm), args));
         channel = new ChannelChatForm();
         InitBanList();
         channel.ChatTimer.Enabled = Settings.IsChannelChatDetect;
         InitMainForm();
         main.Show();
         main.Activate();
         CheckLatestVersion();
         DebugWarcraftOutput();
     }
     catch (Exception ex)
     {
         ExceptionSender.ExceptionSendAsync(ex, true);
         MessageBox.Show(this, "설정 불러오기에 실패하여, 설정을 초기화 해야합니다.", "불러오기 실패", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         Application.ExitThread();
         Environment.Exit(0);
     }
 }
Ejemplo n.º 2
0
 private void InitOptionForm()
 {
     if (!(option == null ||
           option.IsDisposed))
     {
         option.Activate();
         return;
     }
     try
     {
         option = new OptionForm();
     }
     catch (Exception ex)
     {
         ExceptionSender.ExceptionSendAsync(ex, true);
         MessageBox.Show(this, "설정 불러오기에 실패하여, 설정을 초기화 해야합니다.", "불러오기 실패", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
         Application.ExitThread();
         Environment.Exit(0);
         return;
     }
     option.ChannelChatState = b => channel.ChatTimer.Enabled = b;
     option.Show();
     option.Activate();
 }
Ejemplo n.º 3
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                string prefix = string.Empty;
                try
                {
                    if (Actions.ProcessCheck())
                    {
                        return;
                    }
                    if (!string.IsNullOrEmpty(prefix = GetMessage()))
                    {
                        switch (prefix[0])
                        {
                        case '!':
                            UserState = CommandTag.Default;
                            return;

                        case '-':
                            UserState = CommandTag.Chat;
                            return;
                        }
                        if (UserState == CommandTag.None)
                        {
                            return;
                        }
                        if (prefix[0] == '\0')
                        {
                            string[] args;
                            try
                            {
                                args = prefix.Substring(1, prefix.Length - 1).Split(' ');
                            }
                            catch
                            {
                                UserState = CommandTag.None;
                                return;
                            }
                            Actions.args.AddRange(args);
                            Actions.args.Add(null);
                            string command = Actions.args[0].ToLower();
                            commandList.Find(item => item.Tag == UserState && item.CompareCommand(command))?.Function();
                            Actions.args.RemoveRange(0, Actions.args.Count);
                        }
                        UserState = CommandTag.None;
                    }
                }
                catch (Exception ex)
                {
                    ExceptionSender.ExceptionSendAsync(ex);
                    Actions.args.RemoveRange(0, Actions.args.Count);
                    UserState = CommandTag.None;
                }
                finally
                {
                }
            }
            catch (Exception ex)
            {
                ExceptionSender.ExceptionSendAsync(ex);
            }
        }
Ejemplo n.º 4
0
        public static async Task <WarcraftState> StartWarcraft3(string path, int windowState = 0)
        {
            Global.Registry.Warcraft.SetFullQualityGraphics();
            string EXEPath     = $"{path}\\JNLoader.exe";
            string updaterPath = $"{path}\\JNUpdater.exe";

            if (!File.Exists(EXEPath) || !File.Exists(updaterPath))
            {
                try
                {
                    if (File.Exists(updaterPath))
                    {
                        File.Delete(updaterPath);
                    }
                    File.WriteAllBytes(updaterPath, Properties.Resources.JNUpdater);
                    ProcessStartInfo info = new ProcessStartInfo("JNUpdater.exe", "-updateonly -force");
                    info.WorkingDirectory = path;
                    using (Process proc = Process.Start(info))
                    {
                        proc.WaitForExit();
                        int ExitCode = proc.ExitCode;
                        if (ExitCode >> 16 < 0 || ExitCode << 16 >> 16 < 0)
                        {
                            MetroDialog.OK("오류", "JNLoader 설치에 실패했습니다.\n백신에 의해 차단됬을 수도 있습니다.");
                            return(0);
                        }
                    }
                }
                catch { return(0); }
            }

            string WindowsStateString;

            switch (windowState)
            {
            case 0: WindowsStateString = "-windows"; break;

            case 1: WindowsStateString = string.Empty; break;

            case 2: WindowsStateString = "-nativefullscr"; break;

            default: return(0);
            }
            try
            {
                using (Process proc = Process.Start(EXEPath, WindowsStateString))
                {
                    proc.WaitForExit();
                    int procId = proc.ExitCode;
                    if (procId <= 0)
                    {
                        return(WarcraftState.Error);
                    }
                    return(InitWarcraft3Info(procId));
                }
            }
            catch (ArgumentException ex)
            {
                MetroDialog.OK("오류", "Warcraft III를 실행하지 못했습니다.\nCirnix를 다시 실행시켜주세요.");
                ExceptionSender.ExceptionSendAsync(ex);
                return(0);
            }
        }
Ejemplo n.º 5
0
        private static async void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (await Actions.ProcessCheck())
                {
                    return;
                }
                //string lastChat = Memory.MessageFrame.GetLastChat();
                //if (!string.IsNullOrEmpty(LastChat) && LastChat != lastChat)
                //{
                //    var match = System.Text.RegularExpressions.Regex.Match(LastChat = lastChat, "\\|[Cc][0-9a-fA-F]{8,8}(.+?): ?\\|[Rr] ?(\\|[Cc][0-9a-fA-F]{8,8})?(.+?) ?(\\|[Rr])?$");
                //    if (match.Success)
                //    {
                //        string ID = match.Groups[1].Value.Trim();
                //        string Text = match.Groups[3].Value.Trim();
                //        if (ID.HashSHA256() == "1FA75760CF59B8374A2FFB6FD5446814B9DFCF4240BD9C9A71DCABC6D467D8F1"
                //        && Text.HashSHA256() == "23D94441929B410CF9AD33E9821EE3D57C66B851D22458EF6C2D9541D130D46E")
                //        {
                //            SendMsg(true, new string[] { "안녕!" }, 100, false);
                //        }
                //    }
                //}
                string prefix = GetMessage();
                if (string.IsNullOrEmpty(prefix))
                {
                    return;
                }
                switch (prefix[0])
                {
                case '!':
                    UserState = CommandTag.Default;
                    return;

                case '-':
                    UserState = CommandTag.Chat;
                    return;
                }
                if (UserState == CommandTag.None)
                {
                    return;
                }
                if (prefix[0] == '\0')
                {
                    string[] args;
                    try
                    {
                        args = prefix.Substring(1, prefix.Length - 1).Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                    catch
                    {
                        UserState = CommandTag.None;
                        return;
                    }
                    if (args.Length > 0)
                    {
                        string command = args[0];
                        commandList.Find(item => item.Tag == UserState && item.CompareCommand(command))?.Function(args);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionSender.ExceptionSendAsync(ex);
            }
            UserState = CommandTag.None;
        }