private static void Free(IntPtr stream) { OdbBackendStream odbBackendStream = GCHandle.FromIntPtr(Marshal.ReadIntPtr(stream, GitOdbBackendStream.GCHandleOffset)).Target as OdbBackendStream; if (odbBackendStream != null) { try { odbBackendStream.Dispose(); } catch (Exception ex) { Proxy.git_error_set_str(GitErrorCategory.Odb, ex); } } }
private static int FinalizeWrite(IntPtr stream, ref GitOid oid) { OdbBackendStream odbBackendStream = GCHandle.FromIntPtr(Marshal.ReadIntPtr(stream, GitOdbBackendStream.GCHandleOffset)).Target as OdbBackendStream; if (odbBackendStream != null) { try { return(odbBackendStream.FinalizeWrite(new ObjectId(oid))); } catch (Exception ex) { Proxy.git_error_set_str(GitErrorCategory.Odb, ex); } } return((int)GitErrorCode.Error); }
private static unsafe int Write(IntPtr stream, IntPtr buffer, UIntPtr len) { OdbBackendStream odbBackendStream = GCHandle.FromIntPtr(Marshal.ReadIntPtr(stream, GitOdbBackendStream.GCHandleOffset)).Target as OdbBackendStream; if (odbBackendStream != null) { long length = OdbBackend.ConverToLong(len); using (UnmanagedMemoryStream dataStream = new UnmanagedMemoryStream((byte *)buffer, length)) { try { return(odbBackendStream.Write(dataStream, length)); } catch (Exception ex) { Proxy.git_error_set_str(GitErrorCategory.Odb, ex); } } } return((int)GitErrorCode.Error); }
/// <summary> /// Requests that this backend write an object to the backing store. Returns a stream so that the caller can write /// the data in chunks. /// </summary> public abstract int WriteStream( long length, ObjectType objectType, out OdbBackendStream stream);
/// <summary> /// Requests that this backend read an object. Returns a stream so that the caller can read the data in chunks. /// </summary> public abstract int ReadStream( ObjectId id, out OdbBackendStream stream);