Skip to content

Commit

Permalink
feat: version 1.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
EngRajabi committed Mar 19, 2024
1 parent 95ab4ef commit dd00eb7
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 21 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.0.16
fix doc warning
add GeneratedCodeAttribute attrbiute
## v1.0.15
Downgrading packages for older programs
## v1.0.14
Expand Down
57 changes: 57 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ This will generate a class called `EnumNameEnumExtensions` (`UserTypeTest` + `En
For example:

```csharp

/// <summary>
/// Provides extension methods for operations related to the UserTypeTest enumeration.
/// </summary>
public static class UserTypeTestEnumExtensions
{
/// <summary>
/// Provides a dictionary that maps <see cref="UserTypeTest" /> values to their corresponding display names.
/// </summary>
public static readonly ImmutableDictionary<UnitTests.UserTypeTest, string> DisplayNamesDictionary = new Dictionary<UnitTests.UserTypeTest, string>
{
{UnitTests.UserTypeTest.Men, "مرد"},
Expand All @@ -53,6 +60,9 @@ For example:

}.ToImmutableDictionary();

/// <summary>
/// Provides a dictionary that maps <see cref="UserTypeTest" /> values to their corresponding descriptions.
/// </summary>
public static readonly ImmutableDictionary<UnitTests.UserTypeTest, string> DisplayDescriptionsDictionary = new Dictionary<UnitTests.UserTypeTest, string>
{
{UnitTests.UserTypeTest.Men, "Descمرد"},
Expand All @@ -61,6 +71,12 @@ For example:

}.ToImmutableDictionary();

/// <summary>
/// Converts the <see cref="UserTypeTest" /> enumeration value to its string representation.
/// </summary>
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
/// <returns>The string representation of the <see cref="UserTypeTest" /> value.</returns>
public static string ToStringFast(this UnitTests.UserTypeTest states, string defaultValue = null)
{
return states switch
Expand All @@ -71,6 +87,12 @@ For example:
_ => defaultValue ?? throw new ArgumentOutOfRangeException(nameof(states), states, null)
};
}

/// <summary>
/// Checks if the specified <see cref="UserTypeTest" /> value is defined.
/// </summary>
/// <param name="states">The <see cref="UserTypeTest" /> value to check.</param>
/// <returns>True if the <see cref="UserTypeTest" /> value is defined; otherwise, false.</returns>
public static bool IsDefinedFast(UnitTests.UserTypeTest states)
{
return states switch
Expand All @@ -81,6 +103,12 @@ For example:
_ => false
};
}

/// <summary>
/// Checks if the specified string represents a defined <see cref="UserTypeTest" /> value.
/// </summary>
/// <param name="states">The string representing a <see cref="UserTypeTest" /> value.</param>
/// <returns>True if the string represents a defined <see cref="UserTypeTest" /> value; otherwise, false.</returns>
public static bool IsDefinedFast(string states)
{
return states switch
Expand All @@ -91,6 +119,13 @@ For example:
_ => false
};
}

/// <summary>
/// Converts the <see cref="UserTypeTest" /> enumeration value to its display string.
/// </summary>
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
/// <returns>The display string of the <see cref="UserTypeTest" /> value.</returns>
public static string ToDisplayFast(this UnitTests.UserTypeTest states, string defaultValue = null)
{
return states switch
Expand All @@ -101,6 +136,13 @@ For example:
_ => defaultValue ?? throw new ArgumentOutOfRangeException(nameof(states), states, null)
};
}

/// <summary>
/// Gets the description of the <see cref="UserTypeTest" /> enumeration value.
/// </summary>
/// <param name="states">The <see cref="UserTypeTest" /> enumeration value.</param>
/// <param name="defaultValue">The default value to return if the enumeration value is not recognized.</param>
/// <returns>The description of the <see cref="UserTypeTest" /> value.</returns>
public static string ToDescriptionFast(this UnitTests.UserTypeTest states, string defaultValue = null)
{
return states switch
Expand All @@ -111,6 +153,11 @@ For example:
_ => defaultValue ?? throw new ArgumentOutOfRangeException(nameof(states), states, null)
};
}

/// <summary>
/// Retrieves an array of all <see cref="UserTypeTest" /> enumeration values.
/// </summary>
/// <returns>An array containing all <see cref="UserTypeTest" /> enumeration values.</returns>
public static UnitTests.UserTypeTest[] GetValuesFast()
{
return new[]
Expand All @@ -120,6 +167,11 @@ For example:
UnitTests.UserTypeTest.None,
};
}

/// <summary>
/// Retrieves an array of strings containing the names of all <see cref="UserTypeTest" /> enumeration values.
/// </summary>
/// <returns>An array of strings containing the names of all <see cref="UserTypeTest" /> enumeration values.</returns>
public static string[] GetNamesFast()
{
return new[]
Expand All @@ -129,6 +181,11 @@ For example:
nameof(UnitTests.UserTypeTest.None),
};
}

/// <summary>
/// Gets the length of the <see cref="UserTypeTest" /> enumeration.
/// </summary>
/// <returns>The length of the <see cref="UserTypeTest" /> enumeration.</returns>
public static int GetLengthFast()
{
return 3;
Expand Down
43 changes: 22 additions & 21 deletions Supernova.Enum.Generators/Supernova.Enum.Generators.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Supernova.Enum.Generators</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDependencyFile>false</GenerateDependencyFile>
<Version>1.0.15</Version>
<PackageVersion>1.0.15</PackageVersion>
<AssemblyVersion>1.0.15</AssemblyVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<PackageReleaseNotes>
v1.0.15
Downgrading packages for older programs
</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageId>Supernova.Enum.Generators</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDependencyFile>false</GenerateDependencyFile>
<Version>1.0.16</Version>
<PackageVersion>1.0.16</PackageVersion>
<AssemblyVersion>1.0.16</AssemblyVersion>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
<PackageReleaseNotes>
v1.0.16
fix doc warning
add GeneratedCodeAttribute attrbiute
</PackageReleaseNotes>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0" PrivateAssets="all" />
Expand All @@ -26,12 +27,12 @@
<ItemGroup>
<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
<None Include="..\icon.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
<None Include="..\README.md">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
</ItemGroup>
</Project>

0 comments on commit dd00eb7

Please sign in to comment.