Example #1
0
        internal void DoReadNodes <IDbObject>(DbtFileTags top, DbtFileTags second, List <IDbObject> list)
            where IDbObject : class
        {
            Type dbobjtype = MyDbHelper.GetDbObjectType(typeof(IDbObject), _dbDefine.DbType);

            if (dbobjtype != null)
            {
                DoReadObjects <IDbObject>(dbobjtype, top, second, list);
            }
        }
Example #2
0
        internal void DoReadObjects <IDbObject>(Type dbobjType, DbtFileTags top, DbtFileTags second, List <IDbObject> list)
            where IDbObject : class
        {
            List <string> strs = DoReadTags(top, second);

            foreach (string item in strs)
            {
                object    obj = Newtonsoft.Json.JsonConvert.DeserializeObject(item, dbobjType);
                IDbObject dbo = obj as IDbObject;
                if (obj != null)
                {
                    list.Add(dbo);
                }
            }
        }
Example #3
0
 internal string DoInReadTagContent(DbtFileTags tag)
 {
     while (!_fileReader.EndOfStream)
     {
         string str = ReadLine();
         if (string.IsNullOrWhiteSpace(str))
         {
             continue;
         }
         if (CheckTagStart(tag, str))
         {
             str = DoInReadTagContentNoStart(tag);
             return(str);
         }
     }
     return("");
 }
Example #4
0
        internal List <string> DoReadTags(DbtFileTags top, DbtFileTags second)
        {
            List <string> strs = new List <string>();

            while (!_fileReader.EndOfStream)
            {
                string str = ReadLine();
                if (CheckTagStart(second, str))
                {
                    str = DoInReadTagContentNoStart(second);
                    if (!string.IsNullOrWhiteSpace(str))
                    {
                        strs.Add(str);
                    }
                }
                else if (CheckTagEnd(top, str))
                {
                    break;
                }
            }
            return(strs);
        }
Example #5
0
        internal string DoInReadTagContentNoStart(DbtFileTags tag)
        {
            string temp = "";

            while (!_fileReader.EndOfStream)
            {
                string str = ReadLine();
                if (CheckTagEnd(tag, str))
                {
                    break;
                }
                else
                {
                    if (temp != "")
                    {
                        temp += "\r\n";
                    }
                    temp += str;
                }
            }
            return(temp);
        }
Example #6
0
 public string GetTagStart(DbtFileTags tag)
 {
     return string.Format(TagStartFormat, Enum.GetName(typeof(DbtFileTags), tag));
 }
Example #7
0
 public bool CheckTagStart(DbtFileTags tag, string checkStr)
 {
     string tagStr = string.Format(TagStartFormat, Enum.GetName(typeof(DbtFileTags), tag));
     return checkStr.Trim() == tagStr;
 }
Example #8
0
        public bool CheckTagEnd(DbtFileTags tag, string checkStr)
        {
            string tagStr = string.Format(TagEndFormat, Enum.GetName(typeof(DbtFileTags), tag));

            return(checkStr.Trim() == tagStr);
        }
Example #9
0
 public string GetTagEnd(DbtFileTags tag)
 {
     return(string.Format(TagEndFormat, Enum.GetName(typeof(DbtFileTags), tag)));
 }
Example #10
0
 public void EndWrite(DbtFileTags tagsState)
 {
     WriteTagEnd(tagsState);
 }
Example #11
0
 public void BeginWrite(DbtFileTags tagsState)
 {
     BeforeWriteCheck();
     WriteTagStart(tagsState);
 }
Example #12
0
        internal void WriteTagEnd(DbtFileTags tag)
        {
            string str = GetTagEnd(tag);

            _fileWriter.WriteLine(str);
        }