public TemporaryFileCloner(string wordDocumentFilePath) { FilePath = ZlpPathHelper.Combine( Path.GetTempPath(), $@"{Guid.NewGuid()}-{ZlpPathHelper.GetFileNameWithoutExtension(wordDocumentFilePath)}"); ZlpSafeFileOperations.SafeCopyFile( wordDocumentFilePath, FilePath); }
public TemporaryFileCloner(string wordDocumentFilePath) { _tempFilePath = ZlpPathHelper.Combine( Path.GetTempPath(), string.Format(@"{0}-{1}", Guid.NewGuid(), ZlpPathHelper.GetFileNameWithoutExtension(wordDocumentFilePath))); ZlpSafeFileOperations.SafeCopyFile( wordDocumentFilePath, _tempFilePath, true); }
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"); } } }
public static void SafeCopy(this ZlpFileInfo sourcePath, ZlpFileInfo dstFilePath, bool overwrite = true) { ZlpSafeFileOperations.SafeCopyFile(sourcePath, dstFilePath, overwrite); }
public static ZlpFileInfo SafeCopy(this ZlpFileInfo sourcePath, string dstFilePath, bool overwrite = true) { ZlpSafeFileOperations.SafeCopyFile(sourcePath, dstFilePath, overwrite); return(sourcePath); }