csharp_new_line_before_open_brace = none
This commit is contained in:
@ -4,11 +4,9 @@ using System.Globalization;
|
||||
|
||||
namespace File_Folder_Helper.ADO2025.PI4;
|
||||
|
||||
internal static partial class Helper20250126
|
||||
{
|
||||
internal static partial class Helper20250126 {
|
||||
|
||||
private static void Move(string file, string fileName, string checkFile, List<string> foundLines, ReadOnlyCollection<DateTime> dateTimes)
|
||||
{
|
||||
private static void Move(string file, string fileName, string checkFile, List<string> foundLines, ReadOnlyCollection<DateTime> dateTimes) {
|
||||
string checkDirectory = Path.Combine(Path.GetDirectoryName(file) ?? throw new Exception(), dateTimes[0].ToString("yyyy-MM"));
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
_ = Directory.CreateDirectory(checkDirectory);
|
||||
@ -24,12 +22,10 @@ internal static partial class Helper20250126
|
||||
File.WriteAllText(checkFileD, contents);
|
||||
}
|
||||
|
||||
private static void Move(ILogger<Worker> logger, string dateFormat, string file, string checkFile, string fileName, ReadOnlyCollection<string> statementPeriodSegments, List<string> foundLines)
|
||||
{
|
||||
private static void Move(ILogger<Worker> logger, string dateFormat, string file, string checkFile, string fileName, ReadOnlyCollection<string> statementPeriodSegments, List<string> foundLines) {
|
||||
DateTime dateTime;
|
||||
List<DateTime> dateTimes = [];
|
||||
foreach (string check in statementPeriodSegments)
|
||||
{
|
||||
foreach (string check in statementPeriodSegments) {
|
||||
if (!DateTime.TryParseExact(check, dateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dateTime))
|
||||
continue;
|
||||
dateTimes.Add(dateTime);
|
||||
@ -40,24 +36,18 @@ internal static partial class Helper20250126
|
||||
Move(file, fileName, checkFile, foundLines, dateTimes.AsReadOnly());
|
||||
}
|
||||
|
||||
private static void Move(ILogger<Worker> logger, string file, string checkFile, string dateFormat, string statementPeriod, string search)
|
||||
{
|
||||
private static void Move(ILogger<Worker> logger, string file, string checkFile, string dateFormat, string statementPeriod, string search) {
|
||||
List<string> foundLines = [];
|
||||
bool statementPeriodFound = false;
|
||||
string[]? statementPeriodSegments = null;
|
||||
string fileName = Path.GetFileName(file);
|
||||
string[] lines = File.ReadAllLines(file);
|
||||
foreach (string line in lines)
|
||||
{
|
||||
if (statementPeriodSegments is not null)
|
||||
{
|
||||
foreach (string line in lines) {
|
||||
if (statementPeriodSegments is not null) {
|
||||
if (line.Contains(search))
|
||||
foundLines.Add(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (statementPeriodFound)
|
||||
{
|
||||
} else {
|
||||
if (statementPeriodFound) {
|
||||
statementPeriodSegments = line.Split(' ');
|
||||
continue;
|
||||
}
|
||||
@ -72,8 +62,7 @@ internal static partial class Helper20250126
|
||||
Move(logger, dateFormat, file, checkFile, fileName, statementPeriodSegments.AsReadOnly(), foundLines);
|
||||
}
|
||||
|
||||
internal static void Move(ILogger<Worker> logger, List<string> args)
|
||||
{
|
||||
internal static void Move(ILogger<Worker> logger, List<string> args) {
|
||||
string checkFile;
|
||||
string search = args[5];
|
||||
string dateFormat = args[3];
|
||||
@ -81,8 +70,7 @@ internal static partial class Helper20250126
|
||||
string statementPeriod = args[4];
|
||||
string sourceDirectory = Path.GetFullPath(args[0]);
|
||||
string[] files = Directory.GetFiles(sourceDirectory, searchPatterns, SearchOption.AllDirectories);
|
||||
foreach (string file in files)
|
||||
{
|
||||
foreach (string file in files) {
|
||||
checkFile = Path.ChangeExtension(file, ".pdf");
|
||||
if (!File.Exists(checkFile))
|
||||
continue;
|
||||
|
Reference in New Issue
Block a user