Esempio n. 1
0
        internal static void VerifyHearthstonePath()
        {
            var proc = User32.GetHearthstoneProc();

            if (proc == null)
            {
                Log.Warn("Could not find Hearthstone process");
                return;
            }
            try
            {
                var executable  = new FileInfo(proc.MainModule.FileName);
                var currentPath = Config.Instance.HearthstoneDirectory;
                var procPath    = executable.Directory?.FullName;
                if (procPath != null && procPath != currentPath)
                {
                    Log.Warn($"Current path (\"{currentPath}\") does not match the running Hearthstone process: \"{procPath}\". Updating path");
                    Config.Instance.HearthstoneDirectory = procPath;
                    Config.Save();
                    Core.Reset().Forget();
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        internal static void VerifyHearthstonePath()
        {
            var proc = User32.GetHearthstoneProc();

            if (proc == null)
            {
                Log.Warn("Could not find Hearthstone process");
                return;
            }
            try
            {
                var currentPath = Config.Instance.HearthstoneDirectory;
                var procPath    = Path.GetDirectoryName(Kernel32.GetProcessExePath(proc));
                if (procPath != null && procPath != currentPath)
                {
                    Log.Warn($"Current path (\"{currentPath}\") does not match the running Hearthstone process: \"{procPath}\". Updating path");
                    Config.Instance.HearthstoneDirectory = procPath;
                    Config.Save();
                    Core.Reset().Forget();
                }
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }