public void InitNewsFileHandler(LabelWork work) { if (handler != null) { DestroyNewsFileHandler(); } labelWork = work; handler = new NewsFileHandler(new NewsFileHandlerConfig(), onContentUpdate, work); OnNewsFileHandlerInit?.Invoke(); }
public void DestroyNewsFileHandler() { if (handler == null) { return; } int end = isAtEOF ? currentActivePairs.Count() : Math.Min(currentActivePairs.Count() - 1, currentNewsPairIndex); for (int i = 0; i < end; i++) { handler.WriteToOutputFile(currentActivePairs.ElementAt(i)); } handler.Destroy(); currentActivePairs.Clear(); currentNewsPairIndex = 0; handler = null; CurrentNewsPair = null; OnNewsFileHandlerDestroy?.Invoke(); }