예제 #1
0
파일: Program.cs 프로젝트: fcatae/Pipes
        public override PipeOutput Run(PipeInput input)
        {
            using (var conn = GetConnection())
            {
                var inputModel = _insertDouData.CreateInput(input.FromBase64());

                if (inputModel != null)
                {
                    conn.Execute(inputModel.Command, inputModel.Parameters);
                }
                else
                {
                    return(PipeOutput.FromString($"ErroCount = {(_errorCount++).ToString()}"));
                }
            }

            return(PipeOutput.FromString((_lineNumber++).ToString()));
        }
예제 #2
0
        public override PipeOutput Run(PipeInput input)
        {
            string args = input;

            var procStartInfo = new ProcessStartInfo
            {
                FileName               = _process,
                Arguments              = String.Format(_arguments, args),
                UseShellExecute        = false,
                WindowStyle            = ProcessWindowStyle.Normal,
                RedirectStandardOutput = true
            };

            var process = Process.Start(procStartInfo);

            var    reader = process.StandardOutput;
            string result = reader.ReadToEnd().Trim('\n');

            return(PipeOutput.FromString(result));
        }