Start() public static method

public static Start ( string name, string fileName, string arguments, string workingDirectory ) : Process
name string
fileName string
arguments string
workingDirectory string
return Process
Esempio n. 1
0
        private void RunGameMachine(string command, string config)
        {
            string envFile = serverConfig.serverPath + "/env.dat";

            string fileName;

            if (IsWindows())
            {
                fileName = serverConfig.serverPath + "/bin/game_machine.bat";
            }
            else
            {
                fileName = serverConfig.serverPath + "/bin/game_machine.sh";
            }

            if (!string.IsNullOrEmpty(config))
            {
                File.WriteAllText(envFile, config);
            }

            string workingDirectory = serverConfig.serverPath;
            string arguments        = " " + command;

            System.Diagnostics.Process proc = ProcessTracker.Start(gameMachineProcess, fileName, arguments, workingDirectory);

            if (command.StartsWith("build"))
            {
                proc.WaitForExit();
                ProcessTracker.RemoveProcess(proc.Id);
                if (command == "build clean")
                {
                    BuildProtobuf();
                }
            }
        }
Esempio n. 2
0
        private void BuildProtobuf()
        {
            string buildDir       = Application.dataPath + "/GameMachine/third_party/ProtoBuf/build";
            string outDir         = Application.dataPath + "/GameMachine/third_party/ProtoBuf/generated";
            string serializerDll  = outDir + "/GmSerializer.dll";
            string messagesDll    = outDir + "/messages.dll";
            string clientMessages = buildDir + "/messages.cs";
            string serverProto    = serverConfig.serverPath + "/config/combined_messages.proto";
            string clientProto    = buildDir + "/combined_messages.proto";

            if (File.Exists(serverProto))
            {
                File.Delete(clientProto);
                File.Copy(serverProto, clientProto);
            }

            if (File.Exists(clientProto))
            {
                if (File.Exists(serializerDll))
                {
                    File.Delete(serializerDll);
                }

                if (File.Exists(messagesDll))
                {
                    File.Delete(messagesDll);
                }


                string cmd       = buildDir + @"/ProtoGen/protogen.exe";
                string arguments = " -i:combined_messages.proto -o:messages.cs";
                System.Diagnostics.Process proc = ProcessTracker.Start("build_messages", cmd, arguments, buildDir);
                proc.WaitForExit();
                ProcessTracker.RemoveProcess(proc.Id);

                arguments = " -r:../unity/protobuf-net.dll -target:library -out:../generated/messages.dll messages.cs";
                proc      = ProcessTracker.Start("compile_messages", serverConfig.gmcsPath, arguments, buildDir);
                proc.WaitForExit();
                ProcessTracker.RemoveProcess(proc.Id);

                cmd       = buildDir + "/Precompile/precompile.exe";
                arguments = " ../generated/messages.dll ../unity/protobuf-net.dll -o:../generated/GmSerializer.dll -t:GmSerializer";
                proc      = ProcessTracker.Start("compile_serializer", cmd, arguments, buildDir);
                proc.WaitForExit();
                ProcessTracker.RemoveProcess(proc.Id);

                File.Delete(clientMessages);
            }
            else
            {
                Debug.LogWarning("combined_messages.proto not found, not compiling");
            }
        }
Esempio n. 3
0
        private void StartUnity(bool headless)
        {
            string fileName  = ExePath();
            string arguments = " -logFile ./logfile";

            if (headless)
            {
                arguments = " -batchmode -nographics -logFile ./logfile";
            }

            string workingDirectory = PublishPath();

            ProcessTracker.Start(unityProcess, fileName, arguments, workingDirectory);
        }