public override uint GetOrCreateFileId(string filename) { // check the filename exists if (!FileLookup.TryGetValue(filename, out var id)) { id = unchecked ((uint)--CurrentId); FileLookup.Add(filename, id); return(id); } return(id); }
public override uint GetOrCreateFileId(string filename) { // check the filename exists if (!FileLookup.TryGetValue(filename, out var id)) { // attempt to take an id from the pool if (_unusedIds.Count > 0) { id = _unusedIds.Dequeue(); FileLookup.Add(filename, id); return(id); } // TODO verify the best way of handling this throw new Exception("Out of unused Ids - SEND HELP!"); } return(id); }