コード例 #1
0
        private static byte[] GetMetadataBytes(string originalFilePath, long fileSize,
                                               DateTime removingDate)
        {
            var builder = new WindowsRemovedFileMetadataBuilder()
                          .WithFileSize(fileSize)
                          .WithRemovingDateTime(removingDate)
                          .WithFilePath(originalFilePath);

            return(builder.Build());
        }
コード例 #2
0
        private byte[] GetMetadataBytes(string originalFilePath, string trashCanFilePath, DateTime removingDate)
        {
            var fileModel = _fileService.GetFile(trashCanFilePath);
            var builder   = new WindowsRemovedFileMetadataBuilder()
                            .WithFileSize(fileModel.SizeBytes)
                            .WithRemovingDateTime(removingDate)
                            .WithFilePath(originalFilePath);

            return(builder.Build());
        }
コード例 #3
0
        public void TestMetadataBuilder()
        {
            const string filePath = "C://test.txt";
            var          builder  = new WindowsRemovedFileMetadataBuilder()
                                    .WithFilePath(filePath)
                                    .WithRemovingDateTime(DateTime.Now)
                                    .WithFileSize(42);

            var metadata = builder.Build();

            Assert.NotNull(metadata);
            Assert.Equal(30 + filePath.Length * 2, metadata.Length);
        }