Skip to content

Commit

Permalink
#35 Modernised the code base a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
stewienj committed Dec 19, 2024
1 parent 1228df0 commit 318fd62
Show file tree
Hide file tree
Showing 20 changed files with 69 additions and 109 deletions.
12 changes: 12 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project>
<!--
If you want to debug this look at https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview
or dotnet msbuild -preprocess:output.xml <project file name>
Here's a list of all the properties https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props
-->
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net48;net8.0</TargetFrameworks>
<WinTargetFramework>net8.0-windows</WinTargetFramework>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ public DateTime TimeStamp
// Add in the number of seconds since 1970/1/1
returnValue = returnValue.AddSeconds(fileHeader.TimeDateStamp);
// Adjust to local timezone
returnValue += TimeZone.CurrentTimeZone.GetUtcOffset(returnValue);
returnValue = TimeZoneInfo.ConvertTimeFromUtc(returnValue, TimeZoneInfo.Local);

return returnValue;
}
Expand Down
21 changes: 2 additions & 19 deletions ExamplesAndTests/BigCsvFileViewer/BigCsvFileViewer.csproj
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<UseWpf>true</UseWpf>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BigCsvFileViewer</RootNamespace>
<AssemblyName>BigCsvFileViewer</AssemblyName>
<TargetFramework>net46</TargetFramework>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Version>1.0.0</Version>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>BigCsvFileViewer.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Swordfish.NET.CollectionsV3\Swordfish.NET.CollectionsV3.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework>
<UseWPF>true</UseWPF>
<LangVersion>preview</LangVersion>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework>
<UseWPF>true</UseWPF>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,15 @@ private void DataGrid_UserClickedOnHeaderSorting(object sender, DataGridSortingE

var toRemove = SortDescriptions.Where(sd => sd.PropertyName == sortMemberPath).FirstOrDefault();

if (toRemove == SortDescriptions.FirstOrDefault() && toRemove != null)
if (toRemove == SortDescriptions.FirstOrDefault())
{
direction =
toRemove.Direction == ListSortDirection.Ascending ?
ListSortDirection.Descending :
ListSortDirection.Ascending;
}

if (toRemove != null)
{
SortDescriptions.Remove(toRemove);
}
SortDescriptions.Remove(toRemove);

var sortDescription = new SortDescription(sortMemberPath, direction);
SortDescriptions.Insert(0, sortDescription);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework>
<UseWPF>true</UseWPF>
<ApplicationIcon>Resources\Thumbs_Up.ico</ApplicationIcon>
<LangVersion>preview</LangVersion>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework>
<UseWPF>true</UseWPF>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net461</TargetFramework>
<UseWPF>true</UseWPF>
<LangVersion>preview</LangVersion>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
19 changes: 2 additions & 17 deletions ExamplesAndTests/Swordfish.NET.Test/Swordfish.NET.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<UseWpf>true</UseWpf>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swordfish.NET.Test</RootNamespace>
<AssemblyName>Swordfish.NET.Test</AssemblyName>
<TargetFramework>net46</TargetFramework>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Product>Swordfish.NET.Test</Product>
<Title>Swordfish.NET.Test</Title>
<Version>1.0.0</Version>
<TargetFrameworks>net48</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Swordfish.NET.Collections\Swordfish.NET.Collections.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<UseWpf>true</UseWpf>
<TargetFrameworks>netcoreapp3.1;net451;net46</TargetFrameworks>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Product>Swordfish.NET.TestV3</Product>
<Title>Swordfish.NET.TestV3</Title>
<Version>1.0.0</Version>
<TargetFrameworks>$(WinTargetFramework)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net451;net46;net8.0-windows</TargetFrameworks>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Product>Swordfish.NET.TestV3</Product>
Expand Down
7 changes: 4 additions & 3 deletions Swordfish.NET.Collections.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29926.136
# Visual Studio Version 17
VisualStudioVersion = 17.10.35122.118
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swordfish.NET.Collections", "Swordfish.NET.Collections\Swordfish.NET.Collections.csproj", "{F2E1680E-1B15-4CF2-BAB0-54B8C8F6ABDF}"
EndProject
Expand All @@ -20,6 +20,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F612E4C5-2FA3-4F69-9770-09ABCBFFF88A}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
Directory.Build.props = Directory.Build.props
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -31,7 +32,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DGGroupSortFilterExampleNor
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataGridGroupSortFilterUltimateExample", "ExamplesAndTests\DataGridGroupSortFilterUltimateExample\DataGridGroupSortFilterUltimateExample.csproj", "{BA119134-A2E8-4165-B38A-65EE43F6070C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RetainedSelectionTest", "ExamplesAndTests\RetainedSelectionTest\RetainedSelectionTest.csproj", "{B718F642-504D-40C9-8D62-0CD959EDC4FB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RetainedSelectionTest", "ExamplesAndTests\RetainedSelectionTest\RetainedSelectionTest.csproj", "{B718F642-504D-40C9-8D62-0CD959EDC4FB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
1 change: 0 additions & 1 deletion Swordfish.NET.Collections/Auxiliary/BigRational.cs
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,6 @@ void IDeserializationCallback.OnDeserialization(Object sender)
}
}

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
Expand Down
27 changes: 14 additions & 13 deletions Swordfish.NET.Collections/Auxiliary/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,16 @@ public static IEnumerable<T> Flatten<T>(this IEnumerable<T> e, Func<T, IEnumerab
return e.SelectMany(c => f(c).Flatten(f)).Concat(e);
}

//--------------------------------------------------------------------------------------------

/// <summary>
/// Perform a deep Copy of the object.
/// </summary>
/// <typeparam name="T">The type of object being copied.</typeparam>
/// <param name="source">The object instance to copy.</param>
/// <returns>The copied object.</returns>
public static T SerializableClone<T>(this T source)
#if !NET6_0_OR_GREATER
//--------------------------------------------------------------------------------------------

/// <summary>
/// Perform a deep Copy of the object.
/// </summary>
/// <typeparam name="T">The type of object being copied.</typeparam>
/// <param name="source">The object instance to copy.</param>
/// <returns>The copied object.</returns>
public static T SerializableClone<T>(this T source)
{
if (!source.GetType().IsSerializable)
{
Expand All @@ -458,10 +459,10 @@ public static T SerializableClone<T>(this T source)
return (T)formatter.Deserialize(stream);
}
}
#endif
//--------------------------------------------------------------------------------------------

//--------------------------------------------------------------------------------------------

private static Dictionary<Type, Dictionary<string, object>> enumTypeToConverters = new Dictionary<Type, Dictionary<string, object>>();
private static Dictionary<Type, Dictionary<string, object>> enumTypeToConverters = new Dictionary<Type, Dictionary<string, object>>();

/// <summary>
/// Gets the description for the enumerated type
Expand Down Expand Up @@ -1136,4 +1137,4 @@ public static string RemoveNewLineCharacters(this string _txt)
return _txt.Replace("\n", " ").Replace("\r", "");
}
}
}
}
3 changes: 1 addition & 2 deletions Swordfish.NET.Collections/Auxiliary/PeHeaderReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,12 +545,11 @@ public DateTime TimeStamp {
// Add in the number of seconds since 1970/1/1
returnValue = returnValue.AddSeconds(fileHeader.TimeDateStamp);
// Adjust to local timezone
returnValue += TimeZone.CurrentTimeZone.GetUtcOffset(returnValue);
returnValue = TimeZoneInfo.ConvertTimeFromUtc(returnValue, TimeZoneInfo.Local);

return returnValue;
}
}

#endregion Properties
}
}
30 changes: 14 additions & 16 deletions Swordfish.NET.Collections/ConcurrentObservableBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@
// Last Revised: September 2012

using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Threading;
using System.Windows.Threading;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;

namespace Swordfish.NET.Collections {
namespace Swordfish.NET.Collections
{

/// <summary>
/// This class provides the base for concurrent collections that
/// can be bound to user interface elements
/// </summary>
/// <typeparam name="T"></typeparam>
/// <remarks>
/// </remarks>
[Serializable]
/// <summary>
/// This class provides the base for concurrent collections that
/// can be bound to user interface elements
/// </summary>
/// <typeparam name="T"></typeparam>
/// <remarks>
/// </remarks>
[Serializable]
public abstract class ConcurrentObservableBase<T> :
IObservable<NotifyCollectionChangedEventArgs>,
INotifyCollectionChanged,
Expand Down
16 changes: 2 additions & 14 deletions Swordfish.NET.Collections/Swordfish.NET.Collections.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,13 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swordfish.NET.Collections</RootNamespace>
<AssemblyName>Swordfish.NET.Collections</AssemblyName>
<TargetFrameworks>net451</TargetFrameworks>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Product>Swordfish.NET.CollectionsV3</Product>
<Title>Swordfish.NET.CollectionsV3</Title>
<Version Condition=" '$(PointVersion)' == '' ">2.1.0</Version>
<Version Condition=" '$(PointVersion)' != '' ">2.$(PointVersion)</Version>
<TargetFrameworks>net48;net8.0-windows</TargetFrameworks>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion Swordfish.NET.CollectionsV3/Auxiliary/BigRationalOld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,6 @@ void IDeserializationCallback.OnDeserialization(Object sender)
}
}

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Swordfish.NET.Collections</RootNamespace>
<AssemblyName>Swordfish.NET.CollectionsV3</AssemblyName>
<TargetFrameworks>netstandard2.0;net451;net46</TargetFrameworks>
<Copyright>Creative Commons</Copyright>
<Company>Swordfish Computing Pty Ltd</Company>
<Product>Swordfish.NET.CollectionsV3</Product>
<Title>Swordfish.NET.CollectionsV3</Title>
<Authors>stewienj</Authors>
<Description>C# library for Concurrent Observable Collection, Sorted Collection, Dictionary, and Sorted Dictionary</Description>
<RepositoryUrl>https://github.com/stewienj/SwordfishCollections.git</RepositoryUrl>
<RepositoryCommit>$(GITHUB_SHA)</RepositoryCommit>
<Authors>stewienj</Authors>
<Description>C# library for Concurrent Observable Collection, Sorted Collection, Dictionary, and Sorted Dictionary</Description>
<RepositoryUrl>https://github.com/stewienj/SwordfishCollections.git</RepositoryUrl>
<RepositoryCommit>$(GITHUB_SHA)</RepositoryCommit>
<Version Condition=" '$(PointVersion)' == '' ">3.1.0</Version>
<Version Condition=" '$(PointVersion)' != '' ">3.$(PointVersion)</Version>
<UserSecretsId>5d0656ca-f966-42bd-9e74-0ec774d5ccaa</UserSecretsId>
Expand Down

0 comments on commit 318fd62

Please sign in to comment.