Example #1
0
 /// <summary>
 /// If we have a new value, write it out to disk before we go away.
 /// </summary>
 public void Dispose()
 {
     if (!dirty)
     {
         return;
     }
     dirty = false;
     File.WriteAllText(dbFile, StringDictionarySerializer.Serialize(data));
 }
Example #2
0
 /// <summary>
 /// Create the database.
 /// </summary>
 /// <param name="databaseName">Leave this parameter blank.  CSharp will fill in the name of the calling file, which is used to find the database file.</param>
 protected StringTestDatabase([CallerFilePath] string databaseName = null)
 {
     dbFile = GetDatabaseFile(databaseName);
     data   = File.Exists(dbFile)?StringDictionarySerializer.Deserialize(File.ReadAllText(dbFile)):
              new Dictionary <string, string>();
 }