DefaultSequenceFileContext.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 bool EnableEdit(string sequencePathName)
  47. {
  48. return true;
  49. }
  50. public virtual void CustomSequenceItem(XmlDocument xmlContent)
  51. {
  52. }
  53. public virtual bool CustomValidation(XmlDocument xmlContent)
  54. {
  55. return true;
  56. }
  57. }
  58. }