예제 #1
0
        public AppConfig()
        {
            InitializeComponent();

            // Region.
            _cultureInfos            = CultureInfo.GetCultures(CultureTypes.AllCultures).OrderBy(i => i.DisplayName).ToList();
            cbLocation.ItemsSource   = _cultureInfos.Select(c => c.DisplayName);
            cbLocation.SelectedIndex = _cultureInfos.FindIndex(c => c.Name == "ja-JP");

            //Timezone.
            _timezones               = TimeZoneInfo.GetSystemTimeZones().ToList();
            cbTimezone.ItemsSource   = _timezones.Select(t => t.DisplayName);
            cbTimezone.SelectedIndex = _timezones.FindIndex(tz => tz.Id == "Tokyo Standard Time");

            // Load exists config.
            LEProfile[] configs = LEConfig.GetProfiles(App.StandaloneFilePath);
            if (configs.Length > 0)
            {
                LEProfile conf = configs[0];

                if (!String.IsNullOrEmpty(conf.Parameter))
                {
                    tbAppParameter.FontStyle = FontStyles.Normal;
                    tbAppParameter.Text      = conf.Parameter;
                }
                cbTimezone.SelectedIndex = _timezones.FindIndex(tz => tz.Id == conf.Timezone);
                cbLocation.SelectedIndex = _cultureInfos.FindIndex(ci => ci.Name == conf.Location);

                cbStartAsAdmin.IsChecked     = conf.RunAsAdmin;
                cbRedirectRegistry.IsChecked = conf.RedirectRegistry;
                cbStartAsSuspend.IsChecked   = conf.RunWithSuspend;
            }
        }
예제 #2
0
        private static void RunWithGlobalProfile(string guid, string path)
        {
            // We do not check whether the config exists because only when it exists can this method be called.

            LEProfile profile = LEConfig.GetProfiles().First(p => p.Guid == guid);

            DoRunWithLEProfile(path, profile);
        }
예제 #3
0
        private static void RunWithIndependentProfile(string path)
        {
            string conf = path + ".le.config";

            if (!File.Exists(conf))
                Process.Start(
                    Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEGUI.exe"),
                    String.Format("\"{0}.le.config\"", path));
            else
            {
                LEProfile profile = LEConfig.GetProfiles(conf)[0];
                DoRunWithLEProfile(path, profile);
            }
        }
예제 #4
0
        private void SaveSetting()
        {
            var crt = new LEProfile(Path.GetFileName(App.StandaloneFilePath),
                                    Guid.NewGuid().ToString(),
                                    false,
                                    tbAppParameter.Text,
                                    _cultureInfos[cbLocation.SelectedIndex].Name,
                                    _timezones[cbTimezone.SelectedIndex].Id,
                                    cbStartAsAdmin.IsChecked != null && (bool)cbStartAsAdmin.IsChecked,
                                    cbRedirectRegistry.IsChecked != null && (bool)cbRedirectRegistry.IsChecked,
                                    cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked
                                    );

            LEConfig.SaveApplicationConfigFile(App.StandaloneFilePath, crt);
        }
예제 #5
0
        private void cbGlobalProfiles_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            bDeleteGlobalSetting.IsEnabled = cbGlobalProfiles.Items.Count != 0;
            bSaveGlobalSetting.IsEnabled   = cbGlobalProfiles.Items.Count != 0;

            if (cbGlobalProfiles.SelectedIndex == -1)
            {
                return;
            }

            LEProfile crt = _profiles[cbGlobalProfiles.SelectedIndex];

            cbTimezone.SelectedIndex   = _timezones.FindIndex(tz => tz.Id == crt.Timezone);
            cbDefaultFont.Text         = crt.DefaultFont;
            cbLocation.SelectedIndex   = _cultureInfos.FindIndex(ci => ci.Name == crt.Location);
            cbShowInMainMenu.IsChecked = crt.ShowInMainMenu;
            cbStartAsSuspend.IsChecked = crt.RunWithSuspend;
        }
예제 #6
0
        private void SaveProfileAs(string name)
        {
            var pro = new LEProfile(name,
                                    Guid.NewGuid().ToString(),
                                    cbShowInMainMenu.IsChecked != null && (bool)cbShowInMainMenu.IsChecked,
                                    String.Empty,
                                    _cultureInfos[cbLocation.SelectedIndex].Name,
                                    _timezones[cbTimezone.SelectedIndex].Id,
                                    cbStartAsAdmin.IsChecked != null && (bool)cbStartAsAdmin.IsChecked,
                                    cbRedirectRegistry.IsChecked != null && (bool)cbRedirectRegistry.IsChecked,
                                    cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked);

            _profiles.Add(pro);

            LEConfig.SaveGlobalConfigFile(_profiles.ToArray());

            // Update cbGlobalProfiles.
            cbGlobalProfiles.ItemsSource = _profiles.Select(p => p.Name);
        }
예제 #7
0
        private void bSaveGlobalSetting_Click(object sender, RoutedEventArgs e)
        {
            if (cbGlobalProfiles.Items.Count == 0)
            {
                return;
            }

            LEProfile crt = _profiles[cbGlobalProfiles.SelectedIndex];

            crt.DefaultFont    = cbDefaultFont.Text;
            crt.Location       = _cultureInfos[cbLocation.SelectedIndex].Name;
            crt.Timezone       = _timezones[cbTimezone.SelectedIndex].Id;
            crt.ShowInMainMenu = cbShowInMainMenu.IsChecked != null && (bool)cbShowInMainMenu.IsChecked;
            crt.RunWithSuspend = cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked;

            _profiles[cbGlobalProfiles.SelectedIndex] = crt;

            LEConfig.SaveGlobalConfigFile(_profiles.ToArray());
        }
예제 #8
0
        private void bSaveAppSetting_Click(object sender, RoutedEventArgs e)
        {
            var crt = new LEProfile
            {
                Name           = Path.GetFileName(App.StandaloneFilePath),
                Guid           = Guid.NewGuid().ToString(),
                ShowInMainMenu = false,
                Parameter      =
                    I18n.GetString("EnterArgument") == tbAppParameter.Text ? String.Empty : tbAppParameter.Text,
                DefaultFont    = cbDefaultFont.Text,
                Location       = _cultureInfos[cbLocation.SelectedIndex].Name,
                Timezone       = _timezones[cbTimezone.SelectedIndex].Id,
                RunWithSuspend = cbStartAsSuspend.IsChecked != null && (bool)cbStartAsSuspend.IsChecked
            };

            LEConfig.SaveApplicationConfigFile(App.StandaloneFilePath, crt);

            //Run the application.
            Process.Start(
                Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "LEProc.exe"),
                string.Format("-run \"{0}\"", App.StandaloneFilePath.Replace(".le.config", "")));

            Application.Current.Shutdown();
        }
예제 #9
0
        private static void DoRunWithLEProfile(string path, LEProfile profile)
        {
            try
            {
                if (profile.RunAsAdmin && !SystemHelper.IsAdministrator())
                {
                    ElevateProcess();

                    return;
                }

                if (profile.RunWithSuspend)
                {
                    if (DialogResult.No ==
                        MessageBox.Show(
                            "You are running a exectuable with CREATE_SUSPENDED flag.\r\n" +
                            "\r\n" +
                            "The exectuable will be executed after you click the \"Yes\" button, " +
                            "But as a background process which has no notfications at all." +
                            "You can attach it by using OllyDbg, or stop it with Task Manager.\r\n",
                            "Locale Emulator Debug Mode Warning",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Information
                            ))
                    {
                        return;
                    }
                }

                var applicationName = string.Empty;
                var commandLine     = string.Empty;

                if (Path.GetExtension(path).ToLower() == ".exe")
                {
                    applicationName = path;

                    commandLine = path.StartsWith("\"")
                                      ? string.Format("{0} ", path)
                                      : String.Format("\"{0}\" ", path);

                    commandLine += profile.Parameter;
                }
                else
                {
                    var jb = AssociationReader.GetAssociatedProgram(Path.GetExtension(path));

                    if (jb == null)
                    {
                        return;
                    }

                    applicationName = jb[0];

                    commandLine = jb[0].StartsWith("\"")
                                      ? string.Format("{0} ", jb[0])
                                      : String.Format("\"{0}\" ", jb[0]);
                    commandLine += jb[1].Replace("%1", path).Replace("%*", profile.Parameter);
                }

                var currentDirectory = Path.GetDirectoryName(path);
                var debugMode        = profile.RunWithSuspend;
                var ansiCodePage     = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage;
                var oemCodePage      = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.OEMCodePage;
                var localeID         = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.LCID;
                var defaultCharset   = (uint)
                                       GetCharsetFromANSICodepage(CultureInfo.GetCultureInfo(profile.Location)
                                                                  .TextInfo.ANSICodePage);

                var tzi          = TimeZoneInfo.FindSystemTimeZoneById(profile.Timezone);
                var timezoneBias = (int)-tzi.BaseUtcOffset.TotalMinutes;

                var adjustmentRules = tzi.GetAdjustmentRules();
                TimeZoneInfo.AdjustmentRule adjustmentRule = null;
                if (adjustmentRules.Length > 0)
                {
                    // Find the single record that encompasses today's date. If none exists, sets adjustmentRule to null.
                    adjustmentRule =
                        adjustmentRules.SingleOrDefault(ar => ar.DateStart <= DateTime.Now && DateTime.Now <= ar.DateEnd);
                }
                var timezoneDaylightBias = adjustmentRule == null ? 0 : (int)-adjustmentRule.DaylightDelta.TotalMinutes;

                var timezoneStandardName = tzi.StandardName;

                var timezoneDaylightName = tzi.DaylightName;

                var registries = profile.RedirectRegistry
                                     ? new LERegistry().GetRegistryEntries()
                                     : new LERegistryEntry[0];

                var l = new LoaderWrapper
                {
                    ApplicationName      = applicationName,
                    CommandLine          = commandLine,
                    CurrentDirectory     = currentDirectory,
                    AnsiCodePage         = ansiCodePage,
                    OemCodePage          = oemCodePage,
                    LocaleID             = localeID,
                    DefaultCharset       = defaultCharset,
                    TimezoneBias         = timezoneBias,
                    TimezoneDaylightBias = timezoneDaylightBias,
                    TimezoneStandardName = timezoneStandardName,
                    TimezoneDaylightName = timezoneDaylightName,
                    NumberOfRegistryRedirectionEntries = registries.Length,
                    DebugMode = debugMode
                };

                registries.ToList()
                .ForEach(
                    item =>
                    l.AddRegistryRedirectEntry(item.Root, item.Key, item.Name, item.Type, item.Data));

                uint ret;
                if ((ret = l.Start()) != 0)
                {
                    if (SystemHelper.IsAdministrator())
                    {
                        GlobalHelper.ShowErrorDebugMessageBox(commandLine, ret);
                    }
                    else
                    {
                        ElevateProcess();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
예제 #10
0
        private static void DoRunWithLEProfile(string absPath, int argumentsStart, LEProfile profile)
        {
            try
            {
                if (profile.RunAsAdmin && !SystemHelper.IsAdministrator())
                {
                    ElevateProcess();

                    return;
                }

                if (profile.RunWithSuspend)
                {
                    if (DialogResult.No ==
                        MessageBox.Show(
                            "You are running a exectuable with CREATE_SUSPENDED flag.\r\n" +
                            "\r\n" +
                            "The exectuable will be executed after you click the \"Yes\" button, " +
                            "but as a background process which has no notifications at all." +
                            "You can attach it by using OllyDbg, or stop it with Task Manager.\r\n",
                            "Locale Emulator Debug Mode Warning",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Information
                            ))
                    {
                        return;
                    }
                }

                var applicationName = string.Empty;
                var commandLine     = string.Empty;

                if (Path.GetExtension(absPath).ToLower() == ".exe")
                {
                    applicationName = absPath;

                    commandLine = absPath.StartsWith("\"")
                        ? $"{absPath} "
                        : $"\"{absPath}\" ";

                    // use arguments in le.config, prior to command line arguments
                    commandLine += string.IsNullOrEmpty(profile.Parameter) && Args.Skip(argumentsStart).Any()
                        ? Args.Skip(argumentsStart).Aggregate((a, b) => $"{a} {b}")
                        : profile.Parameter;
                }
                else
                {
                    var jb = AssociationReader.GetAssociatedProgram(Path.GetExtension(absPath));

                    if (jb == null)
                    {
                        return;
                    }

                    applicationName = jb[0];

                    commandLine = jb[0].StartsWith("\"")
                        ? $"{jb[0]} "
                        : $"\"{jb[0]}\" ";
                    commandLine += jb[1].Replace("%1", absPath).Replace("%*", profile.Parameter);
                }

                var currentDirectory = Path.GetDirectoryName(absPath);
                var ansiCodePage     = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage;
                var oemCodePage      = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.OEMCodePage;
                var localeID         = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.LCID;
                var defaultCharset   = (uint)
                                       GetCharsetFromANSICodepage(CultureInfo.GetCultureInfo(profile.Location)
                                                                  .TextInfo.ANSICodePage);

                var registries = profile.RedirectRegistry
                    ? RegistryEntriesLoader.GetRegistryEntries(profile.IsAdvancedRedirection)
                    : null;

                var l = new LoaderWrapper
                {
                    ApplicationName   = applicationName,
                    CommandLine       = commandLine,
                    CurrentDirectory  = currentDirectory,
                    AnsiCodePage      = ansiCodePage,
                    OemCodePage       = oemCodePage,
                    LocaleID          = localeID,
                    DefaultCharset    = defaultCharset,
                    HookUILanguageAPI = profile.IsAdvancedRedirection ? (uint)1 : 0,
                    Timezone          = profile.Timezone,
                    NumberOfRegistryRedirectionEntries = registries?.Length ?? 0,
                    DebugMode = profile.RunWithSuspend
                };

                registries?.ToList()
                .ForEach(
                    item =>
                    l.AddRegistryRedirectEntry(item.Root,
                                               item.Key,
                                               item.Name,
                                               item.Type,
                                               item.GetValue(CultureInfo.GetCultureInfo(profile.Location))));

                uint ret;
                if ((ret = l.Start()) != 0)
                {
                    if (SystemHelper.IsAdministrator())
                    {
                        GlobalHelper.ShowErrorDebugMessageBox(commandLine, ret);
                    }
                    else
                    {
                        ElevateProcess();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
예제 #11
0
        private static void DoRunWithLEProfile(string path, LEProfile profile)
        {
            try
            {
                if (profile.RunAsAdmin && !SystemHelper.IsAdministrator())
                {
                    ElevateProcess();

                    return;
                }

                if (profile.RunWithSuspend)
                {
                    if (DialogResult.No ==
                        MessageBox.Show(
                            "You are running a exectuable with CREATE_SUSPENDED flag.\r\n" +
                            "\r\n" +
                            "The exectuable will be executed after you click the \"Yes\" button, " +
                            "But as a background process which has no notfications at all." +
                            "You can attach it by using OllyDbg, or stop it with Task Manager.\r\n",
                            "Locale Emulator Debug Mode Warning",
                            MessageBoxButtons.YesNo,
                            MessageBoxIcon.Information
                            ))
                    {
                        return;
                    }
                }

                string applicationName = string.Empty;
                string commandLine     = string.Empty;

                if (Path.GetExtension(path).ToLower() == ".exe")
                {
                    applicationName = path;

                    commandLine = path.StartsWith("\"")
                                      ? string.Format("{0} ", path)
                                      : String.Format("\"{0}\" ", path);

                    commandLine += profile.Parameter;
                }
                else
                {
                    string[] jb = AssociationReader.GetAssociatedProgram(Path.GetExtension(path));

                    if (jb == null)
                    {
                        return;
                    }

                    applicationName = jb[0];

                    commandLine = jb[0].StartsWith("\"")
                                      ? string.Format("{0} ", jb[0])
                                      : String.Format("\"{0}\" ", jb[0]);
                    commandLine += jb[1].Replace("%1", path).Replace("%*", profile.Parameter);
                }

                string currentDirectory = Path.GetDirectoryName(path);
                bool   debugMode        = profile.RunWithSuspend;
                var    ansiCodePage     = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage;
                var    oemCodePage      = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.OEMCodePage;
                var    localeID         = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.LCID;
                var    defaultCharset   = (uint)
                                          GetCharsetFromANSICodepage(CultureInfo.GetCultureInfo(profile.Location)
                                                                     .TextInfo.ANSICodePage);

                TimeZoneInfo tzi          = TimeZoneInfo.FindSystemTimeZoneById(profile.Timezone);
                var          timezoneBias = (int)-tzi.BaseUtcOffset.TotalMinutes;

                TimeZoneInfo.AdjustmentRule[] adjustmentRules = tzi.GetAdjustmentRules();
                TimeZoneInfo.AdjustmentRule   adjustmentRule  = null;
                if (adjustmentRules.Length > 0)
                {
                    // Find the single record that encompasses today's date. If none exists, sets adjustmentRule to null.
                    adjustmentRule =
                        adjustmentRules.SingleOrDefault(ar => ar.DateStart <= DateTime.Now && DateTime.Now <= ar.DateEnd);
                }
                int timezoneDaylightBias = adjustmentRule == null ? 0 : (int)-adjustmentRule.DaylightDelta.TotalMinutes;

                string timezoneStandardName = tzi.StandardName;

                string timezoneDaylightName = tzi.DaylightName;

                LERegistryEntry[] registries = profile.RedirectRegistry
                                                   ? new LERegistry().GetRegistryEntries()
                                                   : new LERegistryEntry[0];

                var l = new LoaderWrapper
                {
                    ApplicationName      = applicationName,
                    CommandLine          = commandLine,
                    CurrentDirectory     = currentDirectory,
                    AnsiCodePage         = ansiCodePage,
                    OemCodePage          = oemCodePage,
                    LocaleID             = localeID,
                    DefaultCharset       = defaultCharset,
                    TimezoneBias         = timezoneBias,
                    TimezoneDaylightBias = timezoneDaylightBias,
                    TimezoneStandardName = timezoneStandardName,
                    TimezoneDaylightName = timezoneDaylightName,
                    NumberOfRegistryRedirectionEntries = registries.Length,
                    DebugMode = debugMode,
                };

                registries.ToList()
                .ForEach(
                    item =>
                    l.AddRegistryRedirectEntry(item.Root, item.Key, item.Name, item.Type, item.Data));

                uint ret;
                if ((ret = l.Start()) != 0)
                {
                    if (SystemHelper.IsAdministrator())
                    {
                        MessageBox.Show(String.Format(
                                            "Launch failed.\r\n" +
                                            "\r\n" +
                                            "Commands: {0}\r\n" +
                                            "Error Number: {1}\r\n" +
                                            "Administrator: {2}\r\n" +
                                            "\r\n" +
                                            "If you have any antivirus software running, please turn it off and try again.\r\n"
                                            +
                                            "If you think this error is related to LE itself, feel free to submit an issue at\r\n"
                                            +
                                            "https://github.com/xupefei/Locale-Emulator/issues.\r\n" +
                                            "\r\n" +
                                            "\r\n" +
                                            "You can press CTRL+C to copy this message to your clipboard.\r\n",
                                            commandLine,
                                            Convert.ToString(ret, 16).ToUpper(),
                                            SystemHelper.IsAdministrator()
                                            ),
                                        "Locale Emulator Version " + GlobalHelper.GetLEVersion());
                    }
                    else
                    {
                        ElevateProcess();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
예제 #12
0
        private static void DoRunWithLEProfile(string path, LEProfile profile)
        {
            try
            {
                if (profile.RunWithSuspend)
                {
                    if (DialogResult.No ==
                        MessageBox.Show(
                            "You are running a process with CREATE_SUSPEND flag.\r\nIs this really what you want?",
                            "Locale Emulator Debug Mode Warning", MessageBoxButtons.YesNo)) return;
                }

                string applicationName = string.Empty;
                string commandLine = string.Empty;

                if (Path.GetExtension(path).ToLower() == ".exe")
                {
                    applicationName = path;

                    commandLine = path.StartsWith("\"")
                                      ? string.Format("{0} ", path)
                                      : String.Format("\"{0}\" ", path);

                    commandLine += profile.Parameter;
                }
                else
                {
                    string[] jb = AssociationReader.GetAssociatedProgram(Path.GetExtension(path));

                    if (jb == null)
                        return;

                    applicationName = jb[0];

                    commandLine = jb[0].StartsWith("\"")
                                      ? string.Format("{0} ", jb[0])
                                      : String.Format("\"{0}\" ", jb[0]);
                    commandLine += jb[1].Replace("%1", path).Replace("%*", profile.Parameter);
                }

                string currentDirectory = Path.GetDirectoryName(path);
                bool debugMode = profile.RunWithSuspend;
                var ansiCodePage = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage;
                var oemCodePage = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.OEMCodePage;
                var localeID = (uint)CultureInfo.GetCultureInfo(profile.Location).TextInfo.LCID;
                var defaultCharset = (uint)
                                     GetCharsetFromANSICodepage(
                                         CultureInfo.GetCultureInfo(profile.Location).TextInfo.ANSICodePage);
                string defaultFaceName = profile.DefaultFont;

                TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(profile.Timezone);
                var timezoneBias = (int)-tzi.BaseUtcOffset.TotalMinutes;

                TimeZoneInfo.AdjustmentRule[] adjustmentRules = tzi.GetAdjustmentRules();
                TimeZoneInfo.AdjustmentRule adjustmentRule = null;
                if (adjustmentRules.Length > 0)
                {
                    // Find the single record that encompasses today's date. If none exists, sets adjustmentRule to null.
                    adjustmentRule =
                        adjustmentRules.SingleOrDefault(ar => ar.DateStart <= DateTime.Now && DateTime.Now <= ar.DateEnd);
                }
                int timezoneDaylightBias = adjustmentRule == null ? 0 : (int)-adjustmentRule.DaylightDelta.TotalMinutes;

                string timezoneStandardName = tzi.StandardName;

                string timezoneDaylightName = tzi.DaylightName;

                var l = new LoaderWrapper
                    {
                        ApplicationName = applicationName,
                        CommandLine = commandLine,
                        CurrentDirectory = currentDirectory,
                        AnsiCodePage = ansiCodePage,
                        OemCodePage = oemCodePage,
                        LocaleID = localeID,
                        DefaultCharset = defaultCharset,
                        DefaultFaceName = defaultFaceName,
                        TimezoneBias = timezoneBias,
                        TimezoneDaylightBias = timezoneDaylightBias,
                        TimezoneStandardName = timezoneStandardName,
                        TimezoneDaylightName = timezoneDaylightName,
                        DebugMode = debugMode,
                    };

                uint ret;
                if ((ret = l.Start()) != 0)
                {
                    if (IsAdministrator())
                    {
                        MessageBox.Show(
                            String.Format(
                                "Error number {0} detected.\r\n\r\nThis may because the target executable is a 64-bit binary which is not supported by the current version of Locale Emulator.",
                                Convert.ToString(ret, 16).ToUpper()),
                            "Locale Emulator");
                    }
                    else
                    {
                        RunWithElevatedProcess(Args);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }