static void Main(string[] args) { string prevalenceBase = Path.Combine(Environment.CurrentDirectory, "data"); ClearPrevalenceBase(prevalenceBase); PrevalenceEngine engine = PrevalenceActivator.CreateEngine(typeof(Library), prevalenceBase); Library library = engine.PrevalentSystem as Library; Console.Write("Loading titles.xml... "); XmlDocument data = new XmlDocument(); data.Load("titles.xml"); Console.WriteLine("done!"); foreach (XmlElement title in data.SelectNodes("//title")) { library.AddTitle(new Title(title.GetAttribute("name"), title.GetAttribute("summary"))); } Console.Write("Taking snapshot... "); engine.TakeSnapshot(); Console.WriteLine("done!"); Console.WriteLine("Version 1.0 data successfully set up!"); }
private void SystemSnapshot() { WriteLine("Wait... "); _engine.TakeSnapshot(); WriteLine("Done!"); }
public static void Kernel_ComponentDestroyed(ComponentModel model, object instance) { if (instance is PrevalenceEngine) { PrevalenceEngine engine = (PrevalenceEngine)instance; engine.TakeSnapshot(); } }
protected void TakeSnapshotIfRequired(IConfiguration engineConfig) { float period = GetSnapshotInterval(engineConfig); if (RequiresSnapshots(period)) { PrevalenceEngine engine = (PrevalenceEngine)Kernel[engineConfig.Attributes[IdKey]]; engine.TakeSnapshot(); } }
void OnTimer(object state) { PrevalenceEngine engine = (PrevalenceEngine)state; try { engine.TakeSnapshot(); DeleteFiles(_cleanUpPolicy.SelectFiles(engine)); } catch (Exception /*ignored*/) { // a callback? } }
private void Elapsed(object sender, ElapsedEventArgs args) { Console.Write("Taking system snapshot... "); _engine.TakeSnapshot(); Console.WriteLine("Done."); }
protected void Snapshot() { _engine.TakeSnapshot(); }
protected void Application_End(Object sender, EventArgs e) { engine.TakeSnapshot(); timer.Dispose(); }