Ejemplo n.º 1
0
        internal override IFreeformEntity ParseBufferInternal(ref IFreeformEntity entity, IFreeformEntity rootEntity, int id, byte[] buffer)
        {
            if (buffer.Length >= 3)
            {
                FF_AppId_GameMessage_ProtocolTypes   protocolType = buffer[0].GetAppId <FF_GmuId_GameMessage_ProtocolTypes, FF_AppId_GameMessage_ProtocolTypes>();
                FF_AppId_GameMessage_GameResponses   responseType = buffer[1].GetAppId <FF_GmuId_GameMessage_GameResponses, FF_AppId_GameMessage_GameResponses>();
                FFTgt_H2G_GameMessage_MessageRequest target2      = null;

                if (protocolType == FF_AppId_GameMessage_ProtocolTypes.SAS)
                {
                    int longPollCommand = (int)buffer[2];
                    if (_createCommands.ContainsKey(longPollCommand))
                    {
                        target2 = _createCommands[longPollCommand]();
                    }
                    target2.IsGameResponseExpected = responseType;
                    if (buffer.Length > 3)
                    {
                        target2.MessageData = buffer.CopyToBuffer(3, buffer.Length - 3);
                    }
                }
                else
                {
                    var target = new FFTgt_H2G_GameMessage_MessageRequest();
                    target2 = target;
                    target.IsGameResponseExpected = responseType;
                    target.MessageData            = buffer.CopyToBuffer(2, buffer.Length - 2);
                }
                return(target2);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public override void GetTargetData(IFreeformEntity_MsgTgt tgt, ref List <byte> buffer)
        {
            FFTgt_H2G_GameMessage_MessageRequest tgtSrc = tgt as FFTgt_H2G_GameMessage_MessageRequest;

            buffer.Add(tgtSrc.ProtocolType.GetGmuIdInt8());
            buffer.Add(tgtSrc.IsGameResponseExpected.GetGmuIdInt8());
            if (tgtSrc is FFTgt_H2G_GameMessage_SASCommand)
            {
                buffer.Add((byte)(tgtSrc as FFTgt_H2G_GameMessage_SASCommand).LongPollCommand);
            }
            byte[] rawData = tgtSrc.ToRawData();
            if (rawData != null &&
                rawData.Length > 0)
            {
                buffer.AddRange(rawData);
            }
            if (tgtSrc.MessageData != null &&
                tgtSrc.MessageData.Length > 0)
            {
                buffer.AddRange(tgtSrc.MessageData);
            }
        }
Ejemplo n.º 3
0
        internal override IFreeformEntity ParseBufferInternal(ref IFreeformEntity entity, IFreeformEntity rootEntity, int id, byte[] buffer)
        {
            if (buffer.Length >= 3)
            {
                FF_AppId_GameMessage_ProtocolTypes protocolType = buffer[0].GetAppId<FF_GmuId_GameMessage_ProtocolTypes, FF_AppId_GameMessage_ProtocolTypes>();
                FF_AppId_GameMessage_GameResponses responseType = buffer[1].GetAppId<FF_GmuId_GameMessage_GameResponses, FF_AppId_GameMessage_GameResponses>();
                FFTgt_H2G_GameMessage_MessageRequest target2 = null;

                if (protocolType == FF_AppId_GameMessage_ProtocolTypes.SAS)
                {
                    int longPollCommand = (int)buffer[2];
                    if (_createCommands.ContainsKey(longPollCommand))
                        target2 = _createCommands[longPollCommand]();
                    target2.IsGameResponseExpected = responseType;
                    if (buffer.Length > 3)
                        target2.MessageData = buffer.CopyToBuffer(3, buffer.Length - 3);
                }
                else
                {
                    var target = new FFTgt_H2G_GameMessage_MessageRequest();
                    target2 = target;
                    target.IsGameResponseExpected = responseType;
                    target.MessageData = buffer.CopyToBuffer(2, buffer.Length - 2);
                }
                return target2;
            }
            return null;
        }