public DefIDFull GetID(IDef res) { lock (this) { if (res == null) { return(default(DefIDFull)); } try { return(_objectsToPaths[res]); } catch (KeyNotFoundException) { throw new KeyNotFoundException($"Key {res} was not found in the dictionary"); } } }
public bool GetExisting(DefIDFull id, Type type, out IDef res) { lock (this) { if (!_pathsToObjects.TryGetValue(id, out res)) { return(false); } if (res == null) { return(true); } if (!type.IsInstanceOfType(res)) { res = null; } return(true); } }