Esempio n. 1
0
        public static bool InitializeMinimum()
        {
            string PDN = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", "").ToString();

            if (CultureInfo.CurrentCulture.Name.StartsWith("ko"))
            {
                DefaultFont = "맑은 고딕";
                if (PDN.StartsWith("Windows 10"))
                {
                    DefaultFont = "맑은 고딕 Semilight";
                }
            }
            else if (CultureInfo.CurrentCulture.Name.StartsWith("ja"))
            {
                DefaultFont = "Meiryo";
            }
            else
            {
                DefaultFont = "Microsoft Sans Serif";
            }

            LOG.Initialize();
            LOG.Logger.Log(LogLevel.Warning, "Aliapoh Overlay on " + (Environment.Is64BitProcess ? "x64" : "x86") + " Process");

            if (Environment.Is64BitProcess)
            {
                CEFDIR = DIRDICT["CEFX64"];
            }
            else
            {
                APPDIR = DIRDICT["CEFX86"];
            }

            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;

            var Directories = new List <string>()
            {
                APPDIR,
                CEFDIR,
                DIRDICT["BINDIR"]
            };

            asmResolver = new AssemblyResolver(Directories);
            asmResolver.ExceptionOccured += (o, e) => LOG.Logger.Log(LogLevel.Error, "AssemblyResolver: Error: {0}", e.Exception);
            asmResolver.AssemblyLoaded   += (o, e) => LOG.Logger.Log(LogLevel.Debug, "AssemblyResolver: Loaded: {0}", e.LoadedAssembly.FullName);

            VersionManager.Initialize();
            Thread.Sleep(50);
            LOG.Logger.Log(LogLevel.Info, "Initialize CEF");

            CefLoader.Initialize();
            Thread.Sleep(50);
            LOG.Logger.Log(LogLevel.Info, "Initialize Localization");

            LanguageLoader.Initialize();
            Thread.Sleep(50);
            LOG.Logger.Log(LogLevel.Info, "Successfully loaded Aliapoh");

            return(true);
        }
        private void Initializer(SettingObject setting)
        {
            Name = setting.Name;
            InitializeComponent();

            OverlayName.Text = setting.Name;
            overlayGlobalHotkeyType.Items.Add(ShortcutModeNone);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeHide);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeClickthru);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeToggleLock);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeTakeScreenshot);

            OverlayWidth.ValueChanged       += SaveSetting;
            OverlayHeight.ValueChanged      += SaveSetting;
            OverlayX.ValueChanged           += SaveSetting;
            OverlayY.ValueChanged           += SaveSetting;
            OverlayNameChangeButton.Click   += SaveSetting;
            OverlayLock.CheckedChanged      += SaveSetting;
            OverlayClickthru.CheckedChanged += SaveSetting;
            OverlayShow.CheckedChanged      += SaveSetting;
            OverlayFramerate.ValueChanged   += SaveSetting;
            SiteURL.TextChanged             += SaveSetting;
            overlayGlobalHotkeyType.SelectedIndexChanged += SaveSetting;

            SiteURL.Text = setting.Url;

            Overlay = new OverlayForm(setting.Url)
            {
                Framerate     = setting.Framerate,
                Name          = setting.Name,
                Text          = setting.Name,
                ShowInTaskbar = false
            };

            if (!DesignMode)
            {
                LanguageLoader.LanguagePatch(this);
            }

            Overlay.LocationChanged += Overlay_LocationChanged;
            Overlay.SizeChanged     += Overlay_SizeChanged;
            Overlay.Show();
            Overlay.Location                       = new Point(setting.Left, setting.Top);
            Overlay.Size                           = new Size(setting.Width, setting.Height);
            OverlayClickthru.Checked               = setting.Clickthru;
            OverlayGlobalHotkey.Checked            = setting.UseGlobalHotkey;
            OverlayLock.Checked                    = setting.Locked;
            OverlayEnableBeforeLogLineRead.Checked = setting.BeforeLogLineRead;

            GlobalHotkey                  = (Keys)setting.GlobalHotkey;
            GlobalHotkeyModifiers         = (Keys)setting.GlobalHotkeyModifiers;
            OverlayGlobalHotkeyInput.Text = GetHotkeyString((Keys)setting.GlobalHotkeyModifiers, (Keys)setting.GlobalHotkey, "");

            OverlayFramerate.Value              = setting.Framerate;
            OverlayUpdaterate.Value             = setting.Updaterate;
            Overlay.OverlayTicTimer.Interval    = setting.Updaterate;
            Overlay.Browser.BrowserInitialized += Browser_BrowserInitialized;
            IsInitialized = true;
        }
Esempio n. 3
0
        private void Initializer(SettingObject setting)
        {
            Name = setting.Name;
            InitializeComponent();

            OverlayName.Text = setting.Name;
            overlayGlobalHotkeyType.Items.Add(ShortcutModeNone);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeHide);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeClickthru);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeToggleLock);
            overlayGlobalHotkeyType.Items.Add(ShortcutModeTakeScreenshot);

            OverlayWidth.ValueChanged       += SaveSetting;
            OverlayHeight.ValueChanged      += SaveSetting;
            OverlayX.ValueChanged           += SaveSetting;
            OverlayY.ValueChanged           += SaveSetting;
            OverlayNameChangeButton.Click   += SaveSetting;
            OverlayLock.CheckedChanged      += SaveSetting;
            OverlayClickthru.CheckedChanged += SaveSetting;
            OverlayShow.CheckedChanged      += SaveSetting;
            OverlayFramerate.ValueChanged   += SaveSetting;
            SiteURL.TextChanged             += SaveSetting;
            overlayGlobalHotkeyType.SelectedIndexChanged += SaveSetting;

            OverlayEnableBeforeLogLineRead.CheckedChanged += SaveSetting;
            OverlayGlobalHotkey.CheckedChanged            += SaveSetting;

            SiteURL.Text = setting.Url;

            Overlay = new OverlayForm(setting.Url)
            {
                Framerate     = setting.Framerate,
                Name          = setting.Name,
                Text          = setting.Name,
                ShowInTaskbar = false
            };

            if (!DesignMode)
            {
                LanguageLoader.LanguagePatch(this);
            }

            Overlay.LocationChanged += Overlay_LocationChanged;
            Overlay.SizeChanged     += Overlay_SizeChanged;
            Overlay.Show();
            Overlay.Location                       = new Point(setting.Left, setting.Top);
            Overlay.Size                           = new Size(setting.Width, setting.Height);
            OverlayClickthru.Checked               = setting.Clickthru;
            OverlayGlobalHotkey.Checked            = setting.UseGlobalHotkey;
            OverlayLock.Checked                    = setting.Locked;
            OverlayEnableBeforeLogLineRead.Checked = setting.BeforeLogLineRead;

            new Thread((ThreadStart) delegate
            {
                try
                {
                    while (!Process.GetCurrentProcess().HasExited)
                    {
                        if (SettingManager.GlobalSetting.AutoHide)
                        {
                            var l = SettingManager.GlobalSetting.DetectProcessName.Split(',');
                            for (var i = 0; i < l.Length; i++)
                            {
                                l[i] = l[i].ToLower().Trim();
                            }

                            try
                            {
                                var hnd = NativeMethods.GetForegroundWindow();
                                NativeMethods.GetWindowThreadProcessId(hnd, out uint pid);
                                Overlay.Visible = l.Contains(System.IO.Path.GetFileName(Process.GetProcessById((int)pid).MainModule.FileName).ToLower());
                            }
                            catch
                            {
                                // caution: if you running STEAM GAME with VAC, comming here
                            }
                        }
                        else
                        {
                            Overlay.Visible = true;
                        }
                        Thread.Sleep(1000);
                    }
                }
                catch { }
            }).Start();