public void CloseFile() { if (_fileReader != null) { _fileReader.Close(); _fileReader.Dispose(); _fileReader = null; _dbtFile = null; } }
internal DbTFileConfig DoInitReadFile() { if (_fileReader.EndOfStream) { return(null); } bool bdbtFile = false; while (!_fileReader.EndOfStream) { string str = ReadLine(); if (string.IsNullOrWhiteSpace(str)) { continue; } if (bdbtFile) { if (CheckTagStart(DbtFileTags.DbType, str)) { str = DoInReadTagContentNoStart(DbtFileTags.DbType); if (string.IsNullOrWhiteSpace(str)) { return(null); } if (_dbtFile == null) { _dbtFile = new DbTFileConfig(); } _dbtFile.DbType = Newtonsoft.Json.JsonConvert.DeserializeObject <MyDbType>(str); str = DoInReadTagContent(DbtFileTags.Version); _dbtFile.Version = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(str); } else if (CheckTagStart(DbtFileTags.Version, str)) { str = DoInReadTagContentNoStart(DbtFileTags.Version); if (_dbtFile == null) { _dbtFile = new DbTFileConfig(); } _dbtFile.Version = Newtonsoft.Json.JsonConvert.DeserializeObject <string>(str); str = DoInReadTagContent(DbtFileTags.DbType); _dbtFile.DbType = Newtonsoft.Json.JsonConvert.DeserializeObject <MyDbType>(str); } break; } else { bdbtFile = CheckTagStart(DbtFileTags.DbTFile, str); } } return(_dbtFile); }