using System; using System.Collections.Generic; namespace SUISS.Cloud { public class SSPStorageController : ISSPStorageController { public SSPStorageController(IMessageController messageController, IPlayernameController playernameController, Dictionary storage) { this._messageController = messageController; this._playernameController = playernameController; this._storage = storage; } private Dictionary PlayerStorage { get { if (!this._storage.ContainsKey(this._playernameController.PlayerUuid) || !(this._storage[this._playernameController.PlayerUuid] is Dictionary)) { this._storage.Add(this._playernameController.PlayerUuid, new Dictionary()); } return (Dictionary)this._storage[this._playernameController.PlayerUuid]; } } public SSPStorage Get(string key) { return new SSPStorage(key, this.GetStorageDict(key), this._messageController, this._playernameController); } private Dictionary GetStorageDict(string key) { if (!this.PlayerStorage.ContainsKey(key) || !(this.PlayerStorage[key] is Dictionary)) { this.PlayerStorage.Add(key, new Dictionary()); } return (Dictionary)this.PlayerStorage[key]; } private IMessageController _messageController; private IPlayernameController _playernameController; private Dictionary _storage; } }