public StaticInfoSynchronizer(string baseAddress, string section, TimeSpan updateInterval, string savePath = null, OnUpdate updateHandler = null) { if (updateHandler != null) { UpdateEvent += updateHandler; } _updateInterval = updateInterval; _section = section; _client = new StaticInfoClient(baseAddress, section); if (!string.IsNullOrWhiteSpace(savePath)) { _persistent = new FilePersistent(savePath, section); IEnumerable <string> updatedKeys = load(); if (updatedKeys != null && updatedKeys.Count() > 0) { fireUpdateEvent(updatedKeys); } } if (_updateInterval != InfiniteSpan && _updateInterval != TimeSpan.Zero) { _updateTimer = new Timer(onUpdateTimerTick, null, 10, Timeout.Infinite); } }
public StaticInfoManager(string section) { Section = section; _persistent = new FilePersistent(_baseDir, Section); load(); }