public void Link(DiskOptionsDto diskOptions, string location) { if (diskOptions == null) throw new ArgumentNullException("diskOptions"); if (File.Exists(location)) File.Delete(location); FileSystemOptions fileSystemOptions; using (var ms = new MemoryStream()) { ms.Write(diskOptions.SerializedFileSystemOptions, 0, diskOptions.SerializedFileSystemOptions.Length); ms.Seek(0, SeekOrigin.Begin); IFormatter formatter = new BinaryFormatter(); fileSystemOptions = formatter.Deserialize(ms) as FileSystemOptions; if (fileSystemOptions == null) throw new VFSException("Invalid remote file"); fileSystemOptions.LocalVersion = 0; fileSystemOptions.LastServerVersion = 0; fileSystemOptions.RootBlockNr = 0; } using (var disk = File.OpenWrite(location)) { IFormatter f = new BinaryFormatter(); f.Serialize(disk, fileSystemOptions); } }
internal static DiskOptionsDto CalculateDiskOptions(IFileSystemOptions o) { byte[] serializedOptions; using (var ms = new MemoryStream()) { var bf = new BinaryFormatter(); bf.Serialize(ms, o); serializedOptions = ms.ToArray(); } var diskOptions = new DiskOptionsDto { BlockSize = o.BlockSize, MasterBlockSize = o.MasterBlockSize, SerializedFileSystemOptions = serializedOptions }; return diskOptions; }
public Task<DiskDto> CreateDiskAsync(UserDto userDto, DiskOptionsDto optionsDto) { throw new System.NotImplementedException(); }
public DiskDto CreateDisk(UserDto userDto, DiskOptionsDto optionsDto) { return DiskFake; }
public Task SetDiskOptionsAsync(UserDto userDto, DiskDto diskDto, DiskOptionsDto optionsDto) { throw new System.NotImplementedException(); }
public void SetDiskOptions(UserDto userDto, DiskDto diskDto, DiskOptionsDto optionsDto) { DiskOptionsResult = optionsDto; }