コード例 #1
0
 public bool LoadFromCsvFile(string fileName)
 {
     dataMap.Clear();
     try{
         ByteReader reader = ByteReader.Open(fileName);
         int        line   = 0;
         for (; ;)
         {
             BetterList <string> temp = reader.ReadCSV();
             if (temp == null || temp.size == 0)
             {
                 break;
             }
             if (line > 2)
             {
                 jiegou newData = new jiegou();
                 newData.ReadFrom(temp);
                 dataMap.Add(newData.index, newData);
             }
             line++;
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }
コード例 #2
0
 public bool LoadFromFile(string fileName)
 {
     dataMap.Clear();
     try{
         using (var stream = new FileStream(fileName, FileMode.Open))
         {
             Zby.ByteBuffer readBuff = new Zby.ByteBuffer(stream);
             do
             {
                 jiegou newData = new jiegou();
                 try{
                     newData.ReadFrom(readBuff);
                     dataMap.Add(newData.index, newData);
                 }catch (Exception e) {
                     break;
                 }
             }while(true);
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }