예제 #1
0
 public void Load()
 {
     using (EntityReader <T> curReader = new EntityReader <T>(new MemoryStream(data), DBM))
     {
         for (int i = 1; i <= curReader.TotalRecords; i++)
         {
             //nincs double check, mert kevés az az eset amikor nem kellene lockolni (1. ág)
             lock (this.reader)
             {
                 if (array[i - 1] != null)
                 {
                     curReader.SkipRecord();
                 }
                 else
                 {
                     array[i - 1] = curReader.ReadRecord();
                 }
             }
         }
     }
     lock (this.reader)
     {
         this.reader.Close();
         this.reader = null;
         this.data   = null; //free unused memory
     }
     Loaded.Start();
 }
예제 #2
0
 public void LoadData()
 {
     using (var fileStream = OpenFileOfTable())
     {
         data = new byte[fileStream.Length];
         fileStream.Read(data, 0, data.Length);
     }
     lock (reader)
     {
         reader.Close();
         reader = new EntityReader <T>(new MemoryStream(data), DBM);
     }
     Loaded.Start();
 }