|
@@ -3,6 +3,7 @@ using System;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Security.Authentication;
|
|
using System.Security.Authentication;
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
+using DiskAccessLibrary.FileSystems;
|
|
|
|
|
|
namespace DiskAccessLibrary
|
|
namespace DiskAccessLibrary
|
|
{
|
|
{
|
|
@@ -252,9 +253,9 @@ namespace DiskAccessLibrary
|
|
|
|
|
|
public static BlockDifferencingDiskImage Create(string based, string snapshot, int blockSize)
|
|
public static BlockDifferencingDiskImage Create(string based, string snapshot, int blockSize)
|
|
{
|
|
{
|
|
- var fileInfo = new FileInfo(based);
|
|
|
|
|
|
+ var fileSize= IoUtility.GetRealFileSize(based);
|
|
|
|
|
|
- if (fileInfo.Length % blockSize != 0) throw new ArgumentException("Block size no mul to base image size", nameof(blockSize));
|
|
|
|
|
|
+ if (fileSize % blockSize != 0) throw new ArgumentException("Block size no mul to base image size", nameof(blockSize));
|
|
|
|
|
|
using var stream = File.Create(snapshot);
|
|
using var stream = File.Create(snapshot);
|
|
using var writer = new BinaryWriter(stream);
|
|
using var writer = new BinaryWriter(stream);
|
|
@@ -262,7 +263,7 @@ namespace DiskAccessLibrary
|
|
//create bdd struct
|
|
//create bdd struct
|
|
|
|
|
|
var bufBasedPath = Encoding.UTF8.GetBytes(System.IO.Path.GetFullPath(based));
|
|
var bufBasedPath = Encoding.UTF8.GetBytes(System.IO.Path.GetFullPath(based));
|
|
- var numberOfBlocks = (int)(fileInfo.Length / blockSize);
|
|
|
|
|
|
+ var numberOfBlocks = (int)(fileSize / blockSize);
|
|
writer.Write((ushort)bufBasedPath.Length);
|
|
writer.Write((ushort)bufBasedPath.Length);
|
|
writer.Write(bufBasedPath);
|
|
writer.Write(bufBasedPath);
|
|
writer.Write(blockSize);
|
|
writer.Write(blockSize);
|