コード例 #1
0
 /// <summary>
 /// Runs the next operation, if one is available
 /// </summary>
 private void _RunNextOperation()
 {
     if (_logQueue.Count > 0 && (ProgramHelper.ParseMultipleLogs() || !_anyRunning))
     {
         _RunOperation(_logQueue.Dequeue());
     }
     else
     {
         if (!_anyRunning)
         {
             BtnParse.Enabled            = true;
             BtnClearAll.Enabled         = true;
             BtnCancelAll.Enabled        = false;
             BtnDiscordBatch.Enabled     = true;
             ChkAutoDiscordBatch.Enabled = true;
             _settingsForm.ConditionalSettingDisable(_anyRunning);
             AutoUpdateDiscordBatch();
         }
     }
 }
コード例 #2
0
 public ConsoleProgram(IEnumerable <string> logFiles)
 {
     if (ProgramHelper.ParseMultipleLogs())
     {
         var splitLogFiles      = new List <List <string> >();
         var sizeSortedLogFiles = new List <string>(logFiles);
         for (int i = 0; i < ProgramHelper.GetMaxParallelRunning(); i++)
         {
             splitLogFiles.Add(new List <string>());
         }
         sizeSortedLogFiles.Sort((x, y) =>
         {
             var fInfoX  = new FileInfo(x);
             long xValue = fInfoX.Exists ? fInfoX.Length : 0;
             var fInfoY  = new FileInfo(y);
             long yValue = fInfoY.Exists ? fInfoY.Length : 0;
             return(xValue.CompareTo(yValue));
         });
         int index = 0;
         foreach (string file in sizeSortedLogFiles)
         {
             splitLogFiles[index].Add(file);
             index = (index + 1) % ProgramHelper.GetMaxParallelRunning();
         }
         Parallel.ForEach(splitLogFiles, files =>
         {
             foreach (string file in files)
             {
                 ParseLog(file);
             }
         });
     }
     else
     {
         foreach (string file in logFiles)
         {
             ParseLog(file);
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// Queues an operation. If the 'MultipleLogs' setting is true, operations are run asynchronously
 /// </summary>
 /// <param name="operation"></param>
 private void QueueOrRunOperation(FormOperationController operation)
 {
     BtnClearAll.Enabled         = false;
     BtnParse.Enabled            = false;
     BtnCancelAll.Enabled        = true;
     BtnDiscordBatch.Enabled     = false;
     ChkAutoDiscordBatch.Enabled = false;
     if (ProgramHelper.ParseMultipleLogs() && _runningCount < ProgramHelper.GetMaxParallelRunning())
     {
         _RunOperation(operation);
     }
     else
     {
         if (_anyRunning)
         {
             _logQueue.Enqueue(operation);
             operation.ToPendingState();
         }
         else
         {
             _RunOperation(operation);
         }
     }
 }