Esempio n. 1
0
        public override async Task <IDataToSent> TransformData(IDataToSent receiveData)
        {
            if (receiveData == null)
            {
                receiveData = new DataToSentTable();
            }
            results     = CreateTable(receiveData);
            sw          = Stopwatch.StartNew();
            StartedDate = DateTime.UtcNow;
            try
            {
                process = new ProcessIntercept(FileName, Arguments);
                process.OutputDataReceived += new dia.DataReceivedEventHandler(Process_OutputDataReceived);
                process.ErrorDataReceived  += new dia.DataReceivedEventHandler(Process_ErrorDataReceived);
                //process.Exited += new System.EventHandler(Process_Exited);
                process.StartProcessAndWait();
            }
            catch (Exception ex)
            {
                results.Rows.Add("process", Arguments, FileName + Arguments, false, ex.Message, sw.ElapsedMilliseconds, "", ex.Message, StartedDate);
            }



            return(await Task.FromResult(receiveData));
        }
Esempio n. 2
0
        public override async Task <IDataToSent> TransformData(IDataToSent receiveData)
        {
            output = new DataTable();
            output.Columns.Add(new DataColumn("message", typeof(string)));

            error = new DataTable();
            error.Columns.Add(new DataColumn("message", typeof(string)));

            var ret = new DataToSentTable();
            var id  = ret.AddNewTable(output);

            ret.Metadata.AddTable(output, id);
            id = ret.AddNewTable(error);
            ret.Metadata.AddTable(error, id);
            process = new ProcessIntercept(FileName, Arguments);
            process.OutputDataReceived += new System.Diagnostics.DataReceivedEventHandler(Process_OutputDataReceived);
            process.ErrorDataReceived  += new System.Diagnostics.DataReceivedEventHandler(Process_ErrorDataReceived);
            process.Exited             += new System.EventHandler(Process_Exited);
            process.StartProcessAndWait();
            return(await Task.FromResult(ret));
        }