protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_G2H message) { if (message == null) { method.Info("Freeform message (G2H) was null."); return false; } this.OnModifyMessage(method, message); // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return false; } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return false; } return true; }
protected override void OnModifyMessage(ILogMethod method, FFMsg_G2H message) { FFTgt_B2B_Encrypted target = message.GetTarget<FFTgt_B2B_Encrypted>(); if (target == null || target.EntityData == null) { throw new ArgumentNullException("No valid encrypted targets found"); } }
protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message) { if (message == null) { method.Info("Freeform message (H2G) was null."); return false; } this.OnModifyMessage(method, message); return _serverInstance.PostMessageToTransceiver(message); }
public static ExMonServer4MonProcessorProxy Get(IExMonServer4MonProcessorCallback callbackInstance) { using (ILogMethod method = Log.LogMethod("ExMonServer4MonProcessorProxyFactory", "Get")) { ExMonServer4MonProcessorProxy result = default(ExMonServer4MonProcessorProxy); try { result = ExCommsGenericProxy.GetService <ExMonServer4MonProcessorProxy, IExMonServer4MonProcessor>( (i) => { if (callbackInstance != null) { return(new ExMonServer4MonProcessorProxy(i, callbackInstance)); } else { return(new ExMonServer4MonProcessorProxy(i)); } }, (b, u) => { if (callbackInstance != null) { return(new ExMonServer4MonProcessorProxy(callbackInstance, b, u, null)); } else { return(new ExMonServer4MonProcessorProxy(b, u)); } }); } catch (Exception ex) { method.Exception(ex); } return(result); } }
private static void Initialize() { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "GetGMUFactory")) { try { _factoryInstances = new SortedDictionary <FF_FlowDirection, IDictionary <MasterCOMVersions, IFFFactory> >() { { FF_FlowDirection.G2H, new SortedDictionary <MasterCOMVersions, IFFFactory>() { { MasterCOMVersions.MC300, new FFFactory_MC300_G2H() }, { MasterCOMVersions.MC350, new FFFactory_MC350_G2H() }, { MasterCOMVersions.MC400, new FFFactory_MC400_G2H() }, { MasterCOMVersions.SoftGMU, new FFFactory_SoftGMU_G2H() }, } }, { FF_FlowDirection.H2G, new SortedDictionary <MasterCOMVersions, IFFFactory>() { { MasterCOMVersions.MC300, new FFFactory_MC300_H2G() }, { MasterCOMVersions.MC350, new FFFactory_MC350_H2G() }, { MasterCOMVersions.MC400, new FFFactory_MC400_H2G() }, { MasterCOMVersions.SoftGMU, new FFFactory_SoftGMU_H2G() }, } } }; _gmuFactories = new StringConcurrentDictionary <_GMU_Factory>(); _defaultFactory_G2H = _factoryInstances[FF_FlowDirection.G2H][MasterCOMVersions.MC300]; _defaultFactory_H2G = _factoryInstances[FF_FlowDirection.H2G][MasterCOMVersions.MC300]; } catch (Exception ex) { method.Exception(ex); } } }
private static IExMonitorServerConfigStore Create() { using (ILogMethod method = Log.LogMethod("ExMonitorServerConfigStoreFactory", "Create")) { IExMonitorServerConfigStore result = default(IExMonitorServerConfigStore); try { try { result = MEFHelper.GetExportedValue <IExMonitorServerConfigStore>("ExMonitorServerConfigStore"); } catch { result = new ExMonitorServerConfigStore(); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected override bool ProcessG2HMessageInternal(ExComms.Contracts.DTO.Monitor.MonMsg_G2H request) { using (ILogMethod method = Log.LogMethod("MonitorHandler_GameInfo", "ProcessG2HMessageInternal")) { try { MonTgt_G2H_GameInfo monTgtMsg = request.Targets[0] as MonTgt_G2H_GameInfo; // if (ExCommsDataContext.Current.UpdateSession_MGMD_MeterHistory(monTgtMsg)) { } method.Debug("Snap taken, now update the latest meters in floor financials"); //++k BGSMeterHandler.Proceess return(true); } catch (Exception ex) { method.Exception(ex); } return(false); } }
public IEnumerable <T> GetTargets <T>() where T : MonitorEntity_MsgTgt { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "GetTargets<T>")) { IEnumerable <T> result = default(IEnumerable <T>); try { this.GetBaseTargets <T>((e) => { result = e.ToList(); }); } catch (Exception ex) { method.Exception(ex); } return(result); } }
private Type[] GetInstancesFromReferencedAssemblies(AssemblyName[] assemblies) { using (ILogMethod method = Log.LogMethod("", "GetInstancesFromReferencedAssemblies")) { Type[] result = default(Type[]); Assembly pThis = typeof(ConfigStore).Assembly; try { foreach (var asmName in assemblies) { try { Assembly asm = Assembly.Load(asmName); if (asm.GetName().Name.IgnoreCaseCompare("BMC.CoreLib")) { continue; } result = this.GetInstances(asm); if (result != null && result.Length > 0) { return(result); } } catch (Exception ex) { method.Exception(ex); } } } catch (Exception ex) { method.Exception(ex); } return(result); } }
private void Initialize() { using (ILogMethod method = Log.LogMethod("GmuEventCategoryModelCollection", "Initialize")) { try { foreach (var category in ErrorEventCategoryFactory.Categories) { GmuEventCategoryModel modelCategory = new GmuEventCategoryModel(category.Key); foreach (var item in category.Value) { modelCategory.AddEventType(item.ExceptionCode, item.Description); } this.Add(modelCategory); } } catch (Exception ex) { method.Exception(ex); } } }
public T GetTarget <T>() where T : IMonitorEntity_MsgTgt { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "GetTarget<T>")) { T result = default(T); try { this.GetBaseTarget <T>((e) => { result = e; }); } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected bool GetBaseTargets <T>(Action <IEnumerable <T> > doWork) where T : IMonitorEntity_MsgTgt { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ToStringDetail")) { string typeOfT = typeof(T).FullName; try { var items = (from t in this.Targets where t is T select t).OfType <T>(); doWork(items); } catch (Exception ex) { method.Exception(ex); } return(true); } }
public bool AddInstallations(IEnumerable <int> installationNos) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "RemoveInstallationIP")) { try { foreach (var installationNo in installationNos) { if (!_mapEnrolledMachines.ContainsKey(installationNo)) { _mapEnrolledMachines.Add(installationNo, string.Empty); } } } catch (Exception ex) { method.Exception(ex); } return(true); } }
void Log_GlobalWriteToExternalLog(string formattedMessage, CoreLib.Diagnostics.LogEntryType type, object extra) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Log_GlobalWriteToExternalLog")) { try { Dispatcher.Invoke(new Action(() => { if (type == CoreLib.Diagnostics.LogEntryType.Exception) { if (axConsole.Exceptions.Count >= 32767) { axConsole.Exceptions.Clear(); } ExceptionModel item = new ExceptionModel() { SNo = axConsole.Exceptions.Count + 1, ReceivedTime = DateTime.Now, Exception = formattedMessage, }; axConsole.Exceptions.Add(item); } if (axConsole.Output.Length > 32767) { axConsole.Output = string.Empty; } axConsole.Output += DateTime.Now.ToFullString() + "\t" + formattedMessage + Environment.NewLine; axConsole.ScrollToEnd(); })); } catch (Exception ex) { method.Exception(ex); } } }
protected override bool ProcessG2HMessageInternal(ExComms.Contracts.DTO.Monitor.MonMsg_G2H request) { using (ILogMethod method = Log.LogMethod("MonitorHandler_ExtendedGameInfo", "ProcessG2HMessageInternal")) { try { //MonTgt_G2H_ExtendedGameInfo monTgtMsg = request.Targets[0] as MonTgt_G2H_ExtendedGameInfoInfo; // if (ExCommsDataContext.Current.UpdateInstallationGameInfo(monTgtMsg.installationNo,monTgtMsg.GameNumber,monTgtMsg.MaxBet,monTgtMsg.ProgressGroup,monTgtMsg.ProgressLevel,monTgtMsg.GameName,monTgtMsg.PayTableName,false,monTgtMsg.HasGameNameFramed,"")) { } //++k BGSMeterHandler.Proceess return(true); } catch (Exception ex) { method.Exception(ex); } return(false); } }
private EPITimeout AddOrUpdateTimeout(int installationNo, EPIProcessType processType, DateTime lastUpdatedTime) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "AddOrUpdateTimeout")) { EPITimeout result = null; try { string fullKey = this.PrepareKey(installationNo, processType); result = _collection.AddOrGet(fullKey, () => { return(new EPITimeout()); }); result.InstallationNo = installationNo; result.ProcessType = processType; result.LastUpdatedTime = lastUpdatedTime; } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected virtual bool OnProcessMessageInternal(FFMsg_G2H message, IList <MonitorEntity_MsgTgt> monitorTargets) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnProcessMessageInternal(G2H)")) { bool result = default(bool); try { if (monitorTargets == null || monitorTargets.Count == 0) { return(true); } // convert the monitor message from freeform message MonMsg_G2H monMsg = MonitorEntityFactory.CreateEntity(message, monitorTargets); if (monMsg == null) { method.Info("Unable to convert the monitor message from freeform message."); return(false); } // post the monitor message into monitor processor if (!this.MonitorProcessor.ProcessG2HMessage(monMsg)) { method.Info("Unable to post the message to monitor processor."); return(false); } result = true; } catch (Exception ex) { method.Exception(ex); } return(result); } }
internal static bool CreateCommonKey(this FreeformSecurityTableCollection secTables, SECURITY_KEY_INDEX key) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateCommonKey")) { try { if (!secTables.ContainsKey(key)) { return(false); } FreeformSecurityTable secTable = secTables[key]; if (secTable.Flags != (FreeformSecurityFlags.LocalPartialKey | FreeformSecurityFlags.OtherPartialKey)) { return(false); } byte[] localNum = secTable.LocalRandomNumber; for (int i = 0; i < FreeformSecurityTable.KEY_SIZE; i++) { secTable.CommonKey[i] = exp_mod(secTable.OtherPartialKey[i], localNum[i]); } // all the keys are now available secTable.Flags |= (FreeformSecurityFlags.LocalPartialKey | FreeformSecurityFlags.OtherPartialKey | FreeformSecurityFlags.CommonKey); } catch (Exception ex) { method.Exception(ex); return(false); } return(true); } }
public override void QueueWorkerItem(ThreadExecutorItem <T> item) { if (this.ExecutorService.IsShutdown) { return; } using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "QueueWorkerItem")) { try { if (item != null) { string uniqueKey = item.UniqueKey; ConcurrentQueue <ThreadExecutorItem <T> > dataQueue = null; if (!_dataQueues.ContainsKey(uniqueKey)) { _dataQueues.Add(uniqueKey, (dataQueue = new ConcurrentQueue <ThreadExecutorItem <T> >())); } else { dataQueue = _dataQueues[uniqueKey]; } dataQueue.Enqueue(item); Interlocked.Increment(ref _itemCount); method.DebugV("( {0}::QueueWorkerItem ) Queue Count : {1:D}, Item Count : {2:D}", _threadName, _dataQueues.Count, _itemCount); _signalQueue.Enqueue(0); } } catch (Exception ex) { method.Exception(ex); } } }
public int GetGmuIdInt32 <T>(T value) where T : IConvertible { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "GetGmuId")) { int result = default(int); try { IFFEnumParser parser = _parsers.GetValueFromKey2(typeof(T).FullName); if (parser != null) { result = parser.GetGmuIdFromAppId(value.ToInt32(CULTURE)); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
internal static byte GenerateRandomNumber(this FreeformSecurityTableCollection secTables, SECURITY_KEY_INDEX key) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "GenerateRandomNumber")) { byte result = 0; try { if (!secTables.ContainsKey(key)) { return(result); } result = secTables[key].GenerateRandomNumber(); } catch (Exception ex) { method.Exception(ex); return(0); } return(result); } }
public static T CreateEntity <T>(FF_FlowDirection direction, FFCreateEntityRequest request) where T : IFreeformEntity { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateG2HEntity")) { T result = default(T); try { _GMU_Factory gmuFactory = GetGMUFactory(request.IPAddress); if (gmuFactory != null) { result = (T)gmuFactory[direction].CreateEntity(request); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
public static void ProcessMessage(FFMsg_H2G message) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "ProcessMessage(H2G)")) { try { FreeformExecutorBase executor = GetMessageType(message.SessionID); if (message.SessionID == FF_AppId_SessionIds.GIM) { UpdateInstallationIP(message.IpAddress, message.InstallationNo); } else { UpdateIP(ref message); } executor.ProcessMessage(message); } catch (Exception ex) { method.Exception(ex); } } }
private bool PopulateIP(FFMsg_H2G message) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "UpdateInstallationNo")) { bool retval = default(bool); try { if (_mapInstallationIP != null && _mapInstallationIP.ContainsKey(message.InstallationNo)) { message.IpAddress = _mapInstallationIP[message.InstallationNo]; retval = true; } } catch (Exception ex) { method.Exception(ex); } return(retval); } }
public bool Stop() { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "Start")) { bool result = default(bool); try { this.ExecutorService.Shutdown(); foreach (var host in _hosts) { result |= host.Stop(); } this.ExecutorService.AwaitTermination(TimeSpan.FromMinutes(2)); } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected override bool OnExecuteInternal(MonitorExecutionContext context, MonitorEntity_MsgTgt target) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnExecuteInternal")) { bool result = default(bool); MonMsg_G2H request = context.G2HMessage; try { DateTime faultDate = request.FaultDate; ExCommsDataContext.Current.CreateTickeException_Handpay(request.InstallationNo, 0, request.BarPositionNo, true, "", faultDate); ExCommsDataContext.Current.UpdateFloorFinancialSession(request.InstallationNo, "HP", ""); ExCommsDataContext.Current.UpdateFloorFinancialSession(request.InstallationNo, "INIT", ""); this.ForceMeterRead(context, target); } catch (Exception ex) { method.Exception(ex); } return(result); } }
public static T CreateEntity <T>(FF_FlowDirection direction, byte[] buffer, string givenAddress) where T : IFreeformEntity_Msg { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { IFreeformEntity result = default(IFreeformEntity); try { UdpFreeformEntity udpEntity = CreateUdpEntity(direction, buffer, givenAddress); if (udpEntity != null) { result = CreateEntity(direction, udpEntity); } } catch (Exception ex) { method.Exception(ex); } return((T)result); } }
protected override bool ProcessG2HMessageInternal(MonMsg_G2H request) { using (ILogMethod method = Log.LogMethod("MonitorHandler_PC_33_7", "ProcessG2HMessageInternal")) { try { MonTgt_G2H_PC_NotificationResponse notificationResponse = request.Targets[0] as MonTgt_G2H_PC_NotificationResponse; if (notificationResponse == null) { return(false); } PCNotificationResponse pgnotificationResponse = GetNotificationResponseEntity(request, notificationResponse); HandlerHelper.PlayerGatewayInstance.SendPCNotificationResponse(pgnotificationResponse); return(true); } catch (Exception ex) { method.Exception(ex); } return(false); } }
public static uint GenerateCRC(byte[] buffer, long amount, byte[] key) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "GenerateCRC")) { uint crc = 0; try { byte[] tk = new byte[TK_DATA_LENGTH]; // Key if (key != null && key.Length == TK_KEY_LENGTH) { tk.CopyToBuffer(key, 0, TK_KEY_LENGTH); } // Amount byte[] amountInBytes = FFDataTypeHelper.GetInt32Bytes((int)amount, FFEndianType.BigEndian); tk.CopyToBuffer(amountInBytes, TK_KEY_LENGTH, TK_AMOUNT_LENGTH); // barcode if (buffer != null && buffer.Length == TK_NUMBER_LENGTH) { tk.CopyToBuffer(buffer, TK_KEY_LENGTH + TK_AMOUNT_LENGTH, TK_NUMBER_LENGTH); } // crc crc = CreateCRC(tk, (uint)tk.Length, 0) % 1000; } catch (Exception ex) { method.Exception(ex); } return(crc); } }
public virtual void AddBufferEntityParser(Type gmuIdEnum, Type appIdEnum, IFFParser parser, FFTgtParseBufferHandler action) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "AddBufferEntityParser")) { try { //Array gmuIdValues = Enum.GetValues(gmuIdEnum); //Array appIdValues = Enum.GetValues(appIdEnum); //if (gmuIdValues.Length == appIdValues.Length) //{ // for (int i = 0; i < gmuIdValues.Length; i++) // { // this.AddBufferEntityParser((int)gmuIdValues.GetValue(i), (int)appIdValues.GetValue(i), parser, action); // } //} string[] gmuIdNames = Enum.GetNames(gmuIdEnum); foreach (var gmuIdName in gmuIdNames) { try { object gmuIdValue = Enum.Parse(gmuIdEnum, gmuIdName, true); object appIdValue = Enum.Parse(appIdEnum, gmuIdName, true); this.AddBufferEntityParser((int)gmuIdValue, (int)appIdValue, parser, action); } catch (Exception ex) { method.InfoV("::: ENUM ERROR : Unable to convert from ({0}) to ({1})", gmuIdEnum.FullName, appIdEnum.FullName); } } } catch (Exception ex) { method.Exception(ex); } } }
private static void InitializeTgtParserMappingTypesH2G() { using (ILogMethod method = Log.LogMethod("MonEntityFactory", "InitializeMappingTypes")) { try { _tgtParserMappingTypesH2G = new ConcurrentDictionary <string, MappingTypeH2GInfo>(StringComparer.OrdinalIgnoreCase); var tgtParserMappingTypes = (from t in typeof(MonTgtParserMappingH2GAttribute).Assembly.GetTypes() let j = t.GetCustomAttributes(typeof(MonTgtParserMappingH2GAttribute), true).OfType <MonTgtParserMappingH2GAttribute>().ToArray() where j.Length == 1 select new { Type = t, Attribute = j.FirstOrDefault() }).ToArray(); foreach (var parserMappingType in tgtParserMappingTypes.AsParallel()) { Type classType = parserMappingType.Type; string key = classType.FullName; if (!_tgtParserMappingTypesH2G.ContainsKey(key)) { _tgtParserMappingTypesH2G.Add(key, new MappingTypeH2GInfo() { MappingType = classType, MappingAttribute = parserMappingType.Attribute, }); } } } catch (Exception ex) { method.Exception(ex); } } }
private static bool UpdateInstallationNo(ref FFMsg_G2H message) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "UpdateInstallationNo")) { bool retval = default(bool); try { string ipAddress = message.IpAddress; if (_htIpInstallation != null && _htIpInstallation.ContainsKey(ipAddress)) { message.InstallationNo = _htIpInstallation[ipAddress]; retval = true; } } catch (Exception ex) { method.Exception(ex); } return(retval); } }
/// <summary> /// Creates the freeform entity from given buffer. /// </summary> /// <param name="direction">The direction.</param> /// <param name="udpEntity">The UDP entity.</param> /// <returns> /// Freeform entity. /// </returns> public static IFreeformEntity CreateEntity(FF_FlowDirection direction, UdpFreeformEntity udpEntity) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "CreateEntity")) { IFreeformEntity result = default(IFreeformEntity); try { // get the gmu factory for this ip address _GMU_Factory gmuFactory = GetGMUFactory(udpEntity.AddressString); if (gmuFactory != null && udpEntity.RawData != null) { result = gmuFactory[direction].CreateEntity(udpEntity.RawData, udpEntity.AddressString); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected virtual void OnModifyMessage(ILogMethod method, FFMsg_H2G message) { }
internal override ExecutionStep ExecuteInternal(ILogMethod method, IFreeformEntity_Msg request) { return base.ExecuteInternal(method, request); }
protected abstract bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message);