Exemple #1
0
            private static int ReadStream(
                out IntPtr stream_out,
                IntPtr backend,
                ref GitOid oid)
            {
                stream_out = IntPtr.Zero;

                OdbBackend odbBackend = MarshalOdbBackend(backend);

                if (odbBackend == null)
                {
                    return((int)GitErrorCode.Error);
                }

                try
                {
                    OdbBackendStream stream;
                    int toReturn = odbBackend.ReadStream(new ObjectId(oid), out stream);

                    if (toReturn == 0)
                    {
                        stream_out = stream.GitOdbBackendStreamPointer;
                    }

                    return(toReturn);
                }
                catch (Exception ex)
                {
                    Proxy.giterr_set_str(GitErrorCategory.Odb, ex);
                    return((int)GitErrorCode.Error);
                }
            }
Exemple #2
0
            private static int ReadStream(
                out IntPtr stream_out,
                IntPtr backend,
                ref GitOid oid)
            {
                stream_out = IntPtr.Zero;

                OdbBackend odbBackend = GCHandle.FromIntPtr(Marshal.ReadIntPtr(backend, GitOdbBackend.GCHandleOffset)).Target as OdbBackend;

                if (odbBackend != null)
                {
                    OdbBackendStream stream;

                    try
                    {
                        int toReturn = odbBackend.ReadStream(oid.Id, out stream);

                        if (0 == toReturn)
                        {
                            stream_out = stream.GitOdbBackendStreamPointer;
                        }

                        return(toReturn);
                    }
                    catch (Exception ex)
                    {
                        Proxy.giterr_set_str(GitErrorCategory.Odb, ex);
                    }
                }

                return((int)GitErrorCode.Error);
            }