Exemplo n.º 1
0
        public override void GetTargetData(IFreeformEntity_MsgTgt tgt, ref List <byte> buffer)
        {
            FFTgt_H2G_GIM_GameIDInfo tgt2 = tgt as FFTgt_H2G_GIM_GameIDInfo;

            // display message length & message
            byte[] display = tgt2.DisplayMessage.GetASCIIBytesValue();
            this.AddTargetToBuffer(ref buffer, 2,
                                   new byte[][]
            {
                new byte[] { tgt2.EnableNetworkMessaging.ConvertToByte() },
                display,
            });

            // source ip address
            IPAddress ipAddr = tgt2.SourceAddress;

            this.AddTargetToBuffer(ref buffer, 3, ipAddr.GetAddressBytes());

            // asset number and game prefix
            if (tgt2.AssetNumberInt > 0)
            {
                this.AddTargetToBuffer(ref buffer, 4, tgt2.AssetNumberInt.GetBCDToBytes(4));
                byte[] pokerGamePrefix = tgt2.PokerGamePrefix.GetASCIIBytesValue();
                this.AddTargetToBuffer(ref buffer, 5, pokerGamePrefix);
            }
        }
Exemplo n.º 2
0
 protected override IFreeformEntity ParseBufferInternal(IFreeformEntity parent, IFreeformEntity rootEntity, ref IFreeformEntity entity, byte[] buffer, int offset,
     int length)
 {
     FFTgt_H2G_GIM_GameIDInfo tgt = new FFTgt_H2G_GIM_GameIDInfo();
     parent.Targets.Add(tgt);
     this.GetParserFromAppId((int)FF_AppId_GIM_SubTargets.GameIDInfo)
         .ParseBuffer(tgt, rootEntity, buffer, offset, length);
     return tgt;
 }
Exemplo n.º 3
0
        protected override IFreeformEntity ParseBufferInternal(IFreeformEntity parent, IFreeformEntity rootEntity, ref IFreeformEntity entity, byte[] buffer, int offset,
                                                               int length)
        {
            FFTgt_H2G_GIM_GameIDInfo tgt = new FFTgt_H2G_GIM_GameIDInfo();

            parent.Targets.Add(tgt);
            this.GetParserFromAppId((int)FF_AppId_GIM_SubTargets.GameIDInfo)
            .ParseBuffer(tgt, rootEntity, buffer, offset, length);
            return(tgt);
        }
Exemplo n.º 4
0
        protected override IFreeformEntity_MsgTgt CreateFreeformTarget(IMonitorEntity parent, IMonitorEntity_MsgTgt request)
        {
            MonTgt_H2G_GIM_GameIDInfo tgtSrc = request as MonTgt_H2G_GIM_GameIDInfo;
            if (tgtSrc != null)
            {
                FFTgt_B2B_GIM tgtDest = new FFTgt_B2B_GIM();
                FFTgt_H2G_GIM_GameIDInfo ffTgtGameIdInfo = new FFTgt_H2G_GIM_GameIDInfo()
                {
                    SourceAddress = tgtSrc.SourceAddress,
                    AssetNumberInt = tgtSrc.AssetNumberInt,
                    PokerGamePrefix = tgtSrc.PokerGamePrefix,
                    EnableNetworkMessaging = tgtSrc.EnableNetworkMessaging,
                };

                tgtDest.AddTarget(ffTgtGameIdInfo);
                return tgtDest;
            }
            return null;
        }
Exemplo n.º 5
0
 protected override void AddSubParsersInternal()
 {
     this.AddBufferEntityParser((int)FF_GmuId_GIM_GameIDInfo_H2G.DisplayMessage,
                                (int)FF_AppId_GIM_GameIDInfo_H2G.DisplayMessage,
                                (tgt, idx, len, buf) =>
     {
         FFTgt_H2G_GIM_GameIDInfo tgt2 = tgt as FFTgt_H2G_GIM_GameIDInfo;
         tgt2.EnableNetworkMessaging   = buf[0].ConvertToBoolean();
         tgt2.DisplayMessage           = buf.GetASCIIStringValue(1, -1);
         return(null);
     });
     this.AddBufferEntityParser((int)FF_GmuId_GIM_GameIDInfo_H2G.IPAddress,
                                (int)FF_AppId_GIM_GameIDInfo_H2G.IPAddress,
                                (tgt, idx, len, buf) =>
     {
         FFTgt_H2G_GIM_GameIDInfo tgt2 = tgt as FFTgt_H2G_GIM_GameIDInfo;
         tgt2.SourceAddress            = new IPAddress(buf);
         return(null);
     });
     this.AddBufferEntityParser((int)FF_GmuId_GIM_GameIDInfo_H2G.AssetNumber,
                                (int)FF_AppId_GIM_GameIDInfo_H2G.AssetNumber,
                                (tgt, idx, len, buf) =>
     {
         FFTgt_H2G_GIM_GameIDInfo tgt2 = tgt as FFTgt_H2G_GIM_GameIDInfo;
         tgt2.AssetNumberInt           = buf.GetBytesToBCDInt32(0, len);
         //tgt2.HasAssetNumber &= (tgt2.AssetNumber.Length > 0);
         return(null);
     });
     this.AddBufferEntityParser((int)FF_GmuId_GIM_GameIDInfo_H2G.PokerGamePrefix,
                                (int)FF_AppId_GIM_GameIDInfo_H2G.PokerGamePrefix,
                                (tgt, idx, len, buf) =>
     {
         FFTgt_H2G_GIM_GameIDInfo tgt2 = tgt as FFTgt_H2G_GIM_GameIDInfo;
         tgt2.PokerGamePrefix          = buf.GetASCIIStringValue();
         //tgt2.HasAssetNumber &= !tgt2.PokerGamePrefix.IsEmpty();
         return(null);
     });
 }
Exemplo n.º 6
0
        public void Buf2FF_GIM_GameIDInfo_H2G()
        {
            FFMsg_H2G msg = FreeformEntityFactory.CreateEntity<FFMsg_H2G>(FF_FlowDirection.H2G,
                new FFCreateEntityRequest_H2G()
                {
                    PollCode = FF_AppId_H2G_PollCodes.FreeformNoResponse,
                    SessionID = FF_AppId_SessionIds.GIM,
                    TransactionID = 1,
                });

            FFTgt_B2B_GIM tgt = new FFTgt_B2B_GIM();
            msg.AddTarget(tgt);

            FFTgt_H2G_GIM_GameIDInfo tgt2 = new FFTgt_H2G_GIM_GameIDInfo();
            tgt.AddTarget(tgt2);

            tgt2.AssetNumberInt = 00012345;
            tgt2.DisplayMessage = "Success!";
            tgt2.EnableNetworkMessaging = true;
            tgt2.SourceAddress = Extensions.GetIpAddress(-1);
            tgt2.PokerGamePrefix = "G";

            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]");
        }