Exemplo n.º 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)
             {
                 effect newData = new effect();
                 newData.ReadFrom(temp);
                 dataMap.Add(newData.ID, newData);
             }
             line++;
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }
Exemplo n.º 2
0
        public effect FindData(int key)
        {
            effect ret = null;

            if (dataMap.ContainsKey(key))
            {
                ret = dataMap[key];
            }
            return(ret);
        }
Exemplo n.º 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
             {
                 effect newData = new effect();
                 try{
                     newData.ReadFrom(readBuff);
                     dataMap.Add(newData.ID, newData);
                 }catch (Exception e) {
                     break;
                 }
             }while(true);
         }
     }catch (Exception e) {
         return(false);
     }
     return(dataMap.Count > 0);
 }