Skip to content

Commit

Permalink
Changed code targets to .NET7.0 and .NET Standard 2.1 only / General …
Browse files Browse the repository at this point in the history
…code cleannup
  • Loading branch information
ritchiecarroll committed Nov 22, 2022
1 parent e4a4e52 commit ad72956
Show file tree
Hide file tree
Showing 25 changed files with 530 additions and 456 deletions.
74 changes: 74 additions & 0 deletions src/Gemstone.PQDIF/Gemstone - Backup.PQDIF.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<Project>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net7.0</TargetFrameworks>
<RootNamespace>Gemstone.PQDIF</RootNamespace>
<PackageId>Gemstone.PQDIF</PackageId>
<Authors>Grid Protection Alliance</Authors>
<Company>Grid Protection Alliance</Company>
<Product>Gemstone</Product>
<PackageDescription>GPA Gemstone PQDIF Library</PackageDescription>
<Description>GPA Gemstone Power Quality Data Exchange File Format Parser Library</Description>
<Copyright>Copyright © 2022</Copyright>
<PackageProjectUrl>https://github.com/gemstone</PackageProjectUrl>
<PackageIcon>gemstone-square-128.png</PackageIcon>
<RepositoryUrl>https://github.com/gemstone/pqdif</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>GPA;Gemstone;library;pqdif</PackageTags>
<LangVersion>latest</LangVersion>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<Nullable>enable</Nullable>
<PlatformTarget>AnyCPU</PlatformTarget>
<Version>1.0.86</Version>
<InformationalVersion Condition="'$(Configuration)'=='Release'">1.0.86 -- Release Build</InformationalVersion>
<InformationalVersion Condition="'$(Configuration)'!='Release'">1.0.86 -- Debug Build</InformationalVersion>
<Configurations>Debug;Release;Development</Configurations>
</PropertyGroup>

<PropertyGroup>
<OutputPath>..\..\build\$(Configuration)</OutputPath>
</PropertyGroup>

<PropertyGroup>
<DocumentationFile>..\..\build\$(Configuration)\$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Development'">
<DebugType>Full</DebugType>
</PropertyGroup>

<ItemGroup>
<None Remove="TagDefinitions.xml" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="TagDefinitions.xml">
<LogicalName>TagDefinitions.xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<None Include="..\..\docs\img\gemstone-square-128.png" Link="gemstone-square-128.png" Visible="false">
<Pack>True</Pack>
<PackagePath />
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="DotNetZip" Version="1.13.4" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.3" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup>

<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />

<PropertyGroup Condition="'$(SIGNTOOL)' != ''">
<PostBuildEvent>$(SIGNTOOL) $(TargetPath)</PostBuildEvent>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Gemstone.PQDIF/Gemstone.PQDIF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks>
<TargetFrameworks>net7.0;netstandard2.1</TargetFrameworks>
<RootNamespace>Gemstone.PQDIF</RootNamespace>
<PackageId>Gemstone.PQDIF</PackageId>
<Authors>Grid Protection Alliance</Authors>
Expand Down
24 changes: 12 additions & 12 deletions src/Gemstone.PQDIF/Logical/ChannelDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ public IList<SeriesDefinition> SeriesDefinitions
/// <returns>New series definition.</returns>
public SeriesDefinition AddNewSeriesDefinition()
{
CollectionElement seriesDefinitionElement = new CollectionElement { TagOfElement = OneSeriesDefinitionTag };
SeriesDefinition seriesDefinition = new SeriesDefinition(seriesDefinitionElement, this);
CollectionElement seriesDefinitionElement = new() { TagOfElement = OneSeriesDefinitionTag };
SeriesDefinition seriesDefinition = new(seriesDefinitionElement, this);

seriesDefinition.ValueTypeID = SeriesValueType.Val;
seriesDefinition.QuantityUnits = QuantityUnits.None;
Expand Down Expand Up @@ -548,7 +548,7 @@ public void Remove(SeriesDefinition seriesDefinition)

foreach (CollectionElement seriesDefinitionElement in seriesDefinitionElements)
{
SeriesDefinition definition = new SeriesDefinition(seriesDefinitionElement, this);
SeriesDefinition definition = new(seriesDefinitionElement, this);

if (Equals(seriesDefinition, definition))
seriesDefinitionsElement.RemoveElement(seriesDefinitionElement);
Expand All @@ -569,7 +569,7 @@ public bool Equals(ChannelDefinition other) =>
/// <param name="obj">The object to compare with the current object. </param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
public override bool Equals(object obj) => obj is ChannelDefinition other
public override bool Equals(object? obj) => obj is ChannelDefinition other
? Equals(other)
: false;

Expand All @@ -590,42 +590,42 @@ public override int GetHashCode() =>
/// <summary>
/// Tag that identifies the channel definition index.
/// </summary>
public static Guid ChannelDefinitionIndexTag { get; } = new Guid("b48d858f-f5f5-11cf-9d89-0080c72e70a3");
public static Guid ChannelDefinitionIndexTag { get; } = new("b48d858f-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the channel name.
/// </summary>
public static Guid ChannelNameTag { get; } = new Guid("b48d8590-f5f5-11cf-9d89-0080c72e70a3");
public static Guid ChannelNameTag { get; } = new("b48d8590-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the phase ID.
/// </summary>
public static Guid PhaseIDTag { get; } = new Guid("b48d8591-f5f5-11cf-9d89-0080c72e70a3");
public static Guid PhaseIDTag { get; } = new("b48d8591-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the quantity type.
/// </summary>
public static Guid QuantityTypeIDTag { get; } = new Guid("b48d8592-f5f5-11cf-9d89-0080c72e70a3");
public static Guid QuantityTypeIDTag { get; } = new("b48d8592-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the quantity measured ID.
/// </summary>
public static Guid QuantityMeasuredIDTag { get; } = new Guid("c690e872-f755-11cf-9d89-0080c72e70a3");
public static Guid QuantityMeasuredIDTag { get; } = new("c690e872-f755-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the quantity name.
/// </summary>
public static Guid QuantityNameTag { get; } = new Guid("b48d8595-f5f5-11cf-9d89-0080c72e70a3");
public static Guid QuantityNameTag { get; } = new("b48d8595-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the series definitions collection.
/// </summary>
public static Guid SeriesDefinitionsTag { get; } = new Guid("b48d8598-f5f5-11cf-9d89-0080c72e70a3");
public static Guid SeriesDefinitionsTag { get; } = new("b48d8598-f5f5-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies a single series definition within the collection.
/// </summary>
public static Guid OneSeriesDefinitionTag { get; } = new Guid("b48d859a-f5f5-11cf-9d89-0080c72e70a3");
public static Guid OneSeriesDefinitionTag { get; } = new("b48d859a-f5f5-11cf-9d89-0080c72e70a3");

// Static Methods

Expand Down
18 changes: 9 additions & 9 deletions src/Gemstone.PQDIF/Logical/ChannelInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ public SeriesInstance AddNewSeriesInstance()
if (Definition.SeriesDefinitions.Count <= SeriesInstances.Count)
throw new InvalidOperationException("Cannot create a series instance without a corresponding series definition.");

CollectionElement seriesInstanceElement = new CollectionElement { TagOfElement = OneSeriesInstanceTag };
CollectionElement seriesInstanceElement = new() { TagOfElement = OneSeriesInstanceTag };
SeriesDefinition seriesDefinition = Definition.SeriesDefinitions[SeriesInstances.Count];
SeriesInstance seriesInstance = new SeriesInstance(seriesInstanceElement, this, seriesDefinition);
SeriesInstance seriesInstance = new(seriesInstanceElement, this, seriesDefinition);
seriesInstanceElement.AddOrUpdateVector(SeriesInstance.SeriesValuesTag, PhysicalType.UnsignedInteger1, new byte[0]);

CollectionElement? seriesInstancesElement = m_physicalStructure.GetCollectionByTag(SeriesInstancesTag);
Expand Down Expand Up @@ -277,7 +277,7 @@ public void Remove(SeriesInstance seriesInstance)

for (int i = seriesInstanceElements.Count; i >= 0; i--)
{
SeriesInstance instance = new SeriesInstance(seriesInstanceElements[i], this, seriesDefinitions[i]);
SeriesInstance instance = new(seriesInstanceElements[i], this, seriesDefinitions[i]);

if (Equals(seriesInstance, instance))
seriesInstancesElement.RemoveElement(seriesInstancesElement);
Expand All @@ -298,7 +298,7 @@ public bool Equals(ChannelInstance other) =>
/// <param name="obj">The object to compare with the current object. </param>
/// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
/// <filterpriority>2</filterpriority>
public override bool Equals(object obj) => obj is ChannelInstance other
public override bool Equals(object? obj) => obj is ChannelInstance other
? Equals(other)
: false;

Expand All @@ -319,27 +319,27 @@ public override int GetHashCode() =>
/// <summary>
/// Tag that identifies the channel group ID.
/// </summary>
public static Guid ChannelGroupIDTag { get; } = new Guid("f90de218-e67b-4cf1-a295-b021a2d46767");
public static Guid ChannelGroupIDTag { get; } = new("f90de218-e67b-4cf1-a295-b021a2d46767");

/// <summary>
/// Tag that identifies the series instances collection.
/// </summary>
public static Guid SeriesInstancesTag { get; } = new Guid("3d786f93-f76e-11cf-9d89-0080c72e70a3");
public static Guid SeriesInstancesTag { get; } = new("3d786f93-f76e-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies a single series instance in the collection.
/// </summary>
public static Guid OneSeriesInstanceTag { get; } = new Guid("3d786f94-f76e-11cf-9d89-0080c72e70a3");
public static Guid OneSeriesInstanceTag { get; } = new("3d786f94-f76e-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the channel trigger module name.
/// </summary>
public static Guid ChannelTriggerModuleNameTag { get; } = new Guid("0fa118c6-cb4a-11cf-9d89-0080c72e70a3");
public static Guid ChannelTriggerModuleNameTag { get; } = new("0fa118c6-cb4a-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the cross trigger device name.
/// </summary>
public static Guid CrossTriggerDeviceNameTag { get; } = new Guid("0fa118c5-cb4a-11cf-9d89-0080c72e70a3");
public static Guid CrossTriggerDeviceNameTag { get; } = new("0fa118c5-cb4a-11cf-9d89-0080c72e70a3");

#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions src/Gemstone.PQDIF/Logical/ChannelSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ public bool HasElement(Guid tag) =>
/// <summary>
/// Tag that identifies the system side ratio.
/// </summary>
public static Guid XDSystemSideRatioTag { get; } = new Guid("62f2818a-f9c4-11cf-9d89-0080c72e70a3");
public static Guid XDSystemSideRatioTag { get; } = new("62f2818a-f9c4-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the monitor side ratio.
/// </summary>
public static Guid XDMonitorSideRatioTag { get; } = new Guid("62f2818b-f9c4-11cf-9d89-0080c72e70a3");
public static Guid XDMonitorSideRatioTag { get; } = new("62f2818b-f9c4-11cf-9d89-0080c72e70a3");

#endregion
}
Expand Down
20 changes: 10 additions & 10 deletions src/Gemstone.PQDIF/Logical/ContainerRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -333,42 +333,42 @@ public void RemoveElement(Guid tag) =>
/// <summary>
/// Tag that identifies the version info.
/// </summary>
public static Guid VersionInfoTag { get; } = new Guid("89738607-f1c3-11cf-9d89-0080c72e70a3");
public static Guid VersionInfoTag { get; } = new("89738607-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the file name.
/// </summary>
public static Guid FileNameTag { get; } = new Guid("89738608-f1c3-11cf-9d89-0080c72e70a3");
public static Guid FileNameTag { get; } = new("89738608-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the date and time of creation.
/// </summary>
public static Guid CreationTag { get; } = new Guid("89738609-f1c3-11cf-9d89-0080c72e70a3");
public static Guid CreationTag { get; } = new("89738609-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the title applied to the PQDIF file.
/// </summary>
public static readonly Guid TitleTag = new Guid("8973860d-f1c3-11cf-9d89-0080c72e70a3");
public static readonly Guid TitleTag = new("8973860d-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the subject applied to the PQDIF file.
/// </summary>
public static readonly Guid SubjectTag = new Guid("8973860e-f1c3-11cf-9d89-0080c72e70a3");
public static readonly Guid SubjectTag = new("8973860e-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the notes stored in the PQDIF file.
/// </summary>
public static Guid NotesTag { get; } = new Guid("89738617-f1c3-11cf-9d89-0080c72e70a3");
public static Guid NotesTag { get; } = new("89738617-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the compression style of the PQDIF file.
/// </summary>
public static Guid CompressionStyleTag { get; } = new Guid("8973861b-f1c3-11cf-9d89-0080c72e70a3");
public static Guid CompressionStyleTag { get; } = new("8973861b-f1c3-11cf-9d89-0080c72e70a3");

/// <summary>
/// Tag that identifies the compression algorithm used when writing the PQDIF file.
/// </summary>
public static Guid CompressionAlgorithmTag { get; } = new Guid("8973861c-f1c3-11cf-9d89-0080c72e70a3");
public static Guid CompressionAlgorithmTag { get; } = new("8973861c-f1c3-11cf-9d89-0080c72e70a3");

// Static Methods

Expand All @@ -379,8 +379,8 @@ public void RemoveElement(Guid tag) =>
public static ContainerRecord CreateContainerRecord()
{
Guid recordTypeTag = Record.GetTypeAsTag(RecordType.Container);
Record physicalRecord = new Record(recordTypeTag);
ContainerRecord containerRecord = new ContainerRecord(physicalRecord);
Record physicalRecord = new(recordTypeTag);
ContainerRecord containerRecord = new(physicalRecord);

DateTime now = DateTime.UtcNow;
containerRecord.WriterMajorVersion = 1;
Expand Down
Loading

0 comments on commit ad72956

Please sign in to comment.