DefaultSequenceFileContext.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Xml;
  7. using Aitex.Common.Util;
  8. using Aitex.Core.RT.Event;
  9. using Aitex.Core.RT.Log;
  10. namespace MECF.Framework.Common.RecipeCenter
  11. {
  12. public class DefaultSequenceFileContext:ISequenceFileContext
  13. {
  14. public string GetConfigXml()
  15. {
  16. try
  17. {
  18. string configContent = PathManager.GetCfgDir() + @"\SequenceFormat.xml";
  19. XmlDocument xmlDom = new XmlDocument();
  20. xmlDom.Load(configContent);
  21. CustomSequenceItem(xmlDom);
  22. return xmlDom.OuterXml;
  23. }
  24. catch (Exception ex)
  25. {
  26. LOG.Write(ex);
  27. return "";
  28. }
  29. }
  30. public virtual bool Validation(string content)
  31. {
  32. try
  33. {
  34. XmlDocument xmlDom = new XmlDocument();
  35. xmlDom.LoadXml(content);
  36. CustomValidation(xmlDom);
  37. return CustomValidation(xmlDom);
  38. }
  39. catch (Exception ex)
  40. {
  41. LOG.Write(ex);
  42. EV.PostWarningLog("Recipe", "sequence file not valid, "+ex.Message);
  43. return false;
  44. }
  45. }
  46. public virtual void CustomSequenceItem(XmlDocument xmlContent)
  47. {
  48. }
  49. public virtual bool CustomValidation(XmlDocument xmlContent)
  50. {
  51. return true;
  52. }
  53. }
  54. }