コード例 #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)
             {
                 language newData = new language();
                 newData.ReadFrom(temp);
                 dataMap.Add(newData.Key, newData);
             }
             line++;
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }
コード例 #2
0
        public language FindData(string key)
        {
            language ret = null;

            if (dataMap.ContainsKey(key))
            {
                ret = dataMap[key];
            }
            return(ret);
        }
コード例 #3
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
             {
                 language newData = new language();
                 try{
                     newData.ReadFrom(readBuff);
                     dataMap.Add(newData.Key, newData);
                 }catch (Exception e) {
                     break;
                 }
             }while(true);
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }