예제 #1
0
 public void Start(PrefixedWriter <Entry> prefixedWriter, string connectionPort)
 {
     lock (_sync)
     {
         if (IsLogging())
         {
             Stop();
         }
         _prefixedWriter            = prefixedWriter;
         _stopwatch                 = Stopwatch.StartNew();
         _counter                   = 0;
         _totalCounter              = 0;
         Connection.SweepCompleted += ConnectionSweepCompleted;
         Connection.Start(connectionPort);
     }
 }
예제 #2
0
 public void Stop()
 {
     lock (_sync)
     {
         if (IsLogging())
         {
             _prefixedWriter.Close();
         }
         Connection.SweepCompleted -= ConnectionSweepCompleted;
         if (_stopwatch != null)
         {
             _stopwatch.Stop();
         }
         Connection.Stop();
         _prefixedWriter = null;
     }
 }
예제 #3
0
        private void work(List <Entry> entries, int width, int height, long position, PrefixedWriter <Entry> output)
        {
            var outEntries = new Entry[entries.Count];

            Parallel.For(0, outEntries.Length, i => outEntries[i] = work(entries[i], width, height));
            foreach (var entry in entries)
            {
                output.Write(entry);
            }

            entries.Clear();
            GC.Collect();
            UpdateProgress((int)position);
            Application.DoEvents();
        }