add unicode figure

This commit is contained in:
Nitload
2026-02-23 19:54:21 +08:00
parent 36279a6aae
commit d99c1e3aa6
6 changed files with 119 additions and 94 deletions
+13 -24
View File
@@ -2,8 +2,8 @@
// -----------------------------------------------------------------------
// file="Counter"
// Project: StgSharp
// AuthorGroup: Nitload
// Copyright (c) Nitload. All rights reserved.
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -30,7 +30,7 @@ using System.Numerics;
namespace StgSharp
{
public class Counter<T> where T : unmanaged, INumber<T>
public class Counter<T> where T: unmanaged, INumber<T>
{
internal dynamic _value;
@@ -39,11 +39,7 @@ namespace StgSharp
internal readonly T _defaultIncrement;
internal readonly T _defaultValue;
public Counter(
T defaultValue,
T defaultIncrement,
T defaultDecrement
)
public Counter(T defaultValue, T defaultIncrement, T defaultDecrement)
{
_value = defaultValue;
_defaultValue = defaultValue;
@@ -63,9 +59,7 @@ namespace StgSharp
set => _value = value;
}
public void Add(
T value
)
public void Add(T value)
{
_value += value;
}
@@ -85,34 +79,29 @@ namespace StgSharp
_value = _defaultValue;
}
public void Sub(
T value
)
public void Sub(T value)
{
_value -= value;
}
public override string ToString() => Value.ToString();
public override string ToString()
{
return Value.ToString() ?? string.Empty;
}
public static Counter<T> operator --(
Counter<T> counter
)
public static Counter<T> operator --(Counter<T> counter)
{
counter?.QuickSub();
return counter;
}
public static Counter<T> operator ++(
Counter<T> counter
)
public static Counter<T> operator ++(Counter<T> counter)
{
counter?.QuickAdd();
return counter;
}
public static implicit operator T(
Counter<T> counter
)
public static implicit operator T(Counter<T> counter)
{
return counter switch
{