/// <summary> /// 添加一个信息体 /// </summary> /// <param name="io">信息体对象</param> public void AddInformationObject(InformationObject io) { if (informationObjects == null) { informationObjects = new List <InformationObject>(); } if (hasTypeId) { //类型标识不同的,直接异常,不予以添加 if (io.Type != typeId) { throw new ArgumentException("Invalid information object type: expected " + typeId.ToString() + " was " + io.Type.ToString()); } } else { //初始化的时候没有设置类型标识,则在赋值的时候确认类型标识 typeId = io.Type; hasTypeId = true; } //增加对象 informationObjects.Add(io); //修改数量 vsq = (byte)((vsq & 0x80) | informationObjects.Count); }
/// <summary> /// Adds an information object to the ASDU. /// </summary> /// This function add an information object (InformationObject) to the ASDU. NOTE: that all information objects /// have to be of the same type. Otherwise an ArgumentException will be thrown. /// The function returns true when the information object has been added to the ASDU. The function returns false if /// there is no space left in the ASDU to add the information object, or when object cannot be added to a sequence /// because the IOA does not match. /// <returns><c>true</c>, if information object was added, <c>false</c> otherwise.</returns> /// <param name="io">The information object to add</param> public bool AddInformationObject(InformationObject io) { if (informationObjects == null) { informationObjects = new List <InformationObject>(); } if (hasTypeId) { if (io.Type != typeId) { throw new ArgumentException("Invalid information object type: expected " + typeId.ToString() + " was " + io.Type.ToString()); } } else { typeId = io.Type; hasTypeId = true; } if (informationObjects.Count >= 0x7f) { return(false); } int objectSize = io.GetEncodedSize(); if (IsSequence == false) { objectSize += parameters.SizeOfIOA; } else { if (informationObjects.Count == 0) // is first object? { objectSize += parameters.SizeOfIOA; } else { if (io.ObjectAddress != (informationObjects[0].ObjectAddress + informationObjects.Count)) { return(false); } } } if (objectSize <= spaceLeft) { spaceLeft -= objectSize; informationObjects.Add(io); vsq = (byte)((vsq & 0x80) | informationObjects.Count); return(true); } else { return(false); } }
public string[] ToArray() { return(new[] { Name, Container, Type, TypeID.ToString(), FileID.ToString(), PathID.ToString(), Size.ToString(), Modified }); }
/// <summary> /// 发送控制命令Sends the control command. /// </summary> /// /// The type ID has to match the type of the InformationObject! /// /// C_SC_NA_1 -> SingleCommand 单位遥控命令 /// C_DC_NA_1 -> DoubleCommand 双位遥控命令 /// C_RC_NA_1 -> StepCommand 档位调节命令 /// C_SC_TA_1 -> SingleCommandWithCP56Time2a /// C_SE_NA_1 -> SetpointCommandNormalized 归一化设定值 /// C_SE_NB_1 -> SetpointCommandScaled 标度化设定值 /// C_SE_NC_1 -> SetpointCommandShort 短浮点设定值 /// C_BO_NA_1 -> Bitstring32Command /// /// /// <param name="typeId">类型标识Type ID of the control command</param> /// <param name="cot">传送原因Cause of transmission (use ACTIVATION to start a control sequence)</param> /// <param name="ca">公共地址Common address</param> /// <param name="sc">信息体对象Information object of the command</param> /// <exception cref="ConnectionException">description</exception> public void SendControlCommand(TypeID typeId, CauseOfTransmission cot, int ca, InformationObject sc) { Frame frame = new T104Frame(); EncodeIdentificationField(frame, typeId, 1 /* SQ:false; NumIX:1 */, cot, ca); sc.Encode(frame, parameters, false); if (debugOutput) { Console.WriteLine("Encoded " + typeId.ToString() + " with " + frame.GetMsgSize() + " bytes."); } sendIMessage(frame); }
public override String ToString() { String result = OverallID.ToString() + "\n" + TypeID.ToString() + "\n" + (Cost * 10).ToString() + "\n" + (Remaining * 10).ToString() + "\n" + ((int)Type).ToString() + "\n" + Date + "\n" + Date + "\n" + //todo ??? NoteToNumber + "\n" + //todo ??? CustName + "\n" + Content + "\n" + Note + "\n" + PayedTo + "\n"; return(result); }
/// <summary> Throw <see cref="InvalidOperationException"/> if type of next data block is not expected type. </summary> /// <param name="Type"> Expected type. </param> private void AssertType(TypeID Type) { if (!HasNext(Type)) { TypeID NextType = (TypeID)Scanner.PeekNextByte(); String StrExpectedType = Type.ToString().ToLower(); if (NextType >= TypeID.MAX) { throw new InvalidOperationException("Expected to read " + StrExpectedType + ", but got unknown type id. Did you use SafePacketWriter on the other end?"); } else { String StrActualType = NextType.ToString().ToLower(); throw new InvalidOperationException("Expected to read " + StrExpectedType + ", but actual type of next data block is " + StrActualType + "."); } } Scanner.NextByte(); // Move cursor forward }
private void BindDDL() { IList <ICriterion> qryList = new List <ICriterion>(); qryList.Add(Expression.Eq("IsUsed", 2)); Order[] orderList = new Order[1]; Order orderli = new Order("ID", true); orderList[0] = orderli; IList <tm_FoodClass> list = Core.Container.Instance.Resolve <IServiceFoodClass>().GetAllByKeys(qryList, orderList); ddlPType.DataSource = list; ddlPType.DataBind(); ddlPType.SelectedIndex = 0; if (TypeID > 0) { ddlPType.SelectedValue = TypeID.ToString(); tm_FoodClass objClass = Core.Container.Instance.Resolve <IServiceFoodClass>().GetEntity(TypeID); ddlUnit.SelectedValue = objClass != null ? objClass.Unit : "0"; ddlPrint.SelectedValue = objClass != null?objClass.PrintID.ToString() : "0"; } }
public override string ToString() { return(TypeID.ToString()); }
public override bool PerformDelete() { LogHelper.Debug <dictionaryTasks>(TypeID.ToString() + " " + ParentID.ToString() + " deleting " + Alias); new cms.businesslogic.Dictionary.DictionaryItem(ParentID).delete(); return(true); }