Exemplo n.º 1
0
        /// <summary>
        /// Renames or moves file or folder to a new location in the remote storage.
        /// </summary>
        /// <param name="userFileSystemNewPath">Target path of this file or folder in the user file system.</param>
        public async Task MoveToAsync(string userFileSystemNewPath)
        {
            string remoteStorageOldPath = RemoteStorageUri;
            string remoteStorageNewPath = Mapping.MapPath(userFileSystemNewPath);

            await Program.DavClient.MoveToAsync(new Uri(remoteStorageOldPath), new Uri(remoteStorageNewPath), true);
        }
        /// <inheritdoc/>
        public VirtualDrive(string license, string userFileSystemRootPath, Settings settings, ILog log)
            : base(license, userFileSystemRootPath, settings, log)
        {
            string remoteStorageRootPath = Mapping.MapPath(userFileSystemRootPath);

            remoteStorageMonitor = new RemoteStorageMonitor(remoteStorageRootPath, this, log);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates instance of this class.
        /// </summary>
        /// <param name="userFileSystemPath">File or folder path in the user file system.</param>
        /// <param name="engine">Engine instance.</param>
        /// <param name="logger">Logger.</param>
        public VirtualFileSystemItem(string userFileSystemPath, VirtualEngine engine, ILogger logger)
        {
            if (string.IsNullOrEmpty(userFileSystemPath))
            {
                throw new ArgumentNullException(nameof(userFileSystemPath));
            }
            Logger = logger ?? throw new ArgumentNullException(nameof(logger));
            Engine = engine ?? throw new ArgumentNullException(nameof(engine));

            UserFileSystemPath = userFileSystemPath;
            RemoteStoragePath  = Mapping.MapPath(userFileSystemPath);
        }
Exemplo n.º 4
0
        ///<inheritdoc>
        public async Task MoveToAsync(string userFileSystemNewPath, byte[] targetParentItemId, IOperationContext operationContext, IConfirmationResultContext resultContext)
        {
            string userFileSystemOldPath = this.UserFileSystemPath;

            Logger.LogMessage($"{nameof(IFileSystemItem)}.{nameof(MoveToAsync)}()", userFileSystemOldPath, userFileSystemNewPath);

            string remoteStorageOldPath = RemoteStoragePath;
            string remoteStorageNewPath = Mapping.MapPath(userFileSystemNewPath);

            await Program.DavClient.MoveToAsync(new Uri(remoteStorageOldPath), new Uri(remoteStorageNewPath), true);

            await Engine.CustomDataManager(userFileSystemOldPath, Logger).MoveToAsync(userFileSystemNewPath);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a vitual file system Engine.
        /// </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="serverDataFolderPath">Path to the folder that stores custom data associated with files and folders.</param>
        /// <param name="iconsFolderPath">Path to the icons folder.</param>
        /// <param name="log">Logger.</param>
        public VirtualEngine(string license, string userFileSystemRootPath, string serverDataFolderPath, string iconsFolderPath, ILog log)
            : base(license, userFileSystemRootPath)
        {
            logger = new Logger("File System Engine", log) ?? throw new NullReferenceException(nameof(log));
            this.serverDataFolderPath = serverDataFolderPath ?? throw new NullReferenceException(nameof(serverDataFolderPath));
            this.iconsFolderPath      = iconsFolderPath ?? throw new NullReferenceException(nameof(iconsFolderPath));

            // 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;

            string remoteStorageRootPath = Mapping.MapPath(userFileSystemRootPath);

            RemoteStorageMonitor = new RemoteStorageMonitor(remoteStorageRootPath, this, log);
            msOfficeDocsMonitor  = new MsOfficeDocsMonitor(userFileSystemRootPath, this, log);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates instance of this class.
 /// </summary>
 /// <param name="userFileSystemPath">Path of this file of folder in the user file system.</param>
 public UserFileSystemItem(string userFileSystemPath)
 {
     this.UserFileSystemPath = userFileSystemPath;
     this.RemoteStorageUri   = Mapping.MapPath(userFileSystemPath);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates instance of this class.
 /// </summary>
 /// <param name="userFileSystemPath">Path of this file of folder in the user file system.</param>
 /// <param name="logger">Logger.</param>
 public VirtualFileSystemItem(string userFileSystemPath, ILogger logger)
 {
     this.UserFileSystemPath = userFileSystemPath;
     this.RemoteStorageUri   = Mapping.MapPath(userFileSystemPath);
     this.Logger             = logger;
 }