Esempio n. 1
0
 public static Database GetActiveDatabase()
 {
     if (ActiveDatabase == null)
     {
         ActiveDatabase = new Database();
         ActiveDatabase.Characters = new List<Character>();
     }
     return ActiveDatabase;
 }
Esempio n. 2
0
 public static void LoadDatabase()
 {
     string path = "C:\\Users\\Telorath\\Heroes";
     if (!Directory.Exists(path))
     {
         Directory.CreateDirectory(path);
     }
     path = path + "\\Database.txt";
     IFormatter formatter = new BinaryFormatter();
     FileStream _stream = new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
     ActiveDatabase = (Database)formatter.Deserialize(_stream);
     _stream.Close();
 }