public void LoadGroupLocalRead() { try { string _json = string.Empty; string _filePath = Main.GCONST.CachePath + Login.user.user_id + "_LR.dat"; StreamReader _sr = File.OpenText(_filePath); _json = _sr.ReadToEnd(); _sr.Close(); if (!GCONST.DEBUG) { _json = StringUtility.Decompress(_json); } LocalReadRT _lr = JsonConvert.DeserializeObject <LocalReadRT>(_json); m_groupLocalLastReadID = _lr.GroupLocalLastReadID; m_groupHaveReadPosts = _lr.GroupHaveReadPosts; s_logger.Trace("LoadGroupLocalRead:OK"); } catch (Exception _e) { NLogUtility.Exception(s_logger, _e, "LoadGroupLocalRead"); } }
public bool SaveGroupLocalRead() { LocalReadRT _lr = new LocalReadRT(); _lr.GroupLocalLastReadID = m_groupLocalLastReadID; _lr.GroupHaveReadPosts = m_groupHaveReadPosts; try { string _json = JsonConvert.SerializeObject(_lr); if (!GCONST.DEBUG) { _json = StringUtility.Compress(_json); } string _filePath = Main.GCONST.CachePath + Login.user.user_id + "_LR.dat"; using (StreamWriter _outfile = new StreamWriter(_filePath)) { _outfile.Write(_json); } } catch (Exception _e) { NLogUtility.Exception(s_logger, _e, "SaveGroupLocalRead"); return(false); } s_logger.Trace("SaveGroupLocalRead: OK"); return(true); }