示例#1
0
 public void InitNewsFileHandler(LabelWork work)
 {
     if (handler != null)
     {
         DestroyNewsFileHandler();
     }
     labelWork = work;
     handler   = new NewsFileHandler(new NewsFileHandlerConfig(), onContentUpdate, work);
     OnNewsFileHandlerInit?.Invoke();
 }
示例#2
0
        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();
        }