national-instruments-helper
This commit is contained in:
@ -1,6 +1,12 @@
|
||||
using CliWrap;
|
||||
using File_Watcher.Models;
|
||||
|
||||
#if ShellProgressBar
|
||||
|
||||
using ShellProgressBar;
|
||||
|
||||
#endif
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
@ -21,13 +27,24 @@ internal static partial class DeterministicHashCodeHelper
|
||||
{
|
||||
|
||||
public long Ticks { get; init; }
|
||||
public int? CurrentTick => _ProgressBar?.CurrentTick;
|
||||
public int? CurrentTick =>
|
||||
#if ShellProgressBar
|
||||
_ProgressBar?.CurrentTick;
|
||||
#else
|
||||
throw new NotSupportedException("ShellProgressBar is not supported in this context.");
|
||||
#endif
|
||||
|
||||
#if ShellProgressBar
|
||||
private ProgressBar? _ProgressBar;
|
||||
private readonly ProgressBarOptions _ProgressBarOptions;
|
||||
#endif
|
||||
|
||||
public Windows() =>
|
||||
#if ShellProgressBar
|
||||
_ProgressBarOptions = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
|
||||
#else
|
||||
throw new NotSupportedException("ShellProgressBar is not supported in this context.");
|
||||
#endif
|
||||
|
||||
DeterministicHashCode IWindows.GetDeterministicHashCode(HttpClient httpClient, Uri uri) =>
|
||||
GetDeterministicHashCode(httpClient, uri);
|
||||
@ -98,18 +115,26 @@ internal static partial class DeterministicHashCodeHelper
|
||||
}
|
||||
|
||||
void IWindows.Tick() =>
|
||||
#if ShellProgressBar
|
||||
_ProgressBar?.Tick();
|
||||
#else
|
||||
throw new NotSupportedException("ShellProgressBar is not supported in this context.");
|
||||
#endif
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
#if ShellProgressBar
|
||||
_ProgressBar?.Dispose();
|
||||
#endif
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
void IWindows.ConstructProgressBar(int maxTicks, string message)
|
||||
{
|
||||
#if ShellProgressBar
|
||||
_ProgressBar?.Dispose();
|
||||
_ProgressBar = new(maxTicks, message, _ProgressBarOptions);
|
||||
#endif
|
||||
}
|
||||
|
||||
ReadOnlyCollection<string> IWindows.ConvertAndGetFastForwardMovingPictureExpertsGroupFiles(ResultSettings resultSettings, HttpClient? httpClient, FilePath filePath)
|
||||
|
||||
Reference in New Issue
Block a user