private static void Dispose( GitObjectSafeHandle handle, IEnumerable <IDisposable> linkedResources) { handle.SafeDispose(); if (linkedResources == null) { return; } foreach (IDisposable linkedResource in linkedResources) { linkedResource.Dispose(); } }
internal GitObject LookupInternal(ObjectId id, GitObjectType type, FilePath knownPath) { Ensure.ArgumentNotNull(id, "id"); GitObjectSafeHandle obj = null; try { obj = Proxy.git_object_lookup(handle, id, type); if (obj == null) { return(null); } return(GitObject.BuildFrom(this, id, Proxy.git_object_type(obj), knownPath)); } finally { obj.SafeDispose(); } }
internal GitObject LookupInternal(ObjectId id, GitObjectType type, FilePath knownPath) { Ensure.ArgumentNotNull(id, "id"); GitOid oid = id.Oid; GitObjectSafeHandle obj = null; try { int res; if (id is AbbreviatedObjectId) { res = NativeMethods.git_object_lookup_prefix(out obj, handle, ref oid, (uint)((AbbreviatedObjectId)id).Length, type); } else { res = NativeMethods.git_object_lookup(out obj, handle, ref oid, type); } if (res == (int)GitErrorCode.GIT_ENOTFOUND) { return(null); } Ensure.Success(res); if (id is AbbreviatedObjectId) { id = GitObject.ObjectIdOf(obj); } return(GitObject.CreateFromPtr(obj, id, this, knownPath)); } finally { obj.SafeDispose(); } }
private void Dispose(bool disposing) { objectPtr.SafeDispose(); }