SuperPutty.Data.SessionData.SaveSessionsToFile C# (CSharp) Method

SaveSessionsToFile() public static method

Save session configuration to the specified XML file
public static SaveSessionsToFile ( List sessions, string fileName ) : void
sessions List A containing the session configuration data
fileName string A path to a filename to save the data in
return void
        public static void SaveSessionsToFile(List<SessionData> sessions, string fileName)
        {
            Log.InfoFormat("Saving {0} sessions to {1}", sessions.Count, fileName);

            BackUpFiles(fileName, 20);

            // sort and save file
            sessions.Sort();
            XmlSerializer s = new XmlSerializer(sessions.GetType());
            using (TextWriter w = new StreamWriter(fileName))
            {
                s.Serialize(w, sessions);
            }
        }