Beispiel #1
0
        // Define the event handlers.
        private void OnChanged(object source, FileSystemEventArgs e)
        {
            // Specify what is done when a file is changed, created, or deleted.
            _logger.LogInformation($"File: {e.FullPath} {e.ChangeType}");

            var message = new FSWatchMessage
            {
                Name       = e.Name,
                FullPath   = e.FullPath,
                ChangeType = e.ChangeType
            };
            var json = JsonSerializer.Serialize(message);

            _queueClient.SendMessage(json);
        }
Beispiel #2
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            // Specify what is done when a file is renamed.
            _logger.LogInformation($"File: {e.OldFullPath} renamed to {e.FullPath}");

            var message = new FSWatchMessage
            {
                Name        = e.Name,
                FullPath    = e.FullPath,
                ChangeType  = e.ChangeType,
                OldFullPath = e.OldFullPath,
                OldName     = e.OldName
            };
            var json = JsonSerializer.Serialize(message);

            _queueClient.SendMessage(json);
        }