コード例 #1
0
        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();
        }
コード例 #2
0
 public static CPhoto GetPhotoRecord(string id, CDB db)
 {
     foreach (CPhoto p in db.Photos)
     {
         if (p.ID == id)
         {
             return(p);
         }
     }
     throw new ApplicationException("BANG01");
 }
コード例 #3
0
 public static bool NewEntry(string id, CDB db)
 {
     foreach (CPhoto p in db.Photos)
     {
         if (p.ID == id)
         {
             return(false);
         }
     }
     return(true);
 }
コード例 #4
0
        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());
            }
        }
コード例 #5
0
 public CDBMan()
 {
     db = CWorker.ReadDB();
 }
コード例 #6
0
 public static void StoreDB(CDB db)
 {
     _Store(DataBaseRootName, db);
 }