コード例 #1
0
        /// <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);
        }
コード例 #2
0
ファイル: DbSaveHandler.cs プロジェクト: fossabot/CaveTester
        /// <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);
        }