Example #1
0
        public static void SaveDB(string path, string key, Model.DataBase db)
        {
            try
            {
                db.Attribute.LastWrite    = DateTime.Now;
                db.Attribute.User         = Environment.UserName;
                db.Attribute.Computer     = Environment.MachineName;
                db.Attribute.LastSavePath = path;

                Crc32 crc = new Crc32();
                db.Attribute.Crc32 = BitConverter.ToString(crc.ComputeHash(ObjectToByteArray(db))).Replace("-", string.Empty).ToUpper();

                CryptoSerializer.GenericCryptoClass cc = new CryptoSerializer.GenericCryptoClass();
                cc.CryptoSerialize <Model.DataBase>(path, db, key);

                GenSerialize.XmlSerialisierung <Model.DataBase> .Serialisieren(db, path + "_");

                KeyPortNet.Properties.Settings.Default.DBPfad = path;
                KeyPortNet.Properties.Settings.Default.Save();
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Example #2
0
 public static Model.DataBase LoadDB(string path, string key)
 {
     CryptoSerializer.GenericCryptoClass cc = new CryptoSerializer.GenericCryptoClass();
     return(cc.CryptoDeSerialize <Model.DataBase>(path, key));
 }