Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        public void BackupOralAnnotationSegmentFile(string srcfile, bool deleteAfterBackingUp)
        {
            var fileName = Path.GetFileName(srcfile);

            if (fileName == null)
            {
                return;
            }
            var dstFile = Path.Combine(TempOralAnnotationsFolder, fileName);

            // If the file has already been backed up, then make a backup with the next
            // available sequence number.
            if (File.Exists(dstFile))
            {
                int latestBackup = GetLatestBackupNumberForFile(dstFile);
                dstFile += kBackupVersionPrefix + (latestBackup + 1);
            }

            if (!Directory.Exists(TempOralAnnotationsFolder))
            {
                FileSystemUtils.CreateDirectory(TempOralAnnotationsFolder);
            }

            CopyFilesViewModel.Copy(srcfile, dstFile);

            if (deleteAfterBackingUp)
            {
                EraseAnnotation(srcfile);
            }
        }