public static void ProcessMessage(FFMsg_G2H message) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "ProcessMessage(G2H)")) { try { FreeformExecutorBase executor = GetMessageType(message.SessionID); bool result = false; if (message.SessionID == FF_AppId_SessionIds.GIM) { result = executor.ProcessMessage(message); } else { if (UpdateInstallationNo(ref message)) { result = executor.ProcessMessage(message); } } if (!result) { Log.Info("Freeform message received before GIM message."); } } catch (Exception ex) { method.Exception(ex); } } }
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); }
static void ExecutionStepsTest() { //var d = new ExecutionStepDictionary(); //d.CreateExecutionSteps(ExecutionStepDeviceTypes.Simulator, null, null); //return; FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ResponseRequest, SessionID = FF_AppId_SessionIds.GIM, TransactionID = 1, IPAddress = Extensions.GetIpAddressString(-1), }); FFTgt_B2B_GIM tgt = new FFTgt_B2B_GIM(); msg.AddTarget(tgt); FFTgt_G2H_GIM_GameIDInfo tgt2 = new FFTgt_G2H_GIM_GameIDInfo(); tgt.AddTarget(tgt2); tgt2.AssetNumber = "00012345"; tgt2.SerialNumber = "00012345"; ExecutionStepFactory.Current.Execute(msg); }
static void TestGIM() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { Command = FF_AppId_G2H_Commands.ResponseRequest, MessageType = FF_AppId_G2H_MessageTypes.FreeForm, SessionID = FF_AppId_SessionIds.GIM, IPAddress = "192.168.10.2", SkipTransactionId = true, }); FFTgt_B2B_GIM gim = new FFTgt_B2B_GIM() { GIMData = new FFTgt_G2H_GIM_GameIDInfo() { AssetNumber = "1111", GMUNumber = "1112", SerialNumber = "1113", ManufacturerID = "1114", MACAddress = "1115", SASVersion = "1116", GMUVersion = "1117", } }; msg.AddTarget(gim); FFMsgHandlerFactory.Current.Execute(msg); }
public void Entity_TicketVoid_G2H() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ResponseRequest, SessionID = FF_AppId_SessionIds.Tickets, TransactionID = 1, }); FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo(); msg.AddTarget(tgt); FFTgt_G2H_Ticket_Void tgt2 = new FFTgt_G2H_Ticket_Void(); tgt.AddTarget(tgt2); tgt2.Barcode = "100000000078789098"; tgt2.Error = FF_AppId_TicketPrintStatus.PaperOut; byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); Assert.AreEqual(sBuffer, "[05][A2][BC][8A][01][00][01][00][01][00][0D][0A][0B][02][10][00][00][00][00][78][78][90][98][01][C3]"); }
public void Buf2FF_GIM_GameIDInfo_G2H() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ResponseRequest, SessionID = FF_AppId_SessionIds.GIM, TransactionID = 1, }); FFTgt_B2B_GIM tgt = new FFTgt_B2B_GIM(); msg.AddTarget(tgt); FFTgt_G2H_GIM_GameIDInfo tgt2 = new FFTgt_G2H_GIM_GameIDInfo(); tgt.AddTarget(tgt2); tgt2.AssetNumber = "12345"; byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); Assert.AreEqual(sBuffer, "[05][FB][17][01][00][01][00][01][00][1C][17][1A][02][09][01][53][75][63][63][65][73][73][21][03][04][0A][02][1E][68][04][04][00][01][23][45][05][01][47][3C]"); }
public void Entity_TicketRedeem_End_G2H() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ResponseRequest, SessionID = FF_AppId_SessionIds.Tickets, TransactionID = 1, }); FFTgt_B2B_TicketInfo tgt = new FFTgt_B2B_TicketInfo(); msg.AddTarget(tgt); FFTgt_G2H_Ticket_Redemption_Close tgt2 = new FFTgt_G2H_Ticket_Redemption_Close(); tgt.AddTarget(tgt2); tgt2.Status = FF_AppId_TicketRedemption_Close_Status.Success; tgt2.Barcode = "100000000078789098"; tgt2.Amount = 9856; tgt2.Type = FF_AppId_TicketTypes.Cashable; byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); Assert.AreEqual(sBuffer, "[05][A2][BC][8A][01][00][01][00][01][00][12][0A][10][04][00][10][00][00][00][00][78][78][90][98][00][00][98][56][00][CA]"); }
public void Buffer_WithdrawalRequest() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ResponseRequest, SessionID = FF_AppId_SessionIds.ECash, TransactionID = 1, }); FFTgt_B2B_EFT tgt = new FFTgt_B2B_EFT(); msg.AddTarget(tgt); FFTgt_G2H_EFT_WithdrawalRequest tgt2 = new FFTgt_G2H_EFT_WithdrawalRequest(); tgt.AddTarget(tgt2); tgt2.AccountType = FF_AppId_EFT_AccountTypes.PlayerCash; tgt2.AmountRequested = 2520; tgt2.PlayerCardNumber = "1000500026"; tgt2.Pin = "0652"; byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); Assert.IsNotNull(buffer); }
private static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_FlowInitiation flowInitiation, FFTgt_B2B_TicketInfoData data) { FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest, FF_AppId_G2H_MessageTypes.FreeForm, FF_AppId_SessionIds.Tickets, true, WrapTargetAndReturn(data)); msg.FlowInitiation = flowInitiation; return(msg); }
private static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_FlowInitiation flowInitiation, FFTgt_B2B_GameMessage data) { FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest, FF_AppId_G2H_MessageTypes.FreeForm, FF_AppId_SessionIds.GameMessage, false, data); msg.FlowInitiation = flowInitiation; return(msg); }
private static FFMsg_G2H WrapMessageAndReturnG2H(string ipAddress, FF_FlowInitiation flowInitiation, bool isSecured, FFTgt_B2B_EFT_Data data) { FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest, FF_AppId_G2H_MessageTypes.FreeForm, FF_AppId_SessionIds.ECash, (isSecured ? WrapTargetAndReturnSecured(data) : WrapTargetAndReturn(data))); msg.FlowInitiation = flowInitiation; return(msg); }
internal static FFMsg_G2H WrapMessageAndReturn(string ipAddress, FF_FlowInitiation flowInitiation, FF_AppId_SessionIds sessionId, params FFTgt_B2B_GMUVarAction_Data[] datas) { FFMsg_G2H msg = FreeformEntityFactory.CreateG2HMessage(ipAddress, FF_AppId_G2H_Commands.ResponseRequest, FF_AppId_G2H_MessageTypes.FreeForm, sessionId, WrapTargetsAndReturn(datas)); msg.FlowInitiation = flowInitiation; return(msg); }
protected override void OnModifyMessage(ILogMethod method, FFMsg_G2H message) { FFTgt_B2B_Security target = message.GetTarget <FFTgt_B2B_Security>(); if (target == null || target.Targets.Count == 0) { throw new ArgumentNullException("No valid encrypted targets found"); } }
static void TestECashBalanceRequest() { FFMsg_G2H msg = ECashHelper.BalanceRequest("192.168.10.2", "1000012345", "0124"); byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); var msg2 = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, buffer); FFTgt_G2H_GMUEvent_StdData std2 = msg2.EntityPrimaryTarget as FFTgt_G2H_GMUEvent_StdData; ExecutionStepFactory.Current.Execute(msg); }
internal static bool ProcessMessage(FFMsg_G2H request) { if (_executorType == 0) { return(_executor.ProcessMessage(request)); } else { FreeformExecutorFactory.ProcessMessage(request); return(true); } }
static void TestPlayerCardOut() { FFMsg_G2H msg = GMUStdEventHelper.PlayerCardOut("192.168.10.2", "1000012345"); FFTgt_G2H_GMUEvent_StdData std = msg.EntityPrimaryTarget as FFTgt_G2H_GMUEvent_StdData; std.SMICode = "12"; byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string sBuffer = buffer.GetConvertBytesToHexString(string.Empty); var msg2 = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, buffer); FFTgt_G2H_GMUEvent_StdData std2 = msg2.EntityPrimaryTarget as FFTgt_G2H_GMUEvent_StdData; ExecutionStepFactory.Current.Execute(msg); }
protected virtual IThreadPoolExecutor <FFMsg_G2H> GetExecutorG2H(FFMsg_G2H msg) { switch (msg.SessionID) { case FF_AppId_SessionIds.A1: return(_g2hExecutor_NonPrio); case FF_AppId_SessionIds.GIM: return(_g2hExecutor_GIM); default: return(_g2hExecutor_Prio); } }
public virtual bool ProcessMessage(FFMsg_G2H message) { bool retval = true; try { g2hQueue.AddToQueue(message); } catch (Exception ex) { retval = false; Log.Exception(ex); } return(retval); }
/// <summary> /// Converts Freeform entity message to Moitor entity message /// </summary> /// <param name="request"></param> /// <returns></returns> public MonMsg_G2H CreateEntity(FFMsg_G2H request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CreateEntity")) { MonMsg_G2H result = null; try { result = _monMsgParserG2H.CreateEntity(null, request) as MonMsg_G2H; if (result == null) { Log.Info("Unable to create the monitor message"); return(null); } Stack <IFreeformEntity> st = new Stack <IFreeformEntity>(); request.CopyTo(st); // push all the grandchildren into stack and process again while (st.Count != 0) { IFreeformEntity child = st.Pop() as IFreeformEntity; if (child.IsLeafNode) { continue; } MonitorEntity_MsgTgt target = this.CreateTargetEntity(child as IFreeformEntity_MsgTgt); if (target != null) { result.AddTarget(target); } if (target is MonTgt_G2H_Status_CardBase) { result.CardNumber = (target as MonTgt_G2H_Status_CardBase).CardNumber; } child.CopyTo(st); } } catch (Exception ex) { method.Exception(ex); } return(result); } }
protected virtual bool OnProcessMessageG2H(ILogMethod method, FFMsg_G2H message) { if (message == null) { method.Info("Freeform message (G2H) was null."); return(false); } // further modifiy the message if (this.OnModifyMessageG2H(method, message)) { return(this.PostMessageToMonitorServer(method, message)); } return(false); }
private void btnSend_Click(object sender, RoutedEventArgs e) { using (ILogMethod method = Log.LogMethod("", "Method")) { try { string input = "[C0][A8][02][10][05][A2][BC][17][B1][00][01][00][01][00][5E][17][5C][01][5A][01][05][30][30][30][30][32][02][05][31][32][33][34][35][03][02][42][39][04][0C][30][30][30][30][30][30][30][31][32][33][34][35][05][06][00][16][80][01][47][4D][06][03][36][30][31][07][2B][4F][63][74][20][31][38][20][32][30][31][33][20][31][35][3A][35][32][3A][31][37][20][56][65][72][2D][33][30][30][2E][30][35][2E][31][34][61][20][4F][70][74][69][6F][6E][73][C4]"; FFMsg_G2H g2h = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, FreeformHelper.GetBufferFromHexString(input)); IFreeformEntity_MsgTgt tgt = g2h.Targets[0]; FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { Command = FF_AppId_G2H_Commands.ResponseRequest, MessageType = FF_AppId_G2H_MessageTypes.FreeForm, SessionID = FF_AppId_SessionIds.GIM, TransactionID = 0xB1, IPAddress = "192.168.2.16" }); FFTgt_B2B_GIM gim = new FFTgt_B2B_GIM() { GIMData = new FFTgt_G2H_GIM_GameIDInfo() { AssetNumber = txtAssetNumber.Text, GMUNumber = txtGMUNumber.Text, SerialNumber = txtSerialNumber.Text, ManufacturerID = txtManufacturerID.Text, MACAddress = txtMACAddress.Text, SASVersion = txtSASVersion.Text, GMUVersion = txtGMUVersion.Text, } }; msg.AddTarget(gim); byte[] bytes = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); string data = FreeformEntityFactory.CreateBufferHexString(FF_FlowDirection.G2H, msg); _socket.Send(bytes, bytes.Length, _ep); } catch (Exception ex) { method.Exception(ex); } } }
public bool ProcessMessage(FFMsg_G2H message, IList <MonitorEntity_MsgTgt> monitorTargets) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessMessage(G2H)")) { bool result = default(bool); try { result = this.OnProcessMessageInternal(message, monitorTargets); } catch (Exception ex) { method.Exception(ex); } return(result); } }
public bool ProcessMessage(FFMsg_G2H message) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessMessage(G2H)")) { bool result = default(bool); try { result = this.ProcessMessageInternal(method, message); } catch (Exception ex) { method.Exception(ex); } return(result); } }
void OnProcessG2HMessageFromWorker(FFMsg_G2H request) { bool proceed = true; if (request.SessionID != FF_AppId_SessionIds.GIM) { proceed = PopulateInstallationNo(request); } if (!proceed) { Log.Info("Freeform message received before GIM message."); } else { FFMsgHandlerFactory.Current.Execute(request); } }
static void EncryptSecurity() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H_ResponseRequired() { Command = FF_AppId_G2H_Commands.ResponseRequest, MessageType = FF_AppId_G2H_MessageTypes.FreeForm, SessionID = FF_AppId_SessionIds.Security, TransactionID = 0xB1, IPAddress = IPADDR, }); FFTgt_B2B_Security tgt = new FFTgt_B2B_Security_ResponseRequired() { SecurityData = new FFTgt_B2B_Security_KeyExchange_Request(), }; msg.AddTarget(tgt); byte[] buf2 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); var msgF = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, buf2); FFMsg_H2G msg2 = msg.CopyTo(FF_FlowDirection.H2G, new FFCreateEntityRequest_H2G_ResponseRequired() { PollCode = FF_AppId_H2G_PollCodes.FreeformResponse, }) as FFMsg_H2G; FFTgt_B2B_Security tgt2 = new FFTgt_B2B_Security() { SecurityData = new FFTgt_B2B_Security_KeyExchange_PartialKey() { PartialKey = new byte[] { 10, 11, 12, 34, 56, 78, 96, 89, 44 }, } }; msg2.AddTarget(tgt2); byte[] buf3 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg2); var msgF3 = FreeformEntityFactory.CreateEntity <FFMsg_H2G>(FF_FlowDirection.H2G, buf3, IPADDR); ExecutionStepFactory.Current.Execute(msg); //byte[] buf1 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.H2G, msg2); //UdpFreeformEntity buffer = FreeformEntityFactory.CreateUdpEntity(FF_FlowDirection.G2H, buf1); //IFreeformEntity ff = FreeformEntityFactory.CreateEntity(FF_FlowDirection.G2H, buffer); //byte[] buf2 = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, msg); }
protected virtual bool PostMessageToMonitorServer(ILogMethod method, FFMsg_G2H 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); }
public void GMUEvent_Standard() { FFMsg_G2H msg = FreeformEntityFactory.CreateEntity <FFMsg_G2H>(FF_FlowDirection.G2H, new FFCreateEntityRequest_G2H() { MessageType = FF_AppId_G2H_MessageTypes.FreeForm, Command = FF_AppId_G2H_Commands.ACK, SessionID = FF_AppId_SessionIds.A1, TransactionID = 1, }); FFTgt_G2H_GMUEvent tgt = new FFTgt_G2H_GMUEvent(); msg.AddTarget(tgt); FFTgt_G2H_GMUEvent_StdData std = new FFTgt_G2H_GMUEvent_StdData(); std.ExceptionCode = FF_AppId_GMUEventExceptionCodes.Jackpot; tgt.AddTarget(std); byte[] buffer = FreeformEntityFactory.CreateBuffer(FF_FlowDirection.G2H, tgt); Assert.IsNotNull(buffer); }
public bool ProcessMessage(FFMsg_G2H message) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessMessage(G2H)")) { bool result = default(bool); try { var sessionId = (int)message.SessionID; result = _handlers.ContainsKey(sessionId) ? _handlers[sessionId].ProcessMessage(message) : _genericHandler.ProcessMessage(message); } catch (Exception ex) { method.Exception(ex); } return(result); } }
public virtual bool ProcessMessage(FFMsg_G2H request) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessG2HMessage")) { bool result = false; try { // find the queue executor by session id IThreadPoolExecutor <FFMsg_G2H> executor = this.GetExecutorG2H(request); executor.QueueWorkerItem(request); result = true; } catch (Exception ex) { method.Exception(ex); } return(result); } }
public MonMsg_G2H CreateEntity(FFMsg_G2H request, IList <MonitorEntity_MsgTgt> targets) { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "CreateEntity")) { MonMsg_G2H result = null; try { result = _monMsgParserG2H.CreateEntity(null, request) as MonMsg_G2H; if (result == null) { Log.Info("Unable to create the monitor message"); return(null); } foreach (var target in targets) { if (target != null) { if (target is MonTgt_G2H_Status_CardBase) { result.CardNumber = (target as MonTgt_G2H_Status_CardBase).CardNumber; } else if (target is MonTgt_G2H_Meters) { result.Meters = target as MonTgt_G2H_Meters; continue; } result.Targets.Add(target); } } } catch (Exception ex) { method.Exception(ex); } return(result); } }