/// <summary> /// Initialize and create a save. /// If a save with <param name="id">id</param> already exists, does nothing /// </summary> /// <param name="save">The save to add</param> /// <param name="id">The save id, if null save.Name is used</param> public void Add(IDbSave save, string id = null) { id = id ?? save.Name; if (_databases.ContainsKey(id)) { return; } save.Initialize(); save.Create(); _databases.Add(id, save); }
/// <summary> /// Initialize and create a save. /// If a save with <param name="id">id</param> already exists, does nothing /// </summary> /// <param name="save">The save to add</param> /// <param name="id">The save id, if null save.Name is used</param> public async Task AddAsync([NotNull] IDbSave save, string id = null) { id = id ?? save.Name; if (_databases.ContainsKey(id)) { return; } await save.InitializeAsync(); await save.CreateAsync(); _databases.Add(id, save); }