SigFilterHelper.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. Process pro;
  14. // 【fin】 [fout] [fsample] [bandwidth]
  15. public async Task SigFilter(SigFilterDto dto, string outFile)
  16. {
  17. pro = new Process();
  18. await Task.Run(() =>
  19. {
  20. pro.StartInfo.Arguments = $"\"{dto.File}\" \"{outFile}\" {(Int64)(dto.FsHz)} {dto.BandHz}";
  21. var exePath = Path.Combine(pro.StartInfo.WorkingDirectory, "AddIns");
  22. pro.StartInfo.WorkingDirectory = exePath;
  23. pro.StartInfo.FileName = Path.Combine(exePath, "FileFilter.exe");
  24. pro.StartInfo.CreateNoWindow = true;
  25. pro.StartInfo.RedirectStandardError = true;
  26. pro.StartInfo.RedirectStandardOutput = true;
  27. pro.StartInfo.UseShellExecute = false;
  28. pro.Start();
  29. var suceed = pro.WaitForExit(dto.TimeoutSeconds * 1000);
  30. if (!suceed)
  31. {
  32. throw new Exception("滤波处理超时");
  33. }
  34. });
  35. }
  36. }
  37. }