Beispiel #1
0
            public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
            {
                TokenStream result = new LowerCaseTokenizer(reader);

                result = new PayloadFilter(enclosingInstance, result, fieldName);
                return(result);
            }
        public Task <object> SendReceive <TSend>(TSend obj, PayloadFilter filter,
                                                 CancellationToken?token = null)
        {
            var res = Receive(filter, token);

            Send(obj);
            return(res);
        }
Beispiel #3
0
            public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
            {
                PayloadData payload = (PayloadData)fieldToData[fieldName];
                TokenStream ts      = new WhitespaceTokenizer(reader);

                if (payload != null)
                {
                    if (payload.numFieldInstancesToSkip == 0)
                    {
                        ts = new PayloadFilter(ts, payload.data, payload.offset, payload.length);
                    }
                    else
                    {
                        payload.numFieldInstancesToSkip--;
                    }
                }
                return(ts);
            }
			public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
			{
				TokenStream result = new LowerCaseTokenizer(reader);
				result = new PayloadFilter(enclosingInstance, result, fieldName);
				return result;
			}
Beispiel #5
0
			public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
			{
				PayloadData payload = (PayloadData) fieldToData[fieldName];
				TokenStream ts = new WhitespaceTokenizer(reader);
				if (payload != null)
				{
					if (payload.numFieldInstancesToSkip == 0)
					{
						ts = new PayloadFilter(ts, payload.data, payload.offset, payload.length);
					}
					else
					{
						payload.numFieldInstancesToSkip--;
					}
				}
				return ts;
			}
Beispiel #6
0
        /// <summary>
        /// Find all payload components with the help of the PayloadComponentAttribute
        /// </summary>
        /// <param name="assembly"></param>
        /// <returns></returns>
        public static IEnumerable <PayloadDefinition> FindPayloadComponents(Assembly assembly, PayloadFilter includePayload)
        {
            var  types         = assembly.GetTypes();
            Type interfaceType = typeof(IPayloadComponent);

            foreach (var t in types)
            {
                if (interfaceType.IsAssignableFrom(t))
                {
                    foreach (var componentAttribute in t.GetCustomAttributes <PayloadComponentAttribute>())
                    {
                        if (includePayload(t, componentAttribute))
                        {
                            Serialize   serialize   = FindSerializeMethod(t);
                            Deserialize deserialize = FindDeserializeMethod(t);
                            yield return(new PayloadDefinition(componentAttribute.Name, t, serialize, deserialize));
                        }
                    }
                }
            }
        }