Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of a FixedLengthParserOptions.
 /// </summary>
 public FixedLengthOptions()
 {
     FillCharacter      = ' ';
     alignment          = FixedAlignment.LeftAligned;
     HasRecordSeparator = true;
     truncationPolicy   = OverflowTruncationPolicy.TruncateLeading;
 }
Esempio n. 2
0
        private string GetTruncatedValue(string value, Window window)
        {
            OverflowTruncationPolicy policy = window.TruncationPolicy ?? Metadata.ExecutionContext.Options.TruncationPolicy;

            if (policy == OverflowTruncationPolicy.TruncateLeading)
            {
                int start = value.Length - window.Width;  // take characters on the end
                return(value.Substring(start, window.Width));
            }

            return(value.Substring(0, window.Width));
        }
Esempio n. 3
0
        private string getTruncatedValue(string value, Window window)
        {
            OverflowTruncationPolicy policy = window.TruncationPolicy ?? options.TruncationPolicy;

            if (policy == OverflowTruncationPolicy.TruncateLeading)
            {
                int start = value.Length - window.Width;  // take characters on the end
                return(value.Substring(start, window.Width));
            }
            else
            {
                return(value.Substring(0, window.Width));
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Initializes a new instance of a FixedLengthParserOptions.
 /// </summary>
 public FixedLengthOptions()
 {
     FillCharacter    = ' ';
     RecordSeparator  = Environment.NewLine;
     truncationPolicy = OverflowTruncationPolicy.TruncateLeading;
 }