コード例 #1
0
        public TemporaryFileCloner(string wordDocumentFilePath)
        {
            FilePath =
                ZlpPathHelper.Combine(
                    Path.GetTempPath(),
                    $@"{Guid.NewGuid()}-{ZlpPathHelper.GetFileNameWithoutExtension(wordDocumentFilePath)}");

            ZlpSafeFileOperations.SafeCopyFile(
                wordDocumentFilePath,
                FilePath);
        }
コード例 #2
0
        public TemporaryFileCloner(string wordDocumentFilePath)
        {
            _tempFilePath =
                ZlpPathHelper.Combine(
                    Path.GetTempPath(),
                    string.Format(@"{0}-{1}",
                                  Guid.NewGuid(),
                                  ZlpPathHelper.GetFileNameWithoutExtension(wordDocumentFilePath)));

            ZlpSafeFileOperations.SafeCopyFile(
                wordDocumentFilePath,
                _tempFilePath,
                true);
        }
コード例 #3
0
        private void backupFiles()
        {
            lock (_backupLock)
            {
                foreach (var resxFile in _resxFiles)
                {
                    var bak = resxFile.FilePath;

                    // Delete old bak files
                    if (ZlpIOHelper.FileExists(bak.FullName + @".bak"))
                    {
                        // Remove ReadOnly-attribute.
                        removeReadOnlyAttributes(
                            new ZlpFileInfo(bak.FullName + @".bak"));
                        ZlpSafeFileOperations.SafeDeleteFile(bak + @".bak");
                    }

                    ZlpSafeFileOperations.SafeCopyFile(
                        resxFile.FilePath.FullName,
                        bak.FullName + @".bak");
                }
            }
        }
コード例 #4
0
 public static void SafeCopy(this ZlpFileInfo sourcePath, ZlpFileInfo dstFilePath, bool overwrite = true)
 {
     ZlpSafeFileOperations.SafeCopyFile(sourcePath, dstFilePath, overwrite);
 }
コード例 #5
0
 public static ZlpFileInfo SafeCopy(this ZlpFileInfo sourcePath, string dstFilePath, bool overwrite = true)
 {
     ZlpSafeFileOperations.SafeCopyFile(sourcePath, dstFilePath, overwrite);
     return(sourcePath);
 }