Skip to content

Commit

Permalink
Update packages. Generate documentation for all versions. Remove Sand…
Browse files Browse the repository at this point in the history
…castle Helpfile Builder project. General minor code cleanup.
  • Loading branch information
RobThree committed May 27, 2024
1 parent 6e28227 commit 101081d
Show file tree
Hide file tree
Showing 36 changed files with 78 additions and 1,327 deletions.
8 changes: 2 additions & 6 deletions IdGen.Configuration/IdGen.Configuration.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<Authors>RobIII</Authors>
<Company>Devcorner.nl</Company>
<PackageId>IdGen.Configuration</PackageId>
Expand All @@ -21,17 +21,13 @@
<RepositoryType>git</RepositoryType>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<Configurations>Debug;Release;ReleaseWithDocumentation</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net45|AnyCPU'">
<DocumentationFile>bin\Release\IdGen.Configuration.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='ReleaseWithDocumentation|net45|AnyCPU'">
<DocumentationFile>bin\Release\IdGen.Configuration.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion IdGen.Configuration/IdGeneratorElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace IdGen.Configuration;
/// </summary>
public sealed class IdGeneratorElement : ConfigurationElement
{
private readonly string[] DATETIMEFORMATS = { "yyyy-MM-dd\\THH:mm:ss", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd" };
private readonly string[] DATETIMEFORMATS = ["yyyy-MM-dd\\THH:mm:ss", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd"];

/// <summary>
/// Gets/sets the name of the <see cref="IdGeneratorElement"/>.
Expand Down
8 changes: 2 additions & 6 deletions IdGen.DependencyInjection/IdGen.DependencyInjection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,19 @@
<LangVersion>latest</LangVersion>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<Configurations>Debug;Release;ReleaseWithDocumentation</Configurations>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
<DocumentationFile>bin\Release\IdGen.DependencyInjection.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='ReleaseWithDocumentation|netstandard2.0|AnyCPU'">
<DocumentationFile>bin\Release\IdGen.DependencyInjection.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\IdGen\IdGen.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="8.0.2" />
</ItemGroup>

Expand Down
19 changes: 0 additions & 19 deletions IdGen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdGen", "IdGen\IdGen.csproj", "{E6856E0A-523F-4451-9C95-621156A1B9F4}"
EndProject
Project("{7CF6DF6D-3B04-46F8-A40B-537D21BCA0B4}") = "IdGenDocumentation", "IdGenDocumentation\IdGenDocumentation.shfbproj", "{E2E02CC8-5CA2-4FA9-912F-3174152DE7D3}"
ProjectSection(ProjectDependencies) = postProject
{E6856E0A-523F-4451-9C95-621156A1B9F4} = {E6856E0A-523F-4451-9C95-621156A1B9F4}
{651A0785-A880-4467-A92F-110C26F3FA28} = {651A0785-A880-4467-A92F-110C26F3FA28}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdGenTests", "IdGenTests\IdGenTests.csproj", "{12E4642B-A533-400C-987B-67B21DB80EC7}"
ProjectSection(ProjectDependencies) = postProject
{651A0785-A880-4467-A92F-110C26F3FA28} = {651A0785-A880-4467-A92F-110C26F3FA28}
Expand All @@ -31,37 +25,24 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
ReleaseWithDocumentation|Any CPU = ReleaseWithDocumentation|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E6856E0A-523F-4451-9C95-621156A1B9F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E6856E0A-523F-4451-9C95-621156A1B9F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E6856E0A-523F-4451-9C95-621156A1B9F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E6856E0A-523F-4451-9C95-621156A1B9F4}.Release|Any CPU.Build.0 = Release|Any CPU
{E6856E0A-523F-4451-9C95-621156A1B9F4}.ReleaseWithDocumentation|Any CPU.ActiveCfg = ReleaseWithDocumentation|Any CPU
{E6856E0A-523F-4451-9C95-621156A1B9F4}.ReleaseWithDocumentation|Any CPU.Build.0 = ReleaseWithDocumentation|Any CPU
{E2E02CC8-5CA2-4FA9-912F-3174152DE7D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2E02CC8-5CA2-4FA9-912F-3174152DE7D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2E02CC8-5CA2-4FA9-912F-3174152DE7D3}.ReleaseWithDocumentation|Any CPU.ActiveCfg = ReleaseWithDocumentation|Any CPU
{E2E02CC8-5CA2-4FA9-912F-3174152DE7D3}.ReleaseWithDocumentation|Any CPU.Build.0 = ReleaseWithDocumentation|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.Release|Any CPU.Build.0 = Release|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.ReleaseWithDocumentation|Any CPU.ActiveCfg = ReleaseWithDocumentation|Any CPU
{12E4642B-A533-400C-987B-67B21DB80EC7}.ReleaseWithDocumentation|Any CPU.Build.0 = ReleaseWithDocumentation|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.Debug|Any CPU.Build.0 = Debug|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.Release|Any CPU.ActiveCfg = Release|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.Release|Any CPU.Build.0 = Release|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.ReleaseWithDocumentation|Any CPU.ActiveCfg = ReleaseWithDocumentation|Any CPU
{651A0785-A880-4467-A92F-110C26F3FA28}.ReleaseWithDocumentation|Any CPU.Build.0 = ReleaseWithDocumentation|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.Release|Any CPU.Build.0 = Release|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.ReleaseWithDocumentation|Any CPU.ActiveCfg = ReleaseWithDocumentation|Any CPU
{ED1E5B28-18FA-475D-A0FC-6CB08CD05185}.ReleaseWithDocumentation|Any CPU.Build.0 = ReleaseWithDocumentation|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
17 changes: 7 additions & 10 deletions IdGen/DefaultTimeSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ namespace IdGen;
/// <remarks>
/// Unless specified the default duration of a tick for a <see cref="DefaultTimeSource"/> is 1 millisecond.
/// </remarks>
public class DefaultTimeSource : StopwatchTimeSource
/// <remarks>
/// Initializes a new <see cref="DefaultTimeSource"/> object.
/// </remarks>
/// <param name="epoch">The epoch to use as an offset from now,</param>
/// <param name="tickDuration">The duration of a tick for this timesource.</param>
public class DefaultTimeSource(DateTimeOffset epoch, TimeSpan tickDuration) : StopwatchTimeSource(epoch, tickDuration)
{
/// <summary>
/// Initializes a new <see cref="DefaultTimeSource"/> object.
Expand All @@ -18,14 +23,6 @@ public class DefaultTimeSource : StopwatchTimeSource
public DefaultTimeSource(DateTimeOffset epoch)
: this(epoch, TimeSpan.FromMilliseconds(1)) { }

/// <summary>
/// Initializes a new <see cref="DefaultTimeSource"/> object.
/// </summary>
/// <param name="epoch">The epoch to use as an offset from now,</param>
/// <param name="tickDuration">The duration of a tick for this timesource.</param>
public DefaultTimeSource(DateTimeOffset epoch, TimeSpan tickDuration)
: base(epoch, tickDuration) { }

/// <summary>
/// Returns the current number of ticks for the <see cref="DefaultTimeSource"/>.
/// </summary>
Expand All @@ -35,4 +32,4 @@ public DefaultTimeSource(DateTimeOffset epoch, TimeSpan tickDuration)
/// it a millisecond, an hour, 2.5 seconds or any other value.
/// </remarks>
public override long GetTicks() => (Offset.Ticks + Elapsed.Ticks) / TickDuration.Ticks;
}
}
11 changes: 3 additions & 8 deletions IdGen/IdGen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,21 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/RobThree/IdGen</PackageProjectUrl>
<PackageTags>scalable unique id generator distributed</PackageTags>
<PackageReleaseNotes>Added NetStandard 2.0</PackageReleaseNotes>
<PackageReleaseNotes></PackageReleaseNotes>
<Description>Twitter Snowflake-alike ID generator for .Net</Description>
<RootNamespace>IdGen</RootNamespace>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
<RepositoryUrl>https://github.com/RobThree/IdGen</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisLevel>latest</AnalysisLevel>
<LangVersion>latest</LangVersion>
<Configurations>Debug;Release;ReleaseWithDocumentation</Configurations>
<Configurations>Debug;Release</Configurations>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard1.1|AnyCPU'">
<DocumentationFile>bin\Release\IdGen.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='ReleaseWithDocumentation|netstandard1.1|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DocumentationFile>bin\Release\IdGen.xml</DocumentationFile>
</PropertyGroup>

Expand Down
33 changes: 13 additions & 20 deletions IdGen/IdGeneratorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ namespace IdGen;
/// <summary>
/// Represents the options an <see cref="IdGenerator"/> can be configured with.
/// </summary>
public class IdGeneratorOptions
/// <remarks>
/// Initializes a new instance of the <see cref="IdGeneratorOptions"/> class.
/// </remarks>
/// <param name="idStructure">The <see cref="IdStructure"/> for ID's to be generated.</param>
/// <param name="timeSource">The <see cref="ITimeSource"/> to use when generating ID's.</param>
/// <param name="sequenceOverflowStrategy">The <see cref="SequenceOverflowStrategy"/> to use when generating ID's.</param>
public class IdGeneratorOptions(
IdStructure? idStructure = null,
ITimeSource? timeSource = null,
SequenceOverflowStrategy sequenceOverflowStrategy = SequenceOverflowStrategy.Throw)
{
/// <summary>
/// Returns the default epoch.
Expand All @@ -29,31 +38,15 @@ public class IdGeneratorOptions
/// <summary>
/// Gets the <see cref="IdStructure"/> of the generated ID's
/// </summary>
public IdStructure IdStructure { get; init; } = _defaultidstructure;
public IdStructure IdStructure { get; init; } = idStructure ?? _defaultidstructure;

/// <summary>
/// Gets the <see cref="ITimeSource"/> to use when generating ID's.
/// </summary>
public ITimeSource TimeSource { get; init; } = _defaulttimesource;
public ITimeSource TimeSource { get; init; } = timeSource ?? _defaulttimesource;

/// <summary>
/// Gets the <see cref="SequenceOverflowStrategy"/> to use when generating ID's.
/// </summary>
public SequenceOverflowStrategy SequenceOverflowStrategy { get; init; } = _defaultsequenceoverflowstrategy;

/// <summary>
/// Initializes a new instance of the <see cref="IdGeneratorOptions"/> class.
/// </summary>
/// <param name="idStructure">The <see cref="IdStructure"/> for ID's to be generated.</param>
/// <param name="timeSource">The <see cref="ITimeSource"/> to use when generating ID's.</param>
/// <param name="sequenceOverflowStrategy">The <see cref="SequenceOverflowStrategy"/> to use when generating ID's.</param>
public IdGeneratorOptions(
IdStructure? idStructure = null,
ITimeSource? timeSource = null,
SequenceOverflowStrategy sequenceOverflowStrategy = SequenceOverflowStrategy.Throw)
{
IdStructure = idStructure ?? _defaultidstructure;
TimeSource = timeSource ?? _defaulttimesource;
SequenceOverflowStrategy = sequenceOverflowStrategy;
}
public SequenceOverflowStrategy SequenceOverflowStrategy { get; init; } = sequenceOverflowStrategy;
}
30 changes: 14 additions & 16 deletions IdGen/InvalidSystemClockException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ namespace IdGen;
/// <summary>
/// The exception that is thrown when a clock going backwards is detected.
/// </summary>
public class InvalidSystemClockException : Exception
/// <remarks>
/// Initializes a new instance of the <see cref="InvalidSystemClockException"/> class with a message that describes
/// the error and underlying exception.
/// </remarks>
/// <param name="message">
/// The message that describes the exception. The caller of this constructor is required to ensure that this
/// string has been localized for the current system culture.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current <see cref="InvalidSystemClockException"/>. If the
/// innerException parameter is not null, the current exception is raised in a catch block that handles the
/// inner exception.
/// </param>
public class InvalidSystemClockException(string message, Exception? innerException) : Exception(message, innerException)
{
/// <summary>
/// Initializes a new instance of the <see cref="InvalidSystemClockException"/> class.
Expand All @@ -21,19 +34,4 @@ public InvalidSystemClockException() : this("Invalid system clock") { }
/// </param>
public InvalidSystemClockException(string message)
: this(message, null) { }

/// <summary>
/// Initializes a new instance of the <see cref="InvalidSystemClockException"/> class with a message that describes
/// the error and underlying exception.
/// </summary>
/// <param name="message">
/// The message that describes the exception. The caller of this constructor is required to ensure that this
/// string has been localized for the current system culture.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current <see cref="InvalidSystemClockException"/>. If the
/// innerException parameter is not null, the current exception is raised in a catch block that handles the
/// inner exception.
/// </param>
public InvalidSystemClockException(string message, Exception? innerException) : base(message, innerException) { }
}
30 changes: 14 additions & 16 deletions IdGen/SequenceOverflowException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ namespace IdGen;
/// <summary>
/// The exception that is thrown when a sequence overflows (e.g. too many Id's generated within the same timespan (ms)).
/// </summary>
public class SequenceOverflowException : Exception
/// <remarks>
/// Initializes a new instance of the <see cref="SequenceOverflowException"/> class with a message that describes
/// the error and underlying exception.
/// </remarks>
/// <param name="message">
/// The message that describes the exception. The caller of this constructor is required to ensure that this
/// string has been localized for the current system culture.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current <see cref="SequenceOverflowException"/>. If the
/// innerException parameter is not null, the current exception is raised in a catch block that handles the
/// inner exception.
/// </param>
public class SequenceOverflowException(string message, Exception? innerException) : Exception(message, innerException)
{
/// <summary>
/// Initializes a new instance of the <see cref="SequenceOverflowException"/> class.
Expand All @@ -21,19 +34,4 @@ public SequenceOverflowException() : this("Sequence overflow") { }
/// </param>
public SequenceOverflowException(string message)
: this(message, null) { }

/// <summary>
/// Initializes a new instance of the <see cref="SequenceOverflowException"/> class with a message that describes
/// the error and underlying exception.
/// </summary>
/// <param name="message">
/// The message that describes the exception. The caller of this constructor is required to ensure that this
/// string has been localized for the current system culture.
/// </param>
/// <param name="innerException">
/// The exception that is the cause of the current <see cref="SequenceOverflowException"/>. If the
/// innerException parameter is not null, the current exception is raised in a catch block that handles the
/// inner exception.
/// </param>
public SequenceOverflowException(string message, Exception? innerException) : base(message, innerException) { }
}
2 changes: 1 addition & 1 deletion IdGen/SequenceOverflowStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public enum SequenceOverflowStrategy
/// </summary>
Throw = 0,
/// <summary>
/// Wait, using a <see cref="System.Threading.SpinWait"/>, for the tick te pass before generating a new ID.
/// Wait, using a <see cref="SpinWait"/>, for the tick te pass before generating a new ID.
/// </summary>
SpinWait = 1
}
Loading

0 comments on commit 101081d

Please sign in to comment.