本文整理汇总了C#中Core.ToObjectType方法的典型用法代码示例。如果您正苦于以下问题:C# Core.ToObjectType方法的具体用法?C# Core.ToObjectType怎么用?C# Core.ToObjectType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core.ToObjectType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteStream
private static int WriteStream(
out IntPtr stream_out,
IntPtr backend,
UIntPtr length,
Core.GitObjectType type)
{
stream_out = IntPtr.Zero;
OdbBackend odbBackend = GCHandle.FromIntPtr(Marshal.ReadIntPtr(backend, GitOdbBackend.GCHandleOffset)).Target as OdbBackend;
ObjectType objectType = type.ToObjectType();
if (odbBackend != null &&
length.ToUInt64() < long.MaxValue)
{
OdbBackendStream stream;
try
{
int toReturn = odbBackend.WriteStream((long)length.ToUInt64(), objectType, 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;
}
示例2: Write
private static unsafe int Write(
ref GitOid oid,
IntPtr backend,
IntPtr data,
UIntPtr len,
Core.GitObjectType type)
{
OdbBackend odbBackend = GCHandle.FromIntPtr(Marshal.ReadIntPtr(backend, GitOdbBackend.GCHandleOffset)).Target as OdbBackend;
ObjectType objectType = type.ToObjectType();
if (odbBackend != null &&
len.ToUInt64() < long.MaxValue)
{
try
{
using (UnmanagedMemoryStream stream = new UnmanagedMemoryStream((byte*)data, (long)len.ToUInt64()))
{
byte[] finalOid;
int toReturn = odbBackend.Write(oid.Id, stream, (long)len.ToUInt64(), objectType, out finalOid);
if (0 == toReturn)
{
oid.Id = finalOid;
}
return toReturn;
}
}
catch (Exception ex)
{
Proxy.giterr_set_str(GitErrorCategory.Odb, ex);
}
}
return (int)GitErrorCode.Error;
}