forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs: gitextensions#10307
- Loading branch information
Showing
26 changed files
with
122 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System.ComponentModel.Design; | ||
|
||
namespace GitExtUtils; | ||
|
||
public static class ServiceContainerRegistry | ||
{ | ||
public static void RegisterServices(ServiceContainer serviceContainer) | ||
{ | ||
serviceContainer.AddService<ISubscribableTraceListener>(new SubscribableTraceListener()); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...inInterfaces/ServiceProviderExtensions.cs → .../GitExtUtils/ServiceProviderExtensions.cs
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,82 @@ | ||
using System.Diagnostics; | ||
using System.Text; | ||
|
||
namespace GitExtUtils; | ||
|
||
public delegate void TraceHandler(in string message); | ||
|
||
/// <summary> | ||
/// Provides an event for receiving the <see cref="Trace"/> output. | ||
/// </summary> | ||
public interface ISubscribableTraceListener | ||
{ | ||
event TraceHandler TraceReceived; | ||
} | ||
|
||
public class SubscribableTraceListener : TraceListener, ISubscribableTraceListener | ||
{ | ||
private readonly StringBuilder _trace = new(); | ||
|
||
public event TraceHandler TraceReceived; | ||
|
||
public SubscribableTraceListener() | ||
{ | ||
Trace.Listeners.Add(this); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
Trace.Listeners.Remove(this); | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
|
||
public override void Write(string? message) | ||
{ | ||
lock (this) | ||
{ | ||
_trace.Append(message); | ||
} | ||
} | ||
|
||
public override void WriteLine(string? message) | ||
{ | ||
lock (this) | ||
{ | ||
_trace.AppendLine(message); | ||
Flush(); | ||
} | ||
} | ||
|
||
public override void Flush() | ||
{ | ||
lock (this) | ||
{ | ||
base.Flush(); | ||
try | ||
{ | ||
if (_trace.Length == 0) | ||
{ | ||
return; | ||
} | ||
|
||
string message = _trace.ToString(); | ||
#if DEBUG | ||
if (message.Contains("Exception") || message.Contains("RevisionReader")) | ||
#endif | ||
{ | ||
TraceReceived?.Invoke(message); | ||
} | ||
|
||
_trace.Clear(); | ||
} | ||
catch | ||
{ | ||
// Do not worsen things | ||
} | ||
} | ||
} | ||
} |
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
4 changes: 2 additions & 2 deletions
4
src/app/GitUI/CommandsDialogs/SettingsDialog/Pages/ControlHotkeys.cs
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
4 changes: 2 additions & 2 deletions
4
src/app/GitUI/CommandsDialogs/SettingsDialog/Pages/TextboxHotkey.cs
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
4 changes: 2 additions & 2 deletions
4
src/app/GitUI/CommandsDialogs/UserScriptContextMenuExtensions.cs
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
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
2 changes: 1 addition & 1 deletion
2
tests/app/IntegrationTests/UI.IntegrationTests/GlobalServiceContainer.cs
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
1 change: 1 addition & 0 deletions
1
tests/app/UnitTests/GitUI.Tests/Script/ScriptsManagerScriptRunnerTests.cs
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