Skip to content

Commit 69cb222

Browse files
committed
fix plugin handling #BUILD beta
1 parent e2401b7 commit 69cb222

File tree

2 files changed

+29
-30
lines changed

2 files changed

+29
-30
lines changed

Interfaces/ILogger.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public static class LoggerFactory
6161
{
6262
public static ILogger CreateLogger(bool isJSON)
6363
{
64-
Trace.WriteLine($"Creating logger with JSON: {isJSON}");
64+
//Trace.WriteLine($"Creating logger with JSON: {isJSON}");
6565
if (isJSON)
6666
{
6767
return new LogJSON();

MainWindow.xaml.cs

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace PointCloudConverter
2828
{
2929
public partial class MainWindow : Window
3030
{
31-
static readonly string version = "16.09.2024";
31+
static readonly string version = "17.09.2024";
3232
static readonly string appname = "PointCloud Converter - " + version;
3333
static readonly string rootFolder = AppDomain.CurrentDomain.BaseDirectory;
3434

@@ -100,43 +100,42 @@ private async void Main()
100100

101101
var pluginsDirectory = "plugins";
102102

103-
if (!Directory.Exists(pluginsDirectory))
103+
if (Directory.Exists(pluginsDirectory))
104104
{
105-
Log.Write("Plugins directory not found.");
106-
return;
107-
}
105+
//Log.Write("Plugins directory not found.");
108106

109-
// Get all DLL files in the plugins directory
110-
var pluginFiles = Directory.GetFiles(pluginsDirectory, "*.dll");
107+
// Get all DLL files in the plugins directory
108+
var pluginFiles = Directory.GetFiles(pluginsDirectory, "*.dll");
111109

112-
foreach (var pluginDLL in pluginFiles)
113-
{
114-
try
110+
foreach (var pluginDLL in pluginFiles)
115111
{
116-
// Load the DLL file as an assembly
117-
var assembly = Assembly.LoadFrom(pluginDLL);
112+
try
113+
{
114+
// Load the DLL file as an assembly
115+
var assembly = Assembly.LoadFrom(pluginDLL);
118116

119-
// Find all types in the assembly that implement IWriter
120-
var writerTypes = assembly.GetTypes().Where(type => typeof(IWriter).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract);
117+
// Find all types in the assembly that implement IWriter
118+
var writerTypes = assembly.GetTypes().Where(type => typeof(IWriter).IsAssignableFrom(type) && !type.IsInterface && !type.IsAbstract);
121119

122-
foreach (var writerType in writerTypes)
123-
{
124-
// Derive a unique key for the writer (e.g., from its name or class name)
125-
string writerName = writerType.Name;//.Replace("Writer", ""); // Customize the key generation logic
126-
if (!externalWriters.ContainsKey(writerName))
120+
foreach (var writerType in writerTypes)
127121
{
128-
// Add the writer type to the dictionary for later use
129-
externalWriters.Add(writerName, writerType);
130-
//Log.Write($"Found writer: {writerType.FullName} in {pluginDLL}");
122+
// Derive a unique key for the writer (e.g., from its name or class name)
123+
string writerName = writerType.Name;//.Replace("Writer", ""); // Customize the key generation logic
124+
if (!externalWriters.ContainsKey(writerName))
125+
{
126+
// Add the writer type to the dictionary for later use
127+
externalWriters.Add(writerName, writerType);
128+
//Log.Write($"Found writer: {writerType.FullName} in {pluginDLL}");
131129

132-
// TODO take extensions from plugin? has 2: .glb and .gltf
133-
externalFileFormats += "|" + writerName + " (" + writerType.FullName + ")|*." + writerName.ToLower();
130+
// TODO take extensions from plugin? has 2: .glb and .gltf
131+
externalFileFormats += "|" + writerName + " (" + writerType.FullName + ")|*." + writerName.ToLower();
132+
}
134133
}
135134
}
136-
}
137-
catch (Exception ex)
138-
{
139-
Console.WriteLine($"Error loading plugin {pluginDLL}: {ex.Message}");
135+
catch (Exception ex)
136+
{
137+
Console.WriteLine($"Error loading plugin {pluginDLL}: {ex.Message}");
138+
}
140139
}
141140
}
142141

@@ -413,7 +412,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
413412
Interlocked.Increment(ref errorCounter); // thread-safe error counter increment
414413
if (importSettings.useJSONLog)
415414
{
416-
Trace.WriteLine("useJSONLoguseJSONLoguseJSONLoguseJSONLog");
415+
//Trace.WriteLine("useJSONLoguseJSONLoguseJSONLoguseJSONLog");
417416
Log.Write("{\"event\": \"" + LogEvent.File + "\", \"path\": " + System.Text.Json.JsonSerializer.Serialize(importSettings.inputFiles[i]) + ", \"status\": \"" + LogStatus.Processing + "\"}", LogEvent.Error);
418417
}
419418
else

0 commit comments

Comments
 (0)