// /** // * File: ODB.cs // * Author: haraldwolff // * // * This file and it's content is copyrighted by the Author and / or copyright holder. // * Any use wihtout proper permission is illegal and may lead to legal actions. // * // * // **/ using System; using System.IO; using System.Collections.Generic; namespace ln.types.odb { public class ODB { public String BasePath { get; set; } Dictionary> persistentObjects = new Dictionary>(); public ODB() { BasePath = Path.GetFullPath("./crawler"); if (!Directory.Exists(BasePath)) { Directory.CreateDirectory(BasePath); } } public IPersistent GetPersistent(Guid persistenceID) { if (persistentObjects.ContainsKey(persistenceID)) { WeakReference weakRef = persistentObjects[persistenceID]; IPersistent o = null; if (weakRef.TryGetTarget(out o)) return o; } return null; } } }