From 3724356a912927cfe5e954b0292c2ee8523ece24 Mon Sep 17 00:00:00 2001 From: TheSimplyCode <45294783+TheSimplyCode@users.noreply.github.com> Date: Thu, 22 May 2025 20:44:23 +0200 Subject: [PATCH 1/5] update to visualstudio 2022 - update tests to net core 8.0 --- .gitignore | 1 + CSMatIO.sln | 17 ++++++++++------- demo/CSMatIOTest.csproj | 1 + test/ReaderWriterTests.cs | 15 +++++++-------- test/test.csproj | 25 ++++++++++++++++++++----- 5 files changed, 39 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 1746e32..29692c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ bin obj +/.vs diff --git a/CSMatIO.sln b/CSMatIO.sln index 5f29178..0034e0a 100644 --- a/CSMatIO.sln +++ b/CSMatIO.sln @@ -1,13 +1,16 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio Version 17 +VisualStudioVersion = 17.12.35728.132 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csmatio", "src\csmatio.csproj", "{D6EB17BF-9074-484F-9950-E06169A3C39D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSMatIOTest", "demo\CSMatIOTest.csproj", "{C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{30C632C4-5F79-4893-84E9-CA4CE498846C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{1425535D-7FE0-417E-8B2A-837F498B4792}" + ProjectSection(ProjectDependencies) = postProject + {D6EB17BF-9074-484F-9950-E06169A3C39D} = {D6EB17BF-9074-484F-9950-E06169A3C39D} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,10 +26,10 @@ Global {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.Build.0 = Release|Any CPU - {30C632C4-5F79-4893-84E9-CA4CE498846C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {30C632C4-5F79-4893-84E9-CA4CE498846C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {30C632C4-5F79-4893-84E9-CA4CE498846C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {30C632C4-5F79-4893-84E9-CA4CE498846C}.Release|Any CPU.Build.0 = Release|Any CPU + {1425535D-7FE0-417E-8B2A-837F498B4792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1425535D-7FE0-417E-8B2A-837F498B4792}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1425535D-7FE0-417E-8B2A-837F498B4792}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1425535D-7FE0-417E-8B2A-837F498B4792}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/demo/CSMatIOTest.csproj b/demo/CSMatIOTest.csproj index faad076..bf912f2 100644 --- a/demo/CSMatIOTest.csproj +++ b/demo/CSMatIOTest.csproj @@ -13,6 +13,7 @@ true prompt 4 + true NET40 diff --git a/test/ReaderWriterTests.cs b/test/ReaderWriterTests.cs index 498b15b..318210f 100644 --- a/test/ReaderWriterTests.cs +++ b/test/ReaderWriterTests.cs @@ -1,11 +1,5 @@ -using System; -using System.CodeDom; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using csmatio.io; +using csmatio.io; using csmatio.types; -using NUnit.Framework; namespace test { @@ -13,6 +7,11 @@ public class ReaderWriterTests { string _tempFileName; + public ReaderWriterTests(string tempFileName) + { + _tempFileName = tempFileName; + } + [TearDown] public void TearDown() { @@ -167,7 +166,7 @@ public static IEnumerable ReadDataFolder() { #if NET471 var baseDir = TestContext.CurrentContext.TestDirectory; -#elif NETCOREAPP2_0 +#elif NETCOREAPP2_0_OR_GREATER var baseDir = TestContext.CurrentContext.WorkDirectory; #endif var dir = Path.Combine(baseDir, "..", "..", "..", "..", "data"); diff --git a/test/test.csproj b/test/test.csproj index 8591077..7c7b371 100644 --- a/test/test.csproj +++ b/test/test.csproj @@ -1,13 +1,28 @@  + - netcoreapp2.0;net471 + net8.0 + enable + enable + + false + true + - - - + + + + + + - \ No newline at end of file + + + + + + From 2fdf86b8c089fa1b9b04a7d57fce5819bc2d9e54 Mon Sep 17 00:00:00 2001 From: TheSimplyCode <45294783+TheSimplyCode@users.noreply.github.com> Date: Thu, 22 May 2025 20:58:47 +0200 Subject: [PATCH 2/5] Optimize .mat file loading performance Improve the performance of reading MATLAB .mat files by optimizing the Inflate decompression method: - Replace byte-by-byte reading/writing with efficient bulk operations - Pre-allocate memory streams with estimated capacity to reduce reallocations - Use Stream.CopyTo with optimized buffer size (80KB) for fast decompression - Remove unnecessary bit masking operations This optimization significantly reduces CPU cycles and memory operations when loading large .mat files, especially on systems with limited resources. The functional behavior remains unchanged. --- src/io/MatFileReader.cs | 48 ++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/src/io/MatFileReader.cs b/src/io/MatFileReader.cs index 875c7cf..cbe9b0e 100644 --- a/src/io/MatFileReader.cs +++ b/src/io/MatFileReader.cs @@ -165,40 +165,34 @@ Stream Inflate(Stream buf, int numOfBytes) try { - // skip CRC (at end) and zip format (0x789C at begin) + // Skip zip format header (2 bytes) buf.Position += 2; - numOfBytes -= 6; + numOfBytes -= 6; // Account for header (2) and CRC (4) - var compressedStream = new MemoryStream(); - int data; - do - { - data = buf.ReadByte(); - if (data != -1) - { - compressedStream.WriteByte((byte)(data & 0x000000FF)); - } - } - while (data != -1 && compressedStream.Length < numOfBytes); - - // skip CRC + // Read compressed data in one operation instead of byte by byte + byte[] compressedData = new byte[numOfBytes]; + buf.Read(compressedData, 0, numOfBytes); + + // Skip CRC (4 bytes) buf.Position += 4; - compressedStream.Position = 0; - var decompressedStream = new MemoryStream(); - using (var df = new DeflateStream(compressedStream, CompressionMode.Decompress)) + + // Create memory streams with adequate capacity to avoid reallocations + using (var compressedStream = new MemoryStream(compressedData)) { - do + // Estimate decompressed size (usually compressed data is ~40-60% of original) + // A reasonable estimate helps avoid memory reallocations + var decompressedStream = new MemoryStream(numOfBytes * 3); + + // Use buffer for bulk copying instead of byte-by-byte + using (var df = new DeflateStream(compressedStream, CompressionMode.Decompress)) { - data = df.ReadByte(); - if (data != -1) - { - decompressedStream.WriteByte((byte)(data & 0x000000FF)); - } + // Copy in bulk using a buffer instead of byte-by-byte + df.CopyTo(decompressedStream, 81920); // Use 80KB buffer (optimal for most .NET I/O) } - while (data != -1); + + decompressedStream.Position = 0; + return decompressedStream; } - decompressedStream.Position = 0; - return decompressedStream; } catch (IOException e) { From e3482c46361bf5957bb3c4e585d012445da9dd6a Mon Sep 17 00:00:00 2001 From: TheSimplyCode <45294783+TheSimplyCode@users.noreply.github.com> Date: Thu, 22 May 2025 21:48:53 +0200 Subject: [PATCH 3/5] Updated NuGet - Added support for multiple frameworks: netstandard2.0, netstandard2.1, net6.0, net8.0 - Simplified build process with updated build script for all target frameworks - Updated NuGet package generation process --- .appveyor.yml | 4 ++-- BuildAllReleaseVersions.bat | 19 ++++++++++++++++--- readme.md | 6 ++++++ src/csmatio.csproj | 4 ++-- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 4221aa0..512908a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -1,5 +1,5 @@ -image: Visual Studio 2017 -version: 1.0.20-{build} +image: Visual Studio 2022 +version: 1.0.21-{build} environment: global: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true diff --git a/BuildAllReleaseVersions.bat b/BuildAllReleaseVersions.bat index 87cdf68..68932dd 100644 --- a/BuildAllReleaseVersions.bat +++ b/BuildAllReleaseVersions.bat @@ -1,3 +1,16 @@ -SET BUILDTOOL=c:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe -%BUILDTOOL% CSMatIO.sln /p:Configuration=Release /p:TargetFrameworkVersion=v2.0 -%BUILDTOOL% CSMatIO.sln /p:Configuration=Release /p:TargetFrameworkVersion=v4.0 +SET BUILDTOOL="C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe" + +REM Restore NuGet packages first +dotnet restore src\csmatio.csproj + +REM Build for specific framework targets +dotnet build src\csmatio.csproj -c Release -f netstandard2.0 +dotnet build src\csmatio.csproj -c Release -f netstandard2.1 +dotnet build src\csmatio.csproj -c Release -f net6.0 +dotnet build src\csmatio.csproj -c Release -f net8.0 + +REM Create NuGet package with all frameworks +dotnet pack src\csmatio.csproj -c Release --no-build + +echo Press any key to continue... +pause > nul diff --git a/readme.md b/readme.md index 6c642db..1160402 100644 --- a/readme.md +++ b/readme.md @@ -43,6 +43,12 @@ David A. Zier # CHANGE LOG # +## r21, 2025-05-22 ## +- update to visualstudio 2022 +- support for netstandard2.0, netstandard2.1, net6.0, net8.0 +- update tests to net 8.0 +- Optimize .mat file loading performance + ## r20, 2018-04-22 ## - support netstandard (net471 + netcoreapp2.0) diff --git a/src/csmatio.csproj b/src/csmatio.csproj index 2b1cdc7..38e853a 100644 --- a/src/csmatio.csproj +++ b/src/csmatio.csproj @@ -1,8 +1,8 @@  - netstandard2.0 - 1.0.20 + netstandard2.0;netstandard2.1;net6.0;net8.0 + 1.0.21 Matlab I/O API Library for .NET Copyright © 2007, David A. Zier true From 21410e558811e8f4d8e7dcce06893588af6a9af1 Mon Sep 17 00:00:00 2001 From: TheSimplyCode <45294783+TheSimplyCode@users.noreply.github.com> Date: Thu, 22 May 2025 23:02:15 +0200 Subject: [PATCH 4/5] fixed project structure added demo wpf app --- .gitignore | 1 + CSMatIO.sln | 20 +- .../CsMatIoTestExampleForms.csproj | 164 +++++------ {demo => demo-forms}/Main.Designer.cs | 0 {demo => demo-forms}/Main.cs | 0 {demo => demo-forms}/Main.resx | 0 {demo => demo-forms}/Program.cs | 0 .../Properties/AssemblyInfo.cs | 0 .../Properties/Resources.Designer.cs | 0 .../Properties/Resources.resx | 0 .../Properties/Settings.Designer.cs | 0 .../Properties/Settings.settings | 0 demo-forms/README.md | 35 +++ {demo => demo-forms}/app.config | 0 demo-wpf/App.xaml | 9 + demo-wpf/App.xaml.cs | 11 + demo-wpf/CsMatIoTestExampleWpf.csproj | 15 + demo-wpf/MainWindow.xaml | 116 ++++++++ demo-wpf/MainWindow.xaml.cs | 268 ++++++++++++++++++ demo-wpf/README.md | 35 +++ .../Debug/CSMatIOTest.Main.resources | Bin 180 -> 0 bytes ...CSMatIOTest.Properties.Resources.resources | Bin 180 -> 0 bytes .../Debug/CSMatIOTest.csproj.CopyComplete | 0 ...CSMatIOTest.csproj.CoreCompileInputs.cache | 1 - .../CSMatIOTest.csproj.FileListAbsolute.txt | 25 -- .../CSMatIOTest.csproj.GenerateResource.cache | Bin 1011 -> 0 bytes ...OTest.csprojResolveAssemblyReference.cache | Bin 79448 -> 0 bytes demo/obj-v4.7.1/Debug/CSMatIOTest.exe | Bin 19968 -> 0 bytes demo/obj-v4.7.1/Debug/CSMatIOTest.pdb | Bin 30208 -> 0 bytes ...le_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs | 0 ...le_5937a670-0e60-4077-877b-f7221da3dda1.cs | 0 ...le_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs | 0 test/ReaderWriterTests.cs | 6 + test/{test.csproj => csmatio.test.csproj} | 0 34 files changed, 591 insertions(+), 115 deletions(-) rename demo/CSMatIOTest.csproj => demo-forms/CsMatIoTestExampleForms.csproj (97%) rename {demo => demo-forms}/Main.Designer.cs (100%) rename {demo => demo-forms}/Main.cs (100%) rename {demo => demo-forms}/Main.resx (100%) rename {demo => demo-forms}/Program.cs (100%) rename {demo => demo-forms}/Properties/AssemblyInfo.cs (100%) rename {demo => demo-forms}/Properties/Resources.Designer.cs (100%) rename {demo => demo-forms}/Properties/Resources.resx (100%) rename {demo => demo-forms}/Properties/Settings.Designer.cs (100%) rename {demo => demo-forms}/Properties/Settings.settings (100%) create mode 100644 demo-forms/README.md rename {demo => demo-forms}/app.config (100%) create mode 100644 demo-wpf/App.xaml create mode 100644 demo-wpf/App.xaml.cs create mode 100644 demo-wpf/CsMatIoTestExampleWpf.csproj create mode 100644 demo-wpf/MainWindow.xaml create mode 100644 demo-wpf/MainWindow.xaml.cs create mode 100644 demo-wpf/README.md delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.Main.resources delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.Properties.Resources.resources delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.csproj.CopyComplete delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.csproj.CoreCompileInputs.cache delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.csproj.FileListAbsolute.txt delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.csproj.GenerateResource.cache delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.csprojResolveAssemblyReference.cache delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.exe delete mode 100644 demo/obj-v4.7.1/Debug/CSMatIOTest.pdb delete mode 100644 demo/obj-v4.7.1/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs delete mode 100644 demo/obj-v4.7.1/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs delete mode 100644 demo/obj-v4.7.1/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs rename test/{test.csproj => csmatio.test.csproj} (100%) diff --git a/.gitignore b/.gitignore index 29692c9..9a202af 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin obj /.vs +/*.user diff --git a/CSMatIO.sln b/CSMatIO.sln index 0034e0a..f9c6d0c 100644 --- a/CSMatIO.sln +++ b/CSMatIO.sln @@ -5,13 +5,15 @@ VisualStudioVersion = 17.12.35728.132 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csmatio", "src\csmatio.csproj", "{D6EB17BF-9074-484F-9950-E06169A3C39D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSMatIOTest", "demo\CSMatIOTest.csproj", "{C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{1425535D-7FE0-417E-8B2A-837F498B4792}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csmatio.test", "test\csmatio.test.csproj", "{1425535D-7FE0-417E-8B2A-837F498B4792}" ProjectSection(ProjectDependencies) = postProject {D6EB17BF-9074-484F-9950-E06169A3C39D} = {D6EB17BF-9074-484F-9950-E06169A3C39D} EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsMatIoTestExampleWpf", "demo-wpf\CsMatIoTestExampleWpf.csproj", "{A5A2B6A5-2F80-44BA-8852-562D5048C019}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CsMatIoTestExampleForms", "demo-forms\CsMatIoTestExampleForms.csproj", "{C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -22,14 +24,18 @@ Global {D6EB17BF-9074-484F-9950-E06169A3C39D}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6EB17BF-9074-484F-9950-E06169A3C39D}.Release|Any CPU.ActiveCfg = Release|Any CPU {D6EB17BF-9074-484F-9950-E06169A3C39D}.Release|Any CPU.Build.0 = Release|Any CPU - {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.Build.0 = Release|Any CPU {1425535D-7FE0-417E-8B2A-837F498B4792}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1425535D-7FE0-417E-8B2A-837F498B4792}.Debug|Any CPU.Build.0 = Debug|Any CPU {1425535D-7FE0-417E-8B2A-837F498B4792}.Release|Any CPU.ActiveCfg = Release|Any CPU {1425535D-7FE0-417E-8B2A-837F498B4792}.Release|Any CPU.Build.0 = Release|Any CPU + {A5A2B6A5-2F80-44BA-8852-562D5048C019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5A2B6A5-2F80-44BA-8852-562D5048C019}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5A2B6A5-2F80-44BA-8852-562D5048C019}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5A2B6A5-2F80-44BA-8852-562D5048C019}.Release|Any CPU.Build.0 = Release|Any CPU + {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/demo/CSMatIOTest.csproj b/demo-forms/CsMatIoTestExampleForms.csproj similarity index 97% rename from demo/CSMatIOTest.csproj rename to demo-forms/CsMatIoTestExampleForms.csproj index bf912f2..b8f9005 100644 --- a/demo/CSMatIOTest.csproj +++ b/demo-forms/CsMatIoTestExampleForms.csproj @@ -1,82 +1,82 @@ - - - - Debug - AnyCPU - {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1} - WinExe - bin\ - Properties - CSMatIOTest - CSMatIOTest - v4.7.1 - true - prompt - 4 - true - - - NET40 - true - true - full - false - false - - - NET40 - false - pdbonly - true - false - - - - - - - - - - - - Form - - - Main.cs - - - - - Designer - Main.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - {D6EB17BF-9074-484F-9950-E06169A3C39D} - csmatio - - - - + + + + Debug + AnyCPU + {C5C58FCB-2DDA-4472-ACED-0C97FE09F7C1} + WinExe + bin\ + Properties + CSMatIOTest + CSMatIOTest + v4.7.1 + true + prompt + 4 + true + + + NET40 + true + true + full + false + false + + + NET40 + false + pdbonly + true + false + + + + + + + + + + + + Form + + + Main.cs + + + + + Designer + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {D6EB17BF-9074-484F-9950-E06169A3C39D} + csmatio + + + + diff --git a/demo/Main.Designer.cs b/demo-forms/Main.Designer.cs similarity index 100% rename from demo/Main.Designer.cs rename to demo-forms/Main.Designer.cs diff --git a/demo/Main.cs b/demo-forms/Main.cs similarity index 100% rename from demo/Main.cs rename to demo-forms/Main.cs diff --git a/demo/Main.resx b/demo-forms/Main.resx similarity index 100% rename from demo/Main.resx rename to demo-forms/Main.resx diff --git a/demo/Program.cs b/demo-forms/Program.cs similarity index 100% rename from demo/Program.cs rename to demo-forms/Program.cs diff --git a/demo/Properties/AssemblyInfo.cs b/demo-forms/Properties/AssemblyInfo.cs similarity index 100% rename from demo/Properties/AssemblyInfo.cs rename to demo-forms/Properties/AssemblyInfo.cs diff --git a/demo/Properties/Resources.Designer.cs b/demo-forms/Properties/Resources.Designer.cs similarity index 100% rename from demo/Properties/Resources.Designer.cs rename to demo-forms/Properties/Resources.Designer.cs diff --git a/demo/Properties/Resources.resx b/demo-forms/Properties/Resources.resx similarity index 100% rename from demo/Properties/Resources.resx rename to demo-forms/Properties/Resources.resx diff --git a/demo/Properties/Settings.Designer.cs b/demo-forms/Properties/Settings.Designer.cs similarity index 100% rename from demo/Properties/Settings.Designer.cs rename to demo-forms/Properties/Settings.Designer.cs diff --git a/demo/Properties/Settings.settings b/demo-forms/Properties/Settings.settings similarity index 100% rename from demo/Properties/Settings.settings rename to demo-forms/Properties/Settings.settings diff --git a/demo-forms/README.md b/demo-forms/README.md new file mode 100644 index 0000000..0768887 --- /dev/null +++ b/demo-forms/README.md @@ -0,0 +1,35 @@ +# CSMatIO WPF Demo Application + +This is a .NET 8.0 WPF demo application for the CSMatIO library, which provides functionality for reading and writing MATLAB MAT-files in C#. + +## Features + +- Read MAT-files and display their contents +- Create MAT-files with various data types: + - Cell arrays + - Structures + - Character arrays + - Sparse arrays + - Numeric arrays (Double, Single, Int8, UInt8, Int16, UInt16, Int32, UInt32, Int64, UInt64) + - Imaginary matrices + +## Requirements + +- .NET 8.0 SDK or later +- Windows operating system + +## Building and Running + +1. Open the solution in Visual Studio 2022 or later +2. Build the solution +3. Run the CSMatIOTestWPF project + +## Usage + +1. To read a MAT-file, click the "Read MAT-File" button and select a file +2. To create a MAT-file: + - Select the data types you want to include + - Click the "Create MAT-File" button + - Choose a location to save the file + +The output window will display information about the operations performed. \ No newline at end of file diff --git a/demo/app.config b/demo-forms/app.config similarity index 100% rename from demo/app.config rename to demo-forms/app.config diff --git a/demo-wpf/App.xaml b/demo-wpf/App.xaml new file mode 100644 index 0000000..d156734 --- /dev/null +++ b/demo-wpf/App.xaml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/demo-wpf/App.xaml.cs b/demo-wpf/App.xaml.cs new file mode 100644 index 0000000..79c12f9 --- /dev/null +++ b/demo-wpf/App.xaml.cs @@ -0,0 +1,11 @@ +using System.Windows; + +namespace CSMatIOTest +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} \ No newline at end of file diff --git a/demo-wpf/CsMatIoTestExampleWpf.csproj b/demo-wpf/CsMatIoTestExampleWpf.csproj new file mode 100644 index 0000000..ae20d38 --- /dev/null +++ b/demo-wpf/CsMatIoTestExampleWpf.csproj @@ -0,0 +1,15 @@ + + + + WinExe + net8.0-windows + true + CSMatIOTest + CSMatIOTest + + + + + + + \ No newline at end of file diff --git a/demo-wpf/MainWindow.xaml b/demo-wpf/MainWindow.xaml new file mode 100644 index 0000000..2f2ec6e --- /dev/null +++ b/demo-wpf/MainWindow.xaml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + +