Ejemplo n.º 1
0
        private EdiRepetition LoadRepetition(XElement xml)
        {
            var repetition = new EdiRepetition();

            if (xml.HasElements)
            {
                foreach (XElement element in xml.Elements())
                {
                    int elementIndex = GetElementIndex(element.Name.LocalName);
                    if (elementIndex == -1)
                    {
                        continue;
                    }
                    while (repetition.Components.Count <= elementIndex)
                    {
                        repetition.Components.Add(null);
                    }
                    if (repetition.Components[elementIndex] == null)
                    {
                        repetition.Components[elementIndex] = new EdiComponent(LoadValue(element));
                    }
                }
            }
            else
            {
                repetition.Value = LoadValue(xml);
            }
            return(repetition);
        }
Ejemplo n.º 2
0
        private EdiRepetition ParseRepetition(string rawRepetition, EdiOptions options)
        {
            var repetition = new EdiRepetition();

            string[] components = options.ComponentSeparator.HasValue ? SplitEdi(rawRepetition, options.ComponentSeparator.Value, options.ReleaseCharacter) : new[] { rawRepetition };
            foreach (string rawComponent in components)
            {
                if (rawComponent != string.Empty)
                {
                    repetition.Components.Add(new EdiComponent(options.ReleaseCharacter.HasValue ? UnescapeEdi(rawComponent, options.ReleaseCharacter.Value) : rawComponent));
                }
                else
                {
                    repetition.Components.Add(null);
                }
            }
            return(repetition);
        }
Ejemplo n.º 3
0
 private EdiRepetition LoadRepetition(XElement xml)
 {
     var repetition = new EdiRepetition();
     if (xml.HasElements)
     {
         foreach (XElement element in xml.Elements())
         {
             int elementIndex = GetElementIndex(element.Name.LocalName);
             if (elementIndex == -1)
                 continue;
             while (repetition.Components.Count <= elementIndex)
                 repetition.Components.Add(null);
             if (repetition.Components[elementIndex] == null)
                 repetition.Components[elementIndex] = new EdiComponent(LoadValue(element));
         }
     }
     else
         repetition.Value = LoadValue(xml);
     return repetition;
 }
Ejemplo n.º 4
0
 private EdiRepetition ParseRepetition(string rawRepetition, EdiOptions options)
 {
     var repetition = new EdiRepetition();
     string[] components = options.ComponentSeparator.HasValue ? SplitEdi(rawRepetition, options.ComponentSeparator.Value, options.ReleaseCharacter) : new[] {rawRepetition};
     foreach (string rawComponent in components)
     {
         if (rawComponent != string.Empty)
             repetition.Components.Add(new EdiComponent(options.ReleaseCharacter.HasValue ? UnescapeEdi(rawComponent, options.ReleaseCharacter.Value) : rawComponent));
         else
             repetition.Components.Add(null);
     }
     return repetition;
 }