Save() 공개 메소드

public Save ( ) : bool
리턴 bool
예제 #1
0
파일: FileDB.cs 프로젝트: kuggaa/longomatch
        public bool Backup()
        {
            DirectoryInfo backupDir, dbDir;

            FileInfo[] files;

            dbDir     = new DirectoryInfo(dbDirPath);
            backupDir = new DirectoryInfo(dbDirPath + ".backup");
            try {
                if (backupDir.Exists)
                {
                    backupDir.Delete(true);
                }
                backupDir.Create();
                files = dbDir.GetFiles();
                foreach (FileInfo file in files)
                {
                    string temppath = Path.Combine(backupDir.FullName, file.Name);
                    file.CopyTo(temppath, false);
                }
                projectsDB.LastBackup = DateTime.UtcNow;
                projectsDB.Save();
                return(true);
            } catch (Exception ex) {
                Log.Exception(ex);
                return(false);
            }
        }
예제 #2
0
파일: FileDB.cs 프로젝트: kuggaa/longomatch
        public void Reload()
        {
            projectsDB = new LiteDB(dbPath);
            DirectoryInfo dbDir = new DirectoryInfo(dbDirPath);

            foreach (FileInfo file in dbDir.GetFiles())
            {
                if (file.FullName == dbPath)
                {
                    continue;
                }
                try {
                    Project project = Serializer.Load <Project> (file.FullName);
                    projectsDB.Add(project.Description);
                } catch (Exception ex) {
                    Log.Exception(ex);
                }
            }
            projectsDB.Save();
        }
예제 #3
0
 public void Reload()
 {
     projectsDB = new LiteDB (dbPath);
     DirectoryInfo dbDir = new DirectoryInfo (dbDirPath);
     foreach (FileInfo file in dbDir.GetFiles ()) {
         if (file.FullName == dbPath) {
             continue;
         }
         try {
             Project project = serializer.Load<Project> (file.FullName);
             projectsDB.Add (project.Description);
         } catch (Exception ex) {
             Log.Exception (ex);
         }
     }
     projectsDB.Save ();
 }