Ejemplo n.º 1
0
        private bool GenLEUGlobalFile(LEURF leurf, LEUGlobal leugb, GID gid, string filename)
        {
            try
            {
                XmlFileHelper xmlFile = XmlFileHelper.CreateFromString(null);
                //根据LEU Result Filtered Values文件的内容修改可变部分的值
                leugb.leuName      = leurf.leuName;
                leugb.inBoard.gid  = gid.ibGid;
                leugb.outBoard.gid = gid.ouGid;
                //5.2.1生成Output_balise,TBD
                foreach (LEUBeacon beacon in leurf.beaconList)
                {
                    OutBalise ob = new OutBalise();
                    ob.id       = beacon.outNum;
                    ob.telegram = "LONG";

                    leugb.obList.Add(ob);
                }
                leugb.encoder.netGid = gid.netGid;

                //根据模板文件格式写入LEU文件
                XmlVisitor leuNode = leugb.Write();
                xmlFile.SetRoot(leuNode);
                xmlFile.Save2File(filename);
                return(true);
            }
            catch (System.Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public bool Configure()
        {
            if (Option.BEACON == option)
            {
                //读取beacon layout文件
                List <XmlVisitor> beaconList = xmlBeaconInfo.Children().ToList();
                if (null != beaconList)
                {
                    foreach (XmlVisitor node in beaconList)
                    {
                        BeaconLayout beacon = new BeaconLayout();
                        if (!beacon.SetBeacon(node))
                        {
                            logMsg = string.Format("Read Beacon.ID = {0}  error, please check!", beacon.ID);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        BeaconInfoList.Add(beacon);
                    }
                }
            }
            else if (Option.BMV == option)
            {
                //读取beacon layout文件
                List <XmlVisitor> beaconList = xmlBeaconInfo.Children().ToList();
                if (null != beaconList)
                {
                    foreach (XmlVisitor node in beaconList)
                    {
                        BeaconLayout beacon = new BeaconLayout();
                        if (!beacon.SetBeacon(node))
                        {
                            logMsg = string.Format("Read Beacon.ID = {0} error in beacon layout file, please check!", beacon.ID);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        BeaconInfoList.Add(beacon);
                    }
                }

                try
                {
                    ReadSyDB readSydb = new ReadSyDB(xmlSyDBInfo);
                    //计算LINE.ID
                    sydb.LineID = readSydb.ReadLineId();
                    //读SYDB的IBBM表
                    sydb.ibbmInfoList = readSydb.ReadIBBM();
                    //读SYDB的route表
                    sydb.routeInfoList = readSydb.ReadRoute();
                    //读取SYDB的signal表
                    sydb.signalInfoList = readSydb.ReadSignal();
                    //读取SYDB的block表
                    sydb.blockInfoList = readSydb.ReadBlock();
                    //读取SYDB的point表
                    sydb.pointInfoList = readSydb.ReadPoint();
                    //读取SYDB的overlap表
                    sydb.overlapInfoList = readSydb.ReadOverlap();
                    //读取SYDB的TFC表
                    sydb.tfcInfoList = readSydb.ReadTFC();
                    //读取SYDB的TFC表
                    sydb.sddbInfoList = readSydb.ReadSDDB();
                }
                catch (System.Exception ex)
                {
                    logMsg = "Read sydb data error, please check!";
                    WriteLog(logMsg, LogManager.Level.Error);
                    return(false);
                }
            }
            else if (Option.LEURF == option)
            {
                //读取BMV文件
                this.lineID = DataOpr.Xmlattr2Int(xmlBMVInfo, "LINE_ID");
                List <XmlVisitor> bmvList = xmlBMVInfo.Children().ToList();
                if (null != bmvList)
                {
                    foreach (XmlVisitor node in bmvList)
                    {
                        BMVBeaconInfo bm = new BMVBeaconInfo(node);
                        BmvInfoList.Add(bm.GetBMBeaconInfo());
                    }
                }
            }
            else if (Option.LEUXML == option)
            {
                this.lineID = DataOpr.Xmlattr2Int(xmlLEURFInfo, "LINE_ID");
                List <XmlVisitor> leuList = xmlLEURFInfo.Children().ToList();
                if (null != leuList)
                {
                    foreach (XmlVisitor node in leuList)
                    {
                        LEURF leu = new LEURF();
                        if (!leu.Read(node))
                        {
                            logMsg = string.Format("Read LEU.ID = {0} error int LEU result filtered file, please check!", leu.leuId);
                            WriteLog(logMsg, LogManager.Level.Error);
                            continue;
                        }
                        LeuInfoList.Add(leu);
                    }
                }
                //根据Config文件夹下GID-Table文件的内容计算伪随机数列表
                string       filename = System.IO.Directory.GetCurrentDirectory() + "\\Config\\GID-Table.txt";
                StreamReader sr       = new StreamReader(filename);
                string       line     = null;
                while ((line = sr.ReadLine()) != null)
                {
                    string[] gids = line.Split(',');
                    if (gids.Length < 3)
                    {
                        continue;
                    }
                    GID gid = new GID();
                    gid.ibGid  = gids[0];
                    gid.ouGid  = gids[1];
                    gid.netGid = gids[2];
                    GidInfoList.Add(gid);
                }
            }
            return(true);
        }