diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-03-28 18:50:56 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-03-28 22:00:59 +0400 |
commit | bbad99609d078f1467a75ab5765607d62f05d33b (patch) | |
tree | 2b647f498adfbed7f25a3c794830744741d57a41 /LibGit2Sharp | |
parent | c86825cc038a55d620b2fb0b11e4c734688810af (diff) |
Add OidSafeHandle type
Diffstat (limited to 'LibGit2Sharp')
-rw-r--r-- | LibGit2Sharp/Core/Handles/OidSafeHandle.cs | 17 | ||||
-rw-r--r-- | LibGit2Sharp/LibGit2Sharp.csproj | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/LibGit2Sharp/Core/Handles/OidSafeHandle.cs b/LibGit2Sharp/Core/Handles/OidSafeHandle.cs new file mode 100644 index 00000000..d58bcc92 --- /dev/null +++ b/LibGit2Sharp/Core/Handles/OidSafeHandle.cs @@ -0,0 +1,17 @@ +using System.Runtime.InteropServices; + +namespace LibGit2Sharp.Core.Handles +{ + internal class OidSafeHandle : NotOwnedSafeHandleBase + { + private GitOid MarshalAsGitOid() + { + return (GitOid)Marshal.PtrToStructure(handle, typeof(GitOid)); + } + + public ObjectId MarshalAsObjectId() + { + return new ObjectId(MarshalAsGitOid()); + } + } +} diff --git a/LibGit2Sharp/LibGit2Sharp.csproj b/LibGit2Sharp/LibGit2Sharp.csproj index 4fbda390..8af602fa 100644 --- a/LibGit2Sharp/LibGit2Sharp.csproj +++ b/LibGit2Sharp/LibGit2Sharp.csproj @@ -61,6 +61,7 @@ <Compile Include="Core\GitObjectExtensions.cs" /> <Compile Include="Core\Handles\GitObjectSafeHandle.cs" /> <Compile Include="Core\Handles\NotOwnedSafeHandleBase.cs" /> + <Compile Include="Core\Handles\OidSafeHandle.cs" /> <Compile Include="Core\ReferenceExtensions.cs" /> <Compile Include="Core\SignatureSafeHandle.cs" /> <Compile Include="Core\Handles\TreeEntrySafeHandle.cs" /> |