示例#1
0
        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);
        }
示例#2
0
 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();
 }