Пример #1
0
        private void fileBrowserFields_FileNameChanged(object sender, FileNameChangedEventArgs e)
        {
            var reader = new FieldReader();

            this.field = reader.Read(e.FileName);
            var sb = new StringBuilder();

            for (var row = 0; row < this.field.Height; row++)
            {
                for (var column = 0; column < this.field.Width; column++)
                {
                    sb.Append($"{this.field.GetAt(row, column)} ");
                }
                sb.Append(Environment.NewLine);
            }
            this.txtWords.Text = sb.ToString();
        }
Пример #2
0
        public FluentReader <T> Set <TU>(Expression <Func <T, TU> > property, Action <FieldReader <TU> > action,
                                         string useExactFormat = null)
        {
            var fieldReader = new FieldReader <TU>(_sourceHandler);

            action(fieldReader);
            var result = fieldReader.Read(useExactFormat);

            if (result.HasErrors)
            {
                ReaderResult.LineError.SegmentErrors.Add(new SegmentError(result.ValueToConvert, string.Format(
                                                                              "Could not convert {0} to type {1}", result.ValueToConvert, typeof(TU).Name), property.Name));
                return(this);
            }

            SetPropertyValue(property, result.Result);
            return(this);
        }