예제 #1
0
        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);
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }