SigFilterHelper.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. using XdCxRhDW.Dto;
  9. namespace CheckServer.AddIns
  10. {
  11. public class SigFilterHelper
  12. {
  13. // 【fin】 [fout] [fsample] [bandwidth]
  14. public static async Task<string> SigFilter(SigFilterDto dto, string outFile)
  15. {
  16. var pro = new Process();
  17. var res = await Task.Run(() =>
  18. {
  19. pro.StartInfo.Arguments = $"\"{dto.File}\" \"{outFile}\" {(long)(dto.FsHz)} {dto.BandHz}";
  20. var exePath = Path.Combine(pro.StartInfo.WorkingDirectory, "AddIns");
  21. pro.StartInfo.WorkingDirectory = exePath;
  22. pro.StartInfo.FileName = Path.Combine(exePath, "FileFilter.exe");
  23. pro.StartInfo.CreateNoWindow = true;
  24. pro.StartInfo.RedirectStandardError = true;
  25. pro.StartInfo.RedirectStandardOutput = true;
  26. pro.StartInfo.UseShellExecute = false;
  27. pro.Start();
  28. var suceed = pro.WaitForExit(60 * 1000);
  29. if (!suceed)
  30. {
  31. throw new Exception("滤波处理超时(60秒)");
  32. }
  33. return outFile;
  34. });
  35. return res;
  36. }
  37. }
  38. }