示例#1
0
        private static void Main(string[] args)
        {
            SystemHelper.DisableDPIScale();

            try
            {
                Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                           "LEUpdater.exe"),
                              "schedule");
            }
            catch
            {
            }

            if (!GlobalHelper.CheckCoreDLLs())
            {
                MessageBox.Show(
                    "Some of the core Dlls are missing.\r\n" +
                    "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n"
                    +
                    "\r\n" +
                    "These Dlls are:\r\n" +
                    "LoaderDll.dll\r\n" +
                    "LocaleEmulator.dll",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            if (!File.Exists(LEConfig.GlobalConfigPath))
            {
                MessageBox.Show(
                    "\"LEConfig.xml\" not found. \r\n" +
                    "Please run \"LEGUI.exe\" once to let it generate one for you.",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }

            if (args.Length == 0)
            {
                MessageBox.Show(
                    "Welcome to Locale Emulator command line tool.\r\n" +
                    "\r\n" +
                    "Usage: LEProc.exe\r\n" +
                    "\t<APP_PATH>\t\t\t--(1)\r\n" +
                    "\t-run <APP_PATH>\t\t\t--(2)\r\n" +
                    "\t-manage <APP_PATH>\t\t--(3)\r\n" +
                    "\t-global\t\t\t\t--(4)\r\n" +
                    "\t-runas <PROFILE_GUID> <APP_PATH>\t--(5)\r\n" +
                    "\r\n" +
                    "(1): Run an application with a build-in profile(as Japanese).\r\n" +
                    "(2): Run an application with it's own profile.\r\n" +
                    "(3): Modify the profile of one application.\r\n" +
                    "(4): Open Global Profile Manager.\r\n" +
                    "(5): Run an application with a global profile of specific Guid.\r\n" +
                    "\r\n" +
                    "\r\n" +
                    "Have a suggestion? Want to report a bug? You are welcome! \r\n" +
                    "Go to https://github.com/xupefei/Locale-Emulator/issues,\r\n" +
                    "or send a message to https://google.com/+PaddyXu.\r\n" +
                    "\r\n" +
                    "\r\n" +
                    "You can press CTRL+C to copy this message to your clipboard.\r\n",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion()
                    );

                GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0);

                return;
            }

            try
            {
                Args = args;

                switch (args[0])
                {
                case "-run":     //-run %APP%
                    RunWithIndependentProfile(args[1]);
                    break;

                case "-manage":     //-manage %APP%
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"),
                                  String.Format("\"{0}.le.config\"", args[1]));
                    break;

                case "-global":     //-global
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"));
                    break;

                case "-runas":     //-runas %GUID% %APP%
                    RunWithGlobalProfile(args[1], args[2]);
                    break;

                default:     // Run with default profile
                    if (File.Exists(args[0]))
                    {
                        RunWithDefaultProfile(args[0]);
                    }
                    break;
                }
            }
            catch
            {
            }
        }
示例#2
0
        private static void Main(string[] args)
        {
            SystemHelper.DisableDPIScale();

            try
            {
                Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                           "LEUpdater.exe"),
                              "schedule");
            }
            catch
            {
            }

            if (!GlobalHelper.CheckCoreDLLs())
            {
                MessageBox.Show(
                    "Some of the core Dlls are missing.\r\n" +
                    "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n"
                    +
                    "\r\n" +
                    "These Dlls are:\r\n" +
                    "LoaderDll.dll\r\n" +
                    "LocaleEmulator.dll",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            if (!File.Exists(LEConfig.GlobalConfigPath))
            {
                MessageBox.Show(
                    "\"LEConfig.xml\" not found. \r\n" +
                    "Please run \"LEGUI.exe\" once to let it generate one for you.",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }

            if (args.Length == 0)
            {
                MessageBox.Show(
                    "Welcome to Locale Emulator command line tool.\r\n" +
                    "\r\n" +
                    "Usage: LEProc.exe\r\n" +
                    "\t[-run] path [args]\r\n" +
                    "\t-runas guid path [args]\r\n" +
                    "\t-manage path\r\n" +
                    "\t-global\r\n" +
                    "\r\n" +
                    "path\tFull path of the target application.\r\n" +
                    "guid\tGuid of the target profile (in LEConfig.xml).\r\n" +
                    "args\tAdditional arguments will be passed to the application.\r\n" +
                    "-run\tRun an application with it's own profile.\r\n" +
                    "-runas\tRun an application with a global profile of specific Guid.\r\n" +
                    "-manage\tModify the profile of one application.\r\n" +
                    "-global\tOpen Global Profile Manager.\r\n" +
                    "\r\n" +
                    "\r\n" +
                    "Have a suggestion? Want to report a bug? You're welcome! \r\n" +
                    "Go to 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",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion()
                    );

                GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0);

                return;
            }

            try
            {
                Args = args;

                switch (Args[0])
                {
                case "-run":     //-run %APP%
                    RunWithIndependentProfile(Args[1]);
                    break;

                case "-manage":     //-manage %APP%
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"),
                                  $"\"{Args[1]}.le.config\"");
                    break;

                case "-global":     //-global
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"));
                    break;

                case "-runas":     //-runas %GUID% %APP%
                    RunWithGlobalProfile(Args[1], Args[2]);
                    break;

                default:     // Still run as "-run"
                    if (File.Exists(Args[0]))
                    {
                        Args = new[] { "-run" }.Concat(Args).ToArray();
                        RunWithIndependentProfile(Args[1]);
                    }
                    break;
                }
            }
            catch
            {
            }
        }
示例#3
0
        private static void Main(string[] args)
        {
            SystemHelper.DisableDPIScale();

            if (!GlobalHelper.CheckCoreDLLs())
            {
                MessageBox.Show(
                    "Some of the core Dlls are missing.\r\n" +
                    "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n"
                    +
                    "\r\n" +
                    "These Dlls are:\r\n" +
                    "LoaderDll.dll\r\n" +
                    "LocaleEmulator.dll",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            //If global config does not exist, create a new one.
            LEConfig.CheckGlobalConfigFile(true);

            if (args.Length == 0)
            {
                MessageBox.Show(
                    "Welcome to Locale Emulator command line tool.\r\n" +
                    "\r\n" +
                    "Usage: LEProc.exe\r\n" +
                    "\tpath\r\n" +
                    "\t-run path [args]\r\n" +
                    "\t-runas guid path [args]\r\n" +
                    "\t-manage path\r\n" +
                    "\t-global\r\n" +
                    "\r\n" +
                    "path\tFull path of the target application.\r\n" +
                    "guid\tGuid of the target profile (in LEConfig.xml).\r\n" +
                    "args\tAdditional arguments will be passed to the application.\r\n" +
                    "\r\n" +
                    "path\tRun an application with \r\n" +
                    "\t\t(i) its own profile (if any) or \r\n" +
                    "\t\t(ii) first global profile (if any) or \r\n" +
                    "\t\t(iii) default ja-JP profile.\r\n" +
                    "-run\tRun an application with it's own profile.\r\n" +
                    "-runas\tRun an application with a global profile of specific Guid.\r\n" +
                    "-manage\tModify the profile of one application.\r\n" +
                    "-global\tOpen Global Profile Manager.\r\n" +
                    "\r\n" +
                    "\r\n" +
                    "You can press CTRL+C to copy this message to your clipboard.\r\n",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion()
                    );

                // GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0);

                return;
            }

            try
            {
                // To keep original quotes in the command line. If we directly use args[] to make the command line,
                //      {_cmd1.exe / c _cmd2.exe "path with space"} will become {_cmd1.exe / c _cmd2.exe path with space}
                //      and will cause issues.
                var argWithQuotesList = Regex.Matches(Environment.CommandLine, @"[\""].+?[\""]|[^ ]+")
                                        .Cast <Match>()
                                        .ToArray();
                Args = new string[argWithQuotesList.Length - 1];
                for (var i = 1; i < argWithQuotesList.Length; i += 1)
                {
                    Args[i - 1] = argWithQuotesList[i].ToString();
                }

                switch (Args[0])
                {
                case "-run":     //-run %APP%
                    RunWithIndependentProfile(Args[1]);
                    break;

                case "-manage":     //-manage %APP%
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"),
                                  $"\"{Args[1]}.le.config\"");
                    break;

                case "-global":     //-global
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"));
                    break;

                case "-runas":     //-runas %GUID% %APP%
                    RunWithGlobalProfile(Args[1], Args[2]);
                    break;

                default:
                    if (File.Exists(Args[0].Trim('"')))
                    {
                        RunWithDefaultProfile(Args[0].Trim('"'));
                    }
                    break;
                }
            }
            catch
            {
            }
        }
示例#4
0
        private static void Main(string[] args)
        {
            SystemHelper.DisableDPIScale();

            try
            {
                Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                           "LEUpdater.exe"),
                              "schedule");
            }
            catch
            {
            }

            if (!GlobalHelper.CheckCoreDLLs())
            {
                MessageBox.Show(
                    "Some of the core Dlls are missing.\r\n" +
                    "Please whitelist these Dlls in your antivirus software, then download and re-install LE.\r\n"
                    +
                    "\r\n" +
                    "These Dlls are:\r\n" +
                    "LoaderDll.dll\r\n" +
                    "LocaleEmulator.dll",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion(),
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                return;
            }

            //If global config does not exist, create a new one.
            LEConfig.CheckGlobalConfigFile(true);

            if (args.Length == 0)
            {
                MessageBox.Show(
                    "Welcome to Locale Emulator command line tool.\r\n" +
                    "\r\n" +
                    "Usage: LEProc.exe\r\n" +
                    "\tpath\r\n" +
                    "\t-run path [args]\r\n" +
                    "\t-runas guid path [args]\r\n" +
                    "\t-manage path\r\n" +
                    "\t-global\r\n" +
                    "\r\n" +
                    "path\tFull path of the target application.\r\n" +
                    "guid\tGuid of the target profile (in LEConfig.xml).\r\n" +
                    "args\tAdditional arguments will be passed to the application.\r\n" +
                    "\r\n" +
                    "path\tRun an application with \r\n" +
                    "\t\t(i) its own profile (if any) or \r\n" +
                    "\t\t(ii) first global profile (if any) or \r\n" +
                    "\t\t(iii) default ja-JP profile.\r\n" +
                    "-run\tRun an application with it's own profile.\r\n" +
                    "-runas\tRun an application with a global profile of specific Guid.\r\n" +
                    "-manage\tModify the profile of one application.\r\n" +
                    "-global\tOpen Global Profile Manager.\r\n" +
                    "\r\n" +
                    "\r\n" +
                    "You can press CTRL+C to copy this message to your clipboard.\r\n",
                    "Locale Emulator Version " + GlobalHelper.GetLEVersion()
                    );

                GlobalHelper.ShowErrorDebugMessageBox("SYSTEM_REPORT", 0);

                return;
            }

            try
            {
                Args = args;

                switch (Args[0])
                {
                case "-run":     //-run %APP%
                    RunWithIndependentProfile(Args[1]);
                    break;

                case "-manage":     //-manage %APP%
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"),
                                  $"\"{Args[1]}.le.config\"");
                    break;

                case "-global":     //-global
                    Process.Start(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
                                               "LEGUI.exe"));
                    break;

                case "-runas":     //-runas %GUID% %APP%
                    RunWithGlobalProfile(Args[1], Args[2]);
                    break;

                default:
                    if (File.Exists(Args[0]))
                    {
                        RunWithDefaultProfile(Args[0]);
                    }
                    break;
                }
            }
            catch
            {
            }
        }