浏览代码

添加Serialize

sunyi 5 年之前
父节点
当前提交
ca51c68a56

+ 41 - 4
OTS/OTSModelSharp/Measure/GetBSEPic/BSEImgFileMgr.cs

@@ -8,9 +8,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Forms;
-
-
-
+using System.Xml;
 
 namespace OTSDataType
 {
@@ -66,7 +64,13 @@ namespace OTSDataType
         // file pathname
         String m_strPathName;
 
-      
+        // BSE image file mark
+        const int BSE_IMG_FILE_MARK = 'B' + 'S' + 'E' + 'I' + 'M' + 'G';
+
+        // BSE image file version string
+        const String BSE_IMG_FILE_VERSION = "1.1.1";
+
+
         public void CBSEImgFileMgr()
         {
             // initialization
@@ -384,5 +388,38 @@ namespace OTSDataType
             m_poBSE = a_poBSE;
 
         }
+
+       public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+            //xmls::xBool xbModify;
+
+            //xmls::xInt xBseImgFileMark;
+           // xmls::xString xBseImgFileVersion;
+            //xmls::Collection<CStage> xStagelist;
+          //  xmls::Slo slo;
+            xInt xBseImgFileMark = new xInt();
+            xString xBseImgFileVersion = new xString();
+            Slo slo = new Slo();
+            Collection<CBSEImg> m_poBSE = new Collection<CBSEImg>();
+
+            slo.Register("xBseImgFileMark", xBseImgFileMark);
+            slo.Register("xBseImgFileVersion", xBseImgFileVersion);
+            slo.Register("BSE", m_poBSE);
+            //this->Register("WorkingStageId", &xBseImgFileMark);
+            //this->Register("Stagelist", &xStagelist);
+            //->Register("StageData", m_pStageData.get());
+            if (isStoring)
+            {
+                xBseImgFileMark.AssignValue(BSE_IMG_FILE_MARK);
+                xBseImgFileVersion.AssignValue(BSE_IMG_FILE_VERSION);
+                //xBseImgFileMark = m_nWorkingStageId;
+
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+            }
+        }
     }
 }

+ 50 - 1
OTS/OTSModelSharp/Measure/GetBSEPic/MsrThreadStatus.cs

@@ -1,4 +1,5 @@
-using System;
+using OTSDataType;
+using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
@@ -31,10 +32,14 @@ namespace OTSIncAMeasureApp.OTSMesureControl
 		MAX = 2
 	}
 
+    
+
 
     public class CMsrThreadStatus
     {
         //    protected:DECLARE_SERIAL(CMsrThreadStatus)
+        // status
+       
 
         // constructor
         public CMsrThreadStatus()
@@ -243,6 +248,50 @@ namespace OTSIncAMeasureApp.OTSMesureControl
 
         }
 
+       public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+          
+            xInt xnStatus = new xInt();
+            Collection <DateTime> xtimeStart = new Collection<DateTime>();
+            Collection <TimeSpan>xtimeUsed = new Collection<TimeSpan>();
+            Collection <DateTime> xtimeEnd = new Collection<DateTime>();
+            Collection <COTSSample> xSamples = new Collection<COTSSample>();
+            Slo slo = new Slo();
+
+            slo.Register("xnStatus", xnStatus);
+            slo.Register("xtimeStart", xtimeStart);
+            slo.Register("xtimeUsed", xtimeUsed);            
+            slo.Register("xtimeEnd", xtimeEnd);
+            slo.Register("xSamples", xSamples);
+            if (isStoring)
+            {
+                xnStatus.AssignValue(Convert.ToInt32(m_nStatus));
+                //xtimeStart =  m_timeStart;
+                //xtimeUsed = m_timeUsed;
+                //xtimeEnd = m_timeEnd;
+                xSamples.Clear();
+                foreach (var pSample in m_listCpldSamples)
+                {
+                   // xSamples.addItem(pSample);
+                }
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+
+                m_nStatus = (OTS_MSR_THREAD_STATUS)xnStatus.value();
+                //m_timeStart = xtimeStart;
+                //m_timeUsed = xtimeUsed;
+                //m_timeEnd = xtimeEnd;
+                m_listCpldSamples.Clear();
+                for (uint i = 0; i < xSamples.size(); i++)
+                {
+                    m_listCpldSamples.Add(xSamples.getItem((int)i).ToString());
+                }
+            }
+        }
+
         // cleanup 
         protected void Cleanup()
         {

+ 48 - 0
OTS/OTSModelSharp/Measure/GetBSEPic/SmplMsrResultFile.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Xml;
 using OTSDataType;
 
 namespace OTSModelSharp
@@ -209,5 +210,52 @@ namespace OTSModelSharp
             }
         }
 
+       public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+            
+            xInt xnFileMark = new xInt();
+            xString xnVersion = new xString();
+            xBool xbSwitch = new xBool();
+            Collection<COTSFieldData> xfields = new Collection<COTSFieldData>();
+            Collection<CSEMStageData> m_pSEMStageData = new Collection<CSEMStageData>();
+            Collection<CStage> m_pStage = new Collection<CStage>();
+            Collection<CSEMDataGnr> m_pSEMData = new Collection<CSEMDataGnr>();
+            Collection<COTSSample> m_pSample = new Collection<COTSSample>();
+            Slo slo = new Slo();
+
+            slo.Register("xnFileMark", xnFileMark);
+            slo.Register("xnVersion", xnVersion);
+            slo.Register("xbSwitch", xbSwitch);
+            slo.Register("SEMStageData", m_pSEMStageData);
+            slo.Register("Stage", m_pStage);
+            slo.Register("SEMData", m_pSEMData);
+            slo.Register("Sample", m_pSample);
+            slo.Register("Fields", xfields);
+            if (isStoring)
+            {
+                xnFileMark.AssignValue(SMPL_MSR_RESULT_FILE_MARK);
+                xnVersion.AssignValue(SMPL_MSR_RESULT_FILE_VERSION);
+                xbSwitch.AssignValue(m_bSwitch);
+                xfields.Clear();
+
+                /*for (auto pFildData : m_listFieldData)
+                {
+                    xfields.addItem(pFildData.get());
+                }*/
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+                m_bSwitch = xbSwitch.value();
+                m_strFileVersion = xnVersion.value().ToString();
+                m_listFieldData.Clear();
+                /*for (unsigned int i = 0;i < xfields.size(); i++)
+                {
+                    m_listFieldData.push_back(COTSFieldDataPtr(xfields.getItem(i)));
+                }*/
+            }
+        }
+
     }
 }

+ 69 - 9
OTS/OTSModelSharp/Measure/GetParam/COTSProjMgrFile.cs

@@ -10,6 +10,7 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Forms;
+using System.Xml;
 using static OTSDataType.otsdataconst;
 
 namespace OTSModelSharp
@@ -61,7 +62,13 @@ namespace OTSModelSharp
 
         CSQLiteDB m_generalInfoTable;
 
-       // OTSControl.OTSController control = new OTSControl.OTSController();
+        // OTSControl.OTSController control = new OTSControl.OTSController();
+
+        // project file mark
+      public  const int PROJ_MGR_FILE_MARK = 'P' + 'R' + 'O' + 'J' + 'E' + 'T' + 'M' + 'A' + 'N' + 'A' + 'G' + 'E' + 'R';
+
+        // project file version string
+      public  const String PROJ_MGR_FILE_VERSION = "1.1.1";
 
 
         public COTSProjMgrFile()
@@ -1803,21 +1810,74 @@ namespace OTSModelSharp
 
         public  void SetDefaultParameters(COTSGeneralParameters val) { m_DefaultParameters = val; }
 
-        //合并后新添加的需要的方法
-       
-
-        public bool SetImageScanParam(COTSGeneralParameters ImageScan) { return false; }
+       public void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
 
-       
+            //xmls::xInt xProjMgrFileMark;
+            //xmls::xString xProjMgrFileVersion;
+            //xmls::xString xstrPathName;
+            //xmls::Collection<CHoleBSEImg> xholeBSEImgs;
+            //xmls::Collection<COTSSample> xsamples;
+            //xmls::Slo slo;
+
+            xInt xProjMgrFileMark = new xInt();
+            xString xProjMgrFileVersion = new xString();
+            xString xstrPathName = new xString();
+            Collection<CHoleBSEImg> xholeBSEImgs = new Collection<CHoleBSEImg>();
+            Collection<COTSSample> xsamples = new Collection<COTSSample>();
+            Collection<CSEMStageData> m_pSEMStageData = new Collection<CSEMStageData>();
+            Collection<CStage> m_pStage = new Collection<CStage>();
+            Slo slo = new Slo();
+            slo.Register("ProjMgrFileMark", xProjMgrFileMark);
+            slo.Register("ProjMgrFileVersion", xProjMgrFileVersion);
+            slo.Register("strPathName", xstrPathName);
+            slo.Register("SEMStageData", m_pSEMStageData);
+            slo.Register("Stage", m_pStage);
+            slo.Register("HoleBSEImg", xholeBSEImgs);
+            slo.Register("Samples", xsamples);
+
+            if (isStoring)
+            {
+                xProjMgrFileMark.AssignValue(PROJ_MGR_FILE_MARK);
+                xProjMgrFileVersion.AssignValue(PROJ_MGR_FILE_VERSION);
+                xstrPathName.AssignValue(m_strPathName);
+                xholeBSEImgs.Clear();
+                foreach (var hole in m_listHoleBSEImg)
+                {
+                    xholeBSEImgs.addItem(hole);
+                }
+                xsamples.Clear();
+                foreach (var sample in m_listSamples)
+                {
+                    xsamples.addItem(sample);
+                }
+                slo.Serialize(true, classDoc, rootNode);
 
-        
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+                m_strPathName = xstrPathName.value().ToString();
+                m_listHoleBSEImg.Clear();
+                for (uint i = 0; i < xholeBSEImgs.size(); i++)
+                {
+                    m_listHoleBSEImg.Add(xholeBSEImgs.getItem((int)i));
+                }
+                m_listSamples.Clear();
+                for (int i = 0; i < (int)xsamples.size(); i++)
+                {
+                    m_listSamples.Add(xsamples.getItem(i));
+                }
 
-       
+            }
 
-        public COTSImgScanPrm  GetImageScanParam() { return null; }
+        }
 
+        //合并后新添加的需要的方法
 
+        public bool SetImageScanParam(COTSGeneralParameters ImageScan) { return false; }
 
+        public COTSImgScanPrm  GetImageScanParam() { return null; }
 
     }
 }

+ 4 - 4
OTS/OTSModelSharp/Measure/GetParam/OTSProgMgrParamFile.cs

@@ -615,11 +615,11 @@ namespace OTSModelSharp
             m_strPathName = a_strPathName;
 
             // create stage data
-           // m_pStageData = new CSEMStageData();
+            m_pStageData = new CSEMStageData();
             m_pParam = new COTSGeneralParameters();
-          //  m_pImageScanParam = new COTSImgScanPrm();
-           // m_pImageProcParam = new COTSImageProcessParam();
-          //  m_pXRayParam = new COTSXRayParam();
+            m_pImageScanParam = new COTSImgScanPrm();
+            m_pImageProcParam = new COTSImageProcessParam();
+            m_pXRayParam = new COTSXRayParam();
 
             XmlDocument doc = new XmlDocument();               //tinyxml2.XMLDocument doc = new tinyxml2.XMLDocument();
             doc.Load(a_strPathName);                          //   doc.LoadFile(a_strPathName); //载入xml文件

+ 2 - 0
OTS/OTSModelSharp/OTSDataType/COTSImageScanParam.cs

@@ -229,6 +229,8 @@ namespace OTSDataType
             return m_LpScanParam;
         }
 
+      
+
 
     }
 }

+ 7 - 5
OTS/OTSModelSharp/OTSDataType/MultiLang.cs

@@ -63,15 +63,17 @@ namespace OTSDataType
             string ss = root2.InnerText;
             if (ss == "EN")
             {
-                xml.Load(".\\Resources\\XMLData\\ResourceForSourceGrid-EN.xml");//载入xml文件
+                // xml.Load(".\\Resources\\XMLData\\ResourceForSourceGrid-EN.xml");//载入xml文件
+                xml.Load(".\\Resources\\XMLData\\ResourceForSTDManage-EN.xml");
             }
             else if (ss == "ZH")
             {
-                xml.Load(".\\Resources\\XMLData\\ResourceForSourceGrid-ZH.xml");//载入xml文件
+                // xml.Load(".\\Resources\\XMLData\\ResourceForSourceGrid-ZH.xml");//载入xml文件
+                xml.Load(".\\Resources\\XMLData\\ResourceForSTDManage-ZH.xml");
             }
-            root = xml.SelectSingleNode("XMLData");
-            root2 = root.SelectSingleNode("collection");
-            XmlNodeList childlist = root2.ChildNodes;
+             root = xml.SelectSingleNode("XMLData");           
+             root2 = root.SelectSingleNode("collection");
+             XmlNodeList childlist = root2.ChildNodes;
             for (int i = 0; i < childlist.Count; i++)
             {
                 int colkey = -1;

+ 39 - 0
OTS/OTSModelSharp/OTSDataType/SEMStageData.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Xml;
 
 namespace OTSDataType
 {
@@ -22,6 +23,8 @@ namespace OTSDataType
         // y axis (micros)
         CIntRange m_oYAxis;
 
+        
+
         //-------------public---------------------
         public CSEMStageData()// constructor
         {
@@ -118,5 +121,41 @@ namespace OTSDataType
             m_oYAxis = a_oSource.m_oYAxis;
             m_dMinMag = a_oSource.m_dMinMag;
         }
+
+      public  void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
+        {
+         
+            xInt xscanFieldSize100 = new xInt();
+            xInt xbXAxisDir = new xInt();
+            xInt xbYAxisDir = new xInt();
+            xDouble xMinMag = new xDouble();            
+            Slo slo = new Slo();
+            //Slo::Clear();
+            slo.Register("xscanFieldSize100", xscanFieldSize100);
+            slo.Register("xbXAxisDir", xbXAxisDir);
+            slo.Register("xbYAxisDir", xbYAxisDir);
+            slo.Register("MinMag", xMinMag);
+            slo.Register("XAxis", m_oXAxis);
+            slo.Register("YAxis", m_oYAxis);
+
+            if (isStoring)
+            {
+                xscanFieldSize100.AssignValue(m_nScanFieldSize100);
+                xbXAxisDir.AssignValue((int)m_bXAxisDir);
+                xbYAxisDir.AssignValue((int)m_bYAxisDir);
+                xMinMag.AssignValue(m_dMinMag);
+
+                slo.Serialize(true, classDoc, rootNode);
+            }
+            else
+            {
+                slo.Serialize(false, classDoc, rootNode);
+
+                m_nScanFieldSize100 = xscanFieldSize100.value();
+                m_bXAxisDir = (otsdataconst.OTS_X_AXIS_DIRECTION)xbXAxisDir.value();
+                m_bYAxisDir = (otsdataconst.OTS_Y_AXIS_DIRECTION)xbYAxisDir.value();
+                m_dMinMag = xMinMag.value();
+            }
+        }
     }
 }