示例#1
0
        /// <summary>
        /// Creates a Windows user file system.
        /// </summary>
        /// <param name="license">A license string.</param>
        /// <param name="userFileSystemRootPath">A root folder of your user file system. Your file system tree will be located under this folder.</param>
        /// <param name="log">Logger.</param>
        internal VfsEngine(string license, string userFileSystemRootPath, VirtualDriveBase virtualDrive, ILog log) : base(license, userFileSystemRootPath)
        {
            logger = new Logger("File System Engine", log);

            this.virtualDrive = virtualDrive;

            // We want our file system to run regardless of any errors.
            // If any request to file system fails in user code or in Engine itself we continue processing.
            ThrowExceptions = false;

            StateChanged += Engine_StateChanged;
            Error        += Engine_Error;
            Message      += Engine_Message;
        }
示例#2
0
        /// <summary>
        /// Returns true if the item was created and must be synched to remote storage.
        /// </summary>
        /// <param name="virtualDrive">Vitrual drive.</param>
        /// <returns>
        /// True if the item was created in the user file system and does not exists
        /// in the remote storage. False otherwise.
        /// </returns>
        public static bool IsNew(this PlaceholderItem placeholder, VirtualDriveBase virtualDrive)
        {
            // ETag absence signals that the item is new.
            // However, ETag file may not exists during move operation,
            // additionally checking OriginalPath presence.
            // Can not rely on OriginalPath only,
            // because MS Office files are being deleted and re-created during transactional save.

            string originalPath = placeholder.GetOriginalPath();

            bool eTagFileExists = File.Exists(virtualDrive.GetETagManager(placeholder.Path).ETagFilePath);

            return(!eTagFileExists && string.IsNullOrEmpty(originalPath));
        }
示例#3
0
        /// <summary>
        /// Creates instance of this class.
        /// </summary>
        /// <param name="userFileSystemPath">File or folder path in the user file system.</param>
        /// <param name="logger">Logger.</param>
        public VfsFileSystemItem(string userFileSystemPath, ILogger logger, VfsEngine engine, VirtualDriveBase virtualDrive)
        {
            if (string.IsNullOrEmpty(userFileSystemPath))
            {
                throw new ArgumentNullException(nameof(userFileSystemPath));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            UserFileSystemPath = userFileSystemPath;
            Logger             = logger;
            Engine             = engine;
            VirtualDrive       = virtualDrive;
        }
示例#4
0
 /// <summary>
 /// Creates instance of this class.
 /// </summary>
 /// <param name="path">File path in user file system.</param>
 /// <param name="logger">Logger.</param>
 public VfsFile(string path, ILogger logger, VfsEngine engine, VirtualDriveBase userEngine) : base(path, logger, engine, userEngine)
 {
 }
 public VfsFolder(string path, ILogger logger, VfsEngine engine, VirtualDriveBase virtualDrive) : base(path, logger, engine, virtualDrive)
 {
 }