Example #1
0
        public void init(string str)
        {
            int start;
            int linelength;

            start      = str.IndexOf("begin_<project>") + 16;
            linelength = Tool.readline(str, start);
            name       = str.Substring(start, linelength);
            start      = str.IndexOf("begin_<globals>");
            IndexOfGl  = start;
            if (start != -1)
            {
                linelength = Tool.readline(str, start);
                gl         = new GlobalsStp(str.Substring(start + linelength + 2, str.IndexOf("end_<globals>") - start - linelength - 2));
            }
            else
            {
                gl = null;
            }
            start      = str.IndexOf("FirstAvailableStudyAreaNumber ");
            linelength = Tool.readline(str, start);
            FirstAvailableStudyAreaNumber = Convert.ToInt32(str.Substring(start, linelength).Substring(30));
            start      = str.IndexOf("FirstAvailableCommSystemNumber ");
            linelength = Tool.readline(str, start);
            FirstAvailableCommSystemNumber = Convert.ToInt32(str.Substring(start, linelength).Substring(31));
            start      = str.IndexOf("FirstAvailableFilterNumber ");
            linelength = Tool.readline(str, start);
            FirstAvailableFilterNumber = Convert.ToInt32(str.Substring(start, linelength).Substring(27));
            start      = str.IndexOf("begin_<studyarea>");
            IndexOfStu = start;
            if (start != -1)
            {
                stu = new StudyareaStp(str.Substring(start, str.IndexOf("end_<studyarea>") - start - 2));
            }
            else
            {
                stu = null;
            }
            start     = str.IndexOf("begin_<feature>");
            IndexOfFe = start;
            if (start != -1)
            {
                linelength = Tool.readline(str, start);
                fe         = new FeatureStp(str.Substring(start + linelength + 2, str.IndexOf("end_<feature>") - start - linelength - 2));
            }
            else
            {
                fe = null;
            }
            start     = str.IndexOf("begin_<transmitter>");
            IndexOfTr = start;
            if (start != -1)
            {
                linelength = Tool.readline(str, start);
                tr         = new TransmitterStp(str.Substring(start + linelength + 2, str.IndexOf("end_<transmitter>") - start - linelength - 2));
            }
            else
            {
                tr = null;
            }
            start     = str.IndexOf("begin_<receiver>");
            IndexOfRx = start;
            if (start != -1)
            {
                linelength = Tool.readline(str, start);
                rx         = new ReceiverStp(str.Substring(start + linelength + 2, str.IndexOf("end_<receiver>") - start - linelength - 2));
            }
            else
            {
                rx = null;
            }
            start          = str.IndexOf("begin_<antenna>");
            IndexOfAntenna = start;
            if (start != -1)
            {
                antenna = new TotalAntenna(str.Substring(start, str.LastIndexOf("end_<antenna>") - start));
            }
            else
            {
                antenna = null;
            }
            start           = str.IndexOf("begin_<Waveform>");
            IndexOfWaveform = start;
            if (start != -1)
            {
                waveform = new TotalWaveform(str.Substring(start, str.LastIndexOf("end_<Waveform>") - start));
            }
            else
            {
                waveform = null;
            }
            start      = str.IndexOf("begin_<requests>");
            linelength = Tool.readline(str, start);
            re         = new RequestsStp(str.Substring(start + linelength + 2, str.IndexOf("end_<requests>") - start - linelength - 2));
            start      = str.IndexOf("begin_<Scales>");
            linelength = Tool.readline(str, start);
            sca        = new ScalesStp(str.Substring(start + linelength + 2, str.IndexOf("end_<Scales>") - start - linelength - 2));
        }
Example #2
0
        //参数是接收机和发射机之间的路径
        private static string GetRxTxPol(string rxOrTx, int rxTxNum)
        {
            string      pathSet = ConfigurationManager.AppSettings["setupath"];
            SetupObject so      = SetupFileProceed.GetSetupFile.GetSetup(pathSet);

            SetupFileObject.TotalAntenna      ta    = so.antenna;
            List <SetupFileObject.AntennaStp> asAll = ta.allAntennas;
            //从tx,rx,setup文件中得到信息
            string pathTx = ConfigurationManager.AppSettings["txpath"];
            //存放rxtx的文件内容
            string s;
            int    tantNum = -1;
            int    rantNum = -1;

            try
            {
                if (rxOrTx == "tx")
                {
                    StreamReader st = new StreamReader(pathTx);
                    s = st.ReadToEnd();
                    int    tstart  = s.IndexOf("TxSet " + Convert.ToString(rxTxNum));
                    int    tbstart = s.IndexOf("<antenna>", tstart);
                    int    tastart = s.IndexOf("antenna", tbstart + 7);
                    string str     = s.Substring(tastart + 8);
                    tantNum = Convert.ToInt32(s.Substring(tastart + 8, 1));
                    st.Close();
                    s = "";
                    if (tantNum == -1)
                    {
                        throw new Exception("读取天线的编号出现问题");
                    }
                }
                else if (rxOrTx == "rx")
                {
                    //读取文件rxset
                    string       pathRx = ConfigurationManager.AppSettings["rxpath"];
                    StreamReader sr     = new StreamReader(pathRx);
                    s = sr.ReadToEnd();
                    int    tstart  = s.IndexOf("RxSet " + Convert.ToString(rxTxNum));
                    int    tbstart = s.IndexOf("<antenna>", tstart);
                    int    tastart = s.IndexOf("antenna", tbstart + 7);
                    string str     = s.Substring(tastart + 8);
                    rantNum = Convert.ToInt32(s.Substring(tastart + 8, 1));
                    s       = "";
                    if (rantNum == -1)
                    {
                        throw new Exception("读取天线的编号出现问题");
                    }
                    sr.Close();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw e;
            }
            for (int an = 0; an < asAll.Count; an++)
            {
                if (tantNum == asAll[an].antenna)
                {
                    //返回天线极化类型
                    return(asAll[an].polarization);
                }
                if (rantNum == asAll[an].antenna)
                {
                    //返回天线的极化类型
                    return(asAll[an].polarization);
                }
            }
            return("");
        }