Example #1
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case LabelTag:
                    if (!pStream.ReadVariable(out mLabel))
                    {
                        return(false);
                    }
                    break;

                case EpochTag:
                    if (!pStream.ReadVariable(out mEpoch))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #2
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ImportedServiceIdTag:
                {
                    MemoryStream stream = null;
                    if (!pStream.ReadPrefixed(out stream))
                    {
                        return(false);
                    }
                    uint value = 0;
                    while (stream.ReadVariable(out value))
                    {
                        mImportedServiceIds.Add((uint)value);
                    }
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }
Example #3
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ClientIdTag:
                    mHasClientId = true;
                    if (!pStream.ReadPackable(mClientId))
                    {
                        return(false);
                    }
                    break;

                case BindRequestTag:
                    mHasBindRequest = true;
                    if (!pStream.ReadPackable(mBindRequest))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #4
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case HostTag:
                    if (!pStream.ReadPackable(mHost))
                    {
                        return(false);
                    }
                    break;

                case ObjectIdTag:
                    mHasObjectId = true;
                    if (!pStream.ReadVariable(out mObjectId))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #5
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case HashTag:
                    if (!pStream.ReadFixed32(out mHash))
                    {
                        return(false);
                    }
                    break;

                case IdTag:
                    if (!pStream.ReadVariable(out mId))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #6
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ContentHandleTag:
                {
                    ContentHandle contentHandle = new ContentHandle();
                    if (!pStream.ReadPackable(contentHandle))
                    {
                        return(false);
                    }
                    mContentHandles.Add(contentHandle);
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }
 public static bool ReadKey(this MemoryStream pMemoryStream, out EMessageKeyType pType, out uint pTag)
 {
     pType = EMessageKeyType.Variable;
     pTag = 0;
     uint key = 0;
     if (!pMemoryStream.ReadVariable(out key)) return false;
     pType = (EMessageKeyType)(key & 0x07);
     pTag = key >> 3;
     return true;
 }
Example #8
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ServerIdTag:
                    if (!pStream.ReadPackable(mServerId))
                    {
                        return(false);
                    }
                    break;

                case ClientIdTag:
                    mHasClientId = true;
                    if (!pStream.ReadPackable(mClientId))
                    {
                        return(false);
                    }
                    break;

                case BindResultTag:
                    mHasBindResult = true;
                    if (!pStream.ReadVariable(out mBindResult))
                    {
                        return(false);
                    }
                    break;

                case BindResponseTag:
                    mHasBindResponse = true;
                    if (!pStream.ReadPackable(mBindResponse))
                    {
                        return(false);
                    }
                    break;

                case ConnectionMeteringContentHandlesTag:
                    mHasConnectionMeteringContentHandles = true;
                    if (!pStream.ReadPackable(mConnectionMeteringContentHandles))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #9
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case RegionTag:
                {
                    if (!pStream.ReadFixed32(out mRegion))
                    {
                        return(false);
                    }
                    break;
                }

                case UsageTag:
                {
                    if (!pStream.ReadFixed32(out mUsage))
                    {
                        return(false);
                    }
                    break;
                }

                case HashTag:
                {
                    if (!pStream.ReadPrefixed(out mHash))
                    {
                        return(false);
                    }
                    break;
                }

                case ProtoUrlTag:
                {
                    mHasProtoUrl = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mProtoUrl))
                    {
                        return(false);
                    }
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }
        public static bool ReadKey(this MemoryStream pMemoryStream, out EMessageKeyType pType, out uint pTag)
        {
            pType = EMessageKeyType.Variable;
            pTag  = 0;
            uint key = 0;

            if (!pMemoryStream.ReadVariable(out key))
            {
                return(false);
            }
            pType = (EMessageKeyType)(key & 0x07);
            pTag  = key >> 3;
            return(true);
        }
Example #11
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ObjectAddressTag:
                    if (!pStream.ReadPackable(mObjectAddress))
                    {
                        return(false);
                    }
                    break;

                case StatusTag:
                    if (!pStream.ReadVariable(out mStatus))
                    {
                        return(false);
                    }
                    break;

                case ServiceHashTag:
                    if (!pStream.ReadVariable(out mServiceHash))
                    {
                        return(false);
                    }
                    break;

                case MethodIdTag:
                    if (!pStream.ReadVariable(out mMethodId))
                    {
                        return(false);
                    }
                    break;

                default: return(false);
                }
            }

            return(true);
        }
Example #12
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ErrorCodeTag:
                    if (!pStream.ReadVariable(out mErrorCode))
                    {
                        return(false);
                    }
                    break;

                case AccountTag:
                    mHasAccount = true;
                    if (!pStream.ReadPackable(mAccount))
                    {
                        return(false);
                    }
                    break;

                case GameAccountTag:
                {
                    EntityId entityId = new EntityId();
                    if (!pStream.ReadPackable(entityId))
                    {
                        return(false);
                    }
                    mGameAccounts.Add(entityId);
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }
Example #13
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ImportedServiceHashTag:
                {
                    MemoryStream stream = null;
                    if (!pStream.ReadPrefixed(out stream))
                    {
                        return(false);
                    }
                    uint hash = 0;
                    while (stream.ReadFixed32(out hash))
                    {
                        mImportedServiceHashes.Add(hash);
                    }
                    break;
                }

                case ExportedServiceTag:
                {
                    BoundService boundService = new BoundService();
                    if (!pStream.ReadPackable(boundService))
                    {
                        return(false);
                    }
                    mExportedServices.Add(boundService);
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }
 public static void WriteKey(this MemoryStream pMemoryStream, EMessageKeyType pType, uint pTag)
 {
     pMemoryStream.WriteVariable((pTag << 3) | (byte)pType);
 }
 public static void WriteKey(this MemoryStream pMemoryStream, EMessageKeyType pType, uint pTag)
 {
     pMemoryStream.WriteVariable((pTag << 3) | (byte)pType);
 }
Example #16
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ProgramTag:
                    mHasProgram = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mProgram))
                    {
                        return(false);
                    }
                    break;

                case PlatformTag:
                    mHasPlatform = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mPlatform))
                    {
                        return(false);
                    }
                    break;

                case LocaleTag:
                    mHasLocale = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mLocale))
                    {
                        return(false);
                    }
                    break;

                case EmailTag:
                    mHasEmail = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mEmail))
                    {
                        return(false);
                    }
                    break;

                case VersionTag:
                    mHasVersion = true;
                    if (!pStream.ReadPrefixed(Encoding.GetEncoding(1252), out mVersion))
                    {
                        return(false);
                    }
                    break;

                case ApplicationVersionTag:
                    mHasApplicationVersion = true;
                    if (!pStream.ReadVariable(out mApplicationVersion))
                    {
                        return(false);
                    }
                    break;

                case CookieOnlyTag:
                {
                    uint cookieOnly = 0;
                    mHasCookieOnly = true;
                    if (!pStream.ReadVariable(out cookieOnly))
                    {
                        return(false);
                    }
                    mCookieOnly = Convert.ToBoolean(cookieOnly);
                    break;
                }

                case UnknownTag:
                    mHasUnknown = true;
                    pStream.ReadFixed32(out mUnknown);
                    break;

                default: return(false);
                }
            }
            return(true);
        }
Example #17
0
        public bool Read(MemoryStream pStream)
        {
            EMessageKeyType type = EMessageKeyType.Variable;
            uint            tag  = 0;

            while (pStream.ReadKey(out type, out tag))
            {
                switch (tag)
                {
                case ServiceIdTag:
                    if (!pStream.ReadVariable(out mServiceId))
                    {
                        return(false);
                    }
                    break;

                case MethodIdTag:
                    mHasMethodId = true;
                    if (!pStream.ReadVariable(out mMethodId))
                    {
                        return(false);
                    }
                    break;

                case TokenTag:
                    if (!pStream.ReadVariable(out mToken))
                    {
                        return(false);
                    }
                    break;

                case ObjectIdTag:
                    mHasObjectId = true;
                    if (!pStream.ReadVariable(out mObjectId))
                    {
                        return(false);
                    }
                    break;

                case SizeTag:
                    mHasSize = true;
                    if (!pStream.ReadVariable(out mSize))
                    {
                        return(false);
                    }
                    break;

                case StatusTag:
                    mHasStatus = true;
                    if (!pStream.ReadVariable(out mStatus))
                    {
                        return(false);
                    }
                    break;

                case ErrorTag:
                {
                    ErrorInfo errorInfo = new ErrorInfo();
                    if (!pStream.ReadPackable(errorInfo))
                    {
                        return(false);
                    }
                    mErrors.Add(errorInfo);
                    break;
                }

                default: return(false);
                }
            }
            return(true);
        }