person-key-to-immich-import birthday json (Day-Helper-2024-05-18)
csharp_prefer_braces = true
This commit is contained in:
@ -3,11 +3,9 @@ using System.Collections.ObjectModel;
|
||||
|
||||
namespace File_Folder_Helper.ADO2024.PI2;
|
||||
|
||||
internal static partial class Helper20240711
|
||||
{
|
||||
internal static partial class Helper20240711 {
|
||||
|
||||
internal static void GitRemoteRemove(ILogger<Worker> logger, List<string> args)
|
||||
{
|
||||
internal static void GitRemoteRemove(ILogger<Worker> logger, List<string> args) {
|
||||
string line;
|
||||
string[] lines;
|
||||
bool branchCheck;
|
||||
@ -27,52 +25,56 @@ internal static partial class Helper20240711
|
||||
string extension = args[7].Length > 2 ? args[7] : string.Empty;
|
||||
string[] files = Directory.EnumerateFiles(sourceDirectory, searchPattern, new EnumerationOptions() { IgnoreInaccessible = true, RecurseSubdirectories = true, AttributesToSkip = FileAttributes.None }).ToArray();
|
||||
logger.LogInformation("Found {files} file(s)", files.Length);
|
||||
foreach (string file in files)
|
||||
{
|
||||
foreach (string file in files) {
|
||||
branchCheck = false;
|
||||
remoteCheck = false;
|
||||
lines = File.ReadAllLines(file);
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
for (int i = 0; i < lines.Length; i++) {
|
||||
line = lines[i];
|
||||
if (!line.Contains(remoteToRemove))
|
||||
if (!line.Contains(remoteToRemove)) {
|
||||
continue;
|
||||
if (!lines[i - 1].Contains(remoteToRemoveFilter))
|
||||
}
|
||||
if (!lines[i - 1].Contains(remoteToRemoveFilter)) {
|
||||
continue;
|
||||
}
|
||||
remoteCheck = true;
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
for (int i = 0; i < lines.Length; i++) {
|
||||
line = lines[i];
|
||||
if (!line.Contains(branchName))
|
||||
if (!line.Contains(branchName)) {
|
||||
continue;
|
||||
}
|
||||
branchCheck = true;
|
||||
break;
|
||||
}
|
||||
if (!remoteCheck)
|
||||
if (!remoteCheck) {
|
||||
continue;
|
||||
}
|
||||
directory = Path.GetDirectoryName(file);
|
||||
if (directory is null)
|
||||
if (directory is null) {
|
||||
continue;
|
||||
}
|
||||
parentDirectory = Path.GetDirectoryName(directory);
|
||||
if (parentDirectory is null)
|
||||
if (parentDirectory is null) {
|
||||
continue;
|
||||
}
|
||||
parentDirectoryName = Path.GetFileName(parentDirectory).ToLower();
|
||||
messages = Helpers.HelperGit.RemoteRemove(parentDirectory, lastRemoteSegment, CancellationToken.None);
|
||||
foreach (string message in messages)
|
||||
foreach (string message in messages) {
|
||||
logger.LogInformation("{function} => {parentDirectoryName}: [{message}]", nameof(Helpers.HelperGit.RemoteRemove), parentDirectoryName, message);
|
||||
}
|
||||
messages = Helpers.HelperGit.RemoteAdd(parentDirectory, remoteToAddName, $"{remoteToAddUrl}{parentDirectoryName}{extension}", CancellationToken.None);
|
||||
foreach (string message in messages)
|
||||
foreach (string message in messages) {
|
||||
logger.LogInformation("{function} => {parentDirectoryName}: [{message}]", nameof(Helpers.HelperGit.RemoteAdd), parentDirectoryName, message);
|
||||
if (!branchCheck)
|
||||
}
|
||||
if (!branchCheck) {
|
||||
continue;
|
||||
try
|
||||
{ messages = Helpers.HelperGit.PushBranch(parentDirectory, remoteToAddName, branchName, CancellationToken.None); }
|
||||
catch (Exception ex)
|
||||
{ messages = new([ex.Message]); }
|
||||
foreach (string message in messages)
|
||||
}
|
||||
try { messages = Helpers.HelperGit.PushBranch(parentDirectory, remoteToAddName, branchName, CancellationToken.None); } catch (Exception ex) { messages = new([ex.Message]); }
|
||||
foreach (string message in messages) {
|
||||
logger.LogInformation("{function} => {parentDirectoryName}: [{message}]", nameof(Helpers.HelperGit.PushBranch), parentDirectoryName, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user