Пример #1
0
 /// <summary>
 /// Helper method to create constituent dispenser: arbitrary writer, target number, X12 indicator provided
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="targetNo"></param>
 /// <param name="outputDataKind"></param>
 /// <param name="outputIsAsync"></param>
 /// <param name="x12SegmentDelimiter"></param>
 /// <param name="xmlSettings"></param>
 /// <returns></returns>
 private static LineDispenserForTarget CreateLineDispenser(TextWriter writer, int targetNo, KindOfTextData outputDataKind, bool outputIsAsync, Lazy<string> x12SegmentDelimiter, string xmlSettings)
 {
    if (outputDataKind.ExternalLineType() == ExternalLineType.Xtext) return new TextDispenserForTarget(writer, targetNo);
    if (outputDataKind == KindOfTextData.X12) return new X12DispenserForTarget(writer, targetNo, x12SegmentDelimiter);
    if (outputDataKind == KindOfTextData.XML) return new XmlDispenserForTarget(writer, targetNo, xmlSettings, outputIsAsync);
    if (outputDataKind == KindOfTextData.JSON) return new JsonDispenserForTarget(writer, targetNo, xmlSettings, outputIsAsync);
    if (outputDataKind == KindOfTextData.UnboundJSON) return new UnboundJsonDispenserForTarget(writer, targetNo, xmlSettings);
    throw new NotSupportedException($"Dispenser type for {outputDataKind} could not be determined.");
 }
Пример #2
0
 /// <summary>
 /// Helper method to create a single constituent feeder.
 /// </summary>
 /// <param name="reader"></param>
 /// <param name="sourceNo"></param>
 /// <param name="inputDataKind"></param>
 /// <param name="intakeIsAsync"></param>
 /// <param name="skipHeader"></param>
 /// <param name="x12SegmentDelimiter"></param>
 /// <param name="xmlJsonSettings"></param>
 /// <returns></returns>
 private static LineFeederForSource CreateLineFeeder(TextReader reader, int sourceNo, KindOfTextData inputDataKind, bool intakeIsAsync, bool skipHeader, string x12SegmentDelimiter, string xmlJsonSettings)
 {
     if (inputDataKind.ExternalLineType() == ExternalLineType.Xtext)
     {
         return(new TextFeederForSource(reader, sourceNo, skipHeader));
     }
     if (inputDataKind == KindOfTextData.X12)
     {
         return(new X12FeederForSource(reader, sourceNo, x12SegmentDelimiter));
     }
     if (inputDataKind == KindOfTextData.XML)
     {
         return(new XmlFeederForSource(reader, sourceNo, xmlJsonSettings, intakeIsAsync));
     }
     if (inputDataKind == KindOfTextData.JSON)
     {
         return(new JsonFeederForSource(reader, sourceNo, xmlJsonSettings, intakeIsAsync));
     }
     if (inputDataKind == KindOfTextData.UnboundJSON)
     {
         return(new UnboundJsonFeederForSource(reader, sourceNo, xmlJsonSettings));
     }
     throw new NotSupportedException($"Feeder type for {inputDataKind} could not be determined.");
 }