コード例 #1
0
        public int NTIME;                  // Количество временных шагов

        public SMSPEC(string filename)
        {
            FileReader br = new FileReader();

            br.OpenBinaryFile(filename);

            while (br.Position < br.Length - 24)
            {
                br.ReadHeader();

                if (br.header.keyword == "RESTART")
                {
                    var           tmp = br.ReadStringList();
                    StringBuilder str = new StringBuilder();
                    foreach (string item in tmp)
                    {
                        str.Append(item);
                    }

                    RESTART = str.ToString();
                    continue;
                }

                if (br.header.keyword == "MEASRMNT")
                {
                    var tmp    = br.ReadStringList();
                    int lenght = br.header.count / NLIST;
                    MEASRMNT = new string[NLIST];
                    StringBuilder str = new StringBuilder();
                    for (int iw = 0; iw < NLIST; ++iw)
                    {
                        str.Clear();
                        for (int ik = 0; ik < lenght; ++ik)
                        {
                            str.Append(tmp[iw * lenght + ik]);
                        }
                        MEASRMNT[iw] = str.ToString();
                    }
                    continue;
                }

                if (br.header.keyword == "DIMENS")
                {
                    br.ReadBytes(4);
                    NLIST = br.ReadInt32();
                    NDIVX = br.ReadInt32();
                    NDIVY = br.ReadInt32();
                    NDIVZ = br.ReadInt32();
                    br.ReadBytes(4);
                    ISTAR = br.ReadInt32();
                    br.ReadBytes(4);
                    continue;
                }
                if (br.header.keyword == "KEYWORDS")
                {
                    KEYWORDS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "WGNAMES")
                {
                    WGNAMES = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "NUMS")
                {
                    NUMS = br.ReadIntList();
                    continue;
                }

                if (br.header.keyword == "UNITS")
                {
                    WGUNITS = br.ReadStringList();
                    continue;
                }

                if (br.header.keyword == "STARTDAT")
                {
                    br.ReadBytes(4);
                    int SDAY   = br.ReadInt32();
                    int SMONTH = br.ReadInt32();
                    int SYEAR  = br.ReadInt32();
                    STARTDATE = new DateTime(SYEAR, SMONTH, SDAY);

                    if (br.header.count == 6)
                    {
                        int SHOUR   = br.ReadInt32();
                        int SMINUTE = br.ReadInt32();
                        int SSECOND = (int)(br.ReadInt32() * 1e6);
                        STARTDATE = new DateTime(SYEAR, SMONTH, SDAY, SHOUR, SMINUTE, SSECOND);
                    }

                    br.ReadBytes(4);
                    continue;
                }
                br.SkipEclipseData();
            }
            br.CloseBinaryFile();
        }