示例#1
0
        /// <summary>   Constructor. </summary>
        /// <param name="targetLengths">    List of lengths of the targets. </param>
        /// <param name="sourceValues">  A variable-length parameters list containing source values. </param>
        public StringModel(IEnumerable <int> targetLengths, params string[] sourceValues)
        {
            TargetLengths = targetLengths.ToList();
            TargetStrings = TargetLengths.Select(l => string.Empty).ToList();

            var sb = new StringBuilder();

            foreach (var value in sourceValues)
            {
                if (!string.IsNullOrWhiteSpace(value))
                {
                    sb.AppendLine(value);
                }
            }

            if (!FitDefault(sourceValues))
            {
                if (!FitByWord(sourceValues))
                {
                    if (!FitUgly(sourceValues))
                    {
                        throw new NotImplementedException("CustomerString was too long to handle...");
                    }
                }
            }
        }