-
Notifications
You must be signed in to change notification settings - Fork 876
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
176 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using LibGit2Sharp.Handlers; | ||
|
||
namespace LibGit2Sharp.Core | ||
{ | ||
// | ||
internal class PackbuilderCallbacks | ||
{ | ||
private readonly PackBuilderProgressHandler onPackBuilderProgress; | ||
|
||
/// <summary>S | ||
/// Constructor to set up the native callback given managed delegate. | ||
/// </summary> | ||
/// <param name="onPackBuilderProgress">The <see cref="PackBuilderProgressHandler"/> delegate that the git_packbuilder_progress will call.</param> | ||
internal PackbuilderCallbacks(PackBuilderProgressHandler onPackBuilderProgress) | ||
{ | ||
this.onPackBuilderProgress = onPackBuilderProgress; | ||
} | ||
|
||
/// <summary> | ||
/// Generates a delegate that matches the native git_packbuilder_progress function's signature and wraps the <see cref="PackBuilderProgressHandler"/> delegate. | ||
/// </summary> | ||
/// <returns>A delegate method with a signature that matches git_transfer_progress_callback.</returns> | ||
internal NativeMethods.git_packbuilder_progress GenerateCallback() | ||
{ | ||
if (onPackBuilderProgress == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new PackbuilderCallbacks(onPackBuilderProgress).OnGitPackBuilderProgress; | ||
} | ||
|
||
private int OnGitPackBuilderProgress(int stage, uint current, uint total, IntPtr payload) | ||
{ | ||
return onPackBuilderProgress((PackBuilderStage) stage, (int)current, (int)total) ? -1 : 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using LibGit2Sharp.Handlers; | ||
|
||
namespace LibGit2Sharp.Core | ||
{ | ||
internal class PushTransferCallbacks | ||
{ | ||
private readonly PushTransferProgressHandler onPushTransferProgress; | ||
|
||
/// <summary> | ||
/// Constructor to set up the native callback given managed delegate. | ||
/// </summary> | ||
/// <param name="onPushTransferProgress">The <see cref="TransferProgressHandler"/> delegate that the git_transfer_progress_callback will call.</param> | ||
internal PushTransferCallbacks(PushTransferProgressHandler onPushTransferProgress) | ||
{ | ||
this.onPushTransferProgress = onPushTransferProgress; | ||
} | ||
|
||
/// <summary> | ||
/// Generates a delegate that matches the native git_transfer_progress_callback function's signature and wraps the <see cref="PushTransferProgressHandler"/> delegate. | ||
/// </summary> | ||
/// <returns>A delegate method with a signature that matches git_transfer_progress_callback.</returns> | ||
internal NativeMethods.git_push_transfer_progress GenerateCallback() | ||
{ | ||
if (onPushTransferProgress == null) | ||
{ | ||
return null; | ||
} | ||
|
||
return new PushTransferCallbacks(onPushTransferProgress).OnGitTransferProgress; | ||
} | ||
|
||
private int OnGitTransferProgress(uint current, uint total, UIntPtr bytes, IntPtr payload) | ||
{ | ||
return onPushTransferProgress((int)current, (int)total, (long)bytes) ? -1 : 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters