Ejemplo n.º 1
0
 public string this[MessageID id]
 {
     get
     {
         if (Table.ContainsKey(id) == false)
             return string.Empty;
         return Table[id];
     }
 }
Ejemplo n.º 2
0
 public LambdaSymbol(
     CSharpCompilation compilation,
     Symbol containingSymbol,
     UnboundLambda unboundLambda,
     ImmutableArray<ParameterSymbol> delegateParameters,
     TypeSymbol returnType)
 {
     this.containingSymbol = containingSymbol;
     this.messageID = unboundLambda.Data.MessageID;
     this.syntax = unboundLambda.Syntax;
     this.returnType = returnType;
     this.isSynthesized = unboundLambda.WasCompilerGenerated;
     this.isAsync = unboundLambda.IsAsync;
     // No point in making this lazy. We are always going to need these soon after creation of the symbol.
     this.parameters = MakeParameters(compilation, unboundLambda, delegateParameters);
 }
Ejemplo n.º 3
0
 public LambdaSymbol(
     Symbol containingSymbol,
     ImmutableArray<ParameterSymbol> parameters,
     RefKind refKind,
     TypeSymbol returnType,
     MessageID messageID,
     CSharpSyntaxNode syntax,
     bool isSynthesized)
 {
     _containingSymbol = containingSymbol;
     _messageID = messageID;
     _syntax = syntax;
     _refKind = refKind;
     _returnType = returnType;
     _isSynthesized = isSynthesized;
     _parameters = parameters.SelectAsArray(CopyParameter, this);
 }
Ejemplo n.º 4
0
 private LambdaSymbol(
     Symbol containingSymbol,
     ImmutableArray<ParameterSymbol> parameters,
     TypeSymbol returnType,
     MessageID messageID,
     CSharpSyntaxNode syntax,
     bool isSynthesized,
     bool isAsync)
 {
     this.containingSymbol = containingSymbol;
     this.messageID = messageID;
     this.syntax = syntax;
     this.returnType = returnType;
     this.isSynthesized = isSynthesized;
     this.isAsync = isAsync;
     this.parameters = parameters.SelectAsArray(CopyParameter, this);
 }
Ejemplo n.º 5
0
 public static LocalizableErrorArgument Localize(this MessageID id)
 {
     return(new LocalizableErrorArgument(id));
 }
Ejemplo n.º 6
0
 internal static CSDiagnosticInfo?GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpCompilation compilation)
 => compilation.IsFeatureEnabled(feature) ? null : GetDisabledFeatureDiagnosticInfo(feature, compilation.LanguageVersion);
        public static string GetMessage(MessageID id)
        {
            string idStr = id.ToString();

            return(SR.GetResourceString(idStr, idStr));
        }
Ejemplo n.º 8
0
 internal CompilationUnitSyntax ParseFileExperimental(string text, MessageID feature) =>
     ParseFile(text, parseOptions: TestOptions.Regular.WithExperimental(feature));
Ejemplo n.º 9
0
 //
 // Parse an expression where a declaration expression would be permitted. This is suitable for use after
 // the `out` keyword in an argument list, or in the elements of a tuple literal (because they may
 // be on the left-hand-side of a deconstruction). The first element of a tuple is handled slightly
 // differently, as we check for the comma before concluding that the identifier should cause a
 // disambiguation. For example, for the input `(A < B , C > D)`, we treat this as a tuple with
 // two elements, because if we considered the `A<B,C>` to be a type, it wouldn't be a tuple at
 // all. Since we don't have such a thing as a one-element tuple (even for deconstruction), the
 // absence of the comma after the `D` means we don't treat the `D` as contributing to the
 // disambiguation of the expression/type. More formally, ...
 //
 // If a sequence of tokens can be parsed(in context) as a* simple-name* (§7.6.3), *member-access* (§7.6.5),
 // or* pointer-member-access* (§18.5.2) ending with a* type-argument-list* (§4.4.1), the token immediately
 // following the closing `>` token is examined, to see if it is
 // - One of `(  )  ]  }  :  ;  ,  .  ?  ==  !=  |  ^  &&  ||  &  [`; or
 // - One of the relational operators `<  >  <=  >=  is as`; or
 // - A contextual query keyword appearing inside a query expression; or
 // - In certain contexts, we treat *identifier* as a disambiguating token.Those contexts are where the
 //   sequence of tokens being disambiguated is immediately preceded by one of the keywords `is`, `case`
 //   or `out`, or arises while parsing the first element of a tuple literal(in which case the tokens are
 //   preceded by `(` or `:` and the identifier is followed by a `,`) or a subsequent element of a tuple literal.
 //
 // If the following token is among this list, or an identifier in such a context, then the *type-argument-list* is
 // retained as part of the *simple-name*, *member-access* or  *pointer-member-access* and any other possible parse
 // of the sequence of tokens is discarded.Otherwise, the *type-argument-list* is not considered to be part of the
 // *simple-name*, *member-access* or *pointer-member-access*, even if there is no other possible parse of the
 // sequence of tokens.Note that these rules are not applied when parsing a *type-argument-list* in a *namespace-or-type-name* (§3.8).
 //
 // See also ScanTypeArgumentList where these disambiguation rules are encoded.
 //
 private ExpressionSyntax ParseExpressionOrDeclaration(ParseTypeMode mode, MessageID feature, bool permitTupleDesignation)
 {
     return IsPossibleDeclarationExpression(mode, permitTupleDesignation)
         ? this.ParseDeclarationExpression(mode, feature)
         : this.ParseSubExpression(Precedence.Expression);
 }
Ejemplo n.º 10
0
 public void ErrId(out string s, MessageID id)
 {
     s = ErrorFacts.GetMessage(id);
 }
Ejemplo n.º 11
0
        private bool ParseMessage( MessageID id, byte[] payload )
        {
            switch (id)
            {
                //Parse control messages 1-7
                case MessageID.SetChunkSize:
                    options.ChunkSize = ArrayUtil.BigIndianInt(payload, 0, 4);
                    break;
                case MessageID.WindowAcknowledge:
                    options.WindowSize = ArrayUtil.BigIndianInt(payload, 0, 4);
                    break;

                // Parse commands like connect
                case MessageID.CommandAMF0:
                    var command = ArrayUtil.AMF0String(payload, 0);
                    switch (command.ToLower())
                    {
                        case "connect":
                            var cmdConnect = new CmdConnect( payload );
                            if (OnConnect != null)
                                OnConnect(this, new ConnectData(cmdConnect));
                            break;
                        case "releasestream":
                            if (OnReleaseStream != null)
                                OnReleaseStream(this, new AMFCallData(payload) );
                            break;
                        case "fcpublish":
                            if (OnFCPublish != null)
                                OnFCPublish(this, new AMFCallData(payload) );
                            break;
                        case "createstream":
                            if (OnCreateStream != null)
                                OnCreateStream(this, new AMFCallData(payload));
                            break;
                        case "publish":
                            if (OnPublish != null)
                                OnPublish(this, new AMFCallData(payload));
                            break;
                        default:
                            return false;
                    }
                    break;
                default:
                    return false;
            }
            return true;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Sends the specified <code>MessageID</code> to the client.
 /// </summary>
 /// <param name="messageID">The <code>MessageID</code> to be sent.</param>
 private void SendMessage(MessageID messageID)
 {
     // convert it to byte
     this.SendMessageByte((byte) messageID);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Sends the specified <code>MessageID</code> with some additional <code>byte</code> data to the client.
 /// </summary>
 /// <param name="messageID">The <code>MessageID</code> to be sent.</param>
 /// <param name="data">The data to be sent with the message.</param>
 private void SendMessage(MessageID messageID, byte data)
 {
     this.SendMessage(messageID);
     this.SendMessageByte(data);
 }
Ejemplo n.º 14
0
 public MSG_CLOSE_CONNECTION()
 {
     this.msgType = (ushort)14;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
Ejemplo n.º 15
0
 // Returns the string to be used in the /features flag switch to enable the MessageID feature.
 // Always call this before RequiredVersion:
 //   If this method returns null, call RequiredVersion and use that.
 //   If this method returns non-null, use that.
 // Features should be mutually exclusive between RequiredFeature and RequiredVersion.
 //   (hence the above rule - RequiredVersion throws when RequiredFeature returns non-null)
 internal static string RequiredFeature(this MessageID feature)
 {
     return(null);
 }
Ejemplo n.º 16
0
 public MSG_GET_ROSPECS_RESPONSE()
 {
     this.msgType = (ushort)36;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
Ejemplo n.º 17
0
 public static string ToLocalizedString(this MessageID id)
 {
     return(new LocalizableErrorArgument(id).ToString(null, null));
 }
Ejemplo n.º 18
0
 public MSG_KEEPALIVE()
 {
     this.msgType = (ushort)62;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
Ejemplo n.º 19
0
        //打包想要的json信息
        private string MakeUserPacket(MessageID id,int index)
        {
            var message = new Message()
            {
                ID = id,
                user = Hoster,
                font = MyFont,
                fileid = index
            };
            var serializer = new DataContractJsonSerializer(typeof(Message));
            var stream = new MemoryStream();
            serializer.WriteObject(stream, message);

            byte[] dataBytes = new byte[stream.Length];

            stream.Position = 0;

            stream.Read(dataBytes, 0, (int)stream.Length);

            string dataString = Encoding.UTF8.GetString(dataBytes);

            return dataString;
        }
 public MSG_GET_READER_CONFIG_RESPONSE()
 {
     this.msgType = (ushort)12;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
 private string MakeCommentMessage(Location location, MessageID messageId)
 {
     if (location.IsInSource)
     {
         return ErrorFacts.GetMessage(messageId, CultureInfo.CurrentUICulture);
     }
     else
     {
         return null;
     }
 }
Ejemplo n.º 22
0
 public MSG_GET_ACCESSSPECS_RESPONSE()
 {
     this.msgType = (ushort)54;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
Ejemplo n.º 23
0
 private ExpressionSyntax ParseExpressionExperimental(string text, MessageID feature)
 {
     return SyntaxFactory.ParseExpression(text, options: TestOptions.Regular.WithExperimental(feature));
 }
Ejemplo n.º 24
0
 internal LocalizableErrorArgument(MessageID id)
 {
     _id = id;
 }
Ejemplo n.º 25
0
 public Payload(MessageID id)
 {
     _id = id;
     _body = null;
 }
Ejemplo n.º 26
0
 public Payload(byte[] payload, int offset, int length)
 {
     _id = (MessageID)payload[offset];
     _body = new byte[length - 1];
     System.Buffer.BlockCopy(payload, offset + 1, _body, 0, length - 1);
 }
Ejemplo n.º 27
0
        public void process(byte[] datas, MessageLength length, Dictionary <uint, MessageHandler> flowHandler)
        {
            //Log.Net("process receive Data " + length + " state " + state);
            MessageLength totallen = 0;

            while (length > 0 && expectSize > 0)
            {
                if (state == READ_STATE.READ_STATE_FLAG)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        flag = stream.readUint8();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_MSGLEN;
                        expectSize = 4;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_MSGLEN)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        msglen = stream.readUint32();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_FLOWID;
                        expectSize = 4;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_FLOWID)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        flowId = stream.readUint32();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_MODULEID;
                        expectSize = 1;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_MODULEID)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        moduleId = stream.readUint8();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_MSGID;
                        expectSize = 2;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_MSGID)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        msgid = stream.readUint16();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_RESPONSE_TIME;
                        expectSize = 4;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_RESPONSE_TIME)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        responseTime = stream.readUint32();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_RESPONSE_FLAG;
                        expectSize = 2;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
                else if (state == READ_STATE.READ_STATE_RESPONSE_FLAG)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        responseFlag = stream.readInt16();
                        stream.clear();

                        state      = READ_STATE.READ_STATE_BODY;
                        expectSize = msglen - 4 - 1 - 2 - 4 - 2;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }

                /*
                 * body Can be empty
                 */
                if (state == READ_STATE.READ_STATE_BODY)
                {
                    if (length >= expectSize)
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, expectSize);
                        totallen    += expectSize;
                        stream.wpos += (int)expectSize;
                        length      -= expectSize;

                        /*
                         * No Handler Or PushMessage  forward To IPacketHandler
                         * Call Who's RPC Method Or Register Many RPC Method to Handle It ?
                         * [PushHandler]
                         * void GCPushSpriteInfo(Packet packet) {
                         * }
                         *
                         * PacketHandler namespace
                         * IPacketHandler---->GCPushSpriteInfo
                         */
                        MessageHandler handler = null;
                        if (flowHandler == null)
                        {
                            handler = msgHandle;
                        }
                        else if (flowHandler.ContainsKey(flowId))
                        {
                            handler = flowHandler [flowId];
                            flowHandler.Remove(flowId);
                        }
                        else
                        {
                            handler = msgHandle;
                        }
                        IMessageLite pbmsg    = KBEngine.Message.handlePB(moduleId, msgid, stream);
                        Packet       p        = new Packet(flag, msglen, flowId, moduleId, msgid, responseTime, responseFlag, pbmsg);
                        var          fullName = pbmsg.GetType().FullName;

                        if (fullName.Contains("Push"))
                        {
                            //Log.Net("MessageReader Handler PushMessage");
                            if (mainLoop != null)
                            {
                                mainLoop.queueInLoop(delegate
                                {
                                    var handlerName = fullName.Replace("MyLib", "PacketHandler");
                                    var tp          = Type.GetType(handlerName);
                                    if (tp == null)
                                    {
                                        Debug.LogError("PushMessage noHandler " + handlerName);
                                    }
                                    else
                                    {
                                        //Debug.Log("Handler Push Message here "+handlerName);
                                        var ph = (PacketHandler.IPacketHandler)Activator.CreateInstance(tp);
                                        ph.HandlePacket(p);
                                    }
                                });
                            }
                        }
                        else if (handler != null)
                        {
                            mainLoop.queueInLoop(() => {
                                handler(p);
                            });
                        }
                        else
                        {
                            //flowHandler.Remove(flowId);
                            Debug.LogError("MessageReader::process No handler for flow Message " + msgid + " " + flowId + " " + pbmsg.GetType() + " " + pbmsg);
                        }



                        stream.clear();

                        state      = READ_STATE.READ_STATE_FLAG;
                        expectSize = 1;
                    }
                    else
                    {
                        Array.Copy(datas, totallen, stream.data(), stream.wpos, length);
                        stream.wpos += (int)length;
                        expectSize  -= length;
                        break;
                    }
                }
            }

            if (responseFlag != 0)
            {
                Debug.LogError("MessageReader:: read Error Packet " + responseFlag);
            }

            //Log.Net("current state after " + state + " msglen " + msglen + " " + length);
            //Log.Net("MessageReader::  prop  flag" + flag + "  msglen " + msglen + " flowId " + flowId + " moduleId " + moduleId + " msgid " + msgid + " responseTime " + responseTime + " responseFlag " + responseFlag + " expectSize " + expectSize);
        }
Ejemplo n.º 28
0
 internal static bool IsFeatureEnabled(this CSharpCompilation compilation, MessageID feature)
 {
     return(((CSharpParseOptions)compilation.SyntaxTrees.FirstOrDefault()?.Options)?.IsFeatureEnabled(feature) == true);
 }
        /// <summary>
        /// Parse the NotificationData structure.
        /// </summary>
        /// <param name="s">A stream containing NotificationData structure.</param>
        public override void Parse(Stream s)
        {
            base.Parse(s);
            this.NotificationFlags = new NotificationFlags();
            this.NotificationFlags.Parse(s);

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified)
            {
                this.TableEventType = (TableEventTypeEnum)this.ReadUshort();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowFolderID = new FolderID();
                this.TableRowFolderID.Parse(s);
            }

            if ((((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowMessageID = new MessageID();
                this.TableRowMessageID.Parse(s);
            }

            if ((((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowDeleted || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowInstance = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowFolderID = new FolderID();
                this.InsertAfterTableRowFolderID.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowID = new MessageID();
                this.InsertAfterTableRowID.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0) && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.InsertAfterTableRowInstance = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.TableModified && (this.TableEventType == TableEventTypeEnum.TableRowAdded || this.TableEventType == TableEventTypeEnum.TableRowModified))
            {
                this.TableRowDataSize = this.ReadUshort();

                int parsingSessionID = MapiInspector.MAPIInspector.ParsingSession.id;
                if (MapiInspector.MAPIInspector.IsFromFiddlerCore(MapiInspector.MAPIInspector.ParsingSession))
                {
                    parsingSessionID = int.Parse(MapiInspector.MAPIInspector.ParsingSession["VirtualID"]);
                }
                if (DecodingContext.Notify_handlePropertyTags.Count > 0 && DecodingContext.Notify_handlePropertyTags.ContainsKey(this.notificationHandle) && DecodingContext.Notify_handlePropertyTags[this.notificationHandle].ContainsKey(parsingSessionID) &&
                    DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item1 == MapiInspector.MAPIInspector.ParsingSession.RequestHeaders.RequestPath &&
                    DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item2 == MapiInspector.MAPIInspector.ParsingSession.LocalProcess &&
                    DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item3 == MapiInspector.MAPIInspector.ParsingSession.RequestHeaders["X-ClientInfo"])
                {
                    this.propertiesBySetColum = DecodingContext.Notify_handlePropertyTags[this.notificationHandle][parsingSessionID].Item4;
                }

                this.TableRowData = new PropertyRow(this.TableRowDataSize.Value, this.propertiesBySetColum);
                this.TableRowData.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended)
            {
                this.FolderId = new FolderID();
                this.FolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.TableModified && this.NotificationFlags.Value.NotificationType != NotificationTypesEnum.Extended && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
            {
                this.MessageId = new MessageID();
                this.MessageId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectDeleted || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && ((((int)this.NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0xC000 || (((int)this.NotificationFlags.Value.NotificationDataAvailability) & 0xC000) == 0))
            {
                this.ParentFolderId = new FolderID();
                this.ParentFolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied)
            {
                this.OldFolderId = new FolderID();
                this.OldFolderId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) != 0))
            {
                this.OldMessageId = new MessageID();
                this.OldMessageId.Parse(s);
            }

            if ((this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectMoved || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCopied) && (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x8000) == 0))
            {
                this.OldParentFolderId = new MessageID();
                this.OldParentFolderId.Parse(s);
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectCreated || this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.ObjectModified)
            {
                this.TagCount = this.ReadUshort();

                if (this.TagCount != 0x0000 && this.TagCount != 0xFFFF)
                {
                    List <PropertyTag> listTags = new List <PropertyTag>();

                    for (int i = 0; i < this.TagCount; i++)
                    {
                        PropertyTag tempTag = new PropertyTag();
                        tempTag.Parse(s);
                        listTags.Add(tempTag);
                    }

                    this.Tags = listTags.ToArray();
                }
            }

            if (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x1000) != 0)
            {
                this.TotalMessageCount = this.ReadUint();
            }

            if (((int)this.NotificationFlags.Value.NotificationDataAvailability & 0x2000) != 0)
            {
                this.UnreadMessageCount = this.ReadUint();
            }

            if (this.NotificationFlags.Value.NotificationType == NotificationTypesEnum.NewMail)
            {
                this.MessageFlags = this.ReadUint();
                this.UnicodeFlag  = this.ReadByte();
                this.MessageClass = new MAPIString(Encoding.ASCII);
                this.MessageClass.Parse(s);
            }
        }
Ejemplo n.º 30
0
 //
 // Parse an expression where a declaration expression would be permitted. This is suitable for use after
 // the `out` keyword in an argument list, or in the elements of a tuple literal (because they may
 // be on the left-hand-side of a positional subpattern). The first element of a tuple is handled slightly
 // differently, as we check for the comma before concluding that the identifier should cause a
 // disambiguation. For example, for the input `(A < B , C > D)`, we treat this as a tuple with
 // two elements, because if we considered the `A<B,C>` to be a type, it wouldn't be a tuple at
 // all. Since we don't have such a thing as a one-element tuple (even for positional subpattern), the
 // absence of the comma after the `D` means we don't treat the `D` as contributing to the
 // disambiguation of the expression/type. More formally, ...
 //
 // If a sequence of tokens can be parsed(in context) as a* simple-name* (§7.6.3), *member-access* (§7.6.5),
 // or* pointer-member-access* (§18.5.2) ending with a* type-argument-list* (§4.4.1), the token immediately
 // following the closing `>` token is examined, to see if it is
 // - One of `(  )  ]  }  :  ;  ,  .  ?  ==  !=  |  ^  &&  ||  &  [`; or
 // - One of the relational operators `<  >  <=  >=  is as`; or
 // - A contextual query keyword appearing inside a query expression; or
 // - In certain contexts, we treat *identifier* as a disambiguating token.Those contexts are where the
 //   sequence of tokens being disambiguated is immediately preceded by one of the keywords `is`, `case`
 //   or `out`, or arises while parsing the first element of a tuple literal(in which case the tokens are
 //   preceded by `(` or `:` and the identifier is followed by a `,`) or a subsequent element of a tuple literal.
 //
 // If the following token is among this list, or an identifier in such a context, then the *type-argument-list* is
 // retained as part of the *simple-name*, *member-access* or  *pointer-member-access* and any other possible parse
 // of the sequence of tokens is discarded.Otherwise, the *type-argument-list* is not considered to be part of the
 // *simple-name*, *member-access* or *pointer-member-access*, even if there is no other possible parse of the
 // sequence of tokens.Note that these rules are not applied when parsing a *type-argument-list* in a *namespace-or-type-name* (§3.8).
 //
 // See also ScanTypeArgumentList where these disambiguation rules are encoded.
 //
 private ExpressionSyntax ParseExpressionOrDeclaration(ParseTypeMode mode, MessageID feature, bool permitTupleDesignation)
 {
     return(IsPossibleDeclarationExpression(mode, permitTupleDesignation)
         ? this.ParseDeclarationExpression(mode, feature)
         : this.ParseSubExpression(Precedence.Expression));
 }
Ejemplo n.º 31
0
 internal static CSDiagnosticInfo?GetFeatureAvailabilityDiagnosticInfo(this MessageID feature, CSharpParseOptions options)
 => options.IsFeatureEnabled(feature) ? null : GetDisabledFeatureDiagnosticInfo(feature, options.LanguageVersion);
Ejemplo n.º 32
0
        private void ReduceLet(LetClauseSyntax let, QueryTranslationState state, DiagnosticBag diagnostics)
        {
            // A query expression with a let clause
            //     from x in e
            //     let y = f
            //     ...
            // is translated into
            //     from * in ( e ) . Select ( x => new { x , y = f } )
            //     ...
            var x = state.rangeVariable;

            // We use a slightly different translation strategy.  We produce
            //     from * in ( e ) . Select ( x => new Pair<X,Y>(x, f) )
            // Where X is the type of x, and Y is the type of the expression f.
            // Subsequently, x (or members of x, if it is a transparent identifier)
            // are accessed as TRID.Item1 (or members of that), and y is accessed
            // as TRID.Item2, where TRID is the compiler-generated identifier used
            // to represent the transparent identifier in the result.
            LambdaBodyFactory bodyFactory = (LambdaSymbol lambdaSymbol, ref Binder lambdaBodyBinder, DiagnosticBag d) =>
            {
                var xExpression = new BoundParameter(let, lambdaSymbol.Parameters[0])
                {
                    WasCompilerGenerated = true
                };

                var            yExpression   = lambdaBodyBinder.BindValue(let.Expression, d, BindValueKind.RValue);
                SourceLocation errorLocation = new SourceLocation(let.SyntaxTree, new TextSpan(let.Identifier.SpanStart, let.Expression.Span.End - let.Identifier.SpanStart));
                if (!yExpression.HasAnyErrors && !yExpression.HasExpressionType())
                {
                    MessageID id = MessageID.IDS_NULL;
                    if (yExpression.Kind == BoundKind.UnboundLambda)
                    {
                        id = ((UnboundLambda)yExpression).MessageID;
                    }
                    else if (yExpression.Kind == BoundKind.MethodGroup)
                    {
                        id = MessageID.IDS_MethodGroup;
                    }
                    else
                    {
                        Debug.Assert(yExpression.IsLiteralNull(), "How did we successfully bind an expression without a type?");
                    }

                    Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, id.Localize());
                    yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray <Symbol> .Empty, ImmutableArray.Create <BoundNode>(yExpression), CreateErrorType());
                }
                else if (!yExpression.HasAnyErrors && yExpression.Type.SpecialType == SpecialType.System_Void)
                {
                    Error(d, ErrorCode.ERR_QueryRangeVariableAssignedBadValue, errorLocation, yExpression.Type);
                    yExpression = new BoundBadExpression(yExpression.Syntax, LookupResultKind.Empty, ImmutableArray <Symbol> .Empty, ImmutableArray.Create <BoundNode>(yExpression), yExpression.Type);
                }

                var construction = MakePair(let, x.Name, xExpression, let.Identifier.ValueText, yExpression, state, d);

                // The bound block represents a closure scope for transparent identifiers captured in the let clause.
                // Such closures shall be associated with the lambda body expression.
                return(lambdaBodyBinder.CreateBlockFromExpression(let.Expression, lambdaBodyBinder.Locals, null, construction, d));
            };

            var lambda = MakeQueryUnboundLambda(state.RangeVariableMap(), ImmutableArray.Create(x), let.Expression, bodyFactory);

            state.rangeVariable = state.TransparentRangeVariable(this);
            state.AddTransparentIdentifier(x.Name);
            var y = state.AddRangeVariable(this, let.Identifier, diagnostics);

            state.allRangeVariables[y].Add(let.Identifier.ValueText);
            var invocation = MakeQueryInvocation(let, state.fromExpression, "Select", lambda, diagnostics);

            state.fromExpression = MakeQueryClause(let, invocation, y, invocation);
        }
Ejemplo n.º 33
0
        internal static LanguageVersion RequiredVersion(this MessageID feature)
        {
            Debug.Assert(RequiredFeature(feature) == null);

            // Based on CSourceParser::GetFeatureUsage from SourceParser.cpp.
            // Checks are in the LanguageParser unless otherwise noted.
            switch (feature)
            {
            // C# 9.0 features.
            case MessageID.IDS_FeatureLambdaDiscardParameters:   // semantic check
            case MessageID.IDS_FeatureFunctionPointers:
            case MessageID.IDS_FeatureLocalFunctionAttributes:   // syntax check
            case MessageID.IDS_FeatureExternLocalFunctions:      // syntax check
            case MessageID.IDS_FeatureTargetTypedObjectCreation: // syntax check
            case MessageID.IDS_FeatureMemberNotNull:
            case MessageID.IDS_FeatureAndPattern:
            case MessageID.IDS_FeatureNotPattern:
            case MessageID.IDS_FeatureOrPattern:
            case MessageID.IDS_FeatureParenthesizedPattern:
            case MessageID.IDS_FeatureTypePattern:
            case MessageID.IDS_FeatureRelationalPattern:
            case MessageID.IDS_FeatureExtensionGetEnumerator:       // semantic check
            case MessageID.IDS_FeatureExtensionGetAsyncEnumerator:  // semantic check
            case MessageID.IDS_FeatureNativeInt:
            case MessageID.IDS_FeatureExtendedPartialMethods:       // semantic check
            case MessageID.IDS_TopLevelStatements:
            case MessageID.IDS_FeatureInitOnlySetters:              // semantic check
            case MessageID.IDS_FeatureRecords:
            case MessageID.IDS_FeatureTargetTypedConditional:       // semantic check
            case MessageID.IDS_FeatureCovariantReturnsForOverrides: // semantic check
            case MessageID.IDS_FeatureStaticAnonymousFunction:      // syntax check
            case MessageID.IDS_FeatureModuleInitializers:           // semantic check on method attribute
            case MessageID.IDS_FeatureDefaultTypeParameterConstraint:
                return(LanguageVersion.CSharp9);

            case MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers:     //semantic check
                return(LanguageVersion.Preview);

            // C# 8.0 features.
            case MessageID.IDS_FeatureAltInterpolatedVerbatimStrings:
            case MessageID.IDS_FeatureCoalesceAssignmentExpression:
            case MessageID.IDS_FeatureUnconstrainedTypeParameterInNullCoalescingOperator:
            case MessageID.IDS_FeatureNullableReferenceTypes: // syntax and semantic check
            case MessageID.IDS_FeatureIndexOperator:          // semantic check
            case MessageID.IDS_FeatureRangeOperator:          // semantic check
            case MessageID.IDS_FeatureAsyncStreams:
            case MessageID.IDS_FeatureRecursivePatterns:
            case MessageID.IDS_FeatureUsingDeclarations:
            case MessageID.IDS_FeatureStaticLocalFunctions:
            case MessageID.IDS_FeatureNameShadowingInNestedFunctions:
            case MessageID.IDS_FeatureUnmanagedConstructedTypes:     // semantic check
            case MessageID.IDS_FeatureObsoleteOnPropertyAccessor:
            case MessageID.IDS_FeatureReadOnlyMembers:
            case MessageID.IDS_DefaultInterfaceImplementation:      // semantic check
            case MessageID.IDS_OverrideWithConstraints:             // semantic check
            case MessageID.IDS_FeatureNestedStackalloc:             // semantic check
            case MessageID.IDS_FeatureNotNullGenericTypeConstraint: // semantic check
            case MessageID.IDS_FeatureSwitchExpression:
            case MessageID.IDS_FeatureAsyncUsing:
            case MessageID.IDS_FeatureNullPointerConstantPattern:     //semantic check
                return(LanguageVersion.CSharp8);

            // C# 7.3 features.
            case MessageID.IDS_FeatureAttributesOnBackingFields:  // semantic check
            case MessageID.IDS_FeatureImprovedOverloadCandidates: // semantic check
            case MessageID.IDS_FeatureTupleEquality:              // semantic check
            case MessageID.IDS_FeatureRefReassignment:
            case MessageID.IDS_FeatureRefFor:
            case MessageID.IDS_FeatureRefForEach:
            case MessageID.IDS_FeatureEnumGenericTypeConstraint:                   // semantic check
            case MessageID.IDS_FeatureDelegateGenericTypeConstraint:               // semantic check
            case MessageID.IDS_FeatureUnmanagedGenericTypeConstraint:              // semantic check
            case MessageID.IDS_FeatureStackAllocInitializer:
            case MessageID.IDS_FeatureExpressionVariablesInQueriesAndInitializers: // semantic check
            case MessageID.IDS_FeatureExtensibleFixedStatement:                    // semantic check
            case MessageID.IDS_FeatureIndexingMovableFixedBuffers:                 //semantic check
                return(LanguageVersion.CSharp7_3);

            // C# 7.2 features.
            case MessageID.IDS_FeatureNonTrailingNamedArguments:     // semantic check
            case MessageID.IDS_FeatureLeadingDigitSeparator:
            case MessageID.IDS_FeaturePrivateProtected:
            case MessageID.IDS_FeatureReadOnlyReferences:
            case MessageID.IDS_FeatureRefStructs:
            case MessageID.IDS_FeatureReadOnlyStructs:
            case MessageID.IDS_FeatureRefExtensionMethods:
            case MessageID.IDS_FeatureRefConditional:
                return(LanguageVersion.CSharp7_2);

            // C# 7.1 features.
            case MessageID.IDS_FeatureAsyncMain:
            case MessageID.IDS_FeatureDefaultLiteral:
            case MessageID.IDS_FeatureInferredTupleNames:
            case MessageID.IDS_FeatureGenericPatternMatching:
                return(LanguageVersion.CSharp7_1);

            // C# 7 features.
            case MessageID.IDS_FeatureBinaryLiteral:
            case MessageID.IDS_FeatureDigitSeparator:
            case MessageID.IDS_FeatureLocalFunctions:
            case MessageID.IDS_FeatureRefLocalsReturns:
            case MessageID.IDS_FeaturePatternMatching:
            case MessageID.IDS_FeatureThrowExpression:
            case MessageID.IDS_FeatureTuples:
            case MessageID.IDS_FeatureOutVar:
            case MessageID.IDS_FeatureExpressionBodiedAccessor:
            case MessageID.IDS_FeatureExpressionBodiedDeOrConstructor:
            case MessageID.IDS_FeatureDiscards:
                return(LanguageVersion.CSharp7);

            // C# 6 features.
            case MessageID.IDS_FeatureExceptionFilter:
            case MessageID.IDS_FeatureAutoPropertyInitializer:
            case MessageID.IDS_FeatureNullPropagatingOperator:
            case MessageID.IDS_FeatureExpressionBodiedMethod:
            case MessageID.IDS_FeatureExpressionBodiedProperty:
            case MessageID.IDS_FeatureExpressionBodiedIndexer:
            case MessageID.IDS_FeatureNameof:
            case MessageID.IDS_FeatureDictionaryInitializer:
            case MessageID.IDS_FeatureUsingStatic:
            case MessageID.IDS_FeatureInterpolatedStrings:
            case MessageID.IDS_AwaitInCatchAndFinally:
            case MessageID.IDS_FeatureReadonlyAutoImplementedProperties:
                return(LanguageVersion.CSharp6);

            // C# 5 features.
            case MessageID.IDS_FeatureAsync:
                return(LanguageVersion.CSharp5);

            // C# 4 features.
            case MessageID.IDS_FeatureDynamic:     // Checked in the binder.
            case MessageID.IDS_FeatureTypeVariance:
            case MessageID.IDS_FeatureNamedArgument:
            case MessageID.IDS_FeatureOptionalParameter:
                return(LanguageVersion.CSharp4);

            // C# 3 features.
            case MessageID.IDS_FeatureImplicitArray:
            case MessageID.IDS_FeatureAnonymousTypes:
            case MessageID.IDS_FeatureObjectInitializer:
            case MessageID.IDS_FeatureCollectionInitializer:
            case MessageID.IDS_FeatureLambda:
            case MessageID.IDS_FeatureQueryExpression:
            case MessageID.IDS_FeatureExtensionMethod:
            case MessageID.IDS_FeaturePartialMethod:
            case MessageID.IDS_FeatureImplicitLocal:     // Checked in the binder.
            case MessageID.IDS_FeatureAutoImplementedProperties:
                return(LanguageVersion.CSharp3);

            // C# 2 features.
            case MessageID.IDS_FeatureGenerics:        // Also affects crefs.
            case MessageID.IDS_FeatureAnonDelegates:
            case MessageID.IDS_FeatureGlobalNamespace: // Also affects crefs.
            case MessageID.IDS_FeatureFixedBuffer:
            case MessageID.IDS_FeatureStaticClasses:
            case MessageID.IDS_FeaturePartialTypes:
            case MessageID.IDS_FeaturePropertyAccessorMods:
            case MessageID.IDS_FeatureExternAlias:
            case MessageID.IDS_FeatureIterators:
            case MessageID.IDS_FeatureDefault:
            case MessageID.IDS_FeatureNullable:
            case MessageID.IDS_FeaturePragma:       // Checked in the directive parser.
            case MessageID.IDS_FeatureSwitchOnBool: // Checked in the binder.
                return(LanguageVersion.CSharp2);

            // Special C# 2 feature: only a warning in C# 1.
            case MessageID.IDS_FeatureModuleAttrLoc:
                return(LanguageVersion.CSharp1);

            default:
                throw ExceptionUtilities.UnexpectedValue(feature);
            }
        }
 /// <summary>
 /// Generate a client JavaScript for displaying modal window for message editing.
 /// </summary>
 private void ProcessData()
 {
     lnkEdit.OnClientClick = "EditBoardMessage('" + ResolveUrl("~/CMSModules/MessageBoards/CMSPages/Message_Edit.aspx") + "?messageid=" + MessageID.ToString() + "&messageboardid=" + MessageBoardID.ToString() + "');return false;";
 }
Ejemplo n.º 35
0
 internal LocalizableErrorArgument(MessageID id)
 {
     _id = id;
 }
 public override int GetHashCode()
 {
     return MessageID.GetHashCode();
 }
Ejemplo n.º 37
0
        /// <summary>
        /// Verify RuleAction buffer for stand rule.
        /// </summary>
        /// <param name="ruleAction">RuleAction structure to be verified.</param>
        private void VerifyRuleAction(RuleAction ruleAction)
        {
            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R232, The value of NoOfActions is {0}", ruleAction.NoOfActions);

            // Verify MS-OXORULE requirement: MS-OXORULE_R232.
            // NoOfActions can be either unsigned-integer or unsigned-short.
            uint actionsNumber = (ruleAction.NoOfActions is uint) ? ((uint)ruleAction.NoOfActions) : ((ushort)ruleAction.NoOfActions);
            bool isVerifyR232 = actionsNumber > 0;

            Site.CaptureRequirementIfIsTrue(
                isVerifyR232,
                232,
                @"[In RuleAction Structure] NoOfActions (2 bytes): This number MUST be greater than zero.");
            foreach (ActionBlock actionBlock in ruleAction.Actions)
            {
                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R236");

                // Verify MS-OXORULE requirement: MS-OXORULE_R236.
                // There are 2 or 4 bytes of the ActionLength in the ActionBlocks,
                // so the cumulative length in bytes of the subsequent fields of the ActionLength must equal to the length of  ActionBlock.length - lengthOfActionLength.
                int lengthOfActionLength = actionBlock.ActionLength is ushort ? 2 : 4;
                bool isVerifyR236 = (actionBlock.ActionLength is ushort ? (ushort)actionBlock.ActionLength : (uint)actionBlock.ActionLength) == (actionBlock.Serialize().Length - lengthOfActionLength);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR236,
                    236,
                    @"[In ActionBlock Structure] ActionLength (2 bytes): An integer that specifies the cumulative length, in bytes, of the subsequent fields in this ActionBlock structure.");

                // Verify MS-OXORULE requirement: MS-OXORULE_R947.
                bool isVerifyR947 = (byte)actionBlock.ActionType == 0x01 ||
                                    (byte)actionBlock.ActionType == 0x02 ||
                                    (byte)actionBlock.ActionType == 0x03 ||
                                    (byte)actionBlock.ActionType == 0x04 ||
                                    (byte)actionBlock.ActionType == 0x05 ||
                                    (byte)actionBlock.ActionType == 0x06 ||
                                    (byte)actionBlock.ActionType == 0x07 ||
                                    (byte)actionBlock.ActionType == 0x08 ||
                                    (byte)actionBlock.ActionType == 0x09 ||
                                    (byte)actionBlock.ActionType == 0x0A ||
                                    (byte)actionBlock.ActionType == 0x0B;

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR947,
                    947,
                    @"[In RuleAction Structure] ActionBlocks (variable):  An array of ActionBlock structures, each of which specifies an action (2) of the rule (2), as specified in section 2.2.5.1.");
            }

            // Add the debug information.
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R231");

            // Verify MS-OXORULE requirement: MS-OXORULE_R231.
            Site.CaptureRequirementIfAreEqual<uint>(
                (uint)ruleAction.Actions.Length,
                actionsNumber,
                231,
                @"[In RuleAction Structure] NoOfActions (2 bytes): Specifies the number of structures that are contained in the ActionBlocks field.");

            // isVerifyR274 is used to verify R274 and R272.
            bool isVerifyR274 = false;

            // isVerifyR287 is used to verify R287 and R272.
            bool isVerifyR287 = false;

            // isVerifyR879 is used to verify R879 and R272.
            bool isVerifyR879 = false;

            for (int i = 0; i < ruleAction.Actions.Length; i++)
            {
                ActionBlock actionBlock = ruleAction.Actions[i];

                // Add the debug information.
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R245", "The value of the actionBlock.ActionType{0} should be one of 0x01 to 0x0b", actionBlock.ActionType);

                // Verify MS-OXORULE requirement: MS-OXORULE_R245.
                bool isVerifyR245 = (byte)actionBlock.ActionType == 0x01 ||
                                    (byte)actionBlock.ActionType == 0x02 ||
                                    (byte)actionBlock.ActionType == 0x03 ||
                                    (byte)actionBlock.ActionType == 0x04 ||
                                    (byte)actionBlock.ActionType == 0x05 ||
                                    (byte)actionBlock.ActionType == 0x06 ||
                                    (byte)actionBlock.ActionType == 0x07 ||
                                    (byte)actionBlock.ActionType == 0x08 ||
                                    (byte)actionBlock.ActionType == 0x09 ||
                                    (byte)actionBlock.ActionType == 0x0A ||
                                    (byte)actionBlock.ActionType == 0x0B;

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR245,
                    245,
                    @"[In ActionBlock Structure] The valid actions (2) [of ActionType] are listed in the following table: OP_MOVE, OP_COPY, OP_REPLY, OP_OOF_REPLY, OP_DEFER_ACTION, OP_BOUNCE, OP_FORWARD, OP_DELEGATE, OP_TAG, OP_DELETE, OP_MARK_AS_READ.");

                if ((actionBlock.ActionType == ActionType.OP_MOVE) || (actionBlock.ActionType == ActionType.OP_COPY))
                {
                    MoveCopyActionData moveCopyActionData = (MoveCopyActionData)actionBlock.ActionDataValue;
                    ServerEID serverEID = new ServerEID(moveCopyActionData.FolderEID);

                    // The storeObjectEntryID structure could only verified in ExchangeServer2007, R632 also only executed in ExchangeServer2007.
                    if (Common.IsRequirementEnabled(632, this.Site))
                    {
                        StoreObjectEntryID storeObjectEntryID = new StoreObjectEntryID();
                        storeObjectEntryID.Deserialize(moveCopyActionData.StoreEID);
                        this.VerifyStoreObjectEntryID(storeObjectEntryID);
                    }

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R982: the value of Ours is {0}", serverEID.Ours);

                    // Verify MS-OXORULE_R982.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        0x01,
                        serverEID.Ours,
                        982,
                        @"[In ServerEid Structure] Ours (1 byte): This field MUST be set to 0x01.");

                    // Add the debug information
                    this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R980");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R980
                    // Verify MS-OXORULE_R982 has verified the value of Ours is 0x01, MS-OXORULE_R980 verifies the instance's type.
                    this.Site.CaptureRequirementIfIsInstanceOfType(
                        serverEID,
                        typeof(ServerEID),
                        980,
                        @"[In ServerEid Structure] Ours (1 byte): The value 0x01 indicates that the remaining bytes conform to this structure [ServerEid].");

                    if (moveCopyActionData.StoreEIDSize != 0)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R297");

                        // Verify MS-OXORULE_R297.
                        Site.CaptureRequirementIfAreEqual<ushort>(
                            (ushort)moveCopyActionData.StoreEID.Length,
                            moveCopyActionData.StoreEIDSize,
                            297,
                            @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Standard Rules] StoreEIDSize (2 bytes): An integer that specifies the size, in bytes, of the StoreEID field.");
                    }

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R300");

                    // Verify MS-OXORULE_R300.
                    Site.CaptureRequirementIfAreEqual<ushort>(
                        (ushort)moveCopyActionData.FolderEID.Length,
                        moveCopyActionData.FolderEIDSize,
                        300,
                        @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Standard Rules] FolderEIDSize (2 bytes): An integer that specifies the size, in bytes, of the FolderEID field.");

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R294");

                    // Verify MS-OXORULE_R294.
                    // The structure of the OP_MOVE Action Date Buffer is verified by the requirements MS-OXORULE_R297, MS-OXORULE_R298, MS-OXORULE_R300, and MS-OXORULE_R301.
                    Site.CaptureRequirement(
                        294,
                        @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Standard Rules] The OP_MOVE ActionData structure MUST be in the following format for a standard rule. [FolderInThisStore, StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID].");

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R880");

                    // Verify MS-OXORULE_R880.
                    // The structure of the OP_MOVE Action Date Buffer is verified by the requirements MS-OXORULE_R297, MS-OXORULE_R298, MS-OXORULE_R300, and MS-OXORULE_R301.
                    Site.CaptureRequirement(
                        880,
                        @"[In OP_MOVE and OP_COPY ActionData Structure] [Buffer Format for Standard Rules] The OP_COPY ActionData structure MUST be in the following format for a standard rule. [FolderInThisStore, StoreEIDSize, StoreEID, FolderEIDSize, and FolderEID].");
                }

                if (actionBlock.ActionType == ActionType.OP_COPY)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R249");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R249.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_COPY means server could parse the ActionType 0x02.
                    Site.CaptureRequirement(
                        249,
                        @"[In ActionBlock Structure] The value of action type OP_COPY: 0x02.");
                }

                if (actionBlock.ActionType == ActionType.OP_MOVE)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R246");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R246.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_MOVE means server could parse the ActionType 0x01.
                    Site.CaptureRequirement(
                        246,
                        @"[In ActionBlock Structure] The value of action type OP_MOVE: 0x01.");
                }

                if (actionBlock.ActionType == ActionType.OP_FORWARD)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R261");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R261.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_FORWARD means server could parse the ActionType 0x07.
                    Site.CaptureRequirement(
                        261,
                        @"[In ActionBlock Structure] The value of action type OP_FORWARD: 0x07.");

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R274, the value of ActionFlavor is {0}, the ActionFlavorsForward.x is {1}.", actionBlock.ActionFlavor, ActionFlavorsForward.x);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R274.
                    // In ActionFlavor, the not used Flags must not be set, the used Flags can be set or all the bits are not set, it means ActionFlavor is set according to the description in this requirement.
                    isVerifyR274 = (actionBlock.ActionFlavor & (uint)ActionFlavorsForward.x) == 0;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR274,
                        274,
                        @"[In Action Flavors] If the value of the ActionType field is ""OP_FORWARD"", the ActionFlavor field contains a combination of the bitwise flags [XXXX (TM) (AT) (NC) (PR) XXXXXXXXXXXXXXXXXXXXXXXXXX] specified as follows.");
                }

                if ((actionBlock.ActionType == ActionType.OP_REPLY) || (actionBlock.ActionType == ActionType.OP_OOF_REPLY))
                {
                    ReplyActionData actionData = new ReplyActionData();
                    actionData.Deserialize(ruleAction.Actions[0].ActionDataValue.Serialize());

                    if (actionBlock.ActionType == ActionType.OP_REPLY)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R287, the value of ActionFlavor is {0}, it should be one of ActionFlavorsReply.NS({1}), ActionFlavorsReply.ST({2}), or 0x00000000", actionBlock.ActionFlavor, ActionFlavorsReply.NS, ActionFlavorsReply.ST);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R287.
                        // According to open specification, in this condition, the allowed value of ActionFlavor are NS, ST and 0x00000000.
                        isVerifyR287 = (actionBlock.ActionFlavor == (uint)ActionFlavorsReply.NS) ||
                                            (actionBlock.ActionFlavor == (uint)ActionFlavorsReply.ST) ||
                                            (actionBlock.ActionFlavor == 0x00000000);

                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR287,
                            287,
                            @"[In Action Flavors] If the ActionType field value is ""OP_REPLY"", the ActionFlavor field MUST have one of the values specified in the following table [XXXXXX (ST) (NS) XXXXXXXXXXXXXXXXXXXXXXXX] or zero (0x00000000).");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R252");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R252.
                        // If the ActionType of the actionBlock equals the value ActionType.OP_REPLY means server could parse the ActionType 0x03.
                        Site.CaptureRequirement(
                            252,
                            @"[In ActionBlock Structure] The value of action type OP_REPLY: 0x03.");

                        bool isVerifyR992 = actionData.ReplyTemplateGUID.Length != 0 && actionData.ReplyTemplateFID != 0 && actionData.ReplyTemplateMID != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R992");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R992.
                        // If ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID in the ActionData is not null, R992 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR992,
                            992,
                            @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Standard Rules] The OP_REPLY ActionData structure MUST be in the following format for a standard rule. [ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID]");
                    }

                    ReplyActionData replyActionData = (ReplyActionData)actionBlock.ActionDataValue;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R308");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R308.
                    Site.CaptureRequirementIfIsTrue(
                        Common.IsGUID(replyActionData.ReplyTemplateGUID),
                        308,
                        @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Standard Rules] ReplyTemplateGUID (16 bytes): A GUID that is generated by the client in the process of creating a reply template.");

                    if (actionBlock.ActionType == ActionType.OP_OOF_REPLY)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R879, the value of ActionFlavor is {0}", "it should be one of ActionFlavorsReply.NS({1}), ActionFlavorsReply.ST({2}), or 0x00000000", actionBlock.ActionFlavor, ActionFlavorsReply.NS, ActionFlavorsReply.ST);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R879.
                        // According to open specification, in this condition, the allowed value of ActionFlavor are NS, ST and 0x00000000.
                        isVerifyR879 = (actionBlock.ActionFlavor == (uint)ActionFlavorsReply.NS) ||
                                            (actionBlock.ActionFlavor == (uint)ActionFlavorsReply.ST) ||
                                            (actionBlock.ActionFlavor == 0x00000000);

                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR879,
                            879,
                            @"[In Action Flavors] If the ActionType field value is ""OP_OOF_REPLY"", the ActionFlavor field MUST have one of the values specified in the following table [XXXXXX (ST) (NS) XXXXXXXXXXXXXXXXXXXXXXXX] or zero (0x00000000). ");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R254");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R254.
                        // If the ActionType of the actionBlock equals the value ActionType. OP_OOF_REPLY means server could parse the ActionType and its value must be 0x04.
                        Site.CaptureRequirement(
                            254,
                            @"[In ActionBlock Structure] The value of action type OP_OOF_REPLY: 0x04.");

                        bool isVerifyR993 = actionData.ReplyTemplateGUID.Length != 0 && actionData.ReplyTemplateFID != 0 && actionData.ReplyTemplateMID != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R993");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R993.
                        // If ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID in the ActionData is not null, R993 can be verified.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR993,
                            993,
                            @"[OP_REPLY and OP_OOF_REPLY ActionData Structure] [Buffer Format for Standard Rules] The OP_OOF_REPLY ActionData structure MUST be in the following format for a standard rule. [ReplyTemplateFID, ReplyTemplateMID, ReplyTemplateGUID]");
                    }

                    FolderID folderID = new FolderID();
                    folderID.Deserialize(replyActionData.ReplyTemplateFID);
                    if (folderID != null)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2175");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2175.
                        Site.CaptureRequirementIfAreEqual<int>(
                            8,
                            folderID.Size,
                            "MS-OXCDATA",
                            2175,
                            @"[In Folder ID Structure] It [Folder ID] is an 8-byte structure.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2176");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2176.
                        // "Identifying a Store object" is informative.
                        Site.CaptureRequirementIfAreEqual<int>(
                            2,
                            folderID.ReplicaId.Length,
                            "MS-OXCDATA",
                            2176,
                            @"[In Folder ID Structure] ReplicaId (2 bytes): An unsigned integer identifying a Store object.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2177");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2177.
                        // "Identifying the folder within its Store object" is informative.
                        Site.CaptureRequirementIfAreEqual<int>(
                            6,
                            folderID.GlobalCounter.Length,
                            "MS-OXCDATA",
                            2177,
                            @"[In Folder ID Structure] GlobalCounter (6 bytes): An unsigned integer identifying the folder within its Store object.");
                    }

                    MessageID messageID = new MessageID();
                    messageID.Deserialize(replyActionData.ReplyTemplateMID);
                    if (messageID != null)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2180");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2180.
                        Site.CaptureRequirementIfAreEqual<int>(
                            8,
                            messageID.Size,
                            "MS-OXCDATA",
                            2180,
                            @"[In Message ID Structure] It [Message ID] is an 8-byte structure.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2181");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2181.
                        // "Identifying a Store object" is informative.
                        Site.CaptureRequirementIfAreEqual<int>(
                            2,
                            messageID.ReplicaId.Length,
                            "MS-OXCDATA",
                            2181,
                            @"[In Message ID Structure] ReplicaId (2 bytes): An unsigned integer identifying a Store object.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2182");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R2182.
                        // "Identifying the message within its Store object" is informative.
                        Site.CaptureRequirementIfAreEqual<int>(
                            6,
                            messageID.GlobalCounter.Length,
                            "MS-OXCDATA",
                            2182,
                            @"[In Message ID Structure] GlobalCounter (6 bytes): An unsigned integer identifying the message within its Store object.");
                    }
                }

                if (actionBlock.ActionType == ActionType.OP_DEFER_ACTION)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R256");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R256.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_DEFER_ACTION means server could parse the ActionType 0x05.
                    Site.CaptureRequirement(
                        256,
                        @"[In ActionBlock Structure] The value of action type OP_DEFER_ACTION: 0x05.");
                }

                if (actionBlock.ActionType == ActionType.OP_TAG)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R265");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R265.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_TAG means server could parse the ActionType 0x09.
                    Site.CaptureRequirement(
                        265,
                        @"[In ActionBlock Structure] The value of action type OP_TAG: 0x09.");

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R739");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R739.
                    // If the taggedPropertyValueOP_TAG is not null means the action data buffer can be parsed by the TaggedPropertyValue.
                    TaggedPropertyValue taggedPropertyValueOP_Tag = AdapterHelper.ReadTaggedProperty(actionBlock.ActionDataValue.Serialize());

                    Site.CaptureRequirementIfIsNotNull(
                        taggedPropertyValueOP_Tag,
                        739,
                        @"[In OP_TAG ActionData Structure] An OP_TAG ActionData structure is a TaggedPropertyValue structure, packaged as specified in [MS-OXCDATA] section 2.11.4.");
                }

                if ((actionBlock.ActionType == ActionType.OP_FORWARD) ||
                    (actionBlock.ActionType == ActionType.OP_REPLY) ||
                    (actionBlock.ActionType == ActionType.OP_OOF_REPLY))
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R272", "The value of the ActionFlavor is {0}, and the ActionType is {1}", actionBlock.ActionFlavor, actionBlock.ActionType);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R272.
                    // According to open specification, the only action types that support the Action Flavor are OP_REPLY, OP_OOF_REPLY and OP_FORWARD.
                    // The setting of ActionFlavor is verified in R274 and R287, so the condition to verify R272 is "isVerifyR274 || isVerifyR287".
                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR274 || isVerifyR287 || isVerifyR879,
                        272,
                        @"[In Action Flavors] The only ActionType field values that currently support an Action Flavor are ""OP_REPLY"", ""OP_OOF_REPLY"" and ""OP_FORWARD"".");
                }
                else
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R273");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R273.
                    Site.CaptureRequirementIfAreEqual<uint>(
                        0,
                        actionBlock.ActionFlavor,
                        273,
                        @"[In Action Flavors] The value of the ActionFlavor field MUST be 0x00000000 if the value of the ActionType field is not one of these values [OP_REPLY, OP_OOF_REPLY, and OP_FORWARD].");
                }

                // When the AT flag in ActionFlavor is set.
                if ((actionBlock.ActionFlavor & (uint)ActionFlavorsForward.AT) == (uint)ActionFlavorsForward.AT)
                {
                    // Verify MS-OXORULE requirement: MS-OXORULE_R280.
                    uint otherActionFlavorFlags = (uint)ActionFlavorsForward.PR |
                                                  (uint)ActionFlavorsForward.NC |
                                                  (uint)ActionFlavorsForward.TM |
                                                  (uint)ActionFlavorsForward.x;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R280, the value of ActionFlavor is {0}, this value should not be combined with otherActionFlavorFlags({1}).", actionBlock.ActionFlavor, otherActionFlavorFlags);

                    // To verify whether the other ActionFlavor Flags are 0 when the AT flag in ActionFlavor is set.
                    bool isVerifyR280 = (actionBlock.ActionFlavor & otherActionFlavorFlags) == 0;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR280,
                        280,
                        @"[In Action Flavors] AT (Bitmask 0x00000004): This value MUST NOT be combined with other ActionFlavor flags.");
                }

                // When the TM flag in ActionFlavor is set.
                if ((actionBlock.ActionFlavor & (uint)ActionFlavorsForward.TM) == (uint)ActionFlavorsForward.TM)
                {
                    // Verify MS-OXORULE requirement: MS-OXORULE_R283.
                    uint otherActionFlavorFlags = (uint)ActionFlavorsForward.PR |
                                                  (uint)ActionFlavorsForward.NC |
                                                  (uint)ActionFlavorsForward.AT |
                                                  (uint)ActionFlavorsForward.x;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R283, the value of ActionFlavor is {0}, this value should not be combined with otherActionFlavorFlags({1}).", actionBlock.ActionFlavor, otherActionFlavorFlags);

                    // To verify whether the other ActionFlavor Flags are 0 when the TM flag in ActionFlavor is set.
                    bool isVerifyR283 = (actionBlock.ActionFlavor & otherActionFlavorFlags) == 0;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR283,
                        283,
                        @"[In Action Flavors] TM (Bitmask 0x00000008): This value MUST NOT be combined with other ActionFlavor flags.");
                }

                if (actionBlock.ActionType == ActionType.OP_FORWARD && Common.IsRequirementEnabled(636, this.Site))
                {
                    ForwardDelegateActionData forwardOrDelegateData = (ForwardDelegateActionData)actionBlock.ActionDataValue;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R636");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R636.
                    bool isVerifyR636 = true;
                    foreach (RecipientBlock recipientBlock in forwardOrDelegateData.RecipientsData)
                    {
                        // Whether the PidTagEntryId exists.
                        bool hasPidTagEntryId = false;
                        foreach (TaggedPropertyValue property in recipientBlock.PropertiesData)
                        {
                            // propertyID of PidTagEntryId is 0x0FFF.
                            if (property.PropertyTag.PropertyId == 0x0FFF)
                            {
                                hasPidTagEntryId = true;
                            }
                        }

                        if (!hasPidTagEntryId)
                        {
                            isVerifyR636 = false;
                            break;
                        }
                    }

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR636,
                        636,
                        @"[In Appendix A: Product Behavior] Implementation does require the PidTagEntryId property for action ""OP_FORWARD"". [<8> Section 2.2.5.1.2.4.1: Exchange 2003 and Exchange 2007 also require the PidTagEntryId property for action ""OP_FORWARD"".]");
                }

                if ((actionBlock.ActionType == ActionType.OP_FORWARD) || (actionBlock.ActionType == ActionType.OP_DELEGATE))
                {
                    if (actionBlock.ActionType == ActionType.OP_DELEGATE)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R263");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R263.
                        // If the ActionType of the actionBlock equals the value ActionType.DELEGATE means server could parse the ActionType 0x08.
                        Site.CaptureRequirement(
                            263,
                            @"[In ActionBlock Structure] The value of action type OP_DELEGATE: 0x08.");
                    }

                    ForwardDelegateActionData forwardOrDelegateData = (ForwardDelegateActionData)actionBlock.ActionDataValue;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R323, the recipient count is {0}.", forwardOrDelegateData.RecipientCount);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R323.
                    bool isVerifyR323 = (forwardOrDelegateData.RecipientCount is ushort ? (ushort)forwardOrDelegateData.RecipientCount : (uint)forwardOrDelegateData.RecipientCount) == forwardOrDelegateData.RecipientsData.Length;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR323,
                        323,
                        @"[In OP_FORWARD and OP_DELEGATE ActionData Structure] RecipientCount (4 bytes): An integer that specifies the number of RecipientBlockData structures, as specified in section 2.2.5.1.2.4.1, contained in the RecipientBlocks field. ");

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R324", "The value of the RecipientCount is {0}, it should greater than 0.", forwardOrDelegateData.RecipientCount);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R324.
                    // The RecipientCount can be either unsigned-integer or unsigned-short.
                    uint recipientCount = (forwardOrDelegateData.RecipientCount is uint) ? ((uint)forwardOrDelegateData.RecipientCount) : ((ushort)forwardOrDelegateData.RecipientCount);
                    bool isVerifyR324 = recipientCount > 0;

                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR324,
                        324,
                        @"[In OP_FORWARD and OP_DELEGATE ActionData Structure] RecipientCount (4 bytes): This number MUST be greater than zero.");

                    bool isVerifyR633 = true;
                    bool isVerifyR632 = true;
                    bool isVerifyR331 = true;
                    foreach (RecipientBlock recipientBlock in forwardOrDelegateData.RecipientsData)
                    {
                        if (Common.IsRequirementEnabled(633, this.Site))
                        {
                            if (recipientBlock.Reserved != 0x00)
                            {
                                isVerifyR633 = false;
                                break;
                            }
                        }

                        if (Common.IsRequirementEnabled(632, this.Site))
                        {
                            if (recipientBlock.Reserved != 0x01)
                            {
                                isVerifyR632 = false;
                                break;
                            }
                        }

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R330, the NoOfProperties of the RecipientBlock is {0}.", recipientBlock.NoOfProperties);

                        // Verify MS-OXORULE requirement: MS-OXORULE_R330.
                        bool isVerifyR330 = (recipientBlock.NoOfProperties is ushort ? (ushort)recipientBlock.NoOfProperties : (uint)recipientBlock.NoOfProperties) == (ulong)recipientBlock.PropertiesData.Length;

                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR330,
                            330,
                            @"[In RecipientBlockData Structure] NoOfProperties (4 bytes): An integer that specifies the number of structures present in the PropertyValues field.");

                        TaggedPropertyValue[] taggedPropertyValue = recipientBlock.PropertiesData;
                        bool isVerifyR468 = taggedPropertyValue[0].PropertyTag.PropertyId != 0 && taggedPropertyValue[0].PropertyTag.PropertyType != 0;

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R468");

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R468.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR468,
                            "MS-OXCDATA",
                            468,
                            @"[In TaggedPropertyValue Structure] PropertyTag (4 bytes): A PropertyTag structure, as specified in section 2.9, giving the values of the PropertyId and PropertyType fields for the property.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R469");
                        PropertyValue propertyValue = (PropertyValue)taggedPropertyValue[0];

                        // Verify MS-OXCDATA requirement: MS-OXCDATA_R469.
                        Site.CaptureRequirementIfIsInstanceOfType(
                            propertyValue,
                            typeof(PropertyValue),
                            "MS-OXCDATA",
                            469,
                            @"[In TaggedPropertyValue Structure] PropertyValue (variable): A PropertyValue structure, as specified in section 2.11.2.1.");

                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R1008");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R1008.
                        // The format of the TaggedPropertyValue structure has been verified by MS-OXCDATA_R468, and MS-OXCDATA_R469.
                        Site.CaptureRequirement(
                            1008,
                            @"[In RecipientBlockData Structure] The format of the TaggedPropertyValue structure is specified in [MS-OXCDATA] section 2.11.4.");

                        // Verify MS-OXORULE requirement: MS-OXORULE_R331.
                        uint properties = (recipientBlock.NoOfProperties is uint) ? ((uint)recipientBlock.NoOfProperties) : ((ushort)recipientBlock.NoOfProperties);
                        if (properties <= 0)
                        {
                            isVerifyR331 = false;
                            break;
                        }
                    }

                    if (Common.IsRequirementEnabled(633, this.Site))
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R633");
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR633,
                            633,
                            @"[[In Appendix A: Product Behavior] Implementation does set this value [Reserved (1 byte)] to 0x00. [<9> Section 2.2.5.1.2.4.1: Exchange 2010, Exchange 2013, and Exchange 2016 set this value to 0x00.]");
                    }

                    if (Common.IsRequirementEnabled(632, this.Site))
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R632");

                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR632,
                            632,
                            @"[In Appendix A: Product Behavior] Implementation does set this value [Reserved (1 byte)] to 0x01. [<9> Section 2.2.5.1.2.4.1: Exchange 2003 and Exchange 2007 set this value to 0x01.]");
                    }

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R331");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R331.
                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR331,
                        331,
                        @"[In RecipientBlockData Structure] NoOfProperties (4 bytes): This number MUST be greater than zero.");

                    if (Common.IsRequirementEnabled(895, this.Site))
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R895");

                        // Verify requirement: MS-OXORULE_R895.
                        bool isVerifyR895 = true;
                        foreach (RecipientBlock recipientBlock in forwardOrDelegateData.RecipientsData)
                        {
                            // Whether the PidTagDisplayName exists.
                            bool hasPidTagDisplayName = false;

                            // Whether the PidTagEmailAddress exists.
                            bool hasPidTagEmailAddress = false;

                            // Whether the PidTagRecipientType exists.
                            bool hasPidTagRecipientType = false;
                            foreach (TaggedPropertyValue property in recipientBlock.PropertiesData)
                            {
                                // propertyID of hasPidTagDisplayName is 0x3001.
                                if (property.PropertyTag.PropertyId == 0x3001)
                                {
                                    hasPidTagDisplayName = true;
                                }

                                // propertyID of PidTagEmailAddress is 0x3003.
                                if (property.PropertyTag.PropertyId == 0x3003)
                                {
                                    hasPidTagEmailAddress = true;
                                }

                                // propertyID of PidTagRecipientType is 0x0C15.
                                if (property.PropertyTag.PropertyId == 0x0C15)
                                {
                                    hasPidTagRecipientType = true;
                                }
                            }

                            if (!(hasPidTagDisplayName && hasPidTagEmailAddress && hasPidTagRecipientType))
                            {
                                isVerifyR895 = false;
                                break;
                            }
                        }

                        // Verify MS-OXORULE requirement: MS-OXORULE_R895.
                        Site.CaptureRequirementIfIsTrue(
                            isVerifyR895,
                            895,
                            @"[In RecipientBlock Data Buffer Packet Structure] No rules (2) does require more [specify values for more properties besides the PidTagDisplayName, PidTagEmailAddress, and PidTagRecipientType in the forward/delegate ActionData buffer] on the implementation. (Exchange 2010 and above follow this behavior.)");
                    }
                }

                if (actionBlock.ActionType == ActionType.OP_BOUNCE)
                {
                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R259");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R259.
                    // If the ActionType of the actionBlock equals the value ActionType.OP_COPY means server could parse the ActionType 0x06.
                    Site.CaptureRequirement(
                        259,
                        @"[In ActionBlock Structure] The value of action type OP_BOUNCE: 0x06.");

                    BounceActionData bounceActionData = (BounceActionData)actionBlock.ActionDataValue;

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R340", "The value of the BounceCode field is {0}.", bounceActionData.Bounce);

                    // Verify MS-OXORULE requirement: MS-OXORULE_R340.
                    bool isVerifyR340 =
                          (uint)bounceActionData.Bounce == 0x0000000D
                        || (uint)bounceActionData.Bounce == 0x0000001F
                        || (uint)bounceActionData.Bounce == 0x00000026;
                    Site.CaptureRequirementIfIsTrue(
                        isVerifyR340,
                        340,
                        @"[In OP_BOUNCE ActionData Structure] The bounce code MUST be one of the following values. [0x0000000D, 0x0000001F, and 0x00000026].");
                }

                if ((actionBlock.ActionType == ActionType.OP_DELETE) || (actionBlock.ActionType == ActionType.OP_MARK_AS_READ))
                {
                    if (actionBlock.ActionType == ActionType.OP_DELETE)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R267");

                        // If the ActionType of the actionBlock equals the value ActionType.OP_MOVE means server could parse the ActionType 0x0A.
                        Site.CaptureRequirement(
                                      267,
                                       @"[In ActionBlock Structure] The value of action type OP_DELETE: 0x0A.");
                    }

                    if (actionBlock.ActionType == ActionType.OP_MARK_AS_READ)
                    {
                        // Add the debug information.
                        Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R269");

                        // If the ActionType of the actionBlock equals the value ActionType.OP_COPY means server could parse the ActionType 0x0B.
                        Site.CaptureRequirement(
                                      269,
                                       @"[In ActionBlock Structure] The value of action type OP_MARK_AS_READ: 0x0B.");
                    }

                    // Add the debug information.
                    Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXORULE_R346");

                    // Verify MS-OXORULE requirement: MS-OXORULE_R346.
                    // If the Size of ActionDataValue is 0, it means these actions have no ActionData buffer.
                    Site.CaptureRequirementIfAreEqual<int>(
                        0,
                        actionBlock.ActionDataValue.Size(),
                        346,
                        @"[In OP_DELETE or OP_MARK_AS_READ ActionData Structure] These actions [OP_DELETE, OP_MARK_AS_READ] (3) have no ActionData structure.");
                }
            }
        }
Ejemplo n.º 38
0
    public static PacketDistributed CreatePacket(MessageID packetID)
    {
        PacketDistributed packet = null;

        switch (packetID)
        {
        case MessageID.CSLogin: { packet = new CSLogin(); } break;

        case MessageID.SCLoginRet: { packet = new SCLoginRet(); } break;

        case MessageID.CSLoginThirdPlatform: { packet = new CSLoginThirdPlatform(); } break;

        case MessageID.SCLoginThirdPlatformRet: { packet = new SCLoginThirdPlatformRet(); } break;

        case MessageID.CSThirdPlatformVerifyCharge: { packet = new CSThirdPlatformVerifyCharge(); } break;

        case MessageID.SCThirdPlatformVerifyCharge: { packet = new SCThirdPlatformVerifyCharge(); } break;

        case MessageID.CSAskUserData: { packet = new CSAskUserData(); } break;

        case MessageID.PBUserBaseData: { packet = new PBUserBaseData(); } break;

        case MessageID.PBUserBagData: { packet = new PBUserBagData(); } break;

        case MessageID.PBUserCopyData: { packet = new PBUserCopyData(); } break;

        case MessageID.SCAskUserData: { packet = new SCAskUserData(); } break;

        case MessageID.MissionInfo: { packet = new MissionInfo(); } break;

        case MessageID.CopyInfo: { packet = new CopyInfo(); } break;

        case MessageID.ItemInfo: { packet = new ItemInfo(); } break;

        case MessageID.CardInfo: { packet = new CardInfo(); } break;

        case MessageID.DropBag: { packet = new DropBag(); } break;

        case MessageID.BattleCard: { packet = new BattleCard(); } break;

        case MessageID.CSBattleData: { packet = new CSBattleData(); } break;

        case MessageID.DataBuffInfo: { packet = new DataBuffInfo(); } break;

        case MessageID.DataSingleAction: { packet = new DataSingleAction(); } break;

        case MessageID.DataAction: { packet = new DataAction(); } break;

        case MessageID.DataRound: { packet = new DataRound(); } break;

        case MessageID.DataBattle: { packet = new DataBattle(); } break;

        case MessageID.SCBattleData: { packet = new SCBattleData(); } break;

        case MessageID.CSPVPBattleData: { packet = new CSPVPBattleData(); } break;

        case MessageID.SCPVPBattleData: { packet = new SCPVPBattleData(); } break;

        case MessageID.CSChangeMember: { packet = new CSChangeMember(); } break;

        case MessageID.SCChangeMember: { packet = new SCChangeMember(); } break;

        case MessageID.CSCardCombining: { packet = new CSCardCombining(); } break;

        case MessageID.SCCardCombiningRet: { packet = new SCCardCombiningRet(); } break;

        case MessageID.CSCardEvolve: { packet = new CSCardEvolve(); } break;

        case MessageID.SCCardEvolveRet: { packet = new SCCardEvolveRet(); } break;

        case MessageID.CSCardStrengthen: { packet = new CSCardStrengthen(); } break;

        case MessageID.SCCardStrengthenRet: { packet = new SCCardStrengthenRet(); } break;

        case MessageID.CSFriendsList: { packet = new CSFriendsList(); } break;

        case MessageID.SCFriendsList: { packet = new SCFriendsList(); } break;

        case MessageID.CSSearchFriend: { packet = new CSSearchFriend(); } break;

        case MessageID.SCSearchFriend: { packet = new SCSearchFriend(); } break;

        case MessageID.CSGiveFriendPower: { packet = new CSGiveFriendPower(); } break;

        case MessageID.SCGiveFriendPower: { packet = new SCGiveFriendPower(); } break;

        case MessageID.CSGetFriendPower: { packet = new CSGetFriendPower(); } break;

        case MessageID.SCGetFriendPower: { packet = new SCGetFriendPower(); } break;

        case MessageID.CSADDFriend: { packet = new CSADDFriend(); } break;

        case MessageID.SCADDFriend: { packet = new SCADDFriend(); } break;

        case MessageID.CSDeleteFriend: { packet = new CSDeleteFriend(); } break;

        case MessageID.SCDeleteFriend: { packet = new SCDeleteFriend(); } break;

        case MessageID.CSGetRandomAssistanceList: { packet = new CSGetRandomAssistanceList(); } break;

        case MessageID.SCGetRandomAssistanceList: { packet = new SCGetRandomAssistanceList(); } break;

        case MessageID.PBFriend: { packet = new PBFriend(); } break;

        case MessageID.CSSellCard: { packet = new CSSellCard(); } break;

        case MessageID.SCSellCard: { packet = new SCSellCard(); } break;

        case MessageID.SCErrorMsg: { packet = new SCErrorMsg(); } break;

        case MessageID.CSMailList: { packet = new CSMailList(); } break;

        case MessageID.SCMailList: { packet = new SCMailList(); } break;

        case MessageID.PBMail: { packet = new PBMail(); } break;

        case MessageID.CSMailDelete: { packet = new CSMailDelete(); } break;

        case MessageID.SCMailDelete: { packet = new SCMailDelete(); } break;

        case MessageID.CSMailSend: { packet = new CSMailSend(); } break;

        case MessageID.SCMailSend: { packet = new SCMailSend(); } break;

        case MessageID.CSMailFriend: { packet = new CSMailFriend(); } break;

        case MessageID.SCMailFriend: { packet = new SCMailFriend(); } break;

        case MessageID.CSMailSystem: { packet = new CSMailSystem(); } break;

        case MessageID.SCMailSystem: { packet = new SCMailSystem(); } break;

        case MessageID.CSMailRead: { packet = new CSMailRead(); } break;

        case MessageID.SCMailRead: { packet = new SCMailRead(); } break;

        case MessageID.CSGMcmds: { packet = new CSGMcmds(); } break;

        case MessageID.SCGMcmds: { packet = new SCGMcmds(); } break;

        case MessageID.CSTaskList: { packet = new CSTaskList(); } break;

        case MessageID.SCTaskList: { packet = new SCTaskList(); } break;

        case MessageID.PBTask: { packet = new PBTask(); } break;

        case MessageID.CSFinishTask: { packet = new CSFinishTask(); } break;

        case MessageID.SCFinishTask: { packet = new SCFinishTask(); } break;

        case MessageID.CSShop: { packet = new CSShop(); } break;

        case MessageID.SCShopRet: { packet = new SCShopRet(); } break;

        case MessageID.CSGamble: { packet = new CSGamble(); } break;

        case MessageID.SCGambleRet: { packet = new SCGambleRet(); } break;

        case MessageID.CSGuide: { packet = new CSGuide(); } break;

        case MessageID.SCGuide: { packet = new SCGuide(); } break;

        case MessageID.ButtonInfo: { packet = new ButtonInfo(); } break;

        case MessageID.CSChangeName: { packet = new CSChangeName(); } break;

        case MessageID.SCChangeName: { packet = new SCChangeName(); } break;

        case MessageID.CSBindAccount: { packet = new CSBindAccount(); } break;

        case MessageID.SCBindAccount: { packet = new SCBindAccount(); } break;

        case MessageID.CSAskPVPList: { packet = new CSAskPVPList(); } break;

        case MessageID.SCAskPVPList: { packet = new SCAskPVPList(); } break;

        case MessageID.PVPUserBaseData: { packet = new PVPUserBaseData(); } break;

        case MessageID.CSAskScoreShopFresh: { packet = new CSAskScoreShopFresh(); } break;

        case MessageID.SCAskScoreShopFresh: { packet = new SCAskScoreShopFresh(); } break;

        case MessageID.CSPVPShop: { packet = new CSPVPShop(); } break;

        case MessageID.SCPVPShopRet: { packet = new SCPVPShopRet(); } break;

        case MessageID.ProductInfo: { packet = new ProductInfo(); } break;

        case MessageID.CSProductList: { packet = new CSProductList(); } break;

        case MessageID.SCProductList: { packet = new SCProductList(); } break;

        case MessageID.CSClearBattleData: { packet = new CSClearBattleData(); } break;

        case MessageID.SCClearBattleData: { packet = new SCClearBattleData(); } break;

        case MessageID.CSRandomCardFree: { packet = new CSRandomCardFree(); } break;

        case MessageID.SCRandomCardFree: { packet = new SCRandomCardFree(); } break;

        case MessageID.CS20038: { packet = new CS20038(); } break;

        case MessageID.SC30038: { packet = new SC30038(); } break;

        case MessageID.CS20039: { packet = new CS20039(); } break;

        case MessageID.SC30039: { packet = new SC30039(); } break;

        case MessageID.CS20040: { packet = new CS20040(); } break;

        case MessageID.SC30040: { packet = new SC30040(); } break;

        case MessageID.CS20041: { packet = new CS20041(); } break;

        case MessageID.SC30041: { packet = new SC30041(); } break;

        case MessageID.CSscode: { packet = new CSscode(); } break;

        case MessageID.SCscode: { packet = new SCscode(); } break;

        case MessageID.CSCYouProductList: { packet = new CSCYouProductList(); } break;

        case MessageID.SCCYouProductList: { packet = new SCCYouProductList(); } break;

        case MessageID.CSCYouVerifyCharge: { packet = new CSCYouVerifyCharge(); } break;

        case MessageID.SCCYouVerifyCharge: { packet = new SCCYouVerifyCharge(); } break;

        case MessageID.CSPPProductList: { packet = new CSPPProductList(); } break;

        case MessageID.SCPPProductList: { packet = new SCPPProductList(); } break;

        case MessageID.CSPPVerifyCharge: { packet = new CSPPVerifyCharge(); } break;

        case MessageID.SCPPVerifyCharge: { packet = new SCPPVerifyCharge(); } break;

        case MessageID.CSBuyMoney: { packet = new CSBuyMoney(); } break;

        case MessageID.SCBuyMoney: { packet = new SCBuyMoney(); } break;

        case MessageID.CSBuyPower: { packet = new CSBuyPower(); } break;

        case MessageID.SCBuyPower: { packet = new SCBuyPower(); } break;

        case MessageID.CSSDKLoginThirdPlatform: { packet = new CSSDKLoginThirdPlatform(); } break;

        case MessageID.SCSDKLoginThirdPlatformRet: { packet = new SCSDKLoginThirdPlatformRet(); } break;

        case MessageID.CSSDKRefresh: { packet = new CSSDKRefresh(); } break;

        case MessageID.SCSDKRefreshRet: { packet = new SCSDKRefreshRet(); } break;

        case MessageID.CSCommonProductList: { packet = new CSCommonProductList(); } break;

        case MessageID.SCCommonProductListRet: { packet = new SCCommonProductListRet(); } break;

        case MessageID.CSCYouPayVerifyCharge: { packet = new CSCYouPayVerifyCharge(); } break;

        case MessageID.SCCYouPayVerifyChargeRet: { packet = new SCCYouPayVerifyChargeRet(); } break;

        case MessageID.CSGGL: { packet = new CSGGL(); } break;

        case MessageID.SCGGL: { packet = new SCGGL(); } break;

        case MessageID.CSWuxingActivation: { packet = new CSWuxingActivation(); } break;

        case MessageID.SCWuxingActivation: { packet = new SCWuxingActivation(); } break;

        case MessageID.CSWuxingLevelup: { packet = new CSWuxingLevelup(); } break;

        case MessageID.SCWuxingLevelup: { packet = new SCWuxingLevelup(); } break;

        case MessageID.CSWuxingReset: { packet = new CSWuxingReset(); } break;

        case MessageID.SCWuxingReset: { packet = new SCWuxingReset(); } break;

        case MessageID.WuxingInfo: { packet = new WuxingInfo(); } break;

        case MessageID.SuipianInfo: { packet = new SuipianInfo(); } break;

        case MessageID.FengshuiInfo: { packet = new FengshuiInfo(); } break;

        case MessageID.CSBGZ: { packet = new CSBGZ(); } break;

        case MessageID.SCBGZ: { packet = new SCBGZ(); } break;

        case MessageID.MonthCardInfo: { packet = new MonthCardInfo(); } break;

        case MessageID.CSMonthCardGetDollar: { packet = new CSMonthCardGetDollar(); } break;

        case MessageID.SCMonthCardGetDollar: { packet = new SCMonthCardGetDollar(); } break;

        case MessageID.MonthReward: { packet = new MonthReward(); } break;

        case MessageID.CSMonthCardInfo: { packet = new CSMonthCardInfo(); } break;

        case MessageID.SCMonthCardInfo: { packet = new SCMonthCardInfo(); } break;

        case MessageID.CSFriendMailDelete: { packet = new CSFriendMailDelete(); } break;

        case MessageID.SCFriendMailDelete: { packet = new SCFriendMailDelete(); } break;

        case MessageID.CSStudySkill: { packet = new CSStudySkill(); } break;

        case MessageID.SCStudySkill: { packet = new SCStudySkill(); } break;

        case MessageID.CSStudySkillUpdate: { packet = new CSStudySkillUpdate(); } break;

        case MessageID.SCStudySkillUpdate: { packet = new SCStudySkillUpdate(); } break;

        case MessageID.CSQxzbPVPDataAsk: { packet = new CSQxzbPVPDataAsk(); } break;

        case MessageID.SCQxzbPVPDataAsk: { packet = new SCQxzbPVPDataAsk(); } break;

        case MessageID.CSQxzbBattle: { packet = new CSQxzbBattle(); } break;

        case MessageID.SCQxzbBattle: { packet = new SCQxzbBattle(); } break;

        case MessageID.CSQxzbPVPClearCD: { packet = new CSQxzbPVPClearCD(); } break;

        case MessageID.SCQxzbPVPClearCD: { packet = new SCQxzbPVPClearCD(); } break;

        case MessageID.CSQxzbGetReward: { packet = new CSQxzbGetReward(); } break;

        case MessageID.SCQxzbGetReward: { packet = new SCQxzbGetReward(); } break;

        case MessageID.CSPaiTaBattleData: { packet = new CSPaiTaBattleData(); } break;

        case MessageID.SCPaiTaBattleData: { packet = new SCPaiTaBattleData(); } break;

        case MessageID.CSClearPaiTaBattleData: { packet = new CSClearPaiTaBattleData(); } break;

        case MessageID.SCClearPaiTaBattleData: { packet = new SCClearPaiTaBattleData(); } break;

        case MessageID.CSAskWorldBossInfo: { packet = new CSAskWorldBossInfo(); } break;

        case MessageID.SCAskWorldBossInfo: { packet = new SCAskWorldBossInfo(); } break;

        case MessageID.WorldBoss: { packet = new WorldBoss(); } break;

        case MessageID.WorldBossKillInfo: { packet = new WorldBossKillInfo(); } break;

        case MessageID.WorldBossAttInfo: { packet = new WorldBossAttInfo(); } break;

        case MessageID.WorldBossDamageRankInfo: { packet = new WorldBossDamageRankInfo(); } break;

        case MessageID.CSAskWorldBossBattle: { packet = new CSAskWorldBossBattle(); } break;

        case MessageID.SCAskWorldBossBattle: { packet = new SCAskWorldBossBattle(); } break;

        case MessageID.CSWorldBossAddZhufu: { packet = new CSWorldBossAddZhufu(); } break;

        case MessageID.SCWorldBossAddZhufu: { packet = new SCWorldBossAddZhufu(); } break;

        case MessageID.CSWorldBossResurgence: { packet = new CSWorldBossResurgence(); } break;

        case MessageID.SCWorldBossResurgence: { packet = new SCWorldBossResurgence(); } break;

        case MessageID.CSAskActivity: { packet = new CSAskActivity(); } break;

        case MessageID.SCAskActivity: { packet = new SCAskActivity(); } break;

        case MessageID.ActivityInfo: { packet = new ActivityInfo(); } break;

        case MessageID.ChangeCardInfo: { packet = new ChangeCardInfo(); } break;

        case MessageID.cardGuidAndTempleID: { packet = new cardGuidAndTempleID(); } break;

        case MessageID.CSAskChangeCardList: { packet = new CSAskChangeCardList(); } break;

        case MessageID.SCAskChangeCardList: { packet = new SCAskChangeCardList(); } break;

        case MessageID.CSChangeCardConfirm: { packet = new CSChangeCardConfirm(); } break;

        case MessageID.SCChangeCardConfirm: { packet = new SCChangeCardConfirm(); } break;

        case MessageID.CSWorldBossWeekRank: { packet = new CSWorldBossWeekRank(); } break;

        case MessageID.SCWorldBossWeekRank: { packet = new SCWorldBossWeekRank(); } break;

        case MessageID.CSWorldBossWeekReward: { packet = new CSWorldBossWeekReward(); } break;

        case MessageID.SCWorldBossWeekReward: { packet = new SCWorldBossWeekReward(); } break;

        case MessageID.CSTaskOver: { packet = new CSTaskOver(); } break;

        case MessageID.SCTaskOver: { packet = new SCTaskOver(); } break;

        case MessageID.PBYunyingHuodong: { packet = new PBYunyingHuodong(); } break;

        case MessageID.CSYunyingHuodong: { packet = new CSYunyingHuodong(); } break;

        case MessageID.SCYunyingHuodong: { packet = new SCYunyingHuodong(); } break;

        case MessageID.CSGooglePayVerifyCharge: { packet = new CSGooglePayVerifyCharge(); } break;

        case MessageID.SCGooglePayVerifyChargeRet: { packet = new SCGooglePayVerifyChargeRet(); } break;
        }
        if (null != packet)
        {
            packet.packetID = packetID;
        }
        //netActionTime = DateTime.Now.ToFileTimeUtc();
        return(packet);
    }
Ejemplo n.º 39
0
        //打包想要的json信息
        private string MakeUserPacket(MessageID id, List<SharedFilesTo> files)
        {
            var message = new Message()
            {
                ID = id,
                user = Hoster,
                sharedfiles = files,
                sharedpassword = DownPassword
            };
            var serializer = new DataContractJsonSerializer(typeof(Message));
            var stream = new MemoryStream();
            serializer.WriteObject(stream, message);

            byte[] dataBytes = new byte[stream.Length];

            stream.Position = 0;

            stream.Read(dataBytes, 0, (int)stream.Length);

            string dataString = Encoding.UTF8.GetString(dataBytes);

            return dataString;
        }
Ejemplo n.º 40
0
 public T Get <T>(MessageID id) where T : class, IMessage
 {
     mMessageDic.TryGetValue((int)id, out IMessage message);
     return(message as T);
 }
Ejemplo n.º 41
0
 public void ErrAppendId(MessageID id)
 {
     string str;
     ErrId(out str, id);
     ErrAppendString(str);
 }
Ejemplo n.º 42
0
 public Message(MessageID id)
 {
     this.id      = id;
     this.message = new T();
 }
Ejemplo n.º 43
0
 private void CheckFeatureAvailability(MessageID feature)
 {
     LanguageVersion availableVersion = this.Options.LanguageVersion;
     var requiredVersion = feature.RequiredVersion();
     if (availableVersion >= requiredVersion) return;
     var featureName = feature.Localize();
     this.AddError(availableVersion.GetErrorCode(), featureName, requiredVersion.Localize());
 }
Ejemplo n.º 44
0
 public void AddID(MessageID id, string url)
 {
     if (Table.ContainsKey(id) == true)
         return;
     Table.Add(id, url);
 }
Ejemplo n.º 45
0
 private StatementSyntax ParseStatementExperimental(string text, MessageID feature)
 {
     return ParseStatement(text, offset: 0, options: TestOptions.Regular.WithExperimental(feature));
 }
Ejemplo n.º 46
0
 /// <remarks>Don't call this during a parse--it loads resources</remarks>
 public static string GetMessage(MessageID code, CultureInfo culture)
 {
     string message = ResourceManager.GetString(code.ToString(), culture);
     Debug.Assert(!string.IsNullOrEmpty(message));
     return message;
 }
Ejemplo n.º 47
0
        internal static LanguageVersion RequiredVersion(this MessageID feature)
        {
            // Based on CSourceParser::GetFeatureUsage from SourceParser.cpp.
            // Checks are in the LanguageParser unless otherwise noted.
            switch (feature)
            {
            // C# 7.2 features.
            case MessageID.IDS_FeatureNonTrailingNamedArguments:     // semantic check
            case MessageID.IDS_FeatureLeadingDigitSeparator:
            case MessageID.IDS_FeaturePrivateProtected:
            case MessageID.IDS_FeatureReadOnlyReferences:
            case MessageID.IDS_FeatureRefStructs:
            case MessageID.IDS_FeatureReadOnlyStructs:
            case MessageID.IDS_FeatureRefExtensionMethods:
                return(LanguageVersion.CSharp7_2);

            // C# 7.1 features.
            case MessageID.IDS_FeatureAsyncMain:
            case MessageID.IDS_FeatureDefaultLiteral:
            case MessageID.IDS_FeatureInferredTupleNames:
            case MessageID.IDS_FeatureGenericPatternMatching:
                return(LanguageVersion.CSharp7_1);

            // C# 7 features.
            case MessageID.IDS_FeatureBinaryLiteral:
            case MessageID.IDS_FeatureDigitSeparator:
            case MessageID.IDS_FeatureLocalFunctions:
            case MessageID.IDS_FeatureRefLocalsReturns:
            case MessageID.IDS_FeaturePatternMatching:
            case MessageID.IDS_FeatureThrowExpression:
            case MessageID.IDS_FeatureTuples:
            case MessageID.IDS_FeatureOutVar:
            case MessageID.IDS_FeatureExpressionBodiedAccessor:
            case MessageID.IDS_FeatureExpressionBodiedDeOrConstructor:
                return(LanguageVersion.CSharp7);

            // C# 6 features.
            case MessageID.IDS_FeatureExceptionFilter:
            case MessageID.IDS_FeatureAutoPropertyInitializer:
            case MessageID.IDS_FeatureNullPropagatingOperator:
            case MessageID.IDS_FeatureExpressionBodiedMethod:
            case MessageID.IDS_FeatureExpressionBodiedProperty:
            case MessageID.IDS_FeatureExpressionBodiedIndexer:
            case MessageID.IDS_FeatureNameof:
            case MessageID.IDS_FeatureDictionaryInitializer:
            case MessageID.IDS_FeatureUsingStatic:
            case MessageID.IDS_FeatureInterpolatedStrings:
            case MessageID.IDS_AwaitInCatchAndFinally:
            case MessageID.IDS_FeatureReadonlyAutoImplementedProperties:
                return(LanguageVersion.CSharp6);

            // C# 5 features.
            case MessageID.IDS_FeatureAsync:
                return(LanguageVersion.CSharp5);

            // C# 4 features.
            case MessageID.IDS_FeatureDynamic:     // Checked in the binder.
            case MessageID.IDS_FeatureTypeVariance:
            case MessageID.IDS_FeatureNamedArgument:
            case MessageID.IDS_FeatureOptionalParameter:
                return(LanguageVersion.CSharp4);

            // C# 3 features.
            case MessageID.IDS_FeatureImplicitArray:
            case MessageID.IDS_FeatureAnonymousTypes:
            case MessageID.IDS_FeatureObjectInitializer:
            case MessageID.IDS_FeatureCollectionInitializer:
            case MessageID.IDS_FeatureLambda:
            case MessageID.IDS_FeatureQueryExpression:
            case MessageID.IDS_FeatureExtensionMethod:
            case MessageID.IDS_FeaturePartialMethod:
            case MessageID.IDS_FeatureImplicitLocal:     // Checked in the binder.
            case MessageID.IDS_FeatureAutoImplementedProperties:
                return(LanguageVersion.CSharp3);

            // C# 2 features.
            case MessageID.IDS_FeatureGenerics:        // Also affects crefs.
            case MessageID.IDS_FeatureAnonDelegates:
            case MessageID.IDS_FeatureGlobalNamespace: // Also affects crefs.
            case MessageID.IDS_FeatureFixedBuffer:
            case MessageID.IDS_FeatureStaticClasses:
            case MessageID.IDS_FeaturePartialTypes:
            case MessageID.IDS_FeaturePropertyAccessorMods:
            case MessageID.IDS_FeatureExternAlias:
            case MessageID.IDS_FeatureIterators:
            case MessageID.IDS_FeatureDefault:
            case MessageID.IDS_FeatureNullable:
            case MessageID.IDS_FeaturePragma:       // Checked in the directive parser.
            case MessageID.IDS_FeatureSwitchOnBool: // Checked in the binder.
                return(LanguageVersion.CSharp2);

            // Special C# 2 feature: only a warning in C# 1.
            case MessageID.IDS_FeatureModuleAttrLoc:
                Debug.Assert(false, "Should be handled specially");
                return(LanguageVersion.CSharp1);

            default:
                throw ExceptionUtilities.UnexpectedValue(feature);
            }
        }
Ejemplo n.º 48
0
 public Payload(MessageID id, byte[] body)
 {
     _id = id;
     _body = new byte[body.Length];
     System.Buffer.BlockCopy(body, 0, _body, 0, _body.Length);
 }
Ejemplo n.º 49
0
 public ErrArgIds(MessageID ids)
 {
     this.eak = ErrArgKind.Ids;
     this.eaf = ErrArgFlags.None;
     this.ids = ids;
 }
Ejemplo n.º 50
0
 public MSG_DELETE_ROSPEC()
 {
     this.msgType = (ushort)21;
     this.MSG_ID  = MessageID.getNewMessageID();
 }
Ejemplo n.º 51
0
        private void CheckFeatureAvailability(MessageID feature)
        {
            var options = this.Options;
            if (options.IsFeatureEnabled(feature))
            {
                return;
            }

            string requiredFeature = feature.RequiredFeature();
            if (requiredFeature != null)
            {
                if (!options.IsFeatureEnabled(feature))
                {
                    this.AddError(ErrorCode.ERR_FeatureIsExperimental, feature.Localize(), requiredFeature);
                }

                return;
            }

            LanguageVersion availableVersion = this.Options.LanguageVersion;
            var requiredVersion = feature.RequiredVersion();
            if (availableVersion >= requiredVersion) return;
            var featureName = feature.Localize();
            this.AddError(availableVersion.GetErrorCode(), featureName, requiredVersion.Localize());
        }
Ejemplo n.º 52
0
 public void ErrId(out string s, MessageID id)
 {
     s = ErrorFacts.GetMessage(id);
 }
Ejemplo n.º 53
0
        private RESULT waitResult(MessageID id)
        {
            Payload p = null;
            while (true)
            {
                p = Read();

                if (p.ID == MessageID.ACK)
                {
                    if (id == (MessageID)p.Body[0])
                    {
                        return RESULT.RESULT_ACK;
                    }
                }
                else if (p.ID == MessageID.NACK)
                {
                    if (id == (MessageID)p.Body[0])
                    {
                        return RESULT.RESULT_NACK;
                    }
                }
            }
        }
Ejemplo n.º 54
0
 protected bool IsFeatureEnabled(MessageID feature)
 {
     return(this.Options.IsFeatureEnabled(feature));
 }
 private string MakeCommentMessage(Location location, MessageID messageId)
 {
     if (location.IsInSource)
     {
         // TODO: use culture from compilation instead of invariant culture?
         return ErrorFacts.GetMessage(messageId, CultureInfo.InvariantCulture);
     }
     else
     {
         return null;
     }
 }
Ejemplo n.º 56
0
 public ErrArgIds(MessageID ids)
 {
     this.eak = ErrArgKind.Ids;
     this.eaf = ErrArgFlags.None;
     this.ids = ids;
 }
Ejemplo n.º 57
0
 internal CompilationUnitSyntax ParseFileExperimental(string text, MessageID feature) =>
 ParseFile(text, parseOptions: TestOptions.Regular.WithExperimental(feature));
Ejemplo n.º 58
0
 public static string GetMessage(MessageID id)
 {
     return(id.ToString());
 }
Ejemplo n.º 59
0
        private static void ParseAndResolveReferencePaths(string switchName, string switchValue, string baseDirectory, List<string> builder, MessageID origin, List<Diagnostic> diagnostics)
        {
            if (string.IsNullOrEmpty(switchValue))
            {
                Debug.Assert(!string.IsNullOrEmpty(switchName));
                AddDiagnostic(diagnostics, ErrorCode.ERR_SwitchNeedsString, MessageID.IDS_PathList.Localize(), switchName);
                return;
            }

            foreach (string path in ParseSeparatedPaths(switchValue))
            {
                string resolvedPath = FileUtilities.ResolveRelativePath(path, baseDirectory);
                if (resolvedPath == null)
                {
                    AddDiagnostic(diagnostics, ErrorCode.WRN_InvalidSearchPathDir, path, origin.Localize(), MessageID.IDS_DirectoryHasInvalidPath.Localize());
                }
                else if (!PortableShim.Directory.Exists(resolvedPath))
                {
                    AddDiagnostic(diagnostics, ErrorCode.WRN_InvalidSearchPathDir, path, origin.Localize(), MessageID.IDS_DirectoryDoesNotExist.Localize());
                }
                else
                {
                    builder.Add(resolvedPath);
                }
            }
        }
Ejemplo n.º 60
0
 public static string GetMessage(MessageID id)
 {
     return id.ToString();
 }