Compare commits

..

No commits in common. "eb2c87a4625c2f9ce1bef55f393efb502a457d61" and "88c75a2464330d08d977289d862e1e5385426e6a" have entirely different histories.

5 changed files with 28 additions and 31 deletions

View file

@ -1,22 +0,0 @@
on: [push, pull_request]
jobs:
build-publish:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Build
run: dotnet build
- name: Test
run: dotnet test --collect:"XPlat Code Coverage"
- name: Pack
run: dotnet pack --version-suffix ci.$GITHUB_RUN_NUMBER
- name: Publish
if: github.event_name == 'push' && github.ref_name == 'main'
run: dotnet nuget push -s https://nuget.ellpeck.de/v3/index.json **/*.nupkg -k '${{ secrets.BAGET_KEY }}' -n

20
.woodpecker/main.yml Normal file
View file

@ -0,0 +1,20 @@
variables:
- &image mcr.microsoft.com/dotnet/sdk:8.0-jammy
steps:
build:
image: *image
commands: dotnet build
test:
image: *image
commands: dotnet test --collect:"XPlat Code Coverage"
pack:
image: *image
commands: dotnet pack --version-suffix ci.$CI_PIPELINE_NUMBER
publish:
image: *image
when:
branch: main
event: push
commands: dotnet nuget push -s https://nuget.ellpeck.de/v3/index.json **/*.nupkg -k $BAGET_KEY -n
secrets:
- baget_key

View file

@ -42,8 +42,7 @@ namespace DynamicEnums {
/// </summary>
/// <param name="name">The name of the enum value</param>
/// <param name="value">The value</param>
/// <param name="defined">Whether this enum value <see cref="IsDefined(DynamicEnum)"/>, and thus, not a combined flag.</param>
protected DynamicEnum(string name, BigInteger value, bool defined) {
protected DynamicEnum(string name, BigInteger value) {
this.value = value;
this.name = name;
}
@ -122,7 +121,7 @@ namespace DynamicEnums {
throw new ArgumentException($"Duplicate name {name}", nameof(name));
}
var ret = DynamicEnum.Construct(typeof(T), name, value, true);
var ret = DynamicEnum.Construct(typeof(T), name, value);
storage.Values.Add(value, ret);
return (T) ret;
}
@ -346,7 +345,7 @@ namespace DynamicEnums {
// otherwise, cache the combined value
if (!storage.FlagCache.TryGetValue(value, out var combined)) {
combined = DynamicEnum.Construct(type, null, value, false);
combined = DynamicEnum.Construct(type, null, value);
storage.FlagCache.Add(value, combined);
}
return combined;
@ -432,8 +431,8 @@ namespace DynamicEnums {
#if NET6_0_OR_GREATER
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)]
#endif
Type type, string name, BigInteger value, bool defined) {
return (DynamicEnum) Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new object[] {name, value, defined}, CultureInfo.InvariantCulture);
Type type, string name, BigInteger value) {
return (DynamicEnum) Activator.CreateInstance(type, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new object[] {name, value}, CultureInfo.InvariantCulture);
}
private class Storage {

View file

@ -13,7 +13,7 @@
<RepositoryUrl>https://github.com/Ellpeck/DynamicEnums</RepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<VersionPrefix>1.2.0</VersionPrefix>
<VersionPrefix>1.1.0</VersionPrefix>
</PropertyGroup>
<ItemGroup>

View file

@ -86,7 +86,7 @@ public class EnumTests {
private class TestDynamicEnum : DynamicEnum {
public TestDynamicEnum(string name, BigInteger value, bool defined) : base(name, value, defined) {}
public TestDynamicEnum(string name, BigInteger value) : base(name, value) {}
}