public static ICacheAside CreatePubSubDoubleCache(IConnectionMultiplexer redisConnection, IItemSerializer itemSerializer, TimeSpan? defaultTtl = null) { var remoteCache = new RedisCache(redisConnection.GetDatabase(), itemSerializer, defaultTtl); return new DoubleCache( new SubscribingCache(new LocalCache.MemCache(defaultTtl), new RedisSubscriber(redisConnection, remoteCache, itemSerializer)), new PublishingCache(remoteCache, new RedisPublisher(redisConnection, itemSerializer))); }
public void Setup() { this.contextProvider = new InMemoryPersistenceContextProvider(); new DataInitialization(this.contextProvider, new NullLoggerFactory()).CreateInitialData(3, true); this.gameConfiguration = this.contextProvider.CreateNewConfigurationContext().Get <GameConfiguration>().First(); this.itemSerializer = new ItemSerializer(); }
public DiskBTree(Stream stream, bool leaveOpen, int t, IComparer <T> comparer, IItemSerializer <T> serializer) : base(t, comparer) { if (stream == null) { throw new ArgumentNullException(nameof(stream)); } if (serializer == null) { throw new ArgumentNullException(nameof(serializer)); } if (!stream.CanRead) { throw new ArgumentException("Expected a readable stream", nameof(stream)); } if (!stream.CanWrite) { throw new ArgumentException("Expected a writable stream", nameof(stream)); } if (!stream.CanSeek) { throw new ArgumentException("Expected a seekable stream", nameof(stream)); } _stream = stream; _leaveOpen = leaveOpen; _serializer = serializer; if (_stream.Length < HeaderSize) { Init(); } }
/// <summary> /// Initializes a new instance of the <see cref="WorldView"/> class. /// </summary> /// <param name="connection">The connection.</param> /// <param name="player">The player.</param> /// <param name="itemSerializer">The item serializer.</param> /// <param name="appearanceSerializer">The appearance serializer.</param> public WorldView(IConnection connection, Player player, IItemSerializer itemSerializer, IAppearanceSerializer appearanceSerializer) { this.connection = connection; this.player = player; this.itemSerializer = itemSerializer; this.appearanceSerializer = appearanceSerializer; }
public void Setup() { this.contextProvider = new InMemoryPersistenceContextProvider(); new MUnique.OpenMU.Persistence.Initialization.DataInitialization(this.contextProvider).CreateInitialData(); this.gameConfiguration = this.contextProvider.CreateNewConfigurationContext().Get <GameConfiguration>().First(); this.itemSerializer = new ItemSerializer(); }
public static IItemSerializer <TCurrentItem> Create <TCurrentItem, TLegacyItem>( IItemSerializer <TLegacyItem> legacyReader, Func <TLegacyItem, TCurrentItem> fromLegacyConverter, Func <TCurrentItem, TLegacyItem> toLegacyConverter) { return(new Impl <TCurrentItem, TLegacyItem>(legacyReader, fromLegacyConverter, toLegacyConverter)); }
public HabitatFitnessEventsController([NotNull] IEventDataService dataService, [NotNull] IItemScoringService itemScoringService, [NotNull] IItemSerializer itemSerializer, [NotNull] IStringValueListFacetService facetService) { this.dataService = dataService; this.itemSerializer = itemSerializer; this.itemScoringService = itemScoringService; this.facetService = facetService; }
public RedisSubscriber(IConnectionMultiplexer connection, ICacheAside remoteCache, IItemSerializer itemSerializer) { connection.GetSubscriber().Subscribe("cacheUpdate", CacheUpdated); _remoteCache = remoteCache; _itemSerializer = itemSerializer; _clientName = connection.ClientName; _knownTypes = new ConcurrentDictionary <string, Type>(); }
public RedisSubscriber(IConnectionMultiplexer connection, ICacheAside remoteCache, IItemSerializer itemSerializer) { connection.GetSubscriber().Subscribe("cacheUpdate", CacheUpdated); _remoteCache = remoteCache; _itemSerializer = itemSerializer; _clientName = connection.ClientName; _knownTypes = new ConcurrentDictionary<string, Type>(); }
public Impl(IItemSerializer <TLegacyItem> legacyReader, Func <TLegacyItem, TCurrentItem> fromLegacyConverter, Func <TCurrentItem, TLegacyItem> toLegacyConverter) { LegacyReader = legacyReader; _fromLegacyConverter = fromLegacyConverter; _toLegacyConverter = toLegacyConverter; }
public RedisSubscriber(IConnectionMultiplexer connection, ICacheAside remoteCache, IItemSerializer itemSerializer) { connection.GetSubscriber().Subscribe("cacheUpdate", CacheUpdated); connection.GetSubscriber().Subscribe("cacheDelete", CacheDeleted); _remoteCache = remoteCache; _itemSerializer = itemSerializer; _clientName = connection.ClientName; }
public RedisSubscriberTests() { _subscriber = A.Fake <ISubscriber>(); _remoteCache = A.Fake <ICacheAside>(); _itemSerializer = A.Fake <IItemSerializer>(); _connection = A.Fake <IConnectionMultiplexer>(); A.CallTo(() => _connection.GetSubscriber(A <object> ._)).Returns(_subscriber); }
public RedisSubscriberTests() { _subscriber = A.Fake<ISubscriber>(); _remoteCache = A.Fake<ICacheAside>(); _itemSerializer = A.Fake<IItemSerializer>(); _connection = A.Fake<IConnectionMultiplexer>(); A.CallTo(() => _connection.GetSubscriber(A<object>._)).Returns(_subscriber); }
public static bool TryGet <T>(out IItemSerializer <T> serializer) { if (!Instances.TryGetValue(typeof(T), out var obj)) { serializer = default; return(false); } serializer = (IItemSerializer <T>)obj; return(true); }
private static ItemEditorViewModel SetupClass(IItemSerializer itemSerializer = null, IItemDeserializer itemDeserializer = null) { itemSerializer = itemSerializer ?? new StubIItemSerializer(); itemDeserializer = itemDeserializer ?? new StubIItemDeserializer { Deserialize = () => new List<IItem>() }; return new ItemEditorViewModel(itemSerializer, itemDeserializer); }
public PublisherTests() { _connection = A.Fake <IConnectionMultiplexer>(); _serializer = A.Fake <IItemSerializer>(); _subscriber = A.Fake <ISubscriber>(); A.CallTo(() => _connection.GetSubscriber(null)).Returns(_subscriber); A.CallTo(() => _connection.ClientName).Returns("C"); A.CallTo(() => _serializer.Serialize(A <CacheUpdateNotificationArgs> .Ignored)).Returns(new byte[] { 1 }); publisher = new RedisPublisher(_connection, _serializer); }
public ItemEditorViewModel(IItemSerializer itemSerializer, IItemDeserializer itemDeserializer) { Check.IfIsNull(itemSerializer).Throw<ArgumentNullException>(() => itemSerializer); Check.IfIsNull(itemDeserializer).Throw<ArgumentNullException>(() => itemDeserializer); this.itemSerializer = itemSerializer; this.itemDeserializer = itemDeserializer; AddNewItemCommand = new Command(AddNewItem); RefreshItemsList(); }
/// <summary> /// Initializes a new instance of the <see cref="RemoteView"/> class. /// </summary> /// <param name="connection">The connection.</param> /// <param name="player">The player.</param> /// <param name="context">The context.</param> /// <param name="appearanceSerializer">The appearance serializer.</param> public RemoteView(IConnection connection, Player player, IGameServerContext context, IAppearanceSerializer appearanceSerializer) : base(connection) { this.context = context; this.itemSerializer = new ItemSerializer(); this.connection = connection; this.player = player; this.PartyView = new PartyView(connection, player); this.MessengerView = new MessengerView(connection, player, context.FriendServer, appearanceSerializer); this.TradeView = new TradeView(connection, player, this.itemSerializer); this.GuildView = new GuildView(connection, player); this.WorldView = new WorldView(connection, player, this.itemSerializer, appearanceSerializer); this.InventoryView = new InventoryView(connection, player, this.itemSerializer); this.appearanceSerializer = appearanceSerializer; this.lowestClientVersion = this.GetLowestClientVersionOfConfiguration(); }
public RedisPublisher(IConnectionMultiplexer connection, IItemSerializer itemSerializer) { _connection = connection; _itemSerializer = itemSerializer; }
/// <summary> /// Create a new instance of the <see cref="saveDataBuilder"/> class. /// </summary> /// <param name="itemSerializer">The <see cref="IItemSerializer"/> instance to (de-)serialize <see cref="Item"/> instances.</param> public SaveDataBuilder(IItemSerializer itemSerializer) { this.itemSerializer = itemSerializer; }
private static void AssignTo(this QuestReward questReward, Network.Packets.ServerToClient.QuestReward rewardStruct, IItemSerializer itemSerializer) { rewardStruct.Type = questReward.RewardType.Convert(); rewardStruct.RewardCount = (uint)questReward.Value; if (questReward.RewardType == QuestRewardType.Item && questReward.ItemReward is { } itemReward) { rewardStruct.RewardId = itemReward.Definition.GetItemType(); itemSerializer.SerializeItem(rewardStruct.RewardedItemData, itemReward); } }
public DiskBTree(Stream stream, int t, IItemSerializer <T> serializer) : this(stream, false, t, Comparer <T> .Default, serializer) { }
/// <summary> /// Initializes a new instance of the <see cref="TradeView"/> class. /// </summary> /// <param name="connection">The connection.</param> /// <param name="trader">The trader.</param> /// <param name="itemSerializer">The item serializer.</param> public TradeView(IConnection connection, ITrader trader, IItemSerializer itemSerializer) { this.connection = connection; this.trader = trader; this.itemSerializer = itemSerializer; }
public DiskBTree(string fileName, int t, IComparer <T> comparer, IItemSerializer <T> serializer) : this(File.Open(fileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite), t, comparer, serializer) { }
public CachingDiskBTree(Stream stream, bool leaveOpen, int t, IComparer <T> comparer, IItemSerializer <T> serializer, long memoryLimit) : base(stream, leaveOpen, t, comparer, serializer) { _cache = new BTreeCache(memoryLimit); }
/// <summary> /// Initializes a new instance of the <see cref="InventoryView"/> class. /// </summary> /// <param name="connection">The connection.</param> /// <param name="player">The player.</param> /// <param name="itemSerializer">The item serializer.</param> public InventoryView(IConnection connection, Player player, IItemSerializer itemSerializer) { this.connection = connection; this.player = player; this.itemSerializer = itemSerializer; }
public HabitatFitnessProductsController([NotNull] IProductDataService dataService, IItemScoringService itemScoringService, IItemSerializer itemSerializer) { this.dataService = dataService; this.itemSerializer = itemSerializer; this.itemScoringService = itemScoringService; }
public DiskBTree(string fileName, int t, IItemSerializer <T> serializer) : this(fileName, t, Comparer <T> .Default, serializer) { }
public RedisCache(IDatabase database, IItemSerializer itemSerializer, TimeSpan?defaultTtl = null) { _database = database; _itemSerializer = itemSerializer; _defaultTtl = defaultTtl; }
public DiskBTree(Stream stream, bool leaveOpen, int t, IItemSerializer <T> serializer) : this(stream, leaveOpen, t, Comparer <T> .Default, serializer) { }
public DiskBTree(Stream stream, int t, IComparer <T> comparer, IItemSerializer <T> serializer) : this(stream, false, t, comparer, serializer) { }
public SheetHistoryController(ISheetController sheetController, IItemSerializer itemSerializer) { this._sheetController = sheetController; this._itemSerializer = itemSerializer; }
public static ICacheAside CreatePubSubDoubleCache(IConnectionMultiplexer redisConnection, IItemSerializer itemSerializer, TimeSpan?defaultTtl = null) { var remoteCache = new RedisCache(redisConnection.GetDatabase(), itemSerializer, defaultTtl); return(new DoubleCache( new SubscribingCache(new LocalCache.MemCache(defaultTtl), new RedisSubscriber(redisConnection, remoteCache, itemSerializer)), new PublishingCache(remoteCache, new RedisPublisher(redisConnection, itemSerializer)))); }
public ProductExcludingMultilistFieldSerializer(IItemSerializer itemSerializer, IFieldRenderer fieldRenderer) : base(fieldRenderer) { Assert.ArgumentNotNull(itemSerializer, nameof(itemSerializer)); ItemSerializer = itemSerializer; }
public CachingDiskBTree(string fileName, int t, IComparer <T> comparer, IItemSerializer <T> serializer, long memoryLimit) : base(fileName, t, comparer, serializer) { _cache = new BTreeCache(memoryLimit); }