Beispiel #1
0
 public void PushValues(TIn input, Action <TOut> push)
 {
     using (var s = _args.DataStreamSelector(input))
     {
         var xmlFileDefinition = new XmlFileDefinition()
                                 .AddNodeDefinition(_args.XmlNodeDefinition)
                                 .AddNameSpaces(_args.PrefixToUriNamespaces);
         XmlObjectReader xmlObjectReader = new XmlObjectReader(xmlFileDefinition);
         xmlObjectReader.Read(s, i => push(_args.ResultSelector(input, i.GetValue <TParsed>())));
     }
 }
        public static IStream <TOut> CrossApplyXmlFile <TOut>(this IStream <Stream> stream, string name, XmlFileDefinition xmlFileDefinition, Func <XmlNodeParsed, TOut> resultSelector, bool noParallelisation = false)
        {
            var valuesProvider = new XmlFileValuesProvider <Stream, TOut>(new XmlFileValuesProviderArgs <Stream, TOut>()
            {
                DataStreamSelector = i => i,
                XmlFileDefinition  = xmlFileDefinition,
                ResultSelector     = (s, o) => resultSelector(o)
            });

            return(stream.CrossApply <Stream, TOut>(name, valuesProvider.PushValues, noParallelisation));
        }
        public static IStream <TOut> CrossApplyXmlFile <TOut>(this IStream <string> stream, string name, XmlFileDefinition xmlFileDefinition, Func <string, XmlNodeParsed, TOut> resultSelector, bool noParallelisation = false)
        {
            var valuesProvider = new XmlFileValuesProvider <string, TOut>(new XmlFileValuesProviderArgs <string, TOut>()
            {
                DataStreamSelector = i => File.OpenRead(i),
                XmlFileDefinition  = xmlFileDefinition,
                ResultSelector     = resultSelector
            });

            return(stream.CrossApply <string, TOut>(name, valuesProvider.PushValues, noParallelisation));
        }
        public static IStream <XmlNodeParsed> CrossApplyXmlFile <TIn>(this IStream <TIn> stream, string name, XmlFileDefinition xmlFileDefinition, Func <TIn, string> filePathSelector, bool noParallelisation = false)
        {
            var valuesProvider = new XmlFileValuesProvider <TIn, XmlNodeParsed>(new XmlFileValuesProviderArgs <TIn, XmlNodeParsed>()
            {
                DataStreamSelector = i => File.OpenRead(filePathSelector(i)),
                XmlFileDefinition  = xmlFileDefinition,
                ResultSelector     = (i, o) => o
            });

            return(stream.CrossApply <TIn, XmlNodeParsed>(name, valuesProvider.PushValues, noParallelisation));
        }
        public static IStream <TOut> CrossApplyXmlFile <TOut>(this IStream <LocalFilesValue> stream, string name, XmlFileDefinition xmlFileDefinition, Func <LocalFilesValue, XmlNodeParsed, TOut> resultSelector, bool noParallelisation = false)
        {
            var valuesProvider = new XmlFileValuesProvider <LocalFilesValue, TOut>(new XmlFileValuesProviderArgs <LocalFilesValue, TOut>()
            {
                DataStreamSelector = i => i.GetContent(),
                XmlFileDefinition  = xmlFileDefinition,
                ResultSelector     = resultSelector
            });

            return(stream.CrossApply <LocalFilesValue, TOut>(name, valuesProvider.PushValues, noParallelisation));
        }
Beispiel #6
0
        public static IStream <XmlNodeParsed> CrossApplyXmlFile(this IStream <IFileValue> stream, string name, XmlFileDefinition xmlFileDefinition, bool noParallelisation = false)
        {
            var valuesProvider = new XmlFileValuesProvider(new XmlFileValuesProviderArgs()
            {
                XmlFileDefinition = xmlFileDefinition,
            });

            return(stream.CrossApply <IFileValue, XmlNodeParsed>(name, valuesProvider, noParallelisation));
        }