private void AddFile(IFile file) { using (var stream = file.OpenRead()) using (var ms = new MemoryStream()) { stream.CopyTo(ms); _messageBus.Publish(new AddTorrentMessage(ms.ToArray())); } // Add file to history var hist = new History {Path = file.Path.FullPath}; _autoAddRepository.CreateHistory(hist); }
public void CreateHistory(History history) { var query = @"insert into AutoAdd_History (Path, AddedTime) values (@Path, @AddedTime); select last_insert_rowid();"; history.Id = _connection.Query<int>(query, history).First(); }