Utils erweitert
This commit is contained in:
parent
0c092a0b4d
commit
2cb2fcead5
@ -4,6 +4,13 @@ namespace BlubbFish.Utils.IoT.Bots.Events {
|
||||
public class ModulEventArgs : EventArgs {
|
||||
public ModulEventArgs() {
|
||||
}
|
||||
public ModulEventArgs(String addr, String prop, String val, String src)
|
||||
{
|
||||
this.Address = addr;
|
||||
this.Property = prop;
|
||||
this.Value = val;
|
||||
this.Source = src;
|
||||
}
|
||||
public String Address { get; protected set; }
|
||||
public String Property { get; protected set; }
|
||||
public String Value { get; protected set; }
|
||||
|
13
Helper.cs
13
Helper.cs
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BlubbFish.Utils.IoT.Bots {
|
||||
@ -65,6 +66,18 @@ namespace BlubbFish.Utils.IoT.Bots {
|
||||
#endregion
|
||||
|
||||
#region StringHelper
|
||||
public static String GetEnumDescription(Enum value) {
|
||||
FieldInfo fi = value.GetType().GetField(value.ToString());
|
||||
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
|
||||
if (attributes != null && attributes.Length > 0) {
|
||||
return attributes[0].Description;
|
||||
} else {
|
||||
return value.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public static String ToUpperLower(this String s) {
|
||||
if (s.Length == 0) {
|
||||
return "";
|
||||
|
Loading…
Reference in New Issue
Block a user