using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using XdCxRhDW.Dto; namespace CheckServer.AddIns { public class SigFilterHelper { // 【fin】 [fout] [fsample] [bandwidth] public static async Task SigFilter(SigFilterDto dto, string outFile) { var pro = new Process(); var res = await Task.Run(() => { pro.StartInfo.Arguments = $"\"{dto.File}\" \"{outFile}\" {(long)(dto.FsHz)} {dto.BandHz}"; var exePath = Path.Combine(pro.StartInfo.WorkingDirectory, "AddIns"); pro.StartInfo.WorkingDirectory = exePath; pro.StartInfo.FileName = Path.Combine(exePath, "FileFilter.exe"); pro.StartInfo.CreateNoWindow = true; pro.StartInfo.RedirectStandardError = true; pro.StartInfo.RedirectStandardOutput = true; pro.StartInfo.UseShellExecute = false; pro.Start(); var suceed = pro.WaitForExit(dto.TimeoutSeconds * 1000); if (!suceed) { throw new Exception("滤波处理超时"); } return outFile; }); return res; } } }