mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 11:11:23 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45a9fa0520 | ||
|
|
772f8b89a4 |
@@ -32,7 +32,7 @@ class Program {
|
|||||||
Task.Factory.StartNew(async () => {
|
Task.Factory.StartNew(async () => {
|
||||||
|
|
||||||
//attaching the logger
|
//attaching the logger
|
||||||
Logger.LogLevel = LogLevel.Critical;
|
Logger.LogLevel = LogLevel.Verbose;
|
||||||
Logger.OnNewLogMessage((date, msg) => {
|
Logger.OnNewLogMessage((date, msg) => {
|
||||||
Console.WriteLine($"{date.ToString("HH:mm:ss")} {msg}");
|
Console.WriteLine($"{date.ToString("HH:mm:ss")} {msg}");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ namespace Examples {
|
|||||||
[Register(50)]
|
[Register(50)]
|
||||||
public CurrentState TestEnum { get; private set; }
|
public CurrentState TestEnum { get; private set; }
|
||||||
|
|
||||||
|
[Register(100)]
|
||||||
|
public TimeSpan TsTest2 { get; private set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,9 +115,14 @@ namespace MewtocolNet.Registers {
|
|||||||
public string GetValueString () {
|
public string GetValueString () {
|
||||||
|
|
||||||
if (enumType != null && this is NRegister<int> intEnumReg) {
|
if (enumType != null && this is NRegister<int> intEnumReg) {
|
||||||
|
|
||||||
var dict = new Dictionary<int, string>();
|
var dict = new Dictionary<int, string>();
|
||||||
|
|
||||||
foreach (var name in Enum.GetNames(enumType)) {
|
foreach (var name in Enum.GetNames(enumType)) {
|
||||||
dict.Add((int)Enum.Parse(enumType, name), name);
|
int enumKey = (int)Enum.Parse(enumType, name);
|
||||||
|
if(!dict.ContainsKey(enumKey)) {
|
||||||
|
dict.Add(enumKey, name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dict.ContainsKey(intEnumReg.Value)) {
|
if(dict.ContainsKey(intEnumReg.Value)) {
|
||||||
@@ -125,6 +130,7 @@ namespace MewtocolNet.Registers {
|
|||||||
} else {
|
} else {
|
||||||
return $"{intEnumReg.Value} (Missing Enum)";
|
return $"{intEnumReg.Value} (Missing Enum)";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if (this is NRegister<short> shortReg) {
|
if (this is NRegister<short> shortReg) {
|
||||||
return $"{shortReg.Value}{(isUsedBitwise ? $" [{shortReg.GetBitwise().ToBitString()}]" : "")}";
|
return $"{shortReg.Value}{(isUsedBitwise ? $" [{shortReg.GetBitwise().ToBitString()}]" : "")}";
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<PackageId>MewtocolNet</PackageId>
|
<PackageId>MewtocolNet</PackageId>
|
||||||
<Version>0.5.1</Version>
|
<Version>0.5.2</Version>
|
||||||
<Authors>Felix Weiss</Authors>
|
<Authors>Felix Weiss</Authors>
|
||||||
<Company>Womed</Company>
|
<Company>Womed</Company>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
|
|||||||
Reference in New Issue
Block a user