Exemple #1
0
        public void WriteSesionInfo(SessionInfo session)
        {
            try
            {
                string dir = Path.Combine(CachePath, session.SessionId);
                string rds = Path.Combine(dir, "0.rds");
                Debug.Assert(!Directory.Exists(dir));
                Debug.Assert(!File.Exists(rds));

                Directory.CreateDirectory(dir);
                SerializeEngine.Serialize(session, rds);
            }
            catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
        }
Exemple #2
0
 public SessionInfo LoadSessionInfo(string sessionId)
 {
     try
     {
         string dir = Path.Combine(CachePath, sessionId);
         string rds = Path.Combine(dir, "0.rds");
         if (File.Exists(rds))
         {
             return(SerializeEngine.Deserialize(rds) as SessionInfo);
         }
         else
         {
             return(null);
         }
     }
     catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
 }
Exemple #3
0
        public void WriteSnapshot(SessionInfo session, Snapshot sshot)
        {
            try
            {
                string dir = Path.Combine(CachePath, session.SessionId);
                string rds = Path.Combine(dir, "0.rds");
                string rdi = Path.Combine(dir, sshot.SnapshotId + ".rdi");
                Debug.Assert(Directory.Exists(dir));
                Debug.Assert(File.Exists(rds));
                Debug.Assert(!File.Exists(rdi));

                if (!Directory.Exists(dir) || !File.Exists(rds))
                {
                    Directory.CreateDirectory(dir);
                    SerializeEngine.Serialize(session, rds);
                }
                SerializeEngine.Serialize(sshot, rdi);
            }
            catch (Exception ex) { TraceLogger.Instance.WriteException(ex); throw; }
        }