Ejemplo n.º 1
0
        public override async Task <IFileSystemItem> GetFileSystemItemAsync(string path, FileSystemItemType itemType)
        {
            string remotePath = Mapping.MapPath(path);

            logger.LogMessage($"{nameof(IEngine)}.{nameof(GetFileSystemItemAsync)}()", path, remotePath);

            if (File.Exists(remotePath))
            {
                return(new VirtualFile(path, this));
            }
            else if (Directory.Exists(remotePath))
            {
                return(new VirtualFolder(path, this));
            }

            return(null);
        }
        /// <summary>
        /// Starts monitoring changes on the server.
        /// </summary>
        public void Start()
        {
            watcher.IncludeSubdirectories = true;
            watcher.Path = remoteStorageRootPath;
            //watcher.Filter = "*.*";
            watcher.NotifyFilter        = NotifyFilters.LastWrite | NotifyFilters.Attributes | NotifyFilters.DirectoryName | NotifyFilters.FileName;
            watcher.Error              += Error;
            watcher.Created            += CreatedAsync;
            watcher.Changed            += ChangedAsync;
            watcher.Deleted            += DeletedAsync;
            watcher.Renamed            += RenamedAsync;
            watcher.EnableRaisingEvents = true;

            logger.LogMessage($"Remote Storage Started", remoteStorageRootPath);
        }
Ejemplo n.º 3
0
 public override void LogMessage(string message, string sourcePath = null, string targetPath = null)
 {
     logger.LogMessage(message, sourcePath, targetPath);
 }