private AFValue Calculate(AFTime time, AFAttributeList inputAttributes, AFValues inputValues) { if (time == null) { throw new ArgumentException("No timestamp"); } if (inputValues.Count == 0) { throw new ArgumentException(Resources.ERR_NoInputValues); } int bit; if (!int.TryParse(fBit, out bit)) { throw new ArgumentException(Resources.ERR_NoBitSpecified); } if (bit < 0 || bit > (int)BitEnum.bit31) { throw new ArgumentException(Resources.ERR_InvalidBit); } AFValue inVal = inputValues[0]; object objVal = inVal.Value; if (inVal.IsGood && objVal != null) { if (BitmaskCore.IsIntVal(objVal)) { ulong curVal = (ulong)BitmaskCore.ConvertToType(objVal, TypeCode.UInt64); int tempVal = BitmaskCore.GetBit(curVal, (byte)bit); return(new AFValue(base.Attribute, tempVal, inVal.Timestamp, Attribute.DefaultUOM)); } else { throw new ArgumentException(Resources.ERR_SourceAttributeMustBeAnIntegerType); } } else { return(AFValue.CreateSystemStateValue(Attribute, AFSystemStateCode.BadInput, inVal.Timestamp)); } }
private void ProcessAttributes(AFAttributeTemplates attributes, string prefix) { foreach (AFAttributeTemplate attr in attributes) { if (attr == dataReference.Attribute) { continue; } string attrName = prefix + "|" + attr.Name; if (BitmaskCore.IsIntVal(attr.Type)) { txtAttribute.Items.Add(attrName); } ProcessAttributes(attr.AttributeTemplates, attrName); } }