static void _Store(string title, CDB db) { string fqTitle = _FQ(title); _Delete(title); System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(CDB)); System.IO.StreamWriter file = new System.IO.StreamWriter(_FQ(title)); writer.Serialize(file, db); file.Close(); }
public static CPhoto GetPhotoRecord(string id, CDB db) { foreach (CPhoto p in db.Photos) { if (p.ID == id) { return(p); } } throw new ApplicationException("BANG01"); }
public static bool NewEntry(string id, CDB db) { foreach (CPhoto p in db.Photos) { if (p.ID == id) { return(false); } } return(true); }
static CDB _Read(string title) { string fqName = _FQ(title); if (File.Exists(fqName)) { System.Xml.Serialization.XmlSerializer reader = new System.Xml.Serialization.XmlSerializer(typeof(CDB)); System.IO.StreamReader file = new System.IO.StreamReader(_FQ(title)); CDB it = (CDB)reader.Deserialize(file); file.Dispose(); return(it); } else { return(new CDB()); } }
public CDBMan() { db = CWorker.ReadDB(); }
public static void StoreDB(CDB db) { _Store(DataBaseRootName, db); }