DefaultSequenceFileContext.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.WriteExeption(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.WriteExeption(ex);
  42. return false;
  43. }
  44. }
  45. public bool EnableEdit(string sequencePathName)
  46. {
  47. return true;
  48. }
  49. public virtual void CustomSequenceItem(XmlDocument xmlContent)
  50. {
  51. }
  52. public virtual bool CustomValidation(XmlDocument xmlContent)
  53. {
  54. return true;
  55. }
  56. }
  57. }