1 Commits

Author SHA1 Message Date
e6df9ae54e disk-info-helper
selenium-helper (Not fully tested)

sync-helper (Not fully tested)
2025-05-19 09:59:09 -07:00
4 changed files with 18 additions and 18 deletions

View File

@ -31,7 +31,7 @@
<PackageReference Include="System.Drawing.Common" Version="8.0.16" /> <PackageReference Include="System.Drawing.Common" Version="8.0.16" />
<PackageReference Include="System.IO.Ports" Version="8.0.0" /> <PackageReference Include="System.IO.Ports" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="9.0.5" /> <PackageReference Include="System.Text.Json" Version="9.0.5" />
<PackageReference Include="Phares.Shared" Version="8.0.118.14751" /> <PackageReference Include="Phares.AA.Shared" Version="8.0.114.12235" />
<PackageReference Include="Phares.Metadata" Version="8.0.118.14751" /> <PackageReference Include="Phares.AA.Metadata" Version="8.0.114.12235" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -7,10 +7,10 @@ using System.Drawing.Imaging;
using System.IO.Compression; using System.IO.Compression;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text.Json; using System.Text.Json;
using Phares.Metadata.Models; using View_by_Distance.Metadata.Models;
using Phares.Metadata.Models.Stateless; using View_by_Distance.Metadata.Models.Stateless;
using Phares.Shared.Models; using View_by_Distance.Shared.Models;
using Phares.Shared.Models.Stateless; using View_by_Distance.Shared.Models.Stateless;
namespace File_Watcher.Helpers; namespace File_Watcher.Helpers;
@ -20,12 +20,11 @@ internal static partial class DeterministicHashCodeHelper
private class Windows : IWindows, IDisposable private class Windows : IWindows, IDisposable
{ {
public long Ticks { get; init; }
public int? CurrentTick => _ProgressBar?.CurrentTick;
private ProgressBar? _ProgressBar; private ProgressBar? _ProgressBar;
private readonly ProgressBarOptions _ProgressBarOptions; private readonly ProgressBarOptions _ProgressBarOptions;
public int CurrentTick { get; internal set; }
public Windows() => public Windows() =>
_ProgressBarOptions = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true }; _ProgressBarOptions = new() { ProgressCharacter = '─', ProgressBarOnBottom = true, DisableBottomPercentage = true };
@ -165,7 +164,7 @@ internal static partial class DeterministicHashCodeHelper
string sourceDirectory; string sourceDirectory;
List<string> check = []; List<string> check = [];
string archiveEntryFile; string archiveEntryFile;
Windows windows = new(); long ticks = DateTime.Now.Ticks;
ReadOnlyCollection<FirstPass> collection; ReadOnlyCollection<FirstPass> collection;
string rootDirectory = Path.GetFullPath(appSettings.ResultSettings.RootDirectory); string rootDirectory = Path.GetFullPath(appSettings.ResultSettings.RootDirectory);
if (!Directory.Exists(rootDirectory)) if (!Directory.Exists(rootDirectory))
@ -188,7 +187,7 @@ internal static partial class DeterministicHashCodeHelper
archiveEntryFile = Path.Combine(sourceDirectory, zipArchiveEntry.Name); archiveEntryFile = Path.Combine(sourceDirectory, zipArchiveEntry.Name);
zipArchiveEntry.ExtractToFile(archiveEntryFile); zipArchiveEntry.ExtractToFile(archiveEntryFile);
} }
collection = WindowsWork(windows, logger, appSettings, sourceDirectory); collection = WindowsWork(logger, appSettings, ticks, sourceDirectory);
if (check.Count == collection.Count) if (check.Count == collection.Count)
{ {
json = JsonSerializer.Serialize(collection.ToList(), FirstPassCollectionSourceGenerationContext.Default.ListFirstPass); json = JsonSerializer.Serialize(collection.ToList(), FirstPassCollectionSourceGenerationContext.Default.ListFirstPass);
@ -199,11 +198,12 @@ internal static partial class DeterministicHashCodeHelper
return true; return true;
} }
private static ReadOnlyCollection<FirstPass> WindowsWork(IWindows windows, ILogger<Worker>? logger, AppSettings appSettings, string sourceDirectory) private static ReadOnlyCollection<FirstPass> WindowsWork(ILogger<Worker>? logger, AppSettings appSettings, long ticks, string sourceDirectory)
{ {
ReadOnlyCollection<FirstPass> results; ReadOnlyCollection<FirstPass> results;
Windows windows = new();
IWindows windowsInterface = windows; IWindows windowsInterface = windows;
logger?.LogInformation("{Ticks} {RootDirectory}", windows.Ticks, sourceDirectory); logger?.LogInformation("{Ticks} {RootDirectory}", ticks, sourceDirectory);
A_Metadata metadata = new(appSettings.ResultSettings, appSettings.MetadataSettings); A_Metadata metadata = new(appSettings.ResultSettings, appSettings.MetadataSettings);
int appSettingsMaxDegreeOfParallelism = appSettings.DeterministicHashCodeConfiguration.MaxDegreeOfParallelism; int appSettingsMaxDegreeOfParallelism = appSettings.DeterministicHashCodeConfiguration.MaxDegreeOfParallelism;
ReadOnlyCollection<string> files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories).AsReadOnly(); ReadOnlyCollection<string> files = Directory.GetFiles(sourceDirectory, "*", SearchOption.AllDirectories).AsReadOnly();
@ -299,7 +299,7 @@ internal static partial class DeterministicHashCodeHelper
return result; return result;
} }
private static ReadOnlyCollection<FirstPass> WindowsAsynchronousWork(AppSettings appSettings, IWindows windows, ReadOnlyCollection<string> files, A_Metadata metadata, int appSettingsMaxDegreeOfParallelism) private static ReadOnlyCollection<FirstPass> WindowsAsynchronousWork(AppSettings appSettings, Windows windows, ReadOnlyCollection<string> files, A_Metadata metadata, int appSettingsMaxDegreeOfParallelism)
{ {
List<FirstPass> results = []; List<FirstPass> results = [];
FirstPass firstPass; FirstPass firstPass;

View File

@ -182,7 +182,7 @@ internal static partial class DiskInfoHelper
ReadOnlyCollection<string> normalized = GetNormalized(appSettings, logger, devices); ReadOnlyCollection<string> normalized = GetNormalized(appSettings, logger, devices);
string text = string.Join(Environment.NewLine, normalized); string text = string.Join(Environment.NewLine, normalized);
string markdown = string.Concat("# ", string markdown = string.Concat("# ",
Environment.MachineName.ToLower(), Environment.MachineName.ToUpper(),
Environment.NewLine, Environment.NewLine,
Environment.NewLine, Environment.NewLine,
"## Normalized", "## Normalized",
@ -214,7 +214,7 @@ internal static partial class DiskInfoHelper
Environment.NewLine, Environment.NewLine,
"```", "```",
Environment.NewLine); Environment.NewLine);
WriteAllText(Path.Combine(appSettings.DiskInfoConfiguration.Destination, $"{Environment.MachineName.ToLower()}.md"), markdown); WriteAllText(Path.Combine(appSettings.DiskInfoConfiguration.Destination, $"{Environment.MachineName.ToUpper()}.md"), markdown);
return true; return true;
} }
@ -320,7 +320,7 @@ internal static partial class DiskInfoHelper
networkAdapter = standardOutput; networkAdapter = standardOutput;
else if (segments[0] == "Win32_Processor") else if (segments[0] == "Win32_Processor")
processor = standardOutput; processor = standardOutput;
WriteAllText(Path.Combine(appSettings.DiskInfoConfiguration.Destination, $"{Environment.MachineName.ToLower()}-{segments[0]}-{date}.json"), standardOutput); WriteAllText(Path.Combine(appSettings.DiskInfoConfiguration.Destination, $"{Environment.MachineName.ToUpper()}-{segments[0]}-{date}.json"), standardOutput);
} }
} }
} }

View File

@ -1,6 +1,6 @@
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Phares.Shared.Models; using View_by_Distance.Shared.Models;
namespace File_Watcher.Models; namespace File_Watcher.Models;