public override void Load(Stream stream)
        {
            TestForEditable();
            byte version = stream.ReadNextByte();

            switch (version)
            {
            case 1:
                m_isEnabled = stream.ReadBoolean();
                m_prebufferWriter.Load(stream);
                m_firstStageWriter.Load(stream);
                int cnt = stream.ReadInt32();
                m_stagingRollovers.Clear();
                while (cnt > 0)
                {
                    cnt--;
                    var cfs = new CombineFilesSettings();
                    cfs.Load(stream);
                    m_stagingRollovers.Add(cfs);
                }
                break;

            default:
                throw new VersionNotFoundException("Unknown Version Code: " + version);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a stage writer.
 /// </summary>
 /// <param name="settings">the settings for this stage</param>
 /// <param name="archiveList">the archive list</param>
 /// <param name="rolloverLog">the rollover log</param>
 public CombineFiles(CombineFilesSettings settings, ArchiveList <TKey, TValue> archiveList, RolloverLog rolloverLog)
     : base(MessageClass.Framework)
 {
     m_settings = settings.CloneReadonly();
     m_settings.Validate();
     m_archiveList                      = archiveList;
     m_createNextStageFile              = new SimplifiedArchiveInitializer <TKey, TValue>(settings.ArchiveSettings);
     m_rolloverLog                      = rolloverLog;
     m_rolloverComplete                 = new ManualResetEvent(false);
     m_syncRoot                         = new object();
     m_rolloverTask                     = new ScheduledTask(ThreadingMode.DedicatedForeground, ThreadPriority.BelowNormal);
     m_rolloverTask.Running            += OnExecute;
     m_rolloverTask.UnhandledException += OnException;
     m_rolloverTask.Start(m_settings.ExecuteTimer);
 }