コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            _file = new TabularFile(new DelimitedFileParser(HasHeader.IsChecked.HasValue && HasHeader.IsChecked.Value));
            _file.Load(Filename.Text);

            Output.ItemsSource = _file.DataTable.AsDataView();
        }
コード例 #2
0
ファイル: TabularModule.cs プロジェクト: xlgwr/osdr
        public async Task Process(BlobLoaded blob)
        {
            var  fileId   = NewId.NextGuid();
            var  blobInfo = blob.BlobInfo;
            Guid userId   = blobInfo.UserId.HasValue ? blobInfo.UserId.Value : new Guid(blobInfo.Metadata[nameof(userId)].ToString());
            Guid?parentId = blobInfo.Metadata != null?blobInfo.Metadata.ContainsKey(nameof(parentId)) ? (Guid?)new Guid(blobInfo.Metadata[nameof(parentId)].ToString()) : null : null;

            var file = new TabularFile(fileId, userId, parentId, blobInfo.FileName, FileStatus.Loaded, blobInfo.Bucket, blobInfo.Id, blobInfo.Length, blobInfo.MD5);
            await _session.Add(file);

            await _session.Commit();

            await _bus.Publish <ProcessGenericFile>(new
            {
                Id       = fileId,
                ParentId = parentId,
                Bucket   = blobInfo.Bucket,
                BlobId   = blobInfo.Id,
                UserId   = userId
            });
        }
コード例 #3
0
        public static void TabularEntityShouldBeEquivalentTo(this GenericDictionaryAssertions <string, object> assertions, TabularFile file)
        {
            var expected = new Dictionary <string, object>()
            {
                { "_id", file.Id },
                { "Blob", new Dictionary <string, object>()
                  {
                      { "_id", file.BlobId },
                      { "Bucket", file.Bucket },
                      { "Length", file.Length },
                      { "Md5", file.Md5 }
                  } },
                { "SubType", FileType.Tabular.ToString() },
                { "OwnedBy", file.OwnedBy },
                { "CreatedBy", file.CreatedBy },
                { "CreatedDateTime", file.CreatedDateTime.UtcDateTime },
                { "UpdatedBy", file.UpdatedBy },
                { "UpdatedDateTime", file.UpdatedDateTime.UtcDateTime },
                { "ParentId", file.ParentId },
                { "Name", file.FileName },
                { "Status", file.Status.ToString() },
                { "Version", file.Version }
            };

            if (file.Images.Any())
            {
                expected.Add("Images", file.Images.Select(i => new Dictionary <string, object>
                {
                    { "_id", i.Id },
                    { "Height", i.Height },
                    { "Width", i.Height },
                    { "MimeType", i.MimeType },
                    { "Scale", i.GetScale() },
                    { "Bucket", i.Bucket }
                }));
            }

            assertions.Subject.ShouldAllBeEquivalentTo(expected);
        }