コード例 #1
0
ファイル: Character.cs プロジェクト: SwiftAusterity/NetMud
        /// <summary>
        /// Update the field data for this object to the db
        /// </summary>
        /// <returns>success status</returns>
        public override bool Save()
        {
            var accessor = new NetMud.DataAccess.FileSystem.PlayerData();

            try
            {
                accessor.WriteCharacter(this);
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
                return false;
            }

            return true;
        }
コード例 #2
0
ファイル: Character.cs プロジェクト: SwiftAusterity/NetMud
        /// <summary>
        /// Add it to the cache and save it to the file system
        /// </summary>
        /// <returns>the object with ID and other db fields set</returns>
        public override IData Create()
        {
            var accessor = new NetMud.DataAccess.FileSystem.PlayerData();

            try
            {
                PlayerDataCache.Add(this);
                accessor.WriteCharacter(this);
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
                return null;
            }

            return this;
        }