示例#1
0
        private void ShowPreview(int rowsToShow)
        {
            var mData     = FileReader.ReadFewLines(PathMasterFile, rowsToShow);
            var tData     = FileReader.ReadFewLines(PathTestFile, rowsToShow);
            var delimiter = FindDelimiter(mData);

            if (!string.IsNullOrEmpty(delimiter))
            {
                Delimiter          = delimiter;
                FileView.Delimiter = Delimiter == "\t" ? "\\t": Delimiter;
            }
            else
            {
                Delimiter = FileView.Delimiter;
            }
            HeadersRow          = FindDataBeginning(mData);
            FileView.HeadersRow = HeadersRow.ToString();
            if (!LoadPreview(mData.ToList(), tData.ToList()))
            {
                FileView.ShowError("Error: Files have different number of columns.");
                FileView.BlockLoad();
            }
            var headers = MasterPreviewContent.ElementAt(HeadersRow).ToList();

            if (HeadersRow > 0)
            {
                WriteInfoMessage("Automatically skipped rows:", mData.Take(HeadersRow).ToArray());
            }
            FileView.CurrentFileName = Path.GetFileName(PathMasterFile);
            FileView.DisplayFilePreview(headers, MasterPreviewContent.Skip(HeadersRow + 1).ToList());
        }