Ejemplo n.º 1
0
        internal void writeDataLine(StreamWriter writeStream, string strCommand, object strData, int nTabCount)
        {
            string strTab = string.Empty;

            // 오류 방지
            if (writeStream == null)
            {
                CNotice.printTraceID("TSWI");
                return;
            }

            // 오류 방지
            if (strData == null)
            {
                CNotice.printTraceID("TODI");
                return;
            }

            for (int i = 0; i < nTabCount; i++)
            {
                strTab = strTab + "\t";
            }

            writeStream.WriteLine(strTab + strCommand + "=" + strData.ToString());
        }
Ejemplo n.º 2
0
        // Marerial 데이터를 읽어온다
        public bool readMaterialNames(string strFileFullName, ref List <string> listMaterialNames)
        {
            List <string> listAllLines = new List <string>();

            string strLine, strName, strTemp;
            int    nIndex;

            // 이전에 사용하던 List 데이터를 우선 삭제한다.
            listMaterialNames.Clear();

            if (false == m_manageFile.isExistFile(strFileFullName))
            {
                CNotice.printTraceID("TMFD");
                return(false);
            }

            try
            {
                getAllLines(strFileFullName, ref listAllLines);

                // 다음 행을 사용하는 경우도 있어서 foreach 를 사용하지 않았다.
                for (int i = 0; i < listAllLines.Count; i++)
                {
                    strLine = listAllLines[i];

                    // keyword 앞을 \t 를 제거한다.
                    strLine = strLine.Trim();

                    if (strLine == "$begin \'MaterialDef\'")
                    {
                        strName = listAllLines[i + 1];

                        strName = strName.Trim();

                        // 이름 얻기
                        nIndex  = strName.IndexOf("'");
                        strTemp = strName.Substring(nIndex + 1);
                        nIndex  = strTemp.IndexOf("'");
                        strTemp = strTemp.Remove(nIndex);

                        listMaterialNames.Add(strTemp);
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                CNotice.printTraceID("AETT");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        //Marerial 데이터를 읽어온다
        public bool readMaterialBHData(string strFileFullName, string strMaterialName, ref List <double> listH, ref List <double> listB)
        {
            List <string> listString = new List <string>();

            string strLine, strName, strData, strTemp;
            int    nIndex;
            bool   bBHDataGathering = false;

            // 이전에 사용하던 List 데이터를 우선 삭제한다.
            listH.Clear();
            listB.Clear();

            try
            {
                if (false == m_manageFile.isExistFile(strFileFullName))
                {
                    CNotice.printTraceID("TMFD");
                    return(false);
                }

                List <string> listMaterialNames = new List <string>();

                readMaterialNames(strFileFullName, ref listMaterialNames);

                if (listMaterialNames.Contains(strMaterialName) == false)
                {
                    CNotice.printTrace("존재하지 않은 연자성체의 BH 값을 얻으려고 하고 있다.");
                    return(false);
                }

                getAllLines(strFileFullName, ref listString);

                // 다음 행을 사용하는 경우도 있어서 foreach 를 사용하지 않았다.
                for (int i = 0; i < listString.Count; i++)
                {
                    strLine = listString[i];

                    // keyword 앞을 \t 를 제거한다.
                    strLine = strLine.Trim();

                    if (strLine == "$begin \'MaterialDef\'")
                    {
                        strName = listString[i + 1];

                        strName = strName.Trim();

                        // 이름 얻기
                        nIndex  = strName.IndexOf("'");
                        strTemp = strName.Substring(nIndex + 1);
                        nIndex  = strTemp.IndexOf("'");
                        strTemp = strTemp.Remove(nIndex);

                        // BH 곡선 수집을 시작한다.
                        if (strTemp == strMaterialName)
                        {
                            bBHDataGathering = true;
                        }
                    }

                    // BH 곡선 수집을 종료한다.
                    if (strLine == "$end \'MaterialDef\'")
                    {
                        bBHDataGathering = false;
                    }

                    if (strLine == "$begin \'Coordinate\'" && bBHDataGathering == true)
                    {
                        // H 값 읽기
                        strData = listString[i + 1];
                        strTemp = strData.Trim();       // 앞의 공백 제거함
                        strTemp = strTemp.Substring(2); // X= 제거함
                        listH.Add(Convert.ToDouble(strTemp));

                        // B 값 읽기
                        strData = listString[i + 2];
                        strTemp = strData.Trim();       // 앞의 공백 제거함
                        strTemp = strTemp.Substring(2); // Y= 제거함
                        listB.Add(Convert.ToDouble(strTemp));

                        // 하나의 BH 곡선을 읽고 나면
                        // 아래의 X, Y, $end 3 line 은 그냥 점프 한다.
                        i = i + 3;
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                CNotice.printTraceID("AETT");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        //Marerial 데이터를 읽어온다
        public bool readMaterialMagnetData(string strFileFullName, string strMaterialName, ref double dMu, ref double dHc)
        {
            List <string> listString = new List <string>();

            string strLine, strName, strTemp, strData;

            char[] separetor = { '=' };
            int    nIndex;

            try
            {
                if (false == m_manageFile.isExistFile(strFileFullName))
                {
                    CNotice.printTraceID("TMFD");
                    return(false);
                }

                List <string> listMaterialNames = new List <string>();

                readMaterialNames(strFileFullName, ref listMaterialNames);


                if (listMaterialNames.Contains(strMaterialName) == false)
                {
                    CNotice.printTrace("존재하지 않은 영구자석의 특성값을 얻으려고 하고 있다.");
                    return(false);
                }

                getAllLines(strFileFullName, ref listString);

                // 다음 행을 사용하는 경우도 있어서 foreach 를 사용하지 않았다.
                for (int i = 0; i < listString.Count; i++)
                {
                    strLine = listString[i];

                    // keyword 앞을 \t 를 제거한다.
                    strLine = strLine.Trim();

                    if (strLine == "$begin \'MaterialDef\'")
                    {
                        strName = listString[i + 1];

                        strName = strName.Trim();

                        // 이름 얻기
                        nIndex  = strName.IndexOf("'");
                        strTemp = strName.Substring(nIndex + 1);
                        nIndex  = strTemp.IndexOf("'");
                        strTemp = strTemp.Remove(nIndex);

                        // BH 곡선 수집을 시작한다.
                        if (strTemp == strMaterialName)
                        {
                            strData = listString[i + 2];
                            CParsing.getDataInLine(strData, ref dMu, '=', 2);

                            strData = listString[i + 3];
                            CParsing.getDataInLine(strData, ref dHc, '=', 2);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                CNotice.printTrace(ex.Message);
                CNotice.printTraceID("AETT");
                return(false);
            }

            return(true);
        }