public void Delete(Int32 position) { int wsCount = _worksheets.Values.Count(w => w.Position == position); if (wsCount == 0) { throw new ArgumentException("There isn't a worksheet associated with that index."); } if (wsCount > 1) { throw new ArgumentException( "Can't delete the worksheet because there are multiple worksheets associated with that index."); } var ws = _worksheets.Values.Single(w => w.Position == position); if (!String.IsNullOrWhiteSpace(ws.RelId) && !Deleted.Contains(ws.RelId)) { Deleted.Add(ws.RelId); } _worksheets.RemoveAll(w => w.Position == position); _worksheets.Values.Where(w => w.Position > position).ForEach(w => w._position -= 1); _workbook.UnsupportedSheets.Where(w => w.Position > position).ForEach(w => w.Position -= 1); _workbook.InvalidateFormulas(); ws.Cleanup(); }
public void SaveProcessedTuples(DadTupleId upstreamId, List <DadTuple> processedTuples) { Debug.Assert(!Processed.ContainsKey(upstreamId)); Debug.Assert(!Delivered.Contains(upstreamId)); foreach (var processedTuple in processedTuples) { Debug.Assert(!Deleted.Contains(processedTuple.Id)); } Processed.Add(upstreamId, processedTuples); // TODO: remove from shared? }