net7.0
This commit is contained in:
@ -4,6 +4,7 @@ using View_by_Distance.FaceRecognitionDotNet;
|
||||
using View_by_Distance.Map.Models;
|
||||
using View_by_Distance.Shared.Models;
|
||||
using View_by_Distance.Shared.Models.Properties;
|
||||
using WindowsShortcutFactory;
|
||||
|
||||
namespace View_by_Distance.Distance.Models;
|
||||
|
||||
@ -354,4 +355,55 @@ public class MapLogicSupport : Shared.Models.Methods.IMapLogicSupport
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool TryToFind(string a2PeopleSingletonDirectory, string file, string path)
|
||||
{
|
||||
bool result = false;
|
||||
string? pathName = Path.GetFileName(path);
|
||||
string? group = Path.GetDirectoryName(path);
|
||||
string? groupName = Path.GetFileName(group);
|
||||
if (pathName is not null && group is not null && groupName is not null)
|
||||
{
|
||||
WindowsShortcut windowsShortcut;
|
||||
string checkDirectory = Path.Combine(a2PeopleSingletonDirectory, groupName, pathName);
|
||||
if (Directory.Exists(checkDirectory))
|
||||
{
|
||||
try
|
||||
{
|
||||
windowsShortcut = new() { Path = checkDirectory };
|
||||
windowsShortcut.Save(file);
|
||||
windowsShortcut.Dispose();
|
||||
result = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void BeforeSaveResizedImagesByPersonKeyFormatted(string[] jLinks, string a2PeopleSingletonDirectory)
|
||||
{
|
||||
string[] files;
|
||||
string checkDirectory;
|
||||
WindowsShortcut windowsShortcut;
|
||||
foreach (string directoryName in jLinks)
|
||||
{
|
||||
checkDirectory = Path.Combine(a2PeopleSingletonDirectory, directoryName);
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
continue;
|
||||
files = Directory.GetFiles(checkDirectory, "*.lnk", SearchOption.TopDirectoryOnly);
|
||||
foreach (string file in files)
|
||||
{
|
||||
windowsShortcut = WindowsShortcut.Load(file);
|
||||
if (windowsShortcut.Path is null)
|
||||
continue;
|
||||
if (!Directory.Exists(windowsShortcut.Path))
|
||||
{
|
||||
if (!TryToFind(a2PeopleSingletonDirectory, file, windowsShortcut.Path))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user