Esempio n. 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);
            }
Esempio n. 2
0
        public Task <object> SendReceive <TSend>(TSend obj, PayloadFilter filter,
                                                 CancellationToken?token = null)
        {
            var res = Receive(filter, token);

            Send(obj);
            return(res);
        }
Esempio n. 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);
            }
Esempio n. 4
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;
			}
Esempio n. 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;
			}
Esempio n. 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));
                        }
                    }
                }
            }
        }