示例#1
0
        public QcDictXMLHelper GetDictXML(string path)
        {
            QcDictXMLHelper result;

            try
            {
                string          xml     = System.IO.File.ReadAllText(path);
                QcDictXMLHelper dictXML = Deserialize <QcDictXMLHelper>(xml);
                result = dictXML;
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.InnerException.Message, ex);
            }
            return(result);
        }
示例#2
0
        public bool SaveDataFormatDict(QcDictXMLHelper dictXml)
        {
            bool result;

            try
            {
                string contents = Serializer(typeof(QcDictXMLHelper), dictXml);
                System.IO.File.WriteAllText(this.XmlPath, contents);
                result = true;
            }
            catch (System.Exception ex)
            {
                throw new System.Exception(ex.InnerException.Message, ex);
            }
            return(result);
        }
示例#3
0
 public System.Collections.Generic.List <QcDictXMLHelper.QcDictGroup> GetGroupByName(string groupname)
 {
     System.Collections.Generic.List <QcDictXMLHelper.QcDictGroup> result;
     try
     {
         QcDictXMLHelper dictXML = this.GetDictXML(this.XmlPath);
         if (dictXML != null && dictXML.Model != null)
         {
             result = (from x in dictXML.Model
                       where x.GroupName == groupname
                       select x.Group).FirstOrDefault <System.Collections.Generic.List <QcDictXMLHelper.QcDictGroup> >();
         }
         else
         {
             result = null;
         }
     }
     catch (System.Exception ex)
     {
         throw new System.Exception(ex.InnerException.Message, ex);
     }
     return(result);
 }