public void Process() { XmlFileReader xfr = new XmlFileReader(_producerConsumer.GetConfigurationReader().GetXmlFilesDirectory(), _producerConsumer.GetConfigurationReader().GetXmlFilesProcessedDirectory(), _producerConsumer.FileSystemHelper);; int numberOfFiles = _producerConsumer.GetConfigurationReader().GetXmlFilesDirectory().GetFiles().Length; while (xfr.GetNextStackItem() != null) { IStackItem si = xfr.GetNextStackItem(); _producerConsumer.Queue.Enqueue(si); //_producerConsumer.lollypop.Set(); _producerConsumer.IsDoneReading = false; } _producerConsumer.IsDoneReading = true; }
public void Process() { Thread.Sleep(100); do { //_producerConsumer.lollypop.WaitOne(); HtmlFileWriter hfw = new HtmlFileWriter(_producerConsumer.GetConfigurationReader().GetHtmlFilesDirectory(), _producerConsumer.GetConfigurationReader().GetResourcesDirectory(), _producerConsumer.FileSystemHelper); IStackItem item = null; while (_producerConsumer.Queue.TryDequeue(out item)) { hfw.WriteHtmlFile(item); // do stuff } _producerConsumer.IsDoneWriting = true; } while (!_producerConsumer.IsDoneReading || !_producerConsumer.Queue.IsEmpty); }