CClash.CClashServerClient.CompileOrCache C# (CSharp) Method

CompileOrCache() public method

public CompileOrCache ( ICompiler comp, IEnumerable args ) : int
comp ICompiler
args IEnumerable
return int
        public int CompileOrCache(ICompiler comp, IEnumerable<string> args)
        {
            Logging.Emit("client args: {0}", string.Join(" ", args.ToArray()));

            if (comp != null) // compiler is set, server wasnt ready
            {
                return comp.InvokeCompiler(args, null, null, false, new List<string>());
            }

            try {
                var req = new CClashRequest()
                {
                    cmd = Command.Run,
                    compiler = compilerPath,
                    envs = environment,
                    workdir = workingdir,
                    argv = new List<string> ( args ),
                };
                var resp = Transact(req);
                if (resp != null)
                {
                    if (stdErrCallback != null)
                    {
                        stdErrCallback(resp.stderr);
                    }
                    else
                    {
                        Console.Error.Write(resp.stderr);
                    }
                    if (stdOutCallback != null)
                    {
                        stdOutCallback(resp.stdout);
                    }
                    else
                    {
                        Console.Out.Write(resp.stdout);
                    }

                    return resp.exitcode;
                }
                else
                {
                    throw new CClashErrorException("server returned no response");
                }
            } catch (Exception e) {
                Logging.Emit("server error! {0}", e);
                throw new CClashWarningException("server error");
            }
        }