Пример #1
0
        /*XML 설정파일에서 전체 TP 정보을 가져온다.*/
        public void TPXmlToDataUpdate(TPCommon xmlTPCommonInfo, LinkedList <TPMessageAttributesInformation> xmlTPConnectInfo)
        {
            //tpMessageInfo
            tpCommonInfo.ReceiveMaxSize = xmlTPCommonInfo.ReceiveMaxSize;
            tpCommonInfo.TPTaskCallTime = xmlTPCommonInfo.TPTaskCallTime;
            string connectionName;

            foreach (var connectObject in xmlTPConnectInfo)
            {
                TPMessageAttributesInformation tpConnectObject = new TPMessageAttributesInformation();

                connectionName = string.Format("connection{0}", connectObject.TPHandle);

                tpConnectObject.TPHandle = connectObject.TPHandle;

                tpConnectObject.AddressMode      = connectObject.AddressMode;
                tpConnectObject.UseFlowControl   = connectObject.UseFlowControl;
                tpConnectObject.UseBlockSize     = connectObject.UseBlockSize;
                tpConnectObject.UseSTmin         = connectObject.UseSTmin;
                tpConnectObject.BlockSize        = connectObject.BlockSize;
                tpConnectObject.STmin            = connectObject.STmin;
                tpConnectObject.FirstSN          = connectObject.FirstSN;
                tpConnectObject.SendMsgID        = connectObject.SendMsgID;
                tpConnectObject.ReceiveMsgID     = connectObject.ReceiveMsgID;
                tpConnectObject.SendMsgName      = connectObject.SendMsgName;
                tpConnectObject.ReceiveMsgName   = connectObject.ReceiveMsgName;
                tpConnectObject.N_As             = connectObject.N_As;
                tpConnectObject.N_Bs             = connectObject.N_Bs;
                tpConnectObject.N_Ar             = connectObject.N_Ar;
                tpConnectObject.N_Cr             = connectObject.N_Cr;
                tpConnectObject.WaitMode         = connectObject.WaitMode;
                tpConnectObject.WftMax           = connectObject.WftMax;
                tpConnectObject.WftMaxTime       = connectObject.WftMaxTime;
                tpConnectObject.Pad              = connectObject.Pad;
                tpConnectObject.TpConnectionName = connectionName;
                connectionTree.Nodes.Add(connectionName);
                tpMessageInfo.AddLast(tpConnectObject);
                tpHandleIndex++;
            }
        }
Пример #2
0
        public void UpdateDbToTP(LinkedList <ParserMessageInformation> dbMessageObject, LinkedList <ParserSignalInformation> dbSignalObject)
        {
            foreach (var sendMsgObject in dbMessageObject)
            {
                //파싱해온 메시지가 전송메시지일 경우
                if (sendMsgObject.MessageTpIndex > 0)
                {
                    if (sendMsgObject.MessageDirection == "SEND")
                    {
                        //TPMessageObject.SendMsgName = msg_object.MessageName;
                        foreach (var receiveMessageObject in dbMessageObject)
                        {
                            if (receiveMessageObject.MessageDirection == "RECEIVE")
                            {
                                if (sendMsgObject.MessageTpIndex == receiveMessageObject.MessageTpIndex)
                                {
                                    string connectionName = "";
                                    TPMessageAttributesInformation tpMessageObject = new TPMessageAttributesInformation();
                                    connectionName = string.Format("connection{0}", tpHandleIndex);

                                    tpMessageObject.TPHandle         = tpHandleIndex;
                                    tpMessageObject.SendMsgName      = sendMsgObject.MessageName;
                                    tpMessageObject.SendMsgID        = sendMsgObject.MessageID;
                                    tpMessageObject.ReceiveMsgName   = receiveMessageObject.MessageName;
                                    tpMessageObject.ReceiveMsgID     = receiveMessageObject.MessageID;
                                    tpMessageObject.TPTxIndex        = sendMsgObject.MessageTpIndex;
                                    tpMessageObject.TpConnectionName = connectionName;

                                    tpMessageInfo.AddLast(tpMessageObject);
                                    connectionTree.Nodes.Add(connectionName);
                                    tpHandleIndex++;
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #3
0
        public void TPLoadConfigurationFile(string selectPath, TPCommon tpCommonInfo, LinkedList <TPMessageAttributesInformation> tpConnectInfo)
        {
            XmlReader loadConfigInformation;

            XmlReaderSettings loadConfigSetting = new XmlReaderSettings();

            string tpLoadConfigContent = "";

            loadConfigSetting.IgnoreComments   = true;
            loadConfigSetting.IgnoreWhitespace = true;

            loadConfigInformation = XmlReader.Create(selectPath, loadConfigSetting);
            //TPConnection
            while (loadConfigInformation.Read())
            {
                if (loadConfigInformation.Name.CompareTo("ReceiveBufferMax") == 0 &&
                    loadConfigInformation.NodeType == XmlNodeType.Element)
                {
                    loadConfigInformation.Read();
                    tpCommonInfo.ReceiveMaxSize = Convert.ToUInt32(loadConfigInformation.Value);
                }

                else if (loadConfigInformation.Name.CompareTo("TPCallTaskTime") == 0 &&
                         loadConfigInformation.NodeType == XmlNodeType.Element)
                {
                    loadConfigInformation.Read();
                    tpCommonInfo.TPTaskCallTime = Convert.ToUInt16(loadConfigInformation.Value);
                }

                else if (loadConfigInformation.Name.CompareTo("TPConnection") == 0 && loadConfigInformation.NodeType == XmlNodeType.Element)
                {
                    if (loadConfigInformation.MoveToFirstAttribute())    // 첫 번째 속성이 있다면..
                    {
                        TPMessageAttributesInformation tpInformation = new TPMessageAttributesInformation();
                        do
                        {
                            tpLoadConfigContent = loadConfigInformation.Name;
                            switch (tpLoadConfigContent)
                            {
                            case "TPHandle":
                                tpInformation.TPHandle = Convert.ToUInt32(loadConfigInformation.Value);
                                break;

                            case "AddressMode":
                                tpInformation.AddressMode = loadConfigInformation.Value;
                                break;

                            case "UseFlowControl":
                                tpInformation.UseFlowControl = loadConfigInformation.Value;
                                break;

                            case "UseBlockSize":
                                tpInformation.UseBlockSize = loadConfigInformation.Value;
                                break;

                            case "UseSTmin":
                                tpInformation.UseSTmin = loadConfigInformation.Value;
                                break;

                            case "BlockSize":
                                tpInformation.BlockSize = Convert.ToByte(loadConfigInformation.Value);
                                break;

                            case "STmin":
                                tpInformation.STmin = Convert.ToByte(loadConfigInformation.Value);
                                break;

                            case "FirstSequenceNumber":
                                tpInformation.FirstSN = Convert.ToByte(loadConfigInformation.Value);
                                break;

                            case "TPSendID":
                                tpInformation.SendMsgID = Convert.ToUInt32(loadConfigInformation.Value);
                                break;

                            case "TPReceiveID":
                                tpInformation.ReceiveMsgID = Convert.ToUInt32(loadConfigInformation.Value);
                                break;

                            case "TPSendMsgName":
                                tpInformation.SendMsgName = loadConfigInformation.Value;
                                break;

                            case "TPRecevieMsgName":
                                tpInformation.ReceiveMsgName = loadConfigInformation.Value;
                                break;

                            case "ASTimeout":
                                tpInformation.N_As = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "BSTimeout":
                                tpInformation.N_Bs = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "ARTimeout":
                                tpInformation.N_Ar = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "CRTimeout":
                                tpInformation.N_Cr = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "WaitingMode":
                                tpInformation.WaitMode = loadConfigInformation.Value;
                                break;

                            case "WftMax":
                                tpInformation.WftMax = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "WftMaxTime":
                                tpInformation.WftMaxTime = Convert.ToUInt16(loadConfigInformation.Value);
                                break;

                            case "PAD":
                                tpInformation.Pad = Convert.ToByte(loadConfigInformation.Value);
                                break;

                            default:
                                break;
                            }
                        } while (loadConfigInformation.MoveToNextAttribute());
                        tpConnectInfo.AddLast(tpInformation);
                    }
                }
            }
            loadConfigInformation.Close();
        }