Beispiel #1
0
        public LaunchConfiguration GetLaunchConfiguration(ServerLocal server, string dnExecutablePath)
        {
            var launchConfig = new LaunchConfiguration {
                DragonNestExePath = dnExecutablePath
            };

            server.Login.ToList().ForEach(launchConfig.LoginServers.Add);

            return(launchConfig);
        }
Beispiel #2
0
        public Process Launch(LaunchConfiguration launchConfig, bool startSuspended = false, OnSuspendedLaunch handler = null)
        {
            if (startSuspended)
            {
                var si      = new Startupinfo();
                var pi      = new ProcessInformation();
                var success = NativeMethods.CreateProcess(launchConfig.DragonNestExePath,
                                                          "\"dragonnest.exe\" " + launchConfig.CommandLineParams,
                                                          IntPtr.Zero,
                                                          IntPtr.Zero,
                                                          false,
                                                          ProcessCreationFlags.CREATE_SUSPENDED,
                                                          IntPtr.Zero,
                                                          Directory.GetParent(launchConfig.DragonNestExePath).FullName,
                                                          ref si,
                                                          out pi);

                if (success)
                {
                    handler?.Invoke(pi);
                    NativeMethods.ResumeThread(pi.hThread);
                    return(Process.GetProcessById((int)pi.dwProcessId));
                }
            }

            var proc = new Process
            {
                StartInfo =
                {
                    WorkingDirectory = Directory.GetParent(launchConfig.DragonNestExePath).FullName,
                    FileName         = launchConfig.DragonNestExePath,
                    Arguments        = launchConfig.CommandLineParams
                }
            };

            proc.Start();
            return(proc);
        }