Exemplo n.º 1
0
            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);
                    }
                }
            }
Exemplo n.º 2
0
            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);
            }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
 /// <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);
Exemplo n.º 5
0
 /// <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);