@@ -25,7 +25,7 @@ namespace PointCloudConverter
25
25
{
26
26
public partial class MainWindow : Window
27
27
{
28
- static readonly string version = "09 .09.2024" ;
28
+ static readonly string version = "10 .09.2024" ;
29
29
static readonly string appname = "PointCloud Converter - " + version ;
30
30
static readonly string rootFolder = AppDomain . CurrentDomain . BaseDirectory ;
31
31
@@ -88,6 +88,10 @@ private async void Main()
88
88
//var testwriter = PointCloudConverter.Plugins.PluginLoader.LoadWriter("plugins/GLTFWriter.dll");
89
89
//testwriter.Close();
90
90
91
+ // for debug: print config file location in appdata local here directly
92
+ // string configFilePath = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
93
+ // Log.WriteLine("Config file: " + configFilePath);
94
+
91
95
// using from commandline
92
96
if ( args . Length > 1 )
93
97
{
@@ -168,10 +172,7 @@ private async void Main()
168
172
LoadSettings ( ) ;
169
173
}
170
174
171
-
172
-
173
175
// main processing loop
174
-
175
176
private static async Task ProcessAllFiles ( object workerParamsObject )
176
177
{
177
178
var workerParams = ( WorkerParams ) workerParamsObject ;
@@ -293,6 +294,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
293
294
//// hack to fix progress bar not updating on last file
294
295
//progressFile++;
295
296
297
+ // clamp to maxfiles
296
298
int maxThreads = Math . Min ( importSettings . maxThreads , importSettings . maxFiles ) ;
297
299
// clamp to min 1
298
300
maxThreads = Math . Max ( maxThreads , 1 ) ;
@@ -301,7 +303,7 @@ private static async Task ProcessAllFiles(object workerParamsObject)
301
303
// init pool
302
304
importSettings . InitWriterPool ( maxThreads , importSettings . exportFormat ) ;
303
305
304
- var semaphore = new SemaphoreSlim ( importSettings . maxThreads ) ;
306
+ var semaphore = new SemaphoreSlim ( maxThreads ) ;
305
307
306
308
var tasks = new List < Task > ( ) ;
307
309
@@ -325,18 +327,17 @@ private static async Task ProcessAllFiles(object workerParamsObject)
325
327
}
326
328
finally
327
329
{
328
- // Ensure the semaphore is released, if needed
329
- if ( semaphore . CurrentCount == 0 ) // Make sure we don't release more times than we acquire
330
- {
331
- semaphore . Release ( ) ;
332
- }
330
+ //// Ensure the semaphore is released, if needed
331
+ // if (semaphore.CurrentCount == 0) // Make sure we don't release more times than we acquire
332
+ // {
333
+ // semaphore.Release();
334
+ // }
333
335
}
334
336
//int? taskId = Task.CurrentId; // Get the current task ID
335
337
336
338
//progressFile = i;
337
339
Interlocked . Increment ( ref progressFile ) ;
338
340
339
-
340
341
//bool isLastTask = (i == len - 1); // Check if this is the last task
341
342
342
343
int index = i ; // Capture the current file index in the loop
@@ -582,7 +583,7 @@ static void ProgressTick(object sender, EventArgs e)
582
583
"\" thread\" : " + index + "," +
583
584
"\" currentPoint\" : " + currentValue + "," +
584
585
"\" totalPoints\" : " + maxValue + "," +
585
- "\" percentage\" : " + ( int ) ( ( currentValue / ( float ) maxValue ) * 100 ) + "% ," +
586
+ "\" percentage\" : " + ( int ) ( ( currentValue / ( float ) maxValue ) * 100 ) + "," +
586
587
"\" file\" : " + System . Text . Json . JsonSerializer . Serialize ( progressInfo . FilePath ) +
587
588
"}" ;
588
589
Log . WriteLine ( jsonString , LogEvent . Progress ) ;
@@ -698,7 +699,7 @@ static bool ParseFile(ImportSettings importSettings, int fileIndex, int? taskId,
698
699
}
699
700
else
700
701
{
701
- Log . WriteLine ( "Points: " + pointCount ) ;
702
+ Log . WriteLine ( "Points: " + pointCount + " (" + importSettings . inputFiles [ fileIndex ] + ")" ) ;
702
703
}
703
704
704
705
// NOTE only works with formats that have bounds defined in header, otherwise need to loop whole file to get bounds?
@@ -967,7 +968,7 @@ void StartProcess(bool doProcess = true)
967
968
args . Add ( "-rgb=" + ( bool ) chkImportRGB . IsChecked ) ;
968
969
args . Add ( "-intensity=" + ( bool ) chkImportIntensity . IsChecked ) ;
969
970
970
- if ( cmbExportFormat . SelectedItem . ToString ( ) . ToUpper ( ) . Contains ( "PCROOT" ) ) args . Add ( "-gridsize=" + txtGridSize . Text ) ;
971
+ if ( cmbExportFormat . SelectedItem ? . ToString ( ) ? . ToUpper ( ) ? . Contains ( "PCROOT" ) == true ) args . Add ( "-gridsize=" + txtGridSize . Text ) ;
971
972
972
973
if ( ( bool ) chkUseMinPointCount . IsChecked ) args . Add ( "-minpoints=" + txtMinPointCount . Text ) ;
973
974
if ( ( bool ) chkUseScale . IsChecked ) args . Add ( "-scale=" + txtScale . Text ) ;
@@ -1415,10 +1416,10 @@ private void cmbExportFormat_SelectionChanged(object sender, SelectionChangedEve
1415
1416
// if PCROOT then filename is required, use default output.pcroot then
1416
1417
if ( cmbExportFormat . SelectedValue . ToString ( ) . ToUpper ( ) . Contains ( "PCROOT" ) )
1417
1418
{
1418
- string sourceName = Path . GetFileNameWithoutExtension ( txtInputFile . Text ) ;
1419
+ string sourceName = Path . GetFileNameWithoutExtension ( txtInputFile . Text ) ;
1419
1420
if ( string . IsNullOrEmpty ( sourceName ) ) sourceName = "output" ;
1420
1421
1421
- txtOutput . Text = Path . Combine ( currentOutput , sourceName + ".pcroot" ) ;
1422
+ txtOutput . Text = Path . Combine ( currentOutput , sourceName + ".pcroot" ) ;
1422
1423
}
1423
1424
return ;
1424
1425
}
0 commit comments