public void Porto(string nom) { if (File.Exists(".\\Archivum\\Arma\\" + nom + ".aes")) { BinaryFormatter bi = new BinaryFormatter(); FileStream file = File.Open(".\\Archivum\\Arma\\" + nom + ".aes", FileMode.Open); HerctumA data = (HerctumA)bi.Deserialize(file); file.Close(); this.Peritia = data.Peritia; this.Acutus = data.Acutus; this.Acutulus = data.Acutulus; this.Obtusus = data.Obtusus; this.DamnumT = data.DamnumT; this.Spatium = data.Spatium; this.Toleratio = data.Toleratio; this.Deficio = data.Deficio; this.Nomen = data.Nomen; this.Typus = data.Typus; this.Pondus = data.Pondus; this.Pretium = data.Pretium; this.Materia = Materia.Tributare(data.Mat); } }
public void Salvare() { if (Directory.Exists(".\\Archivum\\Arma\\")) { } else { Directory.CreateDirectory(".\\Archivum\\Arma\\"); } BinaryFormatter bi = new BinaryFormatter(); FileStream file = File.Create(".\\Archivum\\Arma\\" + this.Nomen + ".aes"); HerctumA data = new HerctumA(); data.Peritia = this.Peritia; data.Acutus = this.Acutus; data.Acutulus = this.Acutulus; data.Obtusus = this.Obtusus; data.DamnumT = this.DamnumT; data.Spatium = this.Spatium; data.Toleratio = this.Toleratio; data.Deficio = this.Deficio; data.Mat = this.Materia.Nomen; data.Nomen = this.Nomen; data.Typus = this.Typus; data.Pondus = this.Pondus; data.Pretium = this.Pretium; bi.Serialize(file, data); file.Close(); }