浏览代码

Merge branch 'GSP' of http://36.129.169.60:30080/gogsadmin/OTS into GSP

zhangjiaxin 1 周之前
父节点
当前提交
0376ce8019

+ 10 - 3
OTSIncAMeasureApp/0-OTSModel/OTSDataType/CSEMFieldData.cs

@@ -49,8 +49,10 @@ namespace OTSDataType
 
         // copy data over
         m_nScanFieldWidth = a_oSource.m_nScanFieldWidth;
-		m_nScanFieldSize100 = a_oSource.m_nScanFieldSize100;
-		m_dWorkingDistance = a_oSource.m_dWorkingDistance;
+        m_nScanFieldHeight = a_oSource.m_nScanFieldHeight;
+        m_nScanFieldSize100 = a_oSource.m_nScanFieldSize100;
+        m_nScanFieldHeight100 = a_oSource.m_nScanFieldHeight100;    
+        m_dWorkingDistance = a_oSource.m_dWorkingDistance;
         m_magnification = a_oSource.m_magnification;
 		m_nTotalFields = a_oSource.m_nTotalFields;
 	}
@@ -95,7 +97,8 @@ namespace OTSDataType
            xInt xnScanFieldSize=new xInt();
            xInt xnScanFieldHeight = new xInt();
            xInt xnScanFieldSize100=new xInt();
-           xDouble xdWorkingDistance=new xDouble();
+            xInt xnScanFieldHeight100 = new xInt();  
+            xDouble xdWorkingDistance=new xDouble();
             xDouble xdKV = new xDouble();
             xDouble xdBrightness = new xDouble();
             xDouble xdConstrast = new xDouble();
@@ -105,6 +108,7 @@ namespace OTSDataType
             slo.Register("ScanFieldSize", xnScanFieldSize);
             slo.Register("ScanFieldHeight", xnScanFieldHeight);
             slo.Register("ScanFieldSize100", xnScanFieldSize100);
+            //slo.Register("ScanFieldHeight100", xnScanFieldHeight100);
             slo.Register("WorkingDistance", xdWorkingDistance);           
             slo.Register("Brightness", xdBrightness);
             slo.Register("Constrast", xdConstrast);
@@ -117,6 +121,7 @@ namespace OTSDataType
                 xnScanFieldSize.AssignValue(m_nScanFieldWidth);
                 xnScanFieldHeight.AssignValue(m_nScanFieldHeight);
                 xnScanFieldSize100.AssignValue(m_nScanFieldSize100);
+                //xnScanFieldHeight100.AssignValue(m_nScanFieldHeight100);
                 xdWorkingDistance.AssignValue(m_dWorkingDistance);
                 xdKV.AssignValue(m_KV);
                 xdBrightness.AssignValue(m_Brightness);
@@ -132,7 +137,9 @@ namespace OTSDataType
                 slo.Serialize(false, classDoc, rootNode);
 
                 m_nScanFieldWidth = xnScanFieldSize.value();
+                m_nScanFieldHeight = xnScanFieldHeight.value();
                 m_nScanFieldSize100 = xnScanFieldSize100.value();
+                m_nScanFieldHeight100 = (int)(m_nScanFieldSize100*m_nScanFieldHeight/m_nScanFieldWidth);
                 m_dWorkingDistance = xdWorkingDistance.value();
                 m_KV = xdKV.value();
                 m_Brightness = xdBrightness.value();

+ 0 - 599
OTSIncAMeasureApp/0-OTSModel/OTSDataType/XMLSerialization.cs

@@ -1,599 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Xml;
-using System.Drawing;
-
-namespace OTSDataType
-{
-
-
-    public interface Convertinterface
-    {
-        void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode);
-    }
-    public class MemberBase
-    {
-        const string RootClassName = "XMLData";
-        const string XMLClassEndTag = "</" + RootClassName + ">";
-        const string Empty_String = "";
-
-        protected string m_sValue;
-        //public virtual ~MemberBase() { };
-        public virtual void Dispose() { }
-        public string toString() { return m_sValue; }
-        //public const char* c_str() { return m_sValue.c_str(); }
-        public string getStringPtr(string str) { return m_sValue = str; }     //c++原代码为:std::string *getStringPtr() { return &m_sValue; }; 
-    }
-    /**
-		serializable string
-	*/
-    public class xString : MemberBase
-    {
-        public void AssignValue(string value) { m_sValue = value; }           //因为c#无=重载,所以修改为public
-        public xString() { }
-        public xString(string value) { AssignValue(value); }
-        public string value() { return m_sValue; }
-
-
-    }
-
-    public class xInt : MemberBase
-    {
-        public void AssignValue(int value) { m_sValue = value.ToString(); }        //因为c#无=重载,所以修改为public
-        public xInt() { AssignValue(0); }
-        public xInt(int value) { AssignValue(value); }
-        public int value()
-        {
-            int value;
-            value = int.Parse(m_sValue);
-            return value;
-        }
- 
-    }
-
-    public class xDouble : MemberBase
-    {
-        public void AssignValue(double value) { m_sValue = value.ToString(); }       //因为c#无=重载,所以修改为public
-        public xDouble() { AssignValue(0); }
-        public xDouble(double value) { AssignValue(value); }
-        public double value()
-        {
-            double value;
-            if(m_sValue == null || m_sValue == "")
-            {
-                return 0;
-            }
-            value = Convert.ToDouble(m_sValue);
-            return value;
-        }
-
-    }
-
-
-
-
-    public class xLong : MemberBase
-    {
-        public void AssignValue(long value) { m_sValue = value.ToString(); }   //因为c#无=重载,所以修改为public            public xLong() { AssignValue(0); }
-        public xLong() { AssignValue(0); }
-        public xLong(long value) { AssignValue(value); }
-        public long value()
-        {
-            long value;
-            if (m_sValue == null || m_sValue == "")
-            {
-                return 0;
-            }
-            value = long.Parse(m_sValue);
-            return value;
-        }
-
-    }
-
-    public class xDWORD : MemberBase
-    {
-        public void AssignValue(uint value) { m_sValue = value.ToString(); }    //因为c#无=重载,所以修改为public
-        public xDWORD() { AssignValue(0); }
-        public xDWORD(uint value) { AssignValue(value); }
-        public uint value()
-        {
-            uint value;
-            if (m_sValue == null || m_sValue == "")
-            {
-                return 0;
-            }
-            value = uint.Parse(m_sValue);
-            return value;
-        }
-
-    }
-    public class xBool : MemberBase
-    {
-        public void AssignValue(bool value) { m_sValue = value ? "true" : "false"; }       //因为c#无=重载,所以修改为public
-        public xBool() { AssignValue(false); }
-        public xBool(bool value) { AssignValue(value); }
-        public bool value()
-        {
-            bool value = false;
-            string sHelp = m_sValue;
-            //transform(sHelp.GetEnumerator(), sHelp.end(), sHelp.GetEnumerator(), toupper);
-            sHelp = sHelp.ToUpper();
-            if (sHelp == "TRUE")
-                return true;
-            return value;
-        }
-
-    }
-
-
-    public class xTime_t : MemberBase                
-    {
-        public void AssignValue(DateTime value)     //因为c#无=重载,所以修改为public
-        {
-            m_sValue = value.ToString();
-        }
-
-        public xTime_t()
-        {
-            DateTime t = Convert.ToDateTime("1000-01-01 00:00:00");
-            AssignValue(t);
-        }
-
-        public xTime_t(DateTime value) { AssignValue(value); }
-
-        public DateTime value()
-        {
-            return Convert.ToDateTime(m_sValue);
-        }
-    }
-
-
-    public class xOleDateTimeSpan : MemberBase   
-    {
-        public void AssignValue(TimeSpan value)        //因为c#无=重载,所以修改为public
-        {
-            m_sValue = value.ToString();
-        }
-        public xOleDateTimeSpan()
-        {
-            TimeSpan timeSpan = DateTime.Now - DateTime.Now;
-            AssignValue(timeSpan);
-        }
-        public xOleDateTimeSpan(TimeSpan value) { AssignValue(value); }
-
-        public TimeSpan value()
-        {
-            return TimeSpan.Parse(m_sValue);
-        }
-       
-    };
-
-    public class xRect : MemberBase
-    {
-        public void AssignValue(RectangleF value, int shape = 1)        //因为c#无=重载,所以修改为public
-        {
-            //Rect x = new Rect();
-
-            // domain text body
-            string strDomainTextBody = "";
-            // value 1 -- shape
-            string strValue = "";
-
-            // value 2 -- center x
-            // domain center
-            int centerX = (int)(value.Left + value.Right) / 2;
-            strValue = centerX.ToString();
-
-            strDomainTextBody += strValue + ",";
-            // value 3 -- center y
-            int centerY = (int)(value.Top + value.Bottom) / 2;
-            strValue = centerY.ToString();
-            strDomainTextBody += strValue + ",";
-
-            if (shape == 0)
-            {
-                // value 4 -- diameter
-                int diameter = (int)value.Width;
-                strValue = diameter.ToString();
-                strDomainTextBody += strValue + ",";
-                // value 5 -- 0
-                strDomainTextBody += "0";
-            }
-            else
-            {
-                // value 4 -- width
-                int width = (int)value.Width;
-                strValue = width.ToString();
-                strDomainTextBody += strValue + ",";
-                // value 5 -- height
-                int height = (int)value.Height;
-                strValue = height.ToString();
-                strDomainTextBody += strValue;
-            }
-
-            // return domain text body
-            m_sValue = strDomainTextBody;
-        }
-
-        public xRect()  //xRect() { AssignValue(0); };???
-        {
-            Rectangle value = new Rectangle();
-            value.X = 0;
-            value.Y = 0;
-            value.Width = 1;
-            value.Height = 1;
-            AssignValue(value, 1);
-        }
-
-        public xRect(Rectangle value, int shape) { AssignValue(value, shape); }
-
-        public void SplitString(string s, ref List<string> v, string c)
-        {
-            string[] sArray = System.Text.RegularExpressions.Regex.Split(s, c, System.Text.RegularExpressions.RegexOptions.None);
-            foreach (string i in sArray)
-                v.Add(i);
-        }
-        public Rectangle value()
-        {
-            List<string> point = new List<string>();
-            SplitString(m_sValue, ref point, ",");
-
-            System.Drawing.Point pReftTop = new System.Drawing.Point();
-            pReftTop.X = int.Parse(point[0]);
-            pReftTop.Y = int.Parse(point[1]);
-            System.Drawing.Size pRightBottom = new System.Drawing.Size();
-            pRightBottom.Width = int.Parse(point[2]);
-            pRightBottom.Height = int.Parse(point[3]);
-            Rectangle rectangle = new Rectangle(pReftTop, pRightBottom);
-
-            return rectangle;
-        }
-       
-    }
-
-    public class xPoint : MemberBase
-    {
-        public void AssignValue(System.Drawing.Point value)             //因为c#无=重载,所以修改为public
-        {
-            int X = value.X;
-            int Y = value.Y;
-            string OutString;
-            string sX = X.ToString();
-            string sY = Y.ToString();
-            OutString = sX + "," + sY;
-            m_sValue = OutString;
-        }
-        public xPoint()
-        {
-            System.Drawing.Point value = new System.Drawing.Point();
-            value.X = 0;
-            value.Y = 0;
-            AssignValue(value);
-        }
-        public xPoint(System.Drawing.Point value) { AssignValue(value); }
-        public void SplitString(string s, ref List<string> v, string c)
-        {
-            string[] sArray = System.Text.RegularExpressions.Regex.Split(s, c, System.Text.RegularExpressions.RegexOptions.None);
-            foreach (string i in sArray)
-                v.Add(i);
-        }
-        public System.Drawing.Point value()
-        {
-            System.Drawing.Point p = new System.Drawing.Point();
-            List<string> point = new List<string>();
-            SplitString(m_sValue, ref point, ",");
-
-            p.X = int.Parse(point[0]);
-            p.Y = int.Parse(point[1]);
-
-            return p;
-        }
-      
-    };
-
-
- 
-    public abstract class CollectionBase<ISlo>
-    {
-        private string m_sCollectionName;
-        private string m_sCollectionClassType;
-        public CollectionBase() { m_sCollectionName = ""; m_sCollectionClassType = ""; }
-        public List<ISlo> m_vCollection = new List<ISlo>(); //vector<ISlo*> m_vCollection;  ISlo*转??
-
-        public SortedDictionary<ISlo, bool> m_mOwner = new SortedDictionary<ISlo, bool>();   //map<ISlo*, bool> ??
-        public void setCollectionName(string value) { m_sCollectionName = value; }
-        public void setCollectionClassType(string value) { m_sCollectionClassType = value; }
-        public abstract ISlo newElement();
-        public string getCollectionName() { return m_sCollectionName; }
-        public int size() { return m_vCollection.Count(); }
-        public ISlo getItem(int itemID) { return m_vCollection[itemID]; }
-        public void Clear()
-        {
-            if (m_vCollection.Count() > 0)
-            {
-                m_vCollection.Clear();
-            }
-        }
-    }
-
-    public class Collection<T> : CollectionBase<ISlo>
-    {
-        /**
-        create new element of type T
-        @return empty object of type T
-        */
-        public override ISlo newElement() 
-        {
-            T newItem = System.Activator.CreateInstance<T>();
-            //T newItem = default(T);
-            object temp = newItem;
-            ISlo sIo = (ISlo)temp;
-
-            //Slo sIo = new Slo();
-            m_vCollection.Add(sIo);
-            //I change this value to be false forever(gsp).No matter what case there's no need to set the object's owner to the collection
-            //after we created the object we'll put them to in a smartpointer.then the smartpointer will manage it.
-            //m_mOwner[sIo] = false;//m_mOwner[newItem]=true 
-            //Type type = newItem.GetType();
-            return sIo;
-        }
-
-        public void addItem(T item)
-        {
-            object temp = item;
-            ISlo sIo = (ISlo)temp;
-            m_vCollection.Add(sIo);/* m_mOwner[item] = false;*/
-        }
-
-        public T getItem(int itemID)
-        {
-            object temp = m_vCollection[itemID];
-            T item = (T)temp;
-            return item;
-        }
-    };
-
-    public abstract class ISlo : Convertinterface
-    {
-        public abstract void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode);
-
-       
-    }
-
-
-
-    public class Slo: ISlo
-    {
-        
-
-        public string strReplaceAll(string source, string searchFor, string replaceWith)
-        {
-            if ((searchFor == null) || (searchFor == ""))
-            {
-                return source;
-            }
-            source.Replace(searchFor, replaceWith);
-            return source;
-        }
-
-        public string m_sXML;
-        public string m_sClassName;
-        public string m_sVersion;
-        public SortedDictionary<string, MemberBase> m_AttributeMappings = new SortedDictionary<string, MemberBase>();
-        public SortedDictionary<string, ISlo> m_MemberMappings=new SortedDictionary<string, ISlo>();
-        public SortedDictionary<string, CollectionBase<ISlo>> m_MemberCollections=new SortedDictionary<string, CollectionBase<ISlo>>();
-
-        public void setClassName(string ClassName) { m_sClassName = ClassName; }
-        public Slo()
-        {
-            m_sClassName = null;
-            m_sVersion = null;
-            m_sXML = null;
-            m_AttributeMappings.Clear();
-            m_MemberMappings.Clear();
-            m_MemberCollections.Clear();
-        }
-
-        /**
-         Register a member
-         @MemberName XML-Description/Name for the member
-         @Member Member to register
-         @return void
-        */
-        public void Register(string MemberName, MemberBase Member)  // public void Register(string MemberName, MemberBase Member, string DefaultValue)  DefaultValue无引用,c#无自动补充功能,故方法调整为双参数
-        {
-            m_AttributeMappings[MemberName] = Member;
-        }
-
-        /**
-        Register a member-subclass
-        @MemberName XML-Description/Name for the member-class
-        @Member Member-class to register
-        @return void
-        */
-        public void Register(string MemberName, ISlo Member)
-        {
-            m_MemberMappings[MemberName] = Member;
-        }
-
-        /**
-         Register a class-collection
-         @CollectionName XML-Description/Name for the collection
-         @SubclassCollection Collection to register
-         @return void
-        */
-        public void Register(string CollectionName, CollectionBase<ISlo> SubclassCollection)
-        {
-            SubclassCollection.setCollectionName(CollectionName);
-            m_MemberCollections[CollectionName] = SubclassCollection;
-        }
-
-
-        public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
-        {
-            if (isStoring)
-            {
-                if (xml.DocumentElement != null)
-                {
-                    toXML(xml, rootNode);
-                }
-            }
-            else
-            {
-                fromXML(xml, rootNode);
-            }
-        }
-        public void toXML(XmlDocument xml, XmlNode rootNode)
-        {
-
-            for (int it_member = 0; it_member < m_AttributeMappings.Count; it_member++)
-            {
-                var element = m_AttributeMappings.ElementAt(it_member);
-
-                if (rootNode.Attributes[element.Key] == null)
-                {
-                    XmlElement XmlEle = (XmlElement)rootNode;
-                    XmlEle.SetAttribute(element.Key, element.Value.toString());
-                }
-                else
-                {
-                    rootNode.Attributes[element.Key].InnerText = element.Value.toString();
-                }
-            }
-
-
-            for (int it_subclass = 0; it_subclass < m_MemberMappings.Count; it_subclass++)
-            {
-                var element = m_MemberMappings.ElementAt(it_subclass);
-                ISlo subMember = element.Value;
-                XmlNode subClassNode = xml.CreateElement("Member");
-                rootNode.AppendChild(subClassNode);
-
-  
-                XmlElement XmlEle_subclass = (XmlElement)subClassNode;
-                XmlEle_subclass.SetAttribute("RegName", element.Key);
-                subMember.Serialize(true, xml, subClassNode);
-            }
-
-
-  
-
-            for (int it_collection = 0; it_collection < m_MemberCollections.Count; it_collection++)
-            {
-                var element = m_MemberCollections.ElementAt(it_collection);
-                XmlNode listNode = xml.CreateElement("Collection");
-                XmlElement XmlEle = (XmlElement)listNode;
-                XmlEle.SetAttribute("RegName", element.Value.getCollectionName());
-                for (int c = 0; c < element.Value.size(); c++)
-                {
-                    ISlo item = element.Value.getItem(c);
-                    XmlNode elementNode = xml.CreateElement("Member");
-                    item.Serialize(true, xml, elementNode);
-                    listNode.AppendChild(elementNode);
-                }
-
-                rootNode.AppendChild(listNode);
-            }
-        }
-
-        public void fromXML(XmlDocument xml, XmlNode rootNode)
-        {
-
-
-            for (int count = 0; count < m_AttributeMappings.Count; count++)
-            {
-                var element = m_AttributeMappings.ElementAt(count);
-                if (rootNode.Attributes[element.Key] != null)
-                {
-                    //string aa = rootNode.Attributes[element.Key].Value;
-                    element.Value.getStringPtr(rootNode.Attributes[element.Key].Value);
-                }
-                else
-                {
-                   element.Value.getStringPtr("");
-                    NLog.LogManager.GetCurrentClassLogger().Error("cann't find " + element.Key + " in config file!");
-
-                }
-            }
-
-
-
-            XmlNodeList classNodeList = rootNode.SelectNodes("Member");
-            if (classNodeList.Count != 0)
-            {
-                for (int i = 0; i < classNodeList.Count; i++)
-                {
-                    string className = classNodeList[i].Attributes["RegName"].Value;
-                    for (int count = 0; count < m_MemberMappings.Count; count++)
-                    {
-                        var element = m_MemberMappings.ElementAt(count);
-                        if (element.Key == className)
-                        {
-                            element.Value.Serialize(false, xml, classNodeList[i]);
-                            break;
-                        }
-                    }
-                }
-            }
-
- 
-
-            XmlNodeList collectionNodeList = rootNode.SelectNodes("Collection");
-            if (collectionNodeList.Count != 0)
-            {
-                for (int i = 0; i < collectionNodeList.Count; i++)
-                {
-                    string collectionName = collectionNodeList[i].Attributes["RegName"].Value;
-
-                    for (int count = 0; count < m_MemberCollections.Count; count++)
-                    {
-                        var element = m_MemberCollections.ElementAt(count);
-                        if (element.Value.getCollectionName() == collectionName)
-                        {
-                            element.Value.Clear();
-                            XmlNodeList classNode2List = collectionNodeList[i].SelectNodes("Member");
-                            if (classNode2List.Count != 0)
-                            {
-                                for (int j = 0; j < classNode2List.Count; j++)
-                                {
-                                    Convertinterface newItem = (Convertinterface)element.Value.newElement();
-                                    newItem.Serialize(false, xml, classNode2List[j]);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        public string IdentifyClass(XmlNode rootNode, string XMLSource)
-        {
-            return rootNode.Attributes["RegName"].Value;
-        }
-
-        public string IdentifyClassVersions(XmlNode rootNode, string XMLSource)  //同 IdentifyClass ???
-        {
-            return rootNode.Attributes["RegName"].Value;
-        }
-
-
-        public string getClassName() { return m_sClassName; }
-        public void setVersion(string value) { m_sVersion = value; }
-        public string getVersion() { return m_sVersion; }
-
-        public void Clear()
-        {
-            m_AttributeMappings.Clear();
-            m_MemberMappings.Clear();
-            m_MemberCollections.Clear();
-        }
-
-        internal void Register(string v, bool m_obShowAreaUp)
-        {
-            throw new NotImplementedException();
-        }
-    }
-}

+ 1 - 1
OTSIncAMeasureApp/1-OTSMeasure/Measure/1-OTSInclution/SmplMeasureInclution.cs

@@ -34,7 +34,7 @@ namespace OTSModelSharp
             {
 
                 var anylysisparts = curFldData.GetListAnalysisParticles();
-                var finalParts=new List<COTSParticleClr>();
+                var finalParts = new List<COTSParticleClr>();
                 int nSize = anylysisparts.Count();
 
                 // go through all analysis particles

+ 0 - 1
OTSIncAMeasureApp/OTSIncAMeasureApp.csproj

@@ -387,7 +387,6 @@
     <Compile Include="0-OTSModel\OTSDataType\otsdataconst.cs" />
     <Compile Include="0-OTSModel\OTSDataType\SEMStageData.cs" />
     <Compile Include="0-OTSModel\OTSDataType\XmlResourceData.cs" />
-    <Compile Include="0-OTSModel\OTSDataType\XMLSerialization.cs" />
     <Compile Include="3-OTSDisplaySourceGridData\CPropItem.cs" />
     <Compile Include="3-OTSDisplaySourceGridData\CPropItemGrp.cs" />
     <Compile Include="3-OTSDisplaySourceGridData\MeasureStopMode.cs">

+ 1 - 1
OTSIncAMeasureApp/OTSIncAMeasureAppForm.cs

@@ -1160,7 +1160,7 @@ namespace OTSMeasureApp
             }
            
             m_SamplepaceWindow.PrepareVisualMeasureField(m_SamplepaceWindow.GetWorkingVisualSample());
-           
+            m_SamplepaceWindow.InitSampleMeasure(m_ProjParam.GetWorkSample(), 0);
         }
 
         private void rbSaveFile_Click(object sender, EventArgs e)

+ 1 - 3
OTSPartA_STDEditor/BaseClass/STDInfo.cs

@@ -32,8 +32,8 @@ namespace OTSPartA_STDEditor.BaseClass
             if (!aa)
             {
                 STDDictionary=null;
-                STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
             }
+            STDDictionaryInitial = Clone(STDDictionary) as Dictionary<int, STDdata>;
             aa = LoadGroupDataFromDb();
             if (!aa)
             {
@@ -48,7 +48,6 @@ namespace OTSPartA_STDEditor.BaseClass
         {
             try
             {
-                STDDictionaryInitial.Clear();
                 STDDictionary.Clear();
                 System.Data.SQLite.SQLiteConnection m_dbConnection = new System.Data.SQLite.SQLiteConnection("data source='" + _DBAddress + "'");
                 m_dbConnection.Open();
@@ -101,7 +100,6 @@ namespace OTSPartA_STDEditor.BaseClass
                                 }
                             }
                             STDDictionary.Add(int.Parse(item["STDId"].ToString()), new_STDdata);
-                            STDDictionaryInitial.Add(int.Parse(item["STDId"].ToString()), new_STDdata);
                         }
                     }
                 }

+ 0 - 1
OTSPartA_STDEditor/BaseClass/STDdata.cs

@@ -153,7 +153,6 @@ namespace OTSPartA_STDEditor
               (UsingOtherPropertyList == a_oSource.UsingOtherPropertyList) &&
               (Expression == a_oSource.Expression) &&
               (GroupId == a_oSource.GroupId) &&
-              (ListNum == a_oSource.ListNum) &&
               (IfElementAnalysis == a_oSource.IfElementAnalysis);
         }
 

+ 4 - 19
OTSPartA_STDEditor/UI/Attributes.cs

@@ -1,12 +1,7 @@
 using OTS.WinFormsUI.Docking;
 using System;
 using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
 using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Windows.Forms;
 
 namespace OTSPartA_STDEditor
@@ -73,20 +68,6 @@ namespace OTSPartA_STDEditor
             
             m_MainForm.ChangeSTDRuleName(Convert.ToString( Grid_Attributes[context.Position.Row, context.Position.Column].Value));
         }
-
-
-
-
-
-
-
-
-
-
-
-
-        
-        
         private class MyHeader : SourceGrid.Cells.ColumnHeader
         {
             public MyHeader(object value) : base(value)
@@ -102,6 +83,10 @@ namespace OTSPartA_STDEditor
             }
         }
 
+
+
+
+
         public Attributes(Form_Main mainForm)
         {
             InitializeComponent();

+ 99 - 115
OTSPartA_STDEditor/UI/Form_Main.cs

@@ -25,7 +25,6 @@ namespace OTSPartA_STDEditor
         public Language lan;
         Hashtable table;
         //是否做出过更改
-        public bool IsModified { set; get; }
         public static readonly string[] ColorGroup = { "#FFB6C1", "#FFC0CB", "#DC143C", "#FFF0F5", "#DB7093", "#FF69B4", "#FF1493", "#C71585", "#DA70D6", "#D8BFD8", "#DDA0DD", "#EE82EE", "#FF00FF", "#8B008B", "#800080", "#BA55D3", "#9400D3", "#9932CC", "#4B0082", "#8A2BE2", "#9370DB","#7B68EE", "#6A5ACD", "#483D8B", "#E6E6FA", "#F8F8FF", "#0000FF", "#0000CD", "#191970", "#00008B", "#000080", "#4169E1" , "#6495ED", "#B0C4DE", "#778899", "#708090", "#1E90FF", "#F0F8FF", "#00FFFF" };
         public Form_Main()
         {
@@ -54,18 +53,6 @@ namespace OTSPartA_STDEditor
             {
                 InitForms(STDDBAddress);
                 this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
-                IsModified = false;
-
-                //if (ImportArgs.Count > 1)
-                //{
-                //    ImportStandardLibraryTypeSelection m_importStandardLibraryTypeSelection = new ImportStandardLibraryTypeSelection();
-                //    var result = m_importStandardLibraryTypeSelection.ShowDialog();
-                //    if (m_importStandardLibraryTypeSelection.SelectEvent == "expression")
-                //    {
-                //        int STDId = _sTDEditor.AddSTDDictionaryItem();
-                //        m_STDRuleslist.AddNewRow(STDId, "NewClassify", Attributes.colorHx16toRGB(ddata.Color));
-                //    }
-                //}
             }
         }
 
@@ -74,18 +61,6 @@ namespace OTSPartA_STDEditor
             m_SubMidWindow.ChangeText_textbox_STDEditor(ddata);
             m_Attributes.SetDatatoGrid_Attributes(ddata);
         }
-
-
-
-
-
-
-
-
-
-
-
-        
         private void rbBackup_Click(object sender, EventArgs e)
         {
             if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
@@ -106,6 +81,13 @@ namespace OTSPartA_STDEditor
                 saveFile.OverwritePrompt = false;  //是否覆盖当前文件
                 if (saveFile.ShowDialog() == DialogResult.OK)
                 {
+                    
+                    
+                    
+                    
+                    
+                    
+                    
                     if (STDDBAddress == saveFile.FileName)
                     {
                         MessageBox.Show("Cannot save as same name!", "Tip");
@@ -114,16 +96,23 @@ namespace OTSPartA_STDEditor
                     FormForWaiting forWaiting = new FormForWaiting();
                     forWaiting.Show();
                     this.Refresh();
-                    System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
-                    bool result = _sTDEditor.SaveAsDictionaryToClassify(saveFile.FileName);
-                    if (result)
+                    if (Ruleformatcheck())
                     {
-                        _sTDEditor.UpdateSTDDictionaryInitial();
-                        STDDBAddress = saveFile.FileName;
-                        this.Text = this.Text.Split(' ')[0] + "   " + saveFile.FileName;
-                        IsModified = false;
-                        forWaiting.Close();
-                        MessageBox.Show("Save successful!", "Tip");
+                        System.IO.File.Copy(STDDBAddress, saveFile.FileName, true);
+                        bool result = _sTDEditor.SaveAsDictionaryToClassify(saveFile.FileName);
+                        if (result)
+                        {
+                            _sTDEditor.UpdateSTDDictionaryInitial();
+                            STDDBAddress = saveFile.FileName;
+                            this.Text = this.Text.Split(' ')[0] + "   " + saveFile.FileName;
+                            forWaiting.Close();
+                            MessageBox.Show("Save successful!", "Tip");
+                        }
+                        else
+                        {
+                            forWaiting.Close();
+                            MessageBox.Show("Save failed!", "Tip");
+                        }
                     }
                     else
                     {
@@ -142,10 +131,6 @@ namespace OTSPartA_STDEditor
             }
         }
 
-
-
-
-
         private void rbSave_Click(object sender, EventArgs e)
         {
             if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
@@ -157,30 +142,7 @@ namespace OTSPartA_STDEditor
                 }
             }
             m_STDRuleslist.ConvertToRuleViewDic();
-            if (Ruleformatcheck())
-            {
-                FormForWaiting forWaiting = new FormForWaiting();
-                forWaiting.Show();
-
-                this.Refresh();
-                bool result = _sTDEditor.SaveDictionaryToClassify();
-                if (result)
-                {
-                    _sTDEditor.UpdateSTDDictionaryInitial();
-                    forWaiting.Close();
-                    IsModified = false;
-                    MessageBox.Show("Save successful!", "Tip");
-                }
-                else
-                {
-                    forWaiting.Close();
-                    MessageBox.Show("Save failed!", "Tip");
-                }
-            }
-            else
-            {
-                return;
-            }
+            Save();
         }
         bool Ruleformatcheck()
         {
@@ -210,6 +172,48 @@ namespace OTSPartA_STDEditor
             return true;
         }
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+        public bool Save()
+        {
+            if (Ruleformatcheck())
+            {
+                FormForWaiting forWaiting = new FormForWaiting();
+                forWaiting.Show();
+                this.Refresh();
+                bool result = _sTDEditor.SaveDictionaryToClassify();
+                if (result)
+                {
+                    _sTDEditor.UpdateSTDDictionaryInitial();
+                    MessageBox.Show("Save successful!", "Tip");
+                }
+                else
+                {
+                    MessageBox.Show("Save failed!", "Tip");
+                }
+                forWaiting.Close();
+                return result;
+            }
+            else
+            {
+                return false;
+            }
+        }
         /// <summary>
         /// [颜色:RGB转成16进制]
         /// </summary>
@@ -469,6 +473,7 @@ namespace OTSPartA_STDEditor
                         ddata.SubElementList = sSubElements;
 
                         //ddata.ListNum = "0";   
+                        break;
                     }
                 }
             }
@@ -610,48 +615,30 @@ namespace OTSPartA_STDEditor
         }
         private void rbClose_Click(object sender, EventArgs e)
         {
+            bool expressionright = true;
             if (!_sTDEditor.Isoldversion)
             {
-                if (!EqualsBetweenDictionary() || IsModified)
+                if (!EqualsBetweenDictionary())
                 {
                     DialogResult dr = MessageBox.Show("Whether to save the current modification?", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                     if (dr == DialogResult.Yes)
                     {
-                        if (m_STDRuleslist.Predata != null)
-                        {
-                            int id = m_STDRuleslist.Predata.STDId;
-                            SaveDataOfSelRule(id);
-                        }
-                    }
-                    else
-                    {
-                        return;
-                    }
-                    FormForWaiting forWaiting = new FormForWaiting();
-                    forWaiting.Show();
-
-
-                    bool result = _sTDEditor.SaveDictionaryToClassify();
-                    if (result)
-                    {
-                        forWaiting.Close();
-                    }
-                    else
-                    {
-                        forWaiting.Close();
-                        MessageBox.Show("Save failed!", "Tip");
+                        expressionright = Save();
                     }
                 }
             }
-            m_Attributes.Close();
-            m_STDRuleslist.Close();
-            m_SubMidWindow.m_STDEditor.Close();
-            m_SubMidWindow.m_ComparativeLibrary.Close();
-            m_SubMidWindow.Close();
-            ButtonStatusClose();
-            if (this.Text.Split(' ').Count() != 0)
+            if (expressionright)
             {
-                this.Text = this.Text.Split(' ')[0];
+                m_Attributes.Close();
+                m_STDRuleslist.Close();
+                m_SubMidWindow.m_STDEditor.Close();
+                m_SubMidWindow.m_ComparativeLibrary.Close();
+                m_SubMidWindow.Close();
+                ButtonStatusClose();
+                if (this.Text.Split(' ').Count() != 0)
+                {
+                    this.Text = this.Text.Split(' ')[0];
+                }
             }
         }
 
@@ -669,7 +656,6 @@ namespace OTSPartA_STDEditor
                     STDDBAddress = openFileDialog.FileName;
                     InitForms(STDDBAddress);
                     this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
-                    IsModified = false;
                     CheckAccuracyofZeroRules();
                 }
                 catch(Exception ex)
@@ -744,37 +730,34 @@ namespace OTSPartA_STDEditor
             }
             if (m_STDRuleslist.Text != "")
             {
-                if (!EqualsBetweenDictionary() || IsModified)
+                bool expressionright = true;
+                if (!EqualsBetweenDictionary())
                 {
                     DialogResult dr = MessageBox.Show("Whether to save the current modification", "Tip", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                     if (dr == DialogResult.Yes)
                     {
-                        if (m_STDRuleslist.Predata!=null)
-                        {
-                            int id = m_STDRuleslist.Predata.STDId;
-                            SaveDataOfSelRule(id);
-                        }
-                        FormForWaiting forWaiting = new FormForWaiting();
-                        forWaiting.Show();
-                        bool result = _sTDEditor.SaveDictionaryToClassify();
-                        if (result)
-                        {
-                            forWaiting.Close();
-                        }
-                        else
-                        {
-                            forWaiting.Close();
-                            MessageBox.Show("Save failed!", "Tip");
-                        }
+                        expressionright = Save();
+                       
+                        
+                        if (!expressionright)
+                        { e.Cancel = true; return; }
                     }
                 }
             }
         }
         bool EqualsBetweenDictionary()
         {
+            if (m_STDRuleslist.treeView_G.SelectedNode != null && m_STDRuleslist.treeView_G.SelectedNode.Level == 1)
+            {
+                STDdata sTDdata = (STDdata)m_STDRuleslist.treeView_G.SelectedNode.Tag;
+                if (sTDdata != null)
+                {
+                    SaveDataOfSelRule(sTDdata.STDId);
+                }
+            }
+            m_STDRuleslist.ConvertToRuleViewDic();
             return _sTDEditor.EqualsBetweenDictionary();
         }
-
         private void rbNew_Click(object sender, EventArgs e)
         {
             SaveFileDialog saveFile = new SaveFileDialog();
@@ -814,7 +797,6 @@ namespace OTSPartA_STDEditor
                 STDDBAddress = saveFile.FileName;
                 InitForms(STDDBAddress);
                 this.Text = this.Text.Split(' ')[0] + "   " + STDDBAddress;
-                IsModified = false;
             }
             else
             {
@@ -840,6 +822,8 @@ namespace OTSPartA_STDEditor
                     
                     cmm.CommandText = "CREATE TABLE sqlitestudio_temp_table AS SELECT * FROM ZeroElementRules";
                     cmm.ExecuteNonQuery();
+
+
                     cmm.CommandText = "DROP TABLE ZeroElementRules";
                     cmm.ExecuteNonQuery();
                     cmm.CommandText = "CREATE TABLE ZeroElementRules (ZeroElement TEXT,UsingElementList TEXT,UsingImgPropertyList TEXT,UsingOtherPropertyList TEXT,Expression TEXT)";

+ 5 - 16
OTSPartA_STDEditor/UI/STDRuleslist.cs

@@ -160,23 +160,7 @@ namespace OTSPartA_STDEditor
                 m_MainForm._sTDEditor.GroupIdDictionaryFromName.Add(tDGroups.name.ToString(), int.Parse(tDGroups.id.ToString()));
                 m_MainForm._sTDEditor.GroupIdDictionaryFromId.Add(int.Parse(tDGroups.id.ToString()), tDGroups.name.ToString());
             }
-            if (treeView_G.SelectedNode == null){return;}
-            if (treeView_G.SelectedNode.Level == 1)
-            {
-                m_MainForm.SaveDataOfSelRule(((STDdata)treeView_G.SelectedNode.Tag).STDId);
-            }
         }
-
-
-
-
-
-
-
-
-
-
-
         private void ToolStripMenuItem_NewGroup_Click(object sender, EventArgs e)
         {
             STDGroups group = new STDGroups();
@@ -198,6 +182,11 @@ namespace OTSPartA_STDEditor
             m_MainForm._sTDEditor.GroupIdDictionaryFromId.Add(id, group.name);
             m_MainForm._sTDEditor.GroupIdDictionaryFromName.Add(group.name, group.id);
             InitGroupView();
+
+
+
+
+
             foreach (TreeNode treeNode in treeView_G.Nodes)
             {
                 if (((STDGroups)treeNode.Tag).id == id)