Exemplo n.º 1
0
        /// <summary>
        /// Updates the file size in virtual file.
        /// </summary>
        void UpdateFileSizeInVirtualFile(VirtualPath vp)
        {
            ShadowFullPath readPath    = _pathFactory.CreateShadowFullPath4Read(vp);
            ShadowFullPath writePath   = _pathFactory.CreateShadwoFullPath4Write(vp);
            var            virtualFile = XmlUtil.ReadXml <VirtualFile>(readPath.PathString);
            // Get the size from the real file.
            long fileSize = new FileInfo(writePath.PathString).Length;

            virtualFile.FileSize = fileSize;
            XmlUtil.WriteXml <VirtualFile>(virtualFile, readPath.PathString);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a virtual file with the Physical location information in it.
        /// </summary>
        /// <param name="vp">The vp.</param>
        VirtualFile CreateAndWriteVirtualFile(VirtualPath vp)
        {
            ShadowFullPath readPath    = _pathFactory.CreateShadowFullPath4Read(vp);
            ShadowFullPath writePath   = _pathFactory.CreateShadwoFullPath4Write(vp);
            var            virtualFile = new VirtualFile()
            {
                PhysicalUri = new Uri(writePath.PathString)
            };

            IOUtil.PrepareParentDirForPath(readPath.PathString);
            XmlUtil.WriteXml <VirtualFile>(virtualFile, readPath.PathString);

            Logger.WriteLineIf(LogLevel.Verbose, _log_props,
                               string.Format("A virtual file is created at {0}", readPath.PathString));
            return(virtualFile);
        }