Service.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using BabylonExport.Core;
  2. using BabylonExport.Core.Exporters;
  3. using BabylonExport.Interface;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Reflection;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace BabylonExport
  14. {
  15. public class Service : IService
  16. {
  17. public bool Convert(string input, string outputName)
  18. {
  19. try
  20. {
  21. Console.WriteLine("input:" + input);
  22. Console.WriteLine("outputName:" + outputName);
  23. System.Diagnostics.Process p = new System.Diagnostics.Process();
  24. p.StartInfo.FileName = "BabylonExport.exe";
  25. p.StartInfo.Arguments = "/i:" + input + " /o:" + outputName;
  26. p.Start();
  27. if (p.WaitForExit(1000 * 60 * 3))
  28. {
  29. p.Close();
  30. return true;
  31. }
  32. else
  33. {
  34. p.Close();
  35. return false;
  36. }
  37. }
  38. catch (Exception ex)
  39. {
  40. Console.WriteLine(ex.Message);
  41. return false;
  42. }
  43. }
  44. }
  45. }