Example #1
0
        public static ProjectMRU Get()
        {
            ProjectMRU retVal = null;

            if (!String.IsNullOrEmpty(Properties.Settings.Default.ProjectMRU))
            {
                using (MemoryStream ms = new MemoryStream(Convert.FromBase64String(Properties.Settings.Default.ProjectMRU)))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    retVal = (ProjectMRU)bf.Deserialize(ms);
                }
            }

            return(retVal);
        }
Example #2
0
 public static void Save(ProjectMRU mru)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         using (StreamReader sr = new StreamReader(ms))
         {
             BinaryFormatter bf = new BinaryFormatter();
             bf.Serialize(ms, mru);
             ms.Position = 0;
             byte[] buffer = new byte[(int)ms.Length];
             ms.Read(buffer, 0, buffer.Length);
             Properties.Settings.Default.ProjectMRU = Convert.ToBase64String(buffer);
             Properties.Settings.Default.Save();
         }
     }
 }