コード例 #1
0
 public MessageTypeIndicator(MessageVersion messageVersion, MessageClass messageClass, MessageFunction messageFunction, MessageOrigin originMessage)
 {
     MessageVersion = messageVersion;
     MessageClass = messageClass;
     MessageFunction = messageFunction;
     OriginMessage = originMessage;
     Mit = (int)messageVersion + (int)messageClass + (int)messageFunction + (int)originMessage;
 }
コード例 #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="messageOrigin">Origin of message</param>
        /// <param name="messageType">Type of message</param>
        /// <param name="rawData">The raw data bytes of FileZilla Message</param>
        /// <param name="protocolVersion">server protocol version</param>
        public FileZillaMessage(MessageOrigin messageOrigin, MessageType messageType, byte[] rawData, int protocolVersion)
        {
            MessageOrigin = messageOrigin;
            MessageType = messageType;
            RawData = rawData;
            _body = new Lazy<object>(() => Deserialize(protocolVersion));

#if DEBUG
            // Force immediate load of body during debugging
            var dummy = _body.Value;
#endif
        }
コード例 #3
0
ファイル: MessagePipe.cs プロジェクト: Microsoft/RTVS
        private void LogMessage(MessageOrigin origin, byte[] messageData, bool replay = false) {
            if (_logger == null) {
                return;
            }

            Message message;
            try {
                message = Message.Parse(messageData);
            } catch (InvalidDataException ex) {
                _logger.Log(LogLevel.Error, 0, messageData, ex, delegate {
                    return Invariant($"Malformed {origin.ToString().ToLowerInvariant()} message:{Environment.NewLine}{BitConverter.ToString(messageData)}");
                });
                return;
            }

            _logger.Log(LogLevel.Trace, 0, message, null, delegate {
                var sb = new StringBuilder(replay ? "(replay) " : "");

                sb.Append(Invariant($"|{_pid}|{(origin == MessageOrigin.Host ? ">" : "<")} #{message.Id}# {message.Name} "));

                if (message.IsResponse) {
                    sb.Append(Invariant($"#{message.RequestId}# "));
                }

                sb.Append(message.Json);

                if (message.Blob != null && message.Blob.Length != 0) {
                    sb.Append(Invariant($" <raw ({message.Blob.Length} bytes)>"));
                }

                return sb.ToString();
            });
        }
コード例 #4
0
ファイル: MessageContainer.cs プロジェクト: pranavkm/linker
 public static MessageContainer CreateWarningMessage(LinkContext context, string text, int code, MessageOrigin origin, string subcategory = "", WarnVersion?version = null)
 {
     throw null;
 }
コード例 #5
0
 public Scope(MessageOrigin origin)
 {
     Origin = origin;
 }
コード例 #6
0
        private IrcCommandContext GetContextFromIrcEventArgs(IrcEventArgs ircEventArgs, MessageOrigin messageOrigin)
        {
            string        command;
            CommandName?  commandName;
            var           msgarray   = ircEventArgs.Data.Message.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
            List <string> msgStrings = null;

            switch (messageOrigin)
            {
            case MessageOrigin.Channel:
                command     = ircEventArgs.Data.MessageArray[1];
                commandName = GetCommandName(command);
                if (commandName != null)
                {
                    msgStrings = FilterMsgArray(msgarray, commandName.Value).ToList();
                }
                break;

            case MessageOrigin.Query:
                command     = ircEventArgs.Data.MessageArray[1];
                commandName = GetCommandName(command);
                if (commandName != null)
                {
                    msgStrings = FilterMsgArray(msgarray, commandName.Value).ToList();
                }
                break;

            case MessageOrigin.Notice:
                string connectpart = msgarray[1];
                command     = GetNoticeType(connectpart).ToString();
                commandName = GetCommandName(command);
                if (commandName != null)
                {
                    msgStrings = FilterMsgArray(msgarray, commandName.Value).ToList();
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(messageOrigin));
            }

            var ircCommandContext = new IrcCommandContext
            {
                Channel       = ircEventArgs.Data.Channel,
                Host          = ircEventArgs.Data.Host,
                Ident         = ircEventArgs.Data.Ident,
                MessageOrigin = messageOrigin,
                Command       = commandName,
                MsgArray      = msgStrings,
                User          = ircEventArgs.Data.Nick
            };

            return(ircCommandContext);
        }
コード例 #7
0
        protected override void Process()
        {
            AssemblyDefinition?assembly = LoadAssemblyFile();

            if (assembly == null)
            {
                return;
            }

            var di     = new DependencyInfo(DependencyKind.RootAssembly, assembly);
            var origin = new MessageOrigin(assembly);

            AssemblyAction action = Context.Annotations.GetAction(assembly);

            switch (action)
            {
            case AssemblyAction.Copy:
                Annotations.Mark(assembly.MainModule, di, origin);
                // Mark Step will take care of marking whole assembly
                return;

            case AssemblyAction.CopyUsed:
            case AssemblyAction.Link:
                break;

            default:
                Context.LogError(null, DiagnosticId.RootAssemblyCannotUseAction, assembly.Name.ToString(), action.ToString());
                return;
            }

            switch (rootMode)
            {
            case AssemblyRootMode.Default:
                if (assembly.MainModule.Kind == ModuleKind.Dll)
                {
                    goto case AssemblyRootMode.AllMembers;
                }
                else
                {
                    goto case AssemblyRootMode.EntryPoint;
                }

            case AssemblyRootMode.EntryPoint:
                var ep = assembly.MainModule.EntryPoint;
                if (ep == null)
                {
                    Context.LogError(null, DiagnosticId.RootAssemblyDoesNotHaveEntryPoint, assembly.Name.ToString());
                    return;
                }

                Annotations.Mark(ep.DeclaringType, di, origin);
                Annotations.AddPreservedMethod(ep.DeclaringType, ep);
                break;

            case AssemblyRootMode.VisibleMembers:
                var preserve_visible = TypePreserveMembers.Visible;
                if (MarkInternalsVisibleTo(assembly))
                {
                    preserve_visible |= TypePreserveMembers.Internal;
                }

                MarkAndPreserve(assembly, preserve_visible);
                break;

            case AssemblyRootMode.Library:
                var preserve_library = TypePreserveMembers.Visible | TypePreserveMembers.Library;
                if (MarkInternalsVisibleTo(assembly))
                {
                    preserve_library |= TypePreserveMembers.Internal;
                }

                MarkAndPreserve(assembly, preserve_library);

                // Assembly root mode wins over any enabled optimization which
                // could conflict with library rooting behaviour
                Context.Optimizations.Disable(
                    CodeOptimizations.Sealer |
                    CodeOptimizations.UnusedTypeChecks |
                    CodeOptimizations.UnreachableBodies |
                    CodeOptimizations.UnusedInterfaces |
                    CodeOptimizations.RemoveDescriptors |
                    CodeOptimizations.RemoveLinkAttributes |
                    CodeOptimizations.RemoveSubstitutions |
                    CodeOptimizations.RemoveDynamicDependencyAttribute |
                    CodeOptimizations.OptimizeTypeHierarchyAnnotations, assembly.Name.Name);

                // Enable EventSource special handling
                Context.DisableEventSourceSpecialHandling = false;

                // No metadata trimming
                Context.MetadataTrimming = MetadataTrimming.None;
                break;

            case AssemblyRootMode.AllMembers:
                Context.Annotations.SetAction(assembly, AssemblyAction.Copy);
                return;
            }
        }
コード例 #8
0
 private NotificationMessage createFor(NotificationType notificationType, IObjectBase objectBase, MessageOrigin origin, IBuildingBlock buildingBlock)
 {
     return(new NotificationMessage(objectBase, origin, buildingBlock, notificationType)
     {
         ObjectType = _objectTypeResolver.TypeFor(objectBase),
         BuildingBlockType = _objectTypeResolver.TypeFor(buildingBlock),
     });
 }
コード例 #9
0
 public void UnrecognizedReflectionAccessPattern(MethodDefinition sourceMethod, Instruction reflectionMethodCall, IMetadataTokenProvider accessedItem, string message)
 {
     LogMessage(MessageContainer.CreateWarningMessage(message, 2006, "Unrecognized reflection pattern",
                                                      reflectionMethodCall != null ? MessageOrigin.TryGetOrigin(sourceMethod, reflectionMethodCall.Offset) : null));
     UnrecognizedPatterns.Add(new ReflectionAccessPattern {
         SourceMethod         = sourceMethod,
         ReflectionMethodCall = reflectionMethodCall,
         AccessedItem         = accessedItem,
         Message = message
     });
 }
コード例 #10
0
        public void LogWarning(string text, int code, string origin, string subcategory = MessageSubCategory.None)
        {
            MessageOrigin _origin = new MessageOrigin(origin);

            LogWarning(text, code, _origin, subcategory);
        }