public IMessageFilter CreateFilter(byte key, MessageFilterType type) { IMessageFilter filter = null; Dictionary<byte, IMessageFilter> map = null; if (filterMap.TryGetValue(type, out map)) { var pos = posMap[type]; map.TryGetValue((byte)(key & pos), out filter); } return filter ?? Empty.Instance; }
public IMessageFilter CreateFilter(byte key, MessageFilterType type) { IMessageFilter filter = null; Dictionary <byte, IMessageFilter> map = null; if (filterMap.TryGetValue(type, out map)) { var pos = posMap[type]; map.TryGetValue((byte)(key & pos), out filter); } return(filter ?? Empty.Instance); }
internal static string ToSerializedValue(this MessageFilterType value) { switch (value) { case MessageFilterType.NotSpecified: return("NotSpecified"); case MessageFilterType.Include: return("Include"); case MessageFilterType.Exclude: return("Exclude"); } return(null); }
public void Write(string message, MessageFilterType filterType, RequestResponseType requestResponse, MessageFilterLevel filterLevel, string symbolOrMarket, LogEntryType logType, ConsoleColor textColor) { if (!isConsoleVisible) { return; } if (HasFilterSet) { InternalWrite(message, requestResponse, filterType, filterLevel, symbolOrMarket, logType, textColor); } else { InternalWrite(message, RequestResponseType.All, MessageFilterType.All, MessageFilterLevel.None, null, LogEntryType.Info, textColor); } }
public static DuplexMessage CreateCommandMessage( string messageId, MessageVersion version, string identifier, MessageFilterType filterType, byte[] filterCode, MessageState state, ErrorCode errorCode, SerializeMode serializeMode, CommandCode commandCode, object content = null) { if (content != null) { return(new DuplexMessage(new MessageHeader( messageId, version, identifier, filterCode, filterType, state, errorCode, serializeMode, commandCode, MessageType.Command), content)); } else { return(new DuplexMessage(new MessageHeader( messageId, version, identifier, MessageFilterFactory.CreateDefaultFilterCode(), MessageFilterType.Checksum, state, errorCode, SerializeMode.None, commandCode, MessageType.Command), null)); } }
public static DuplexMessage CreateCommandMessage( string messageId, MessageVersion version, CommandCode commandCode, MessageFilterType filterType, byte[] filterCode, SerializeMode serializeMode, object content) { var identifier = ObjectHost.Host.Resolve <IIdentifierProvider>().GetIdentifier(); if (content != null) { return(CreateCommandMessage( messageId, version, identifier, filterType, filterCode, MessageState.Success, ErrorCode.NoError, serializeMode, commandCode, content)); } else { return(CreateCommandMessage( messageId, version, identifier, MessageFilterType.Checksum, MessageFilterFactory.CreateDefaultFilterCode(), MessageState.Success, ErrorCode.NoError, SerializeMode.None, commandCode)); } }
public MessageHeader( string messageID, MessageVersion version, string identifier, byte[] filterCode, MessageFilterType filterType, MessageState state, ErrorCode errorCode, SerializeMode serializeMode, CommandCode commandCode, MessageType messageType) { this.MessageID = messageID; this.Version = version; this.State = state; this.FilterCode = filterCode; this.FilterType = filterType; this.ErrorCode = errorCode; this.SerializeMode = serializeMode; this.CommandCode = commandCode; this.Identifier = identifier; this.MessageType = messageType; }
private void InternalWrite(string message, RequestResponseType requestResponse, MessageFilterType msgFilterType, MessageFilterLevel msgFilterLevel, string symbolOrMarket, LogEntryType logType, ConsoleColor color) { string messageToLog = string.Empty; //string logEntryTypeString = String.Empty; //if (logType == LogEntryType.Error || logType == LogEntryType.Fatal) // logEntryTypeString = "ERROR"; //else if (logType == LogEntryType.Warning) // logEntryTypeString = "WARNING"; StringBuilder sb = new StringBuilder(); sb.Append(DateTime.Now.ToString("HH:mm:ss ffff")); //sb.Append(" : ["); sb.Append(" : "); //sb.Append(category); //if (!String.IsNullOrEmpty(logEntryTypeString)) //{ // sb.Append(":"); // sb.Append(logEntryTypeString); //} //sb.Append("] "); sb.Append(message); sb.Append(" : "); sb.Append(requestResponse); sb.Append(" : "); sb.Append(msgFilterType); sb.Append(" : "); sb.Append(msgFilterLevel); sb.Append(" : "); sb.Append(symbolOrMarket); sb.Append(" : "); sb.Append(logType); sb.Append("\n"); messageToLog = sb.ToString(); if (color != ConsoleColor.Normal) { readWriteLock.AcquireWriterLock(1000000); try { ConsoleColor oldColor = Color; Color = color; Console.Write(messageToLog); Color = oldColor; } finally { readWriteLock.ReleaseWriterLock(); } } else { Console.WriteLine(messageToLog); } }
/// <summary> /// Initializes a new instance of the X12MessageFilter class. /// </summary> /// <param name="messageFilterType">The message filter type. Possible /// values include: 'NotSpecified', 'Include', 'Exclude'</param> public X12MessageFilter(MessageFilterType messageFilterType) { MessageFilterType = messageFilterType; CustomInit(); }
/// <summary> /// Initializes a new instance of the EdifactMessageFilter class. /// </summary> /// <param name="messageFilterType">The message filter type. Possible /// values include: 'NotSpecified', 'Include', 'Exclude'</param> public EdifactMessageFilter(MessageFilterType messageFilterType) { MessageFilterType = messageFilterType; CustomInit(); }
public MessageFilter(MessageFilterType type, string name, string expression) { Type = type; Name = name; Expression = expression; }