Skip to content

Commit

Permalink
Moved the logic to determine if it should trigger the stats generatio…
Browse files Browse the repository at this point in the history
…n to the BotSettings.
  • Loading branch information
Jeroen Heijster committed May 15, 2022
1 parent 0d31d07 commit 3894f6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion StatBot/Handlers/mIRCStatsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public mIRCStatsHandler(BotSettings botSettings)
/// <returns>A Task representing the asynchronous operation.</returns>
public async Task GenerateStatsAsync()
{
if (!string.IsNullOrEmpty(_botSettings.mIRCStats.GeneratorFile))
if (_botSettings.mIRCStats.UseInternalTimer)
{
System.IO.FileInfo fileinfo = new System.IO.FileInfo(_botSettings.mIRCStats.GeneratorFile);
folder = fileinfo.Directory.FullName;
Expand Down
6 changes: 6 additions & 0 deletions StatBot/Settings/BotSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ public MIRCStats(IConfiguration configuration)
LaunchEveryMinutes = configuration.GetValue<int>("MIRCStats:LaunchEveryMinutes");
GeneratorFile = configuration.GetValue<string>("MIRCStats:GeneratorFile");
WaitUntilCompleted = configuration.GetValue<bool>("MIRCStats:WaitUntilCompleted");
UseInternalTimer = !String.IsNullOrEmpty(GeneratorFile);
}

/// <summary>
Expand Down Expand Up @@ -228,6 +229,11 @@ public MIRCStats(IConfiguration configuration)
/// </summary>
/// <value><c>true</c> if [wait until completed]; otherwise, <c>false</c>.</value>
public bool WaitUntilCompleted { get; }
/// <summary>
/// Gets a value indicating whether to [use the internal timer].
/// </summary>
/// <value><c>true</c> if [use the internal timer]; otherwise, <c>false</c>.</value>
public bool UseInternalTimer { get; }
}

/// <summary>
Expand Down

0 comments on commit 3894f6a

Please sign in to comment.