Skip to content

Commit

Permalink
Resolves #1 trigger capturing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jandini committed Dec 23, 2022
1 parent ebdb705 commit 1f1e904
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/WinGif/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@ namespace WinGif
internal static class Extensions
{


internal static IServiceProvider LogVersion(this IServiceProvider provider)
{
var version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;

Program.Title = $"WinGif {version} by Matt Janda";
Console.Title = Program.Title;

provider
.GetRequiredService<ILogger<Program>>()
.LogInformation("WinGif {version}", Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
.LogInformation("WinGif {version}", version);

return provider;
}
Expand Down
2 changes: 2 additions & 0 deletions src/WinGif/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ namespace WinGif
{
class Program
{
internal static string Title { get; set; }

static void Main(string[] args)
{
try
Expand Down
2 changes: 1 addition & 1 deletion src/WinGif/Services/CaptureService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void StartCapture(ICaptureParameters parameters)
if (text.Contains(parameters.WindowCaption) || (matched && !parameters.SingleWindow))
{
// Do not capture itself
if (!parameters.SingleWindow && text.Contains("WinGif.exe") && !parameters.AllowSelfCapture)
if (!parameters.SingleWindow && text.Contains(Program.Title) && !parameters.AllowSelfCapture)
{
Thread.Sleep(parameters.CaptureDelay);
continue;
Expand Down

0 comments on commit 1f1e904

Please sign in to comment.