Skip to content

Commit 4a7ae7a

Browse files
committed
test upgrade to dotnet 8.0, disable cell hash code
1 parent 42d12db commit 4a7ae7a

11 files changed

+130
-218
lines changed

App.config

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<configSections>
44
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
5-
<section name="PointCloudConverter.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
5+
<section name="PointCloudConverter.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
66
</sectionGroup>
77
</configSections>
88
<startup>
9-
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
9+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
1010
</startup>
1111
<userSettings>
1212
<PointCloudConverter.Properties.Settings>
@@ -17,10 +17,10 @@
1717
<value>0.1</value>
1818
</setting>
1919
<setting name="inputFile" serializeAs="String">
20-
<value />
20+
<value/>
2121
</setting>
2222
<setting name="outputFile" serializeAs="String">
23-
<value />
23+
<value/>
2424
</setting>
2525
<setting name="swapYZ" serializeAs="String">
2626
<value>True</value>
@@ -80,16 +80,16 @@
8080
<value>False</value>
8181
</setting>
8282
<setting name="importFormat" serializeAs="String">
83-
<value />
83+
<value/>
8484
</setting>
8585
<setting name="exportFormat" serializeAs="String">
86-
<value />
86+
<value/>
8787
</setting>
8888
<setting name="lastImportFolder" serializeAs="String">
89-
<value />
89+
<value/>
9090
</setting>
9191
<setting name="lastExportFolder" serializeAs="String">
92-
<value />
92+
<value/>
9393
</setting>
9494
<setting name="importIntensity" serializeAs="String">
9595
<value>False</value>
@@ -147,8 +147,8 @@
147147
<runtime>
148148
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
149149
<dependentAssembly>
150-
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
151-
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
150+
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
151+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
152152
</dependentAssembly>
153153
</assemblyBinding>
154154
</runtime>

App.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace PointCloudConverter
1111
/// <summary>
1212
/// Interaction logic for App.xaml
1313
/// </summary>
14-
public partial class App : Application
14+
public partial class App : System.Windows.Application
1515
{
1616
}
1717
}

MainWindow.xaml.cs

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
using OpenFileDialog = Microsoft.Win32.OpenFileDialog;
2626
using SaveFileDialog = Microsoft.Win32.SaveFileDialog;
2727
using Newtonsoft.Json;
28+
using Brushes = System.Windows.Media.Brushes;
2829

2930
namespace PointCloudConverter
3031
{
@@ -149,10 +150,18 @@ private void Main()
149150

150151

151152
// main processing loop
152-
private static void ProcessAllFiles(System.Object importSettingsObject)
153+
154+
private static void ProcessAllFiles(object workerParamsObject)
153155
{
154-
var importSettings = (ImportSettings)importSettingsObject;
156+
var workerParams = (WorkerParams)workerParamsObject;
157+
var importSettings = workerParams.ImportSettings;
158+
var cancellationToken = workerParams.CancellationToken;
155159

160+
// Use cancellationToken to check for cancellation
161+
if (cancellationToken.IsCancellationRequested)
162+
{
163+
return; // Exit the method if cancellation is requested
164+
}
156165

157166
Stopwatch stopwatch = new Stopwatch();
158167
stopwatch.Start();
@@ -185,6 +194,11 @@ private static void ProcessAllFiles(System.Object importSettingsObject)
185194
{
186195
for (int i = 0, len = importSettings.maxFiles; i < len; i++)
187196
{
197+
if (cancellationToken.IsCancellationRequested)
198+
{
199+
return; // Exit the loop if cancellation is requested
200+
}
201+
188202
progressFile = i;
189203
Log.WriteLine("\nReading bounds from file (" + (i + 1) + "/" + len + ") : " + importSettings.inputFiles[i] + " (" + Tools.HumanReadableFileSize(new FileInfo(importSettings.inputFiles[i]).Length) + ")");
190204
var res = GetBounds(importSettings, i);
@@ -229,6 +243,11 @@ private static void ProcessAllFiles(System.Object importSettingsObject)
229243
progressFile = 0;
230244
for (int i = 0, len = importSettings.maxFiles; i < len; i++)
231245
{
246+
if (cancellationToken.IsCancellationRequested)
247+
{
248+
return; // Exit the loop if cancellation is requested
249+
}
250+
232251
progressFile = i;
233252
Log.WriteLine("\nReading file (" + (i + 1) + "/" + len + ") : " + importSettings.inputFiles[i] + " (" + Tools.HumanReadableFileSize(new FileInfo(importSettings.inputFiles[i]).Length) + ")");
234253
//Debug.WriteLine("\nReading file (" + (i + 1) + "/" + len + ") : " + importSettings.inputFiles[i] + " (" + Tools.HumanReadableFileSize(new FileInfo(importSettings.inputFiles[i]).Length) + ")");
@@ -553,6 +572,12 @@ private void btnConvert_Click(object sender, RoutedEventArgs e)
553572
StartProcess();
554573
}
555574

575+
public class WorkerParams
576+
{
577+
public ImportSettings ImportSettings { get; set; }
578+
public CancellationToken CancellationToken { get; set; }
579+
}
580+
556581
void StartProcess(bool doProcess = true)
557582
{
558583
// get args from GUI settings, TODO could directly create new import settings..
@@ -613,10 +638,23 @@ void StartProcess(bool doProcess = true)
613638

614639
if (doProcess == true)
615640
{
641+
//ParameterizedThreadStart start = new ParameterizedThreadStart(ProcessAllFiles);
642+
//workerThread = new Thread(start);
643+
//workerThread.IsBackground = true;
644+
//workerThread.Start(importSettings);
645+
646+
var workerParams = new WorkerParams
647+
{
648+
ImportSettings = importSettings,
649+
CancellationToken = _cancellationTokenSource.Token
650+
};
651+
616652
ParameterizedThreadStart start = new ParameterizedThreadStart(ProcessAllFiles);
617-
workerThread = new Thread(start);
618-
workerThread.IsBackground = true;
619-
workerThread.Start(importSettings);
653+
workerThread = new Thread(start)
654+
{
655+
IsBackground = true
656+
};
657+
workerThread.Start(workerParams);
620658
}
621659
}
622660
else
@@ -627,15 +665,20 @@ void StartProcess(bool doProcess = true)
627665
}
628666
}
629667

630-
668+
private CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();
631669
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
632670
{
633671
SaveSettings();
634672

635-
abort = true;
673+
// Signal the cancellation to the worker thread
674+
_cancellationTokenSource.Cancel();
675+
636676
if (workerThread != null)
637677
{
638-
workerThread.Abort();
678+
// Wait for the worker thread to finish
679+
workerThread.Join();
680+
681+
// Optionally exit the application
639682
Environment.Exit((int)ExitCode.Cancelled);
640683
}
641684
}
@@ -856,9 +899,11 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
856899
private void BtnCancel_Click(object sender, RoutedEventArgs e)
857900
{
858901
abort = true;
902+
_cancellationTokenSource.Cancel();
903+
859904
if (workerThread != null)
860905
{
861-
workerThread.Abort();
906+
workerThread.Join();
862907
Environment.Exit((int)ExitCode.Cancelled);
863908
}
864909
}

PointCloudConverter.csproj

Lines changed: 28 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -1,169 +1,42 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{B348688B-00FB-45A8-8BBD-D2D64FD7E8D8}</ProjectGuid>
83
<OutputType>WinExe</OutputType>
4+
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework> <!-- Ensure this is valid -->
5+
<UseWPF>true</UseWPF> <!-- or UseWindowsForms=true if using Windows Forms -->
6+
<Nullable>enable</Nullable>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<ApplicationIcon>Icons\app.ico</ApplicationIcon>
9+
<PlatformTarget>x64</PlatformTarget> <!-- Ensure this is a valid value -->
910
<RootNamespace>PointCloudConverter</RootNamespace>
11+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
12+
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
13+
<UseWindowsForms>True</UseWindowsForms>
1014
<AssemblyName>PointCloudConverter</AssemblyName>
11-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12-
<LangVersion>7.3</LangVersion>
13-
<FileAlignment>512</FileAlignment>
14-
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
15-
<WarningLevel>4</WarningLevel>
16-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
17-
<Deterministic>true</Deterministic>
18-
<TargetFrameworkProfile />
1915
</PropertyGroup>
20-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21-
<PlatformTarget>x64</PlatformTarget>
22-
<DebugSymbols>true</DebugSymbols>
23-
<DebugType>full</DebugType>
24-
<Optimize>true</Optimize>
25-
<OutputPath>bin\Debug\</OutputPath>
26-
<DefineConstants>DEBUG;TRACE</DefineConstants>
27-
<ErrorReport>prompt</ErrorReport>
16+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
2817
<WarningLevel>4</WarningLevel>
29-
<Prefer32Bit>false</Prefer32Bit>
3018
</PropertyGroup>
31-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
32-
<PlatformTarget>x64</PlatformTarget>
33-
<DebugType>pdbonly</DebugType>
34-
<Optimize>true</Optimize>
35-
<OutputPath>bin\Release\</OutputPath>
36-
<DefineConstants>TRACE</DefineConstants>
37-
<ErrorReport>prompt</ErrorReport>
19+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
3820
<WarningLevel>4</WarningLevel>
39-
<Prefer32Bit>false</Prefer32Bit>
40-
</PropertyGroup>
41-
<PropertyGroup>
42-
<ApplicationIcon>Icons\app.ico</ApplicationIcon>
4321
</PropertyGroup>
22+
4423
<ItemGroup>
45-
<Reference Include="laszip.net">
46-
<HintPath>libs\laszip.net.dll</HintPath>
47-
</Reference>
48-
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
49-
<HintPath>packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
50-
</Reference>
51-
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
52-
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
53-
</Reference>
54-
<Reference Include="System" />
55-
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
56-
<HintPath>packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
57-
</Reference>
58-
<Reference Include="System.Data" />
59-
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
60-
<HintPath>packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
61-
</Reference>
62-
<Reference Include="System.Numerics" />
63-
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
64-
<HintPath>packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
65-
</Reference>
66-
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
67-
<HintPath>packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
68-
</Reference>
69-
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
70-
<HintPath>packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
71-
</Reference>
72-
<Reference Include="System.Text.Json, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
73-
<HintPath>packages\System.Text.Json.8.0.1\lib\net462\System.Text.Json.dll</HintPath>
74-
</Reference>
75-
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
76-
<HintPath>packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
77-
</Reference>
78-
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
79-
<HintPath>packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
80-
</Reference>
81-
<Reference Include="System.Windows.Forms" />
82-
<Reference Include="System.Xml" />
83-
<Reference Include="Microsoft.CSharp" />
84-
<Reference Include="System.Core" />
85-
<Reference Include="System.Xml.Linq" />
86-
<Reference Include="System.Data.DataSetExtensions" />
87-
<Reference Include="System.Net.Http" />
88-
<Reference Include="System.Xaml">
89-
<RequiredTargetFramework>4.0</RequiredTargetFramework>
90-
</Reference>
91-
<Reference Include="WindowsBase" />
92-
<Reference Include="PresentationCore" />
93-
<Reference Include="PresentationFramework" />
94-
</ItemGroup>
95-
<ItemGroup>
96-
<ApplicationDefinition Include="App.xaml">
97-
<Generator>MSBuild:Compile</Generator>
98-
<SubType>Designer</SubType>
99-
</ApplicationDefinition>
100-
<Compile Include="Readers\IReader.cs" />
101-
<Compile Include="Readers\LAZ.cs" />
102-
<Compile Include="Structs\Bounds.cs" />
103-
<Compile Include="Structs\Color.cs" />
104-
<Compile Include="Structs\ExitCodes.cs" />
105-
<Compile Include="Structs\ExportFormat.cs" />
106-
<Compile Include="Structs\Float3.cs" />
107-
<Compile Include="Structs\Metadata\GeoTiffKeys.cs" />
108-
<Compile Include="Structs\ImportFormat.cs" />
109-
<Compile Include="Structs\ImportSettings.cs" />
110-
<Compile Include="Structs\Metadata\LasHeader.cs" />
111-
<Compile Include="Structs\Metadata\LasVariableLengthRecord.cs" />
112-
<Compile Include="Structs\PointCloudTile.cs" />
113-
<Compile Include="Structs\Metadata\sGeoKeys.cs" />
114-
<Compile Include="Tools\ArgParser.cs" />
115-
<Compile Include="Tools\LogText.cs" />
116-
<Compile Include="Tools\Tools.cs" />
117-
<Compile Include="Writers\UCPC.cs" />
118-
<Page Include="MainWindow.xaml">
119-
<Generator>MSBuild:Compile</Generator>
120-
<SubType>Designer</SubType>
121-
</Page>
122-
<Compile Include="App.xaml.cs">
123-
<DependentUpon>App.xaml</DependentUpon>
124-
<SubType>Code</SubType>
125-
</Compile>
126-
<Compile Include="Writers\IWriter.cs" />
127-
<Compile Include="MainWindow.xaml.cs">
128-
<DependentUpon>MainWindow.xaml</DependentUpon>
129-
<SubType>Code</SubType>
130-
</Compile>
131-
<Page Include="Resources\Colors.xaml">
132-
<SubType>Designer</SubType>
133-
<Generator>MSBuild:Compile</Generator>
134-
</Page>
135-
</ItemGroup>
136-
<ItemGroup>
137-
<Compile Include="Writers\PCROOT.cs" />
138-
<Compile Include="Properties\AssemblyInfo.cs">
139-
<SubType>Code</SubType>
140-
</Compile>
141-
<Compile Include="Properties\Resources.Designer.cs">
142-
<AutoGen>True</AutoGen>
143-
<DesignTime>True</DesignTime>
144-
<DependentUpon>Resources.resx</DependentUpon>
145-
</Compile>
146-
<Compile Include="Properties\Settings.Designer.cs">
147-
<AutoGen>True</AutoGen>
148-
<DependentUpon>Settings.settings</DependentUpon>
149-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
150-
</Compile>
151-
<EmbeddedResource Include="Properties\Resources.resx">
152-
<Generator>ResXFileCodeGenerator</Generator>
153-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
154-
</EmbeddedResource>
155-
<None Include="packages.config" />
156-
<None Include="Properties\Settings.settings">
157-
<Generator>SettingsSingleFileGenerator</Generator>
158-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
159-
</None>
160-
</ItemGroup>
161-
<ItemGroup>
162-
<None Include="App.config" />
24+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
25+
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
26+
<PackageReference Include="System.Buffers" Version="4.5.1" />
27+
<PackageReference Include="System.Memory" Version="4.5.5" />
28+
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
29+
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
30+
<PackageReference Include="System.Text.Encodings.Web" Version="9.0.0-preview.6.24327.7" />
31+
<PackageReference Include="System.Text.Json" Version="8.0.4" />
32+
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
33+
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
34+
<!-- <PackageReference Include="laszip.net" Version="1.0.0" PrivateAssets="all" /> -->
35+
<PackageReference Include="System.Drawing.Common" Version="8.0.7" />
36+
<PackageReference Include="System.Windows.Forms" Version="4.0.0" />
16337
</ItemGroup>
164-
<ItemGroup />
38+
16539
<ItemGroup>
16640
<Resource Include="Icons\app.ico" />
16741
</ItemGroup>
168-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
169-
</Project>
42+
</Project>

0 commit comments

Comments
 (0)