예제 #1
0
        //读取输入射孔数据
        public static List <ItemInputPerforate> readInputPerforation2Struct(string _sJH)
        {
            List <ItemInputPerforate> listInputPeforation = new List <ItemInputPerforate>();
            int    iLineIndex    = 0;
            string inputFilePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameInputWellPerforation);

            if (File.Exists(inputFilePath))
            {
                using (StreamReader sr = new StreamReader(inputFilePath))
                {
                    String line;

                    while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                    {
                        iLineIndex++;
                        if (iLineIndex >= 1)
                        {
                            ItemInputPerforate item = ItemInputPerforate.parseLine(line);
                            listInputPeforation.Add(item);
                        }
                    }
                }
            }
            return(listInputPeforation);
        }
예제 #2
0
        public static string item2string(ItemInputPerforate item)
        {
            List <string> ltStrWrited = new List <string>();

            ltStrWrited.Add(item.sJH);
            ltStrWrited.Add(item.sYM);
            ltStrWrited.Add(item.fDS1.ToString());
            ltStrWrited.Add(item.fDS2.ToString());
            return(string.Join("\t", ltStrWrited.ToArray()));
        }
예제 #3
0
        public void selectSectionDrawData2File(string sJH, string filePath)
        {
            StreamWriter sw      = new StreamWriter(filePath, false, Encoding.UTF8);
            string       sReturn = "";

            foreach (var item in readInputPerforation2Struct(sJH))
            {
                sReturn += ItemInputPerforate.item2string(item) + "\t";
            }
            sw.Write(sReturn);
            sw.Close();
        }
예제 #4
0
        public static ItemInputPerforate parseLine(string line)
        {
            string[]           split = line.Trim().Split(new char[] { ' ', '\t', ',' }, StringSplitOptions.RemoveEmptyEntries);
            ItemInputPerforate item  = new ItemInputPerforate();

            if (split.Length >= 4)
            {
                item.sJH  = split[0];
                item.sYM  = split[1];
                item.fDS1 = 0.0f;
                float.TryParse(split[2], out item.fDS1);
                item.fDS2 = 0.0f;
                float.TryParse(split[3], out item.fDS2);
            }
            return(item);
        }
예제 #5
0
        static List <ItemInputPerforate> readInputFile(string _sJH)
        {
            List <ItemInputPerforate> listReturn = new List <ItemInputPerforate>();
            string filePath = Path.Combine(cProjectManager.dirPathWellDir, _sJH, cProjectManager.fileNameInputWellPerforation);

            if (File.Exists(filePath))
            {
                using (StreamReader sr = new StreamReader(filePath, Encoding.UTF8))
                {
                    String line;
                    int    iLine = 0;
                    while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                    {
                        iLine++;
                        if (iLine > 0)
                        {
                            if (line.TrimEnd() != "")
                            {
                                ItemInputPerforate sttItem = ItemInputPerforate.parseLine(line);
                                //如果射孔的时间小于目前系统存储的YM的最小值,更新系统年月
                                string sYMstart = sttItem.sYM;
                                if (int.Parse(sYMstart) < int.Parse(cProjectData.ltStrProjectYM[0]))
                                {
                                    cProjectData.setProjectYM(sYMstart);
                                }
                                if (sttItem.sJH != null)
                                {
                                    listReturn.Add(sttItem);
                                }
                            }
                        }
                    }
                }
            }
            return(listReturn);
        }