Beispiel #1
0
 /// <summary>
 /// Serialize a secret.
 /// </summary>
 /// <param name="s">Secret ti serialize.</param>
 /// <returns>Base64 string of current serialized secret.</returns>
 public static string Serialize(Secret s)
 {
     MemoryStream m = new MemoryStream();
     formatter.Serialize(m, s);
     return Convert.ToBase64String(m.ToArray());
 }
Beispiel #2
0
        /// <summary>
        /// Saves the list of codes to disk.
        /// </summary>
        internal void SaveList()
        {
            SaveFile sf = new SaveFile();
            sf.Height = this.Parent.Height;
            sf.Width = this.Parent.Width;
            foreach (Control ctrl in fpl_list.Controls)
            {
                if (ctrl is CodeDetail)
                {
                    CodeDetail c = (CodeDetail)ctrl;
                    Secret s = new Secret(c.DisplayName, c.Code);
                    sf.SecretsList.Add(s);
                }
            }

            SaveFile.Serialize(sf, Params.SAVE_FILE);
        }