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); } }
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); } } }
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(""); }
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); }
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); }
public string GetTagStart(DbtFileTags tag) { return string.Format(TagStartFormat, Enum.GetName(typeof(DbtFileTags), tag)); }
public bool CheckTagStart(DbtFileTags tag, string checkStr) { string tagStr = string.Format(TagStartFormat, Enum.GetName(typeof(DbtFileTags), tag)); return checkStr.Trim() == tagStr; }
public bool CheckTagEnd(DbtFileTags tag, string checkStr) { string tagStr = string.Format(TagEndFormat, Enum.GetName(typeof(DbtFileTags), tag)); return(checkStr.Trim() == tagStr); }
public string GetTagEnd(DbtFileTags tag) { return(string.Format(TagEndFormat, Enum.GetName(typeof(DbtFileTags), tag))); }
public void EndWrite(DbtFileTags tagsState) { WriteTagEnd(tagsState); }
public void BeginWrite(DbtFileTags tagsState) { BeforeWriteCheck(); WriteTagStart(tagsState); }
internal void WriteTagEnd(DbtFileTags tag) { string str = GetTagEnd(tag); _fileWriter.WriteLine(str); }