/// <summary> /// /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="type"></param> /// <param name="valuetype">icon,text,date,int</param> public TaskProperty(string id, string name, string type, EValueType valuetype) { Id = id; Name = name; Type = type; ValueType = valuetype.ToXmlString(); }
public FValueId(FAssetRegistryReader Ar) { var id = Ar.Read <uint>(); Type = (EValueType)((id << _INDEX_BITS) >> _INDEX_BITS); Index = (int)id >> _TYPE_BITS; }
public Option(SetterProc aSetProc, string aLongName, string aShortName, EValueType aValueType, string aValueDescr, bool aRequired, string aDescription) { LongName = aLongName; ShortName = aShortName; ValueType = aValueType; ValueDescr = aValueDescr; Required = aRequired; if (aDescription.Length > 0) { Description.Append(aDescription); } theSetterProc = aSetProc; }
public ctlTextBox() { mValType = EValueType.None; mIntVal = 0; mFloatVal = 0; mIntMax = int.MaxValue; mIntMin = int.MinValue; mFloatMax = float.MaxValue; mFloatMin = float.MinValue; AutoSize = false; Height = 28; mErrColor = Color.Red; mValidColor = Color.White; mErrMsg = null; mDisableExceptions = false; mFormat = "0.0"; }
public static bool AddrValueType(string type, ref EValueType valueType) { if (typeof(bool).Name == type) { valueType = EValueType._BOOL; } else if (typeof(Int16).Name == type) { valueType = EValueType._INT16; } else if (typeof(Int32).Name == type) { valueType = EValueType._INT32; } else if (typeof(Int64).Name == type) { valueType = EValueType._INT64; } else if (typeof(UInt16).Name == type) { valueType = EValueType._UINT16; } else if (typeof(UInt32).Name == type) { valueType = EValueType._UINT32; } else if (typeof(Single).Name == type) { valueType = EValueType._FLOAT; } else if (typeof(Double).Name == type) { valueType = EValueType._DOUBLE; } else if (typeof(Byte).Name == type) { valueType = EValueType._STRING; } else { return(false); } return(true); }
public static StructValue Create(object v, Func <StructValue, StructValue, StructValue> mergeOp, Func <StructValue, StructValue, StructValue> diffOp, Func <StructValue, StructValue, bool> isFulFilledByOP, Func <StructValue, StructValue, StructValue, bool> isBetterOp, EValueType tp ) { var o = new StructValue(); o.v = v; o.mergeOp = mergeOp; o.diffOp = diffOp; o.isFulfilledByOP = isFulFilledByOP; o.isBetterOp = isBetterOp; o.tp = tp; return(o); }
public static int BinaryDeserialize(byte[] ioBuffer, int inOffset, out Variant outValue) { int offset = inOffset; offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out byte vt); EValueType valueType = (EValueType)vt; ulong ulong_value = 0; string str = null; switch (valueType) { case EValueType.Bool: case EValueType.Byte: offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out byte byte_value); ulong_value = byte_value; break; case EValueType.Short: case EValueType.UShort: offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out ushort ushort_value); ulong_value = ushort_value; break; case EValueType.Int: case EValueType.UInt: case EValueType.Float: offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out uint uint_value); ulong_value = uint_value; break; case EValueType.Long: case EValueType.ULong: case EValueType.Double: offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out ulong_value); break; case EValueType.String: offset = BinarySerializeUtils.Deserialize(ioBuffer, offset, out str); break; default: throw new ArgumentException($"Unknow type of value: {valueType}"); } outValue = new Variant(); outValue._flags = (byte)valueType; outValue._ulong_value1 = ulong_value; outValue._objref = str; return(offset); }
protected override void Dispose(bool disposing) { if (!IsDisposed) { if (Children != null) { // destroy children first foreach (var i in Children) { i.Dispose(); } Children.Clear(); } _Type = EDIType.Invalid; _ValueType = EValueType.Invalid; } base.Dispose(disposing); }
public void DoInit() { EValueType eValueType = 타입.ConvertEnum <EValueType>(true); switch (eValueType) { case EValueType.INT: p_iValue = int.Parse(값); break; case EValueType.FLOAT: p_fValue = float.Parse(값); break; case EValueType.STRING: p_strValue = 값; break; case EValueType.NOTHING: break; default: Debug.LogError(이름 + " Error"); break; } }
public static string ToXmlString(this EValueType vt) { switch (vt) { case EValueType.Date: return("date"); case EValueType.Icon: return("icon"); case EValueType.Int: return("int"); case EValueType.Text: return("text"); default: throw new ArgumentOutOfRangeException(); } }
public static Decimal ComputePriceFromPercentOrAmount(Decimal basePrice, EValueType type, Decimal value) { return(EValueType.PERCENT == type ? basePrice + ((basePrice * value) / 100M) : basePrice + value); }
public ShowPropertyAttribute(EValueType type) { ValueType = type; }
public JConstEleme(string value, EValueType type) { this.Value = value; this.PValueType = type; }
public ConditionData(EValueType type, int value, int value2, EComparsion comparsion) { Type = type; Value = value; Comparsion = comparsion; }
bool CheckType(EValueType inNeedType) { byte it = (byte)inNeedType; return((TypeCodeBitMask & _flags ^ it) == 0); }
public CJSONValue() { mType = EValueType.NULL; }
private bool ParseWriteSend <T>(FinsAddrInfo addrInfo, List <T> values, ref List <byte> sendmsg) { List <byte> command = new List <byte>(8); // 指令 读 command[0] = PLCConvert.HighByte(Convert.ToUInt16(addrInfo.Operator)); command[1] = PLCConvert.LowByte(Convert.ToUInt16(addrInfo.Operator)); // 地址 command[2] = addrInfo.Area; // 区域 command[3] = addrInfo.HighByte; // 地址-整数位 command[4] = addrInfo.LowByte; command[5] = addrInfo.Decimal; // 地址-小数位 // 长度 command[6] = PLCConvert.HighByte(Convert.ToUInt16(addrInfo.Count)); command[7] = PLCConvert.LowByte(Convert.ToUInt16(addrInfo.Count)); // 数据 EValueType valueType = EValueType._BOOL; if (!PLCConvert.AddrValueType(typeof(T).Name, ref valueType)) { return(false); } List <byte> data = new List <byte>(); switch (valueType) { case EValueType._UNKNOW: return(false); case EValueType._BOOL: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Byte)(Object)i).Reverse()); } break; case EValueType._INT16: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Int16)(Object)i).Reverse()); } break; case EValueType._INT32: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Int32)(Object)i).Reverse()); } break; case EValueType._INT64: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Int64)(Object)i).Reverse()); } break; case EValueType._UINT16: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((UInt16)(Object)i).Reverse()); } break; case EValueType._UINT32: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((UInt32)(Object)i).Reverse()); } break; case EValueType._UINT64: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((UInt64)(Object)i).Reverse()); } break; case EValueType._FLOAT: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Single)(Object)i).Reverse()); } break; case EValueType._DOUBLE: foreach (var i in values) { data.AddRange(BitConverter.GetBytes((Double)(Object)i).Reverse()); } break; } command.AddRange(data); var length = -8 + header.Count + command.Count + data.Count; var length_read = data.Count; sendmsg.AddRange(header); sendmsg.RemoveRange(4, 4); // 数据段长度设置 sendmsg.InsertRange(4, PLCConvert.ArrayByte((UInt32)length)); sendmsg.AddRange(command); // 添加command sendmsg.AddRange(data); // 添加data return(true); }
public CJSONValue(string Value) { mType = EValueType.STRING; mString = Value; }
public static Decimal ComputePriceFromPercentOrAmount(Decimal basePrice, EValueType type, Decimal value) { return EValueType.PERCENT == type ? basePrice + ((basePrice * value) / 100M) : basePrice + value; }