public Notification(NotificationsType type, NotificationsGroup group, string name, string content) { Type = type; Group = group; Name = name; NotificationContent = content; }
public Notification(NotificationsType type, string name, string content) { Type = type; Name = name; NotificationContent = content; NotificationEpochTime = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; //NotificationTime = DateTime.Now.ToString("dd/MM/y hh:mm tt"); }
public Notification(NotificationsType type, string domain, NotificationsGroup group, string name, string content) { Type = type; Group = group; Domain = domain; Name = name; NotificationContent = content; NotificationEpochTime = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; }
public RegisterNotificationCommand(NotificationsType notifMask, EventDataFilter datafilter, short sequenceNumber) { base.name = "RegisterNotificationCommand"; _registerNotificationCommand = new Alachisoft.NCache.Common.Protobuf.RegisterNotifCommand(); _registerNotificationCommand.notifMask = (int)notifMask; _registerNotificationCommand.requestId = base.RequestId; _registerNotificationCommand.datafilter = (int)datafilter; _registerNotificationCommand.sequence = sequenceNumber; }
/// <summary> /// Register callbacks with cache. /// </summary> /// <param name="type"></param> public void RegisterNotification(NotificationsType type) { switch (type) { case NotificationsType.RegHashmapChangedNotif: if (this._hashmapChanged == null) { this._hashmapChanged = new HashmapChangedCallback(HashmapChanged); this._cache.HashmapChanged += this._hashmapChanged; } break; case NotificationsType.UnregHashmapChangedNotif: if (this._hashmapChanged != null) { this._cache.HashmapChanged -= this._hashmapChanged; this._hashmapChanged = null; } break; case NotificationsType.RegNodeJoinedNotif: if (_nodeJoined == null) { _nodeJoined = new NodeJoinedCallback(NodeJoined); _cache.MemberJoined += _nodeJoined; } break; case NotificationsType.RegNodeLeftNotif: if (_nodeLeft == null) { _nodeLeft = new NodeLeftCallback(NodeLeft); _cache.MemberLeft += _nodeLeft; } break; case NotificationsType.UnregNodeJoinedNotif: if (_nodeJoined != null) { _cache.MemberJoined -= _nodeJoined; _nodeJoined = null; } break; case NotificationsType.UnregNodeLeftNotif: if (_nodeLeft != null) { _cache.MemberLeft -= _nodeLeft; _nodeLeft = null; } break; } }
/// <summary> /// 传给服务端处理事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnServerHandler(object sender, NotificationsEventArgs e) { NotificationsVo notifications = JsonConvert.DeserializeObject <NotificationsVo>(e.Notifications.Message); NotificationsType notificationsType = (NotificationsType)Enum.Parse(typeof(NotificationsType), notifications.type, true); switch (notificationsType) { case NotificationsType.receipt_send: case NotificationsType.receipt_offline: int status = (int)MessageStatusEumns.Complete; int MessageId = Convert.ToInt32(e.Notifications.NotificationTag); DataHandleManager.Instance().RtMessageHandle.UpdateAvailResult(MessageId, status, DateTime.Now, notifications.type); break; } }
public void PlayValueNotification(string textValue, NotificationsType type) { var parameter = this.notificationsParameters.FirstOrDefault(p => p.type == type); var notif = PoolManager.Pools["FxPool"].Spawn(parameter.prefabName, transform); if (notif == null) { return; } var valueNotification = notif.gameObject .GetComponent <NotificationText>(); parameter.startPosition = Vector2.zero; valueNotification.PlayNotification(textValue, parameter); }
//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; try { cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { //PROTOBUF:RESPONSE _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; NotificationsType notif = (NotificationsType)cmdInfo.RegNotifs; //Will only register those which are == null i.e. not initialized nCache.RegisterNotification(notif); //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse registerNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse(); response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REGISTER_NOTIF; response.registerNotifResponse = registerNotifResponse; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID)); } }
internal void MaxEventRequirement(EventDataFilter datafilter, NotificationsType eventType, short sequence) { switch (eventType) { case NotificationsType.RegAddNotif: lock (sync_lock_AddDataFilter) { if (_addSeq < sequence) { ItemAddedFilter = datafilter; _addSeq = sequence; } } break; case NotificationsType.RegRemoveNotif: lock (sync_lock_RemoveDataFilter) { if (_removeSeq < sequence) { ItemRemovedFilter = datafilter; _removeSeq = sequence; } } break; case NotificationsType.RegUpdateNotif: lock (sync_lock_UpdateDataFilter) { if (_updateSeq < sequence) { ItemUpdatedFilter = datafilter; _updateSeq = sequence; } } break; } }
private void RegisterNotifications(NotificationsType notifMask, Connection connection) { RegisterNotificationCommand command = new RegisterNotificationCommand(notifMask,-1); Request request = new Request(false, _broker.OperationTimeOut); Address ipAddress = connection.ServerAddress; request.AddCommand(ipAddress, command); _broker.ExecuteRequest(request, connection, true, true); CommandResponse res = (CommandResponse)request.Response; res.ParseResponse(); }
public Notification(NotificationsType type, string name, string content) { Type = type; Name = name; NotificationContent = content; }
public RegisterNotificationCommand(NotificationsType notifMask) : this(notifMask, -1) { }
public RegisterNotificationCommand(NotificationsType notifMask, short sequenceNumber) : this(notifMask, EventDataFilter.None, sequenceNumber) { }
/// <summary> /// Register callbacks with cache. /// </summary> /// <param name="type"></param> public void RegisterNotification(NotificationsType type) { switch (type) { case NotificationsType.RegAddNotif: if (_itemAdded == null) { _itemAdded = new ItemAddedCallback(ItemAdded); _cache.ItemAdded += _itemAdded; } break; case NotificationsType.RegUpdateNotif: if (_itemUpdated == null) { _itemUpdated = new ItemUpdatedCallback(ItemUpdated); _cache.ItemUpdated += _itemUpdated; } break; case NotificationsType.RegRemoveNotif: if (_itemRemoved == null) { _itemRemoved = new ItemRemovedCallback(ItemRemoved); _cache.ItemRemoved += _itemRemoved; } break; case NotificationsType.RegClearNotif: if (_cacheCleared == null) { _cacheCleared = new CacheClearedCallback(CacheCleared); _cache.CacheCleared += _cacheCleared; } break; case NotificationsType.RegCustomNotif: if (_customNotif == null) { _customNotif = new CustomNotificationCallback(CustomNotification); _cache.CustomNotif += _customNotif; } break; case NotificationsType.RegNodeJoinedNotif: if (_nodeJoined == null) { _nodeJoined = new NodeJoinedCallback(NodeJoined); _cache.MemberJoined += _nodeJoined; } break; case NotificationsType.RegNodeLeftNotif: if (_nodeLeft == null) { _nodeLeft = new NodeLeftCallback(NodeLeft); _cache.MemberLeft += _nodeLeft; } break; case NotificationsType.RegCacheStoppedNotif: _cacheStopped = new CacheStoppedCallback(OnCacheStopped); _cache.CacheStopped += _cacheStopped; this._cacheStoppedEventRegistered = true; break; #if !DEVELOPMENT case NotificationsType.RegHashmapChangedNotif: if (this._hashmapChanged == null) { this._hashmapChanged = new HashmapChangedCallback(HashmapChanged); this._cache.HashmapChanged += this._hashmapChanged; } break; #endif case NotificationsType.UnregAddNotif: if (_itemAdded != null) { _cache.ItemAdded -= _itemAdded; _itemAdded = null; lock (sync_lock_AddDataFilter) { ItemAddedFilter = EventDataFilter.None; _addSeq = -1; } } break; case NotificationsType.UnregUpdateNotif: if (_itemUpdated != null) { _cache.ItemUpdated -= _itemUpdated; _itemUpdated = null; lock (sync_lock_UpdateDataFilter = -1) { ItemUpdatedFilter = EventDataFilter.None; _updateSeq = -1; } } break; case NotificationsType.UnregRemoveNotif: if (_itemRemoved != null) { _cache.ItemRemoved -= _itemRemoved; _itemRemoved = null; lock (sync_lock_RemoveDataFilter) { ItemRemovedFilter = EventDataFilter.None; _removeSeq = -1; } } break; case NotificationsType.UnregClearNotif: if (_cacheCleared != null) { _cache.CacheCleared -= _cacheCleared; _cacheCleared = null; } break; case NotificationsType.UnregCustomNotif: if (_customNotif != null) { _cache.CustomNotif -= _customNotif; _customNotif = null; } break; case NotificationsType.UnregNodeJoinedNotif: if (_nodeJoined != null) { _cache.MemberJoined -= _nodeJoined; _nodeJoined = null; } break; case NotificationsType.UnregNodeLeftNotif: if (_nodeLeft != null) { _cache.MemberLeft -= _nodeLeft; _nodeLeft = null; } break; case NotificationsType.UnregCacheStoppedNotif: this._cacheStoppedEventRegistered = false; break; #if !DEVELOPMENT case NotificationsType.UnregHashmapChangedNotif: if (this._hashmapChanged != null) { this._cache.HashmapChanged -= this._hashmapChanged; this._hashmapChanged = null; } break; #endif } }
internal void Read(IBitReader reader, ushort version) { this._Unknown.Clear(); if (version < 2) { var unknownCount = reader.ReadUInt32(); var types = new NotificationsType[unknownCount]; for (uint i = 0; i < unknownCount; i++) { types[i] = (NotificationsType)reader.ReadUInt32(); } for (uint i = 0; i < unknownCount; i++) { var unknown = new NotificationsUnknown6(); unknown.Type = types[i]; unknown.Unknown1 = reader.ReadUInt8(); unknown.Unknown2 = null; this._Unknown.Add(unknown); } } else if (version < 3) { var unknownCount = reader.ReadUInt32(); for (uint i = 0; i < unknownCount; i++) { var unknown = new NotificationsUnknown6(); unknown.Type = (NotificationsType)reader.ReadUInt32(); switch (unknown.Type) { case NotificationsType.Unknown0: case NotificationsType.Unknown1: { unknown.Unknown1 = reader.ReadUInt32(); break; } case NotificationsType.Unknown2: { unknown.Unknown2 = reader.ReadString(); break; } default: { throw new FormatException(); } } this._Unknown.Add(unknown); } } else { var unknownCount = reader.ReadUInt16(); for (uint i = 0; i < unknownCount; i++) { reader.PushFrameLength(24); var unknown = new NotificationsUnknown6(); unknown.Type = (NotificationsType)reader.ReadUInt32(); switch (unknown.Type) { case NotificationsType.Unknown0: case NotificationsType.Unknown1: { unknown.Unknown1 = reader.ReadUInt32(); break; } case NotificationsType.Unknown2: { unknown.Unknown2 = reader.ReadString(); break; } default: { throw new FormatException(); } } this._Unknown.Add(unknown); reader.PopFrameLength(); } } }
public NotificationsVo(NotificationsType notificationsType) : this(notificationsType.ToString(), (int)notificationsType) { }
public NotificationsVo(NotificationsType notificationsType, object data) : this(data, notificationsType.ToString(), (int)notificationsType, "") { }
//PROTOBUF public override void ExecuteCommand(ClientManager clientManager, Alachisoft.NCache.Common.Protobuf.Command command) { CommandInfo cmdInfo; int overload; string exception = null; NotificationsType notif = 0; System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch(); try { overload = command.MethodOverload; stopWatch.Start(); cmdInfo = ParseCommand(command, clientManager); } catch (Exception exc) { if (!base.immatureId.Equals("-2")) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } return; } try { NCache nCache = clientManager.CmdExecuter as NCache; notif = (NotificationsType)cmdInfo.RegNotifs; // Will only register those which are == null i.e. not initialized nCache.RegisterNotification(notif); if ((notif & NotificationsType.RegAddNotif) != 0 || (notif & NotificationsType.RegUpdateNotif) != 0 || (notif & NotificationsType.RegRemoveNotif) != 0) { nCache.MaxEventRequirement((Runtime.Events.EventDataFilter)cmdInfo.datafilter, notif, (short)cmdInfo.sequence); } stopWatch.Stop(); //PROTOBUF:RESPONSE Alachisoft.NCache.Common.Protobuf.Response response = new Alachisoft.NCache.Common.Protobuf.Response(); Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse registerNotifResponse = new Alachisoft.NCache.Common.Protobuf.RegisterNotifResponse(); response.requestId = Convert.ToInt64(cmdInfo.RequestId); response.commandID = command.commandID; response.responseType = Alachisoft.NCache.Common.Protobuf.Response.Type.REGISTER_NOTIF; response.registerNotifResponse = registerNotifResponse; _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeResponse(response)); } catch (Exception exc) { _serializedResponsePackets.Add(Alachisoft.NCache.Common.Util.ResponseHelper.SerializeExceptionResponse(exc, command.requestID, command.commandID)); } finally { TimeSpan executionTime = stopWatch.Elapsed; try { if (Alachisoft.NCache.Management.APILogging.APILogManager.APILogManger != null && Alachisoft.NCache.Management.APILogging.APILogManager.EnableLogging) { string methodNme = null; if (notif == NotificationsType.UnregAddNotif || notif == NotificationsType.UnregAddNotif || notif == NotificationsType.UnregRemoveNotif) { methodNme = MethodsName.UnRegisterCacheNotification.ToLower(); } else { methodNme = MethodsName.RegisterCacheNotification.ToLower(); } APILogItemBuilder log = new APILogItemBuilder(methodNme); log.GenerateRegisterCacheNotificationCallback(0, notif.ToString(), cmdInfo.datafilter.ToString(), overload, exception, executionTime, clientManager.ClientID.ToLower(), clientManager.ClientSocketId.ToString()); } } catch { } } }