Projektdateien hinzufügen.

This commit is contained in:
2025-10-26 14:16:27 +01:00
parent 0ea9fe7e7d
commit ae37a63ec9
27 changed files with 981 additions and 0 deletions

58
BackEnd/FileManager.cs Normal file
View File

@@ -0,0 +1,58 @@
using System;
using System.Diagnostics;
using System.Windows.Threading;
using Blake3;
using MediaDevices;
namespace ReSync
{
public static class FileManager
{
static bool cancel = false;
public static void ScanMTPDevice(MediaDevice device)
{
Debug.WriteLine("Starting MTP device scan...");
Debug.WriteLine(cancel);
device.Connect();
ListAllFiles(device, "//");
device.Disconnect();
}
static void ListAllFiles(MediaDevice device, string directory)
{
if (cancel) return;
// Get all subdirectories
var dirs = device.GetDirectories(directory);
var files = device.GetFiles(directory);
foreach (var file in files)
{
if (cancel) return;
Console.WriteLine(file);
}
// Recursively explore directories
foreach (var dir in dirs)
{
if (cancel) return;
ListAllFiles(device, dir);
}
}
public static string GetFileHash(string filePath)
{
return "a";
}
public static void CancelOperation()
{
cancel = true;
Dispatcher.CurrentDispatcher.InvokeAsync(async() =>
{
await Task.Delay(1000);
cancel = false;
});
}
}
}