public bool IsRoomFor(string name, FileContent fileContent) { VolumeFile existingFile = Open(name); int usedByThisFile = 0; if (existingFile != null) { usedByThisFile = existingFile.ReadAll().Size; } return(INFINITE_CAPACITY == FreeSpace || FreeSpace + usedByThisFile >= fileContent.Size); }
public bool IsRoomFor(VolumePath path, FileContent fileContent) { VolumeItem existing = Open(path); if (existing is VolumeDirectory) { throw new KOSPersistenceException("'" + path + "' is a directory"); } VolumeFile existingFile = existing as VolumeFile; int usedByThisFile = 0; if (existingFile != null) { usedByThisFile = existingFile.ReadAll().Size; } return(INFINITE_CAPACITY == FreeSpace || FreeSpace + usedByThisFile >= fileContent.Size); }
public VolumeFile SaveFile(VolumeFile volumeFile) { return(SaveFile(volumeFile.Path, volumeFile.ReadAll())); }
//public abstract bool AppendToFile(string name, string textToAppend); //public abstract bool AppendToFile(string name, byte[] bytesToAppend); public VolumeFile Save(VolumeFile volumeFile) { return(Save(volumeFile.Name, volumeFile.ReadAll())); }
protected bool CopyFileToDirectory(VolumeFile volumeFile, VolumeDirectory volumeDirectory, bool verifyFreeSpace) { return(volumeDirectory.Volume.SaveFile(volumeDirectory.Path.Combine(volumeFile.Name), volumeFile.ReadAll(), verifyFreeSpace) != null); }
protected bool CopyFile(VolumeFile volumeFile, GlobalPath destinationPath, Volume targetVolume, bool verifyFreeSpace) { return(targetVolume.SaveFile(destinationPath, volumeFile.ReadAll(), verifyFreeSpace) != null); }