public void Send(Command cmmd) { var fileName = CommandNameHelper.GetFileName(cmmd); var filePath = Path.Combine(_shareFolder.GetPath(), fileName); var cmmdContent = _ser.Serializer(cmmd); File.WriteAllText(filePath, cmmdContent); _loger.Info($"Command {cmmd.UpdateEntity.GetType().Name} {cmmd.UpdateEntity.Entity.Id} was send."); }
public CommandSubscriber(ShareFolderBase shareFolder, ICommandJsonSerializer ser, CommandFileFilter filter) { _shareFolder = shareFolder ?? throw new ArgumentNullException(nameof(shareFolder)); _ser = ser ?? throw new ArgumentNullException(nameof(ser)); _filter = filter; _folderWatcher = new FileSystemWatcher { Path = _shareFolder.GetPath(), Filter = $"*{CommandNameHelper.CommandFileExtensionName}" }; _folderWatcher.Created += FolderWatcher_Created; }