public void AddFile(string directoryVirtualPath, FileIndexEntry file) { var directoryPath = GetPhysicalPath(directoryVirtualPath); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } var metaPath = System.IO.Path.Combine(directoryPath, "meta.config"); var metaFile = new DirectoryMetaFile(metaPath); metaFile.AddEntry(file); }
public void DeleteFile(string virtualPath) { Require.NotNullOrEmpty(virtualPath, "virtualPath"); if (virtualPath == "/") throw new ArgumentException("Invalid virtual path.", "virtualPath"); var filePath = GetPhysicalPath(virtualPath); var dirPath = System.IO.Path.GetDirectoryName(filePath); var metaPath = System.IO.Path.Combine(dirPath, "meta.config"); if (!File.Exists(metaPath)) throw new InvalidOperationException("File not exists."); var metaFile = new DirectoryMetaFile(metaPath); metaFile.RemoveEntry(System.IO.Path.GetFileName(virtualPath)); }
public void UpdateFile(string directoryVirtualPath, FileIndexEntry file) { var directoryPath = GetPhysicalPath(directoryVirtualPath); if (!Directory.Exists(directoryPath)) throw new FileNotFoundException("File not exists."); var metaPath = System.IO.Path.Combine(directoryPath, "meta.config"); var metaFile = new DirectoryMetaFile(metaPath); metaFile.UpdateEntry(file); }