public Stream Read(IOutItem item) { var filename = ItemFile(item); return(new FileStream( filename, FileMode.Open )); }
private void SetFlag(IOutItem item, string flag) { var cmd = SqlConn.CreateCommand(); cmd.CommandText = $@" Update items set {flag} = julianday('now') where {Cols.Id} = @{Cols.Id} "; cmd.Parameters.Add(Cols.Id, DbType.UInt32).Value = item.Id; cmd.ExecuteNonQuery(); }
public FileStream AddWrite(IOutItem item) { var filename = ItemFile(item); if (File.Exists(filename)) { File.Delete(filename); } return(new FileStream( filename, FileMode.CreateNew )); }
public void AddRollback(IOutItem item) { var filename = ItemFile(item); if (File.Exists(filename)) { File.Delete(filename); } var cmd = SqlConn.CreateCommand(); cmd.CommandText = $@" delete from items where {Cols.Id} = @{Cols.Id} "; cmd.Parameters.Add(Cols.Id, DbType.UInt32).Value = item.Id; cmd.ExecuteNonQuery(); }
public string ItemFile(IOutItem item) => Path.Combine(StorageFolder, item.Id.ToString() + ".txt");
public void AddCommit(IOutItem item) { this.SetFlag(item, Cols.Commited); this.OnAddItem?.Invoke(this.Queue, item); }
public void Fault(IOutItem item) { SetFlag(item, Cols.Faulted); }
public void Deliver(IOutItem item) { SetFlag(item, Cols.Delivered); }
public void Send(IOutItem item) { SetFlag(item, Cols.Sent); }