Exemple #1
0
        /// <summary>Load sessions database from file into the application</summary>
        public static void LoadSessions()
        {
            string fileName = SessionsFileName;

            Log.InfoFormat("Loading all sessions.  file={0}", fileName);

            try
            {
                if (File.Exists(fileName))
                {
                    List <SessionData> sessions = SessionData.LoadSessionsFromFile(fileName);
                    // remove old
                    sessionsMap.Clear();
                    sessionsList.Clear();

                    foreach (SessionData session in sessions)
                    {
                        AddSession(session);
                    }
                }
                else
                {
                    Log.WarnFormat("Sessions file does not exist, nothing loaded.  file={0}", fileName);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Error while loading sessions from " + fileName, ex);
            }
        }
Exemple #2
0
 /// <summary>Import sessions from the specified file into the in-application database</summary>
 /// <param name="fileName">A string containing the path of the filename that holds session configuration</param>
 public static void ImportSessionsFromFile(string fileName)
 {
     if (fileName == null)
     {
         return;
     }
     if (File.Exists(fileName))
     {
         Log.InfoFormat("Importing sessions from file, path={0}", fileName);
         List <SessionData> sessions = SessionData.LoadSessionsFromFile(fileName);
         ImportSessions(sessions, "Imported");
     }
 }