Ready to release

This commit is contained in:
2025-08-29 12:04:32 -07:00
parent 7b2a843664
commit 89e669c7d3
26 changed files with 266 additions and 82 deletions

View File

@ -30,9 +30,16 @@ public class ExportRepository : IExportRepository
_RepositoryName = nameof(ExportRepository)[..^10];
}
private static string[] Get()
private static string[] Get(HeaderCommon headerCommon)
{
DateTime dateTime = DateTime.Now;
DateTime dateTime;
if (headerCommon.ID < 1)
dateTime = DateTime.Now;
else
{
DateTimeOffset dateTimeOffset = DateTimeOffset.UnixEpoch.AddSeconds(headerCommon.ID).ToLocalTime();
dateTime = new(dateTimeOffset.Ticks);
}
DateTime lastWeekDateTime = dateTime.AddDays(-7);
Calendar calendar = new CultureInfo("en-US").Calendar;
string weekOfYear = $"{dateTime:yyyy}_Week_{calendar.GetWeekOfYear(dateTime, CalendarWeekRule.FirstDay, DayOfWeek.Sunday):00}";
@ -40,11 +47,11 @@ public class ExportRepository : IExportRepository
return new string[] { weekOfYear, lastWeekOfYear };
}
private NginxFileSystemSortable[] GetNginxFileSystemSortableCollection(HeaderCommon headerCommon, HttpClient httpClient, string endsWith)
private NginxFileSystemSortable[] GetNginxFileSystemSortableCollection(HeaderCommon headerCommon, HttpClient httpClient, string[] endsWithCollection)
{
List<NginxFileSystemSortable> results = new();
Uri uri;
string[] weeks = Get();
string[] weeks = Get(headerCommon);
ReadOnlyCollection<NginxFileSystemSortable> collection;
foreach (string weekYear in weeks)
{
@ -52,7 +59,7 @@ public class ExportRepository : IExportRepository
uri = _FileShareRepository.Append(new Uri(_AppSettings.EcMesaFileShareMetrologySi), "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}");
else
uri = _FileShareRepository.Append(new Uri(_AppSettings.EcMesaFileShareMetrologySi), "Archive", "API", weekYear, $"-{headerCommon.PSN}", $"-{headerCommon.Reactor}", $"-{headerCommon.RDS}", $"-{headerCommon.ID}");
collection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, uri, endsWith);
collection = _FileShareRepository.GetNginxFileSystemSortableCollection(httpClient, uri, endsWithCollection);
results.AddRange(collection);
}
return results.OrderByDescending(l => l.DateTime).ToArray();
@ -79,7 +86,7 @@ public class ExportRepository : IExportRepository
{
string result;
HttpClient httpClient = _HttpClientFactory.CreateClient();
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, ".txt");
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, [".txt"]);
result = GetLines(httpClient, nginxFileSystemSortableCollection);
return result;
}
@ -96,7 +103,7 @@ public class ExportRepository : IExportRepository
const string ticks = "Ticks";
JsonProperty[] jsonProperties;
HttpClient httpClient = _HttpClientFactory.CreateClient();
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, ".json");
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, [".json"]);
foreach (NginxFileSystemSortable nginxFileSystemSortable in nginxFileSystemSortableCollection)
{
json = GetLines(httpClient, nginxFileSystemSortableCollection);
@ -137,7 +144,7 @@ public class ExportRepository : IExportRepository
string json;
HeaderCommon? hc;
HttpClient httpClient = _HttpClientFactory.CreateClient();
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, ".json");
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, [".json"]);
foreach (NginxFileSystemSortable nginxFileSystemSortable in nginxFileSystemSortableCollection)
{
json = GetLines(httpClient, nginxFileSystemSortableCollection);
@ -158,7 +165,7 @@ public class ExportRepository : IExportRepository
{
string result;
HttpClient httpClient = _HttpClientFactory.CreateClient();
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, ".pdsf");
NginxFileSystemSortable[] nginxFileSystemSortableCollection = GetNginxFileSystemSortableCollection(headerCommon, httpClient, [".pdsf"]);
result = GetLines(httpClient, nginxFileSystemSortableCollection);
return result;
}

View File

@ -80,7 +80,7 @@ public class FileShareRepository : IFileShareRepository
return result;
}
ReadOnlyCollection<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string? endsWith)
ReadOnlyCollection<NginxFileSystemSortable> IFileShareRepository.GetNginxFileSystemSortableCollection(HttpClient httpClient, Uri uri, string[] endsWithCollection)
{
List<NginxFileSystemSortable> results = new();
Task<HttpResponseMessage> httpResponseMessage = httpClient.GetAsync(uri);
@ -94,7 +94,7 @@ public class FileShareRepository : IFileShareRepository
List<NginxFileSystemSortable> nginxFileSystemSortableCollection = NginxFileSystemSortable.Convert(fileShareRepository, uri, nginxFileSystemCollection);
foreach (NginxFileSystemSortable nginxFileSystemSortable in nginxFileSystemSortableCollection.OrderByDescending(l => l.DateTime))
{
if (!string.IsNullOrEmpty(endsWith) && !nginxFileSystemSortable.Name.EndsWith(endsWith))
if (!endsWithCollection.Any(l => string.IsNullOrEmpty(l) && !nginxFileSystemSortable.Name.EndsWith(l)))
continue;
results.Add(nginxFileSystemSortable);
}

View File

@ -82,6 +82,7 @@ stages:
- script: dotnet clean --configuration $(Configuration)
workingDirectory: Server
displayName: 'App - Clean'
- script: C:/Windows/system32/inetsrv/appcmd.exe stop apppool /apppool.name:$(AssemblyTitle).$(Configuration)
workingDirectory: Server