protected override bool OnProcessMessageG2HExternal_GMU(FFTgtExecutionContext context, IFreeformEntity_MsgTgt target) { FFTgt_G2H_Ticket_Printed_Request tgtSrc = target as FFTgt_G2H_Ticket_Printed_Request; using (TicketIDInfo idInfo = new TicketIDInfo(tgtSrc.BarCode)) { tgtSrc.SequenceNo = idInfo.SequenceNumber; } return base.OnProcessMessageG2HExternal_GMU(context, target); }
protected override bool OnProcessMessageG2HExternal_GMU(FFTgtExecutionContext context, IFreeformEntity_MsgTgt target) { FFTgt_G2H_Ticket_Printed_Request tgtSrc = target as FFTgt_G2H_Ticket_Printed_Request; using (TicketIDInfo idInfo = new TicketIDInfo(tgtSrc.BarCode)) { tgtSrc.SequenceNo = idInfo.SequenceNumber; } return(base.OnProcessMessageG2HExternal_GMU(context, target)); }
internal static FFMsg_G2H PrintTicket(string ipAddress, double amount, FF_AppId_TicketTypes type) { TicketIDInfo ticketID = GenerateTicket(ipAddress, amount); if (ticketID == null) { return(null); } return(WrapMessageAndReturn(ipAddress, FF_FlowInitiation.Gmu, new FFTgt_G2H_Ticket_Printed_Request() { BarCode = ticketID.Barcode, Amount = amount, Type = type, })); }
private static TicketIDInfo GenerateTicket(string key, double Amount) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "GenerateTicket")) { TicketIDInfo result = default(TicketIDInfo); TicketGlobal tk = ModuleHelper.Current.GetTicketGlobal(key); if (tk == null) { return(null); } try { result = new TicketIDInfo(); // ticket number tk.TicketNumber += 1; result.UnpackedID.CopyToBufferASCII(tk.TicketNumber.GetStringToBytes(5), 9, 5); // casino id result.UnpackedID.CopyToBufferASCII(ModuleHelper.Current.TicketLocationCode.GetASCIIBytesValue(4), 0, 4); // slot id result.SlotID = tk.SlotID; result.UnpackedID.CopyToBufferASCII(result.SlotID.GetStringToBytes(4), 4, 5); // crc uint crc = SDGTicketGenerator.GenerateCRC(result.UnpackedID, (long)Amount, tk.TicketKey); result.UnpackedID.CopyToBufferASCII(crc.GetStringToBytes(3), 14, 3); // check digit result.UnpackedID[17] = SDGTicketGenerator.CheckDigit(result.UnpackedID, 17); // Amount result.Amount = Amount; } catch (Exception ex) { method.Exception(ex); } return(result); } }
private static TicketIDInfo GenerateTicket(string key, double Amount) { using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "GenerateTicket")) { TicketIDInfo result = default(TicketIDInfo); TicketGlobal tk = ModuleHelper.Current.GetTicketGlobal(key); if (tk == null) return null; try { result = new TicketIDInfo(); // ticket number tk.TicketNumber += 1; result.UnpackedID.CopyToBufferASCII(tk.TicketNumber.GetStringToBytes(5), 9, 5); // casino id result.UnpackedID.CopyToBufferASCII(ModuleHelper.Current.TicketLocationCode.GetASCIIBytesValue(4), 0, 4); // slot id result.SlotID = tk.SlotID; result.UnpackedID.CopyToBufferASCII(result.SlotID.GetStringToBytes(4), 4, 5); // crc uint crc = SDGTicketGenerator.GenerateCRC(result.UnpackedID, (long)Amount, tk.TicketKey); result.UnpackedID.CopyToBufferASCII(crc.GetStringToBytes(3), 14, 3); // check digit result.UnpackedID[17] = SDGTicketGenerator.CheckDigit(result.UnpackedID, 17); // Amount result.Amount = Amount; } catch (Exception ex) { method.Exception(ex); } return result; } }
static void Main(string[] args) { Console.Title = "ExCommsServer Testing"; Console.SetWindowSize(80, 58); BMCRegistryHelper.ActiveInstallationType = BMCCategorizedInstallationTypes.Exchange; Log.AddAppFileLoggingSystem(); Log.GlobalWriteToExternalLog += Log_GlobalWriteToExternalLog; TestPIDData(); //MonMsg_H2G monH2G = new MonMsg_H2G(); //MonTgt_H2G_AckNack nack = new MonTgt_H2G_AckNack(); //nack.Nack = true; //monH2G.AddTarget(nack); //var msg2 = MonitorEntityFactory.CreateEntity(monH2G); //var ffBuffer = FreeformEntityFactory.CreateBuffer(msg2); var configStore = ExMonitorServerConfigStoreFactory.Store; var cat = ErrorEventCategoryFactory.Categories; string barcode = "889900027000052237"; TicketIDInfo idInfo = new TicketIDInfo(barcode); int seqno = idInfo.SequenceNumber; //byte[] packed = FreeformHelper.GetBCDToBytes(sUnpacked, sUnpacked.Length / 2); //string sUnpacked2 = packed.GetBCDValueString(0, 0, 9); //EncryptSecurity(); //var dr = ExCommsDataContext.Current.GetMeterDeltaForPlayerSession(27, "1000012345", "IR"); //ExecutionStepsTest(); //return; //ExCommsHostingModuleTypeHelper.Current.SetAll(); //_server = new ExCommsServerImpl(ExecutorServiceFactory.CreateExecutorService()); //_server.Start(); IExecutorService exec = ExecutorServiceFactory.CreateExecutorService(); //ExecutionStepFactory.Initialize(exec, false, ExecutionStepDeviceTypes.GMU); //FFMsgHandlerFactory.Initialize(exec, FFTgtHandlerDeviceTypes.GMU, () => //{ // return new FFMsgTransmitter(); //}); MonTgt_G2H_GIM_GameIDInfo target = new MonTgt_G2H_GIM_GameIDInfo(); MonTgt_G2H_GVA_TED_Request r = new MonTgt_G2H_GVA_TED_Request(); //TestGIM(); //Console.ForegroundColor = ConsoleColor.Cyan; //GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY, IPADDR); //GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY, IPADDR); //Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Start ExComms Server?"); Console.ResetColor(); string anser = "y";// Console.ReadLine(); if (anser == "y") { var activators = MEFHelper.GetExportedValues<IExCommsServerHostFactoryActivator>(); ExCommsServerHostFactoryActivatorFactory factory = new ExCommsServerHostFactoryActivatorFactory(exec, ExCommsHostingModuleType.CommunicationServer | ExCommsHostingModuleType.MonitorServer4CommsServer | ExCommsHostingModuleType.MonitorServer4MonProcessor , activators); factory.Start(); } long ticks = DateTime.Now.Ticks; byte[] lohi = FFDataTypeHelper.GetInt64Bytes(ticks, FFEndianType.LittleEndian); //TestGIM(); while (true) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Press any key to continue..."); Console.ResetColor(); string s = Console.ReadLine(); if (s == "q") return; //TestEncryptedTicketMessage(); //InitKeyExchangeStart(); //if (s == "k1") InitKeyExchangeStartG2H(); //if (s == "k2") InitKeyExchangeEnd(); //if (s == "t") GenerateKeys(SECURITY_KEY_INDEX.TICKET_KEY); //if (s == "e") GenerateKeys(SECURITY_KEY_INDEX.EFT_KEY); if (s == "g") ExecutionStepsTest(); if (s == "ss") EncryptSecurity(); if (s == "pci") TestPlayerCardIn(); if (s == "pco") TestPlayerCardOut(); if (s == "bal") TestECashBalanceRequest(); } //TestKeyExchangePartialKey(); return; //short sval = 9999; //short ss1 = sval; //List<byte> ll = new List<byte>(); //while (true) //{ // byte b1 = (byte)(ss1 % 10); // ll.Add(b1); // ss1 /= 10; //} byte[] b1234 = new byte[] { 0x12, 0x34, 0x56, 0x78 }; ulong u = b1234.GetBytesToBCDUInt64(0, 4); int v = 99999; byte b1 = (byte)(v & 0x0F); byte b2 = (byte)((v >> 4) & 0x0F); byte[] buf = "1000500026".GetBCDToBytes(5); byte[] iv = FFDataTypeHelper.GetInt32Bytes(99999, FFEndianType.LittleEndian); byte[] sb1 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.LittleEndian); byte[] sb2 = FFDataTypeHelper.GetInt16Bytes(9999, FFEndianType.BigEndian); short s1 = FFDataTypeHelper.GetInt16(sb1, FFEndianType.LittleEndian); short s2 = FFDataTypeHelper.GetInt16(sb2, FFEndianType.BigEndian); string cc = "1A345"; byte[] b = cc.GetHexBytesValue(2); //FF_AppId_SessionIds sval = FFEnumParserFactory.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>(FF_GmuId_SessionIds.ECash); //FF_GmuId_SessionIds ss2 = FFEnumParserFactory.GetGmuId<FF_AppId_SessionIds, FF_GmuId_SessionIds>(FF_AppId_SessionIds.GIM); //byte b = 23; //FF_AppId_SessionIds ss3 = b.GetAppId<FF_GmuId_SessionIds, FF_AppId_SessionIds>(); }