public LoginCtrl() { if (!OpenFile()) { _Data = new LoginStorage(); } }
//Read from file and deserialize //load file private bool OpenFile() { LoginStorage temp; if (File.Exists(filename)) { Stream stream = File.Open(filename, FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); temp = (LoginStorage)bformatter.Deserialize(stream); stream.Close(); _Data = temp; return(true); } else { return(false); } }
//Read from file and deserialize //load file private bool OpenFile() { LoginStorage temp; if (File.Exists(filename)) { Stream stream = File.Open(filename, FileMode.Open); BinaryFormatter bformatter = new BinaryFormatter(); temp = (LoginStorage)bformatter.Deserialize(stream); stream.Close(); _Data = temp; return true; } else return false; }
public LoginCtrl() { if(!OpenFile()) _Data = new LoginStorage(); }