예제 #1
0
        private void StartProcess(int appId)
        {
            OptionComponent      optionComponent      = Game.Scene.GetComponent <OptionComponent>();
            StartConfigComponent startConfigComponent = Game.Scene.GetComponent <StartConfigComponent>();
            string      configFile  = optionComponent.Options.Config;
            StartConfig startConfig = startConfigComponent.Get(appId);

#if __MonoCS__
            const string exe       = @"dotnet";
            string       arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile}";
#else
            const string exe       = @"dotnet";
            string       arguments = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile}";
#endif

            Log.Info($"{exe} {arguments}");
            try
            {
                ProcessStartInfo info = new ProcessStartInfo {
                    FileName = exe, Arguments = arguments, CreateNoWindow = true, UseShellExecute = true
                };

                Process process = Process.Start(info);
                this.processes.Add(startConfig.AppId, process);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
예제 #2
0
        private void StartProcess(int appId)
        {
            OptionComponent      optionComponent      = Game.Scene.GetComponent <OptionComponent>();
            StartConfigComponent startConfigComponent = StartConfigComponent.Instance;
            string       configFile  = optionComponent.Options.Config;
            StartConfig  startConfig = startConfigComponent.Get(appId);
            const string exe         = "dotnet";
            string       arguments   = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile}";

            Log.Info($"{exe} {arguments}");
            try
            {
                bool             useShellExecute = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
                ProcessStartInfo info            = new ProcessStartInfo {
                    FileName = exe, Arguments = arguments, CreateNoWindow = true, UseShellExecute = useShellExecute
                };

                Process process = Process.Start(info);
                this.processes.Add(startConfig.AppId, process);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }
        private void StartProcess(int appId)
        {
            OptionComponent      optionComponent      = Game.Scene.GetComponent <OptionComponent>();
            StartConfigComponent startConfigComponent = StartConfigComponent.Instance;
            string       configFile  = optionComponent.Options.Config;
            StartConfig  startConfig = startConfigComponent.Get(appId);
            const string exe         = "dotnet";
            string       arguments   = $"App.dll --appId={startConfig.AppId} --appType={startConfig.AppType} --config={configFile}";

            Log.Info($"{exe} {arguments}");
            try
            {
                Process process = ProcessHelper.Run(exe, arguments);
                this.processes.Add(startConfig.AppId, process);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }
        }