예제 #1
0
        public bool ReadByteSl1(byte[] buf, ref int offs)
        {
            if (DT.ReadByte(buf, ref offs, out mDt))
            {
                return(true);
            }
            if (buf.Length - offs < 4)
            {
                return(true);
            }
            int n = BitConverter.ToInt32(buf, offs);

            offs += 4;
            while (0 < n)
            {
                --n;
                DateTime dt;
                if (DT.ReadByteh(buf, ref offs, out dt))
                {
                    return(true);
                }
                ExamSlot sl;
                if (Slots.TryGetValue(dt.ToString(DT.hh), out sl))
                {
                    if (sl.ReadByteR1(buf, ref offs))
                    {
                        return(true);
                    }
                }
                else
                {
                    sl    = new ExamSlot();
                    sl.Dt = dt;
                    if (sl.ReadByteR1(buf, ref offs))
                    {
                        return(true);
                    }
                    Slots.Add(sl.Dt.ToString(DT.hh), sl);
                }
            }
            if (n == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #2
0
파일: ExamSlot.cs 프로젝트: nauhtnn/sQz
 public string ReadF(string fp, ref ExamSlot o)
 {
     throw new NotImplementedException();
     //string buf = Utils.ReadFile(fp);
     //if (buf == null)
     //    return null;
     //string[] vs = buf.Split('\n');
     //StringBuilder eline = new StringBuilder();
     //StringBuilder dup = new StringBuilder();
     //int i = 0;
     //foreach (string s in vs)
     //{
     //    ++i;
     //    ExamineeS0 e = new ExamineeS0();
     //    string[] v = s.Split('\t');
     //    if (v.Length == 5)
     //    {
     //        if (v[0].Length < 2)
     //        {
     //            eline.Append(i.ToString() + ", ");
     //            continue;
     //        }
     //        v[0] = v[0].ToUpper();
     //        if(!Enum.TryParse(v[0].Substring(0, 1), out e.eLv))
     //        {
     //            eline.Append(i.ToString() + ", ");
     //            continue;
     //        }
     //        int urid;
     //        if (!int.TryParse(v[0].Substring(1), out e.uId)
     //            || !int.TryParse(v[1], out urid) || !Rooms.ContainsKey(urid))
     //        {
     //            eline.Append(i.ToString() + ", ");
     //            continue;
     //        }
     //        bool bCont = false;
     //        foreach(ExamRoom ro in Rooms.Values)
     //            if(ro.vExaminee.ContainsKey(e.LvId))
     //            {
     //                dup.Append(e.eLv.ToString() + e.uId + ", ");
     //                bCont = true;
     //            }
     //        if (bCont)
     //            continue;
     //        foreach (ExamRoom ro in o.Rooms.Values)
     //            if (ro.vExaminee.ContainsKey(e.LvId))
     //            {
     //                dup.Append(e.eLv.ToString() + e.uId + ", ");
     //                bCont = true;
     //            }
     //        if (bCont)
     //            continue;
     //        e.mDt = mDt;
     //        e.tName = v[2].Trim();
     //        DateTime dt;
     //        if(DT.To_(v[3], DT.RR, out dt))
     //        {
     //            eline.Append(i.ToString() + ", ");
     //            continue;
     //        }
     //        e.tBirdate = v[3];
     //        e.tBirthplace = v[4].Trim();
     //        if (e.tName.Length == 0 || e.tBirdate.Length == 0 || e.tBirthplace.Length == 0)
     //        {
     //            eline.Append(i.ToString() + ", ");
     //            continue;
     //        }
     //        o.Rooms[urid].vExaminee.Add(e.LvId, e);
     //    }
     //    else
     //        eline.Append(i.ToString() + ", ");
     //}
     //StringBuilder r = new StringBuilder();
     //if(0 < dup.Length)
     //{
     //    dup.Remove(dup.Length - 2, 2);//remove the last comma
     //    r.Append("\n" + Txt.s._[(int)TxI.NEE_ID_EXIST]);
     //    r.Append(dup.ToString() + '.');
     //}
     //if (0 < eline.Length)
     //{
     //    eline.Remove(eline.Length - 2, 2);//remove the last comma
     //    r.Append("\n" + Txt.s._[(int)TxI.NEE_ELINE]);
     //    r.Append(eline.ToString() + '.');
     //}
     //if (r.Length == 0)
     //    return null;
     //else
     //    return Txt.s._[(int)TxI.NEE_FERR] + r.ToString();
 }