コード例 #1
0
 private void FileReaderOnReadedDataAsync(byte[] readedData)
 {
     if (readedData != null)
     {
         byte[][] processedData = null;
         Task     handlerTask   = Task.Run(() =>
         {
             processedData = fileHandler.Process(readedData);
         });
         handlerTask.Wait();
         if (processedData != null)
         {
             HandlerSucces?.Invoke(true);
             foreach (byte[] frame in processedData)
             {
                 fileWriter.WriteToFileAsync(frame);
             }
         }
         else
         {
             HandlerSucces?.Invoke(false);
             fileWriter.WriteToFileAsync(readedData);
         }
     }
     else
     {
         fileReader.CloseReading();
         fileWriter.CloseWriting();
     }
 }
コード例 #2
0
 public void Convert()
 {
     byte[] readedData;
     do
     {
         if (!fileReader.closeFile)
         {
             readedData = fileReader.ReadNextBuff();
             if (readedData != null)
             {
                 byte[][] processedData = fileHandler.Process(readedData);
                 if (processedData != null)
                 {
                     HandlerSucces?.Invoke(true);
                     foreach (byte[] frame in processedData)
                     {
                         fileWriter.WriteToFile(frame);
                     }
                 }
                 else
                 {
                     HandlerSucces?.Invoke(false);
                     fileWriter.WriteToFile(readedData);
                 }
             }
         }
         else
         {
             fileReader.CloseReading();
             fileWriter.CloseWriting();
             readedData = null;
         }
     } while (readedData != null);
     fileReader.CloseReading();
     fileWriter.CloseWriting();
 }