public void TestDriveLetter() { Assert.IsTrue(ZlpIOHelper.DriveExists('C')); Assert.IsTrue(ZlpIOHelper.DriveExists('c')); Assert.IsFalse(ZlpIOHelper.DriveExists('Q')); Assert.IsFalse(ZlpIOHelper.DriveExists('q')); }
public void TestGeneral1() { // -- // Conversion between short and long paths. var lp1 = Assembly.GetEntryAssembly()?.Location; if (lp1 == null) { return; } var sp1 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetShortPath(lp1)); var lp2 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetLongPath(sp1)); var sp2 = ZlpIOHelper.ForceRemoveLongPathPrefix(ZlpPathHelper.GetShortPath(lp2)); Assert.AreEqual(lp1.ToLower(), lp2.ToLower()); Assert.AreEqual(sp1.ToLower(), sp2.ToLower()); // -- // Getting file sizes for short and long paths. var lengthA1 = new ZlpFileInfo(sp1).Length; var lengthA2 = new ZlpFileInfo(sp2).Length; var lengthB1 = new ZlpFileInfo(lp1).Length; var lengthB2 = new ZlpFileInfo(lp2).Length; Assert.AreEqual(lengthA1, lengthA2); Assert.AreEqual(lengthA1, lengthB1); Assert.AreEqual(lengthA1, lengthB2); }
private void checkTablesCreated() { if (!ZlpIOHelper.FileExists(databaseFilePath)) { // http://sqlite.phxsoftware.com/forums/t/77.aspx. SQLiteConnection.CreateFile(databaseFilePath); } if (!doesTableExist(@"ZreSettings")) { using var connection = new SQLiteConnection(connectionString); connection.Open(); new SQLiteCommand(connection) { CommandText = @"CREATE TABLE ZreSettings ( ID INTEGER PRIMARY KEY ASC, Value1, Value2, Value3, Value4 )" }.ExecuteNonQuery(); } }
private void baseFolderSelectButton_Click(object sender, EventArgs e) { using (var dialog = new ExtendedFolderBrowserDialog()) { dialog.Description = Resources.AddNewFileGroupForm_baseFolderSelectButton_Click_Please_select_the_base_folder_where_to_create_the_files_; var initialDir = ConvertHelper.ToString( PersistanceHelper.RestoreValue( MainForm.UserStorageIntelligent, @"filesInitialDir")); if (string.IsNullOrEmpty(initialDir) || !ZlpIOHelper.DirectoryExists(initialDir)) { var d = _project.ProjectConfigurationFilePath.Directory; initialDir = d.FullName; } dialog.SelectedPath = initialDir; dialog.ShowEditBox = true; if (dialog.ShowDialog(this) == DialogResult.OK) { PersistanceHelper.SaveValue( MainForm.UserStorageIntelligent, @"filesInitialDir", dialog.SelectedPath); baseFolderTextEdit.Text = dialog.SelectedPath; UpdateUI(); } } }
private void buttonShow_Click( object sender, EventArgs e) { var item = (ImageListBoxItem)itemsListView.SelectedItems[0]; var info = ((Pair <string, DecompressedItemInfo>)item.Value).Second; var tempFilePath = ZlpPathHelper.Combine( Path.GetTempPath(), info.FileName); if (ZlpIOHelper.FileExists(tempFilePath)) { ZlpIOHelper.DeleteFile(tempFilePath); } using (var sw = new StreamWriter(tempFilePath)) { sw.Write(info.DecompressedString); } _temporaryFilePathsToDelete.Add(tempFilePath); var processInfo = new ProcessStartInfo { UseShellExecute = true, FileName = tempFilePath }; Process.Start(processInfo); }
public NukeTask(IEnumerable <string> target, bool dirmode) { this.target = target.Select(f => f.TrimEnd('\\')).Where(t => ZlpIOHelper.DirectoryExists(t)).ToArray(); this.dirmode = dirmode; this.WritingVolume = ZlpPathHelper.GetPathRoot(this.target.First()).TrimEnd('\\'); this.Action = "Nuking folders"; }
public void TestCreateWithLimitedPermission() { // Only in development environment. if (Directory.Exists(@"\\nas001\Data\users\ukeim\Ablage\restricted\")) { if (true) { ZlpIOHelper.DeleteDirectoryContents(@"\\nas001\Data\users\ukeim\Ablage\restricted\", true); var dirInfo1 = new ZlpDirectoryInfo(@"\\nas001\Data\users\ukeim\Ablage\restricted\my\folder"); // Der Benutzer hat keine Rechte, um "restricted" zu erstellen, nur darin enthaltene. using (new ZlpImpersonator(@"small_user", @"office", @"ThisIsAnUnsecurePassword")) { Assert.DoesNotThrow(delegate { new DirectoryInfo(dirInfo1.FullName).Create(); }); } } if (true) { ZlpIOHelper.DeleteDirectoryContents(@"\\nas001\Data\users\ukeim\Ablage\restricted\", true); var dirInfo1 = new ZlpDirectoryInfo(@"\\nas001\Data\users\ukeim\Ablage\restricted\my\folder"); // Der Benutzer hat keine Rechte, um "restricted" zu erstellen, nur darin enthaltene. using (new ZlpImpersonator(@"small_user", @"office", @"ThisIsAnUnsecurePassword")) { Assert.DoesNotThrow(delegate { dirInfo1.Create(); }); } } } }
private void buttonStop_Click(object sender, EventArgs e) { if (this.InvokeRequired) { this.BeginInvoke(new Action(() => { buttonStart.Enabled = true; buttonStop.Enabled = false; })); } else { buttonStart.Enabled = true; buttonStop.Enabled = false; } try { RobotThread.Abort(); } catch { } RobotThread = null; try { if (ZlpIOHelper.DirectoryExists(UploadedPaths.TempPath)) { ZlpIOHelper.DeleteDirectory(UploadedPaths.TempPath, true); } } catch { } }
/// <summary> /// 確認目錄存在, 不存在時新增 /// </summary> /// <param name="path"></param> public static void DirectoryVerifyExistsAndCreate(string path) { if (!ZlpIOHelper.DirectoryExists(path)) { ZlpIOHelper.CreateDirectory(path); } }
private static void removeReadOnlyAttributes( ZlpFileInfo path) { ZlpIOHelper.SetFileAttributes( path.FullName, path.Attributes & ~ZetaLongPaths.Native.FileAttributes.Readonly); }
/// <summary> /// Handles the project on command line. /// </summary> /// <returns></returns> private bool handleProjectOnCommandLine() { var args = Environment.GetCommandLineArgs(); if (args.Length < 2) { return(false); } else { for (var index = 1; index < args.Length; index++) { var file = args[index]; if (string.Compare( Project.ProjectFileExtension, ZlpPathHelper.GetExtension(file), true) == 0 && ZlpIOHelper.FileExists(file)) { ProjectFilesControl.DoLoadProject(new ZlpFileInfo(file)); return(true); } } return(false); } }
public override void UpdateUI() { base.UpdateUI(); if (wizardControl.SelectedPage == importFileWizardPage) { wizardControl.SelectedPage.AllowNext = buttonOpen.Enabled = sourceFileTextEdit.Text.Trim().Length > 0 && Path.GetExtension(sourceFileTextEdit.Text.Trim().ToLowerInvariant()) == @".xlsx" && ZlpIOHelper.FileExists(sourceFileTextEdit.Text.Trim()); buttonOpen.Enabled = buttonOpen.Enabled && HasExcel; } else if (wizardControl.SelectedPage == fileGroupsWizardPage) { invertFileGroupsButton.Enabled = fileGroupsListBox.Items.Count > 0; selectNoFileGroupsButton.Enabled = fileGroupsListBox.CheckedItems.Count > 0; selectAllFileGroupsButton.Enabled = fileGroupsListBox.Items.Count > 0 && fileGroupsListBox.CheckedItems.Count < fileGroupsListBox.Items.Count; wizardControl.SelectedPage.AllowNext = fileGroupsListBox.CheckedItems.Count > 0; } else if (wizardControl.SelectedPage == languagesWizardPage) { invertLanguagesToExportButton.Enabled = languagesToImportCheckListBox.Items.Count > 0; selectNoLanguagesToExportButton.Enabled = languagesToImportCheckListBox.CheckedItems.Count > 0; selectAllLanguagesToExportButton.Enabled = languagesToImportCheckListBox.Items.Count > 0 && languagesToImportCheckListBox.CheckedItems.Count < languagesToImportCheckListBox.Items.Count; wizardControl.SelectedPage.AllowNext = languagesToImportCheckListBox.CheckedItems.Count > 0; } else if (wizardControl.SelectedPage == progressWizardPage) { } else if (wizardControl.SelectedPage == errorOccurredWizardPage) { } else if (wizardControl.SelectedPage == successWizardPage) { } else { throw new Exception(); } }
/// <summary> /// 強制刪除檔案 (排除因檔案唯讀刪除失敗問題) /// </summary> /// <param name="path"></param> public static void FileForceDelete(string path) { if (ZlpIOHelper.FileExists(path)) { var fileinfo = new ZlpFileInfo(path); fileinfo.Attributes = ZetaLongPaths.Native.FileAttributes.Normal; fileinfo.Delete(); } ; }
private void AboutForm_Load( object sender, EventArgs e) { CenterToParent(); label4.Text = label4.Text. Replace(@"{VersionNo}", Assembly.GetExecutingAssembly().GetName().Version.ToString()). Replace(@"{BuildDate}", ZlpIOHelper.GetFileLastWriteTime(Assembly.GetExecutingAssembly().Location).ToString(@"g")); }
public void TestFolderVsFile() { Assert.IsTrue(ZlpIOHelper.FileExists(@"c:\Windows\notepad.exe")); Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\dslfsdjklfhsd\kjsaklfjd.exe")); Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\Windows")); Assert.IsFalse(ZlpIOHelper.FileExists(@"c:\Windows\")); Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\Windows\notepad.exe")); Assert.IsTrue(ZlpIOHelper.DirectoryExists(@"c:\Windows")); Assert.IsTrue(ZlpIOHelper.DirectoryExists(@"c:\Windows\")); Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\fkjhskfsdhfjkhsdjkfhsdkjfh")); Assert.IsFalse(ZlpIOHelper.DirectoryExists(@"c:\fkjhskfsdhfjkhsdjkfhsdkjfh\")); }
private void openButton_ItemClick(object sender, ItemClickEventArgs e) { if (!string.IsNullOrEmpty(locationTextBox.Text) && ZlpIOHelper.DirectoryExists(locationTextBox.Text)) { var sei = new ShellExecuteInformation { FileName = locationTextBox.Text }; sei.Execute(); } }
public void TestCodePlex() { // http://zetalongpaths.codeplex.com/discussions/396147 const string directoryPath = @"c:\1234567890123456789012345678901234567890"; const string filePath = @"c:\1234567890123456789012345678901234567890\1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345.jpg"; Assert.DoesNotThrow(() => ZlpIOHelper.CreateDirectory(directoryPath)); Assert.DoesNotThrow(() => ZlpIOHelper.WriteAllText(filePath, @"test")); Assert.DoesNotThrow(() => ZlpIOHelper.DeleteFile(filePath)); Assert.DoesNotThrow(() => ZlpIOHelper.DeleteDirectory(directoryPath, true)); }
/// <summary> /// Update UI states, based on the state of the current selection, etc. /// </summary> public override void UpdateUI() { base.UpdateUI(); buttonOK.Enabled = !string.IsNullOrEmpty(locationTextBox.Text) && ZlpIOHelper.DirectoryExists(locationTextBox.Text) && !string.IsNullOrEmpty(nameTextBox.Text.Trim()) && nameTextBox.Text.Trim().IndexOfAny(Path.GetInvalidFileNameChars()) < 0 && !ProjectConfigurationFilePath.Exists; openButton.Enabled = !string.IsNullOrEmpty(locationTextBox.Text) && ZlpIOHelper.DirectoryExists(locationTextBox.Text); }
/// <summary> /// Creates a new instance of the file cloner class, automatically /// creating a temporary copy of the passed file. /// </summary> /// <param name="content">The content to write.</param> public ZetaTemporaryFileCreator( string content) { FilePath = ZlpPathHelper.Combine( Path.GetTempPath(), string.Format(@"{0}.txt", Guid.NewGuid())); ZlpIOHelper.WriteAllText(FilePath, content ?? string.Empty); //using (var f = File.CreateText(FilePath)) //{ // f.Write(content ?? string.Empty); //} }
public static string[] DetectLanguagesFromExcelFile( string filePath) { if (string.IsNullOrEmpty(filePath) || StringExtensionMethods.ToLowerInvariantIntelligent(ZlpPathHelper.GetExtension(filePath)) != @".xlsx" || !ZlpIOHelper.FileExists(filePath)) { return(null); } else { using var tfc = new TemporaryFileCloner(filePath); var wb = CoreExcelImporter.ImportExcelFromFile(tfc.FilePath); return(detectLanguagesFromWorkbook(wb)); } }
private IEnumerable <FileJob> GetFiles(string f, string source, string target) { if (ZlpIOHelper.DirectoryExists(f)) { ZlpDirectoryInfo dir = new ZlpDirectoryInfo(f); foreach (var item in GetFiles(dir, source, target)) { yield return(item); } } else if (ZlpIOHelper.FileExists(f)) { ZlpFileInfo file = new ZlpFileInfo(f); yield return(new FileJob(file, new ZlpFileInfo(replacedir(f, source, target)), copyType, CheckCancel)); } }
public void TestAttributes() { var tempFolder = Environment.ExpandEnvironmentVariables("%temp%"); Assert.True(ZlpIOHelper.DirectoryExists(tempFolder)); var tempPath = ZlpPathHelper.Combine(tempFolder, "ZlpTest"); try { ZlpIOHelper.CreateDirectory(tempPath); Assert.IsTrue(ZlpIOHelper.DirectoryExists(tempPath)); var filePath = ZlpPathHelper.Combine(tempPath, "text.attributes.tests"); using (var fileHandle = ZlpIOHelper.CreateFileHandle( filePath, CreationDisposition.CreateAlways, FileAccess.GenericWrite | FileAccess.GenericRead, FileShare.None)) using (var textStream = new StreamWriter(new FileStream(fileHandle, System.IO.FileAccess.Write))) { textStream.WriteLine("Zeta Long Attribute Extended testing..."); textStream.Flush(); //textStream.Close(); //fileHandle.Close(); } Assert.IsTrue(ZlpIOHelper.FileExists(filePath)); // -- var now = DateTime.Now; Assert.DoesNotThrow(delegate { ZlpIOHelper.SetFileLastAccessTime(filePath, now); }); Assert.DoesNotThrow(delegate { ZlpIOHelper.SetFileLastWriteTime(filePath, now); }); Assert.DoesNotThrow(delegate { ZlpIOHelper.SetFileCreationTime(filePath, now); }); Assert.AreEqual(ZlpIOHelper.GetFileLastAccessTime(filePath), now); Assert.AreEqual(ZlpIOHelper.GetFileLastWriteTime(filePath), now); Assert.AreEqual(ZlpIOHelper.GetFileCreationTime(filePath), now); } finally { ZlpIOHelper.DeleteDirectory(tempPath, true); } }
private static void doTest01() { try { Console.WriteLine(); Console.WriteLine(); const string longFileOnC = @"C:\Ablage\test-only\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\LalalaC.txt"; var f1 = new ZlpFileInfo(longFileOnC); f1.Directory.Create(); f1.WriteAllText("lalala."); Console.WriteLine($"f1.FullName.Length: {f1.FullName.Length}"); const string longFileOnD = @"D:\Ablage\test-only\Ablage2\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\Ablage\LalalaD.txt"; var f2 = new ZlpFileInfo(longFileOnD); f2.Directory.Create(); //f1.MoveTo(f2, true); Console.WriteLine($"f2.FullName.Length: {f2.FullName.Length}"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("sourceFile:"); Console.WriteLine(f1.FullName); Console.WriteLine(); Console.WriteLine("destinationFile:"); Console.WriteLine(f2.FullName); ZlpIOHelper.MoveFile(f1.FullName, f2.FullName, true); } finally { Console.WriteLine(); const string cAblageTestOnly = @"C:\Ablage\test-only\"; new ZlpDirectoryInfo(cAblageTestOnly).Delete(true); Console.WriteLine($"deleted: {cAblageTestOnly}"); const string dAblageTestOnly = @"D:\Ablage\test-only\"; new ZlpDirectoryInfo(dAblageTestOnly).Delete(true); Console.WriteLine($"deleted: {dAblageTestOnly}"); } }
//private void FastResume(ZlpFileInfo file, ZlpFileInfo destination, Action<long> progresscallback, int bufferSize) //{ // byte[] buffer = new byte[bufferSize], buffer2 = new byte[bufferSize]; // byte[] buffer3 = new byte[bufferSize], buffer4 = new byte[bufferSize]; // bool swap = false; // int read; // long len = file.Length; // Task writer = null; // Task<bool> lastcomp = null; // using (var source = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, FileOptions.SequentialScan)) // using (var dest = new FileStream(destination.FullName, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, bufferSize, FileOptions.SequentialScan)) // { // dest.SetLength(source.Length); // bool writing = false; // for (long size = 0; size < len; size += read) // { // if (CheckCancel()) { return; } // progresscallback?.Invoke(size); // if (!writing) // { // swap = !swap; // var b1 = source.ReadAsync(swap ? buffer : buffer3, 0, bufferSize); // var b2 = dest.ReadAsync(swap ? buffer2 : buffer4, 0, bufferSize); // Task.WhenAll(b1, b2).Wait(); // if ((read = b1.Result) != b2.Result) { return false; } // lastcomp?.Wait(); // if (lastcomp != null && !lastcomp.Result) { return false; } // lastcomp = ByteArrayCompareAsync(swap ? buffer : buffer3, swap ? buffer2 : buffer4, b1.Result); // } // else // { // read = source.Read(swap ? buffer : buffer2, 0, bufferSize); // writer?.Wait(); // writer = dest.WriteAsync(swap ? buffer : buffer2, 0, read); // swap = !swap; // } // } // lastcomp?.Wait(); // if (lastcomp != null && !lastcomp.Result) { return false; } // writer?.Wait(); // } //} private void Rename() { var path = Target.FullName; var dir = ZlpPathHelper.GetDirectoryPathNameFromFilePath(path); var name = ZlpPathHelper.GetFileNameWithoutExtension(path); var ext = ZlpPathHelper.GetExtension(path); for (int i = 1; i < 100; i++) { var n = ZlpPathHelper.Combine(dir, $"{name}({i}){ext}"); if (!ZlpIOHelper.FileExists(n)) { Target = new ZlpFileInfo(n); return; } } Target = null; }
/// <summary> /// Loads the recent files. /// </summary> public void LoadRecentFiles( Project project) { CloseAllDocuments(); if (project == null) { var text = PersistanceHelper.RestoreValue( MainForm.UserStorageIntelligent, @"RecentFiles") as string; if (!string.IsNullOrEmpty(text)) { foreach (var filePathsRaw in text.Split( new[] { @"###***###" }, StringSplitOptions.RemoveEmptyEntries)) { var filePaths = new List <ZlpFileInfo>(); foreach (var filePath in filePathsRaw.Split(';')) { if (ZlpIOHelper.FileExists(filePath)) { filePaths.Add(new ZlpFileInfo(filePath)); } } DoLoadFiles( // TODO: Possible modify this function. FileGroup.CheckCreate( MainForm.Current.ProjectFilesControl.Project ?? Project.Empty, filePaths.ToArray()), MainForm.Current.ProjectFilesControl.Project ?? Project.Empty); } } } else { foreach (var d in project.GetProjectMruItems()) { DoLoadFiles(d, project); } } }
static async Task <TebyanMovieModel> GetDownloadLink(string pageUrl) { return(await Task.Run(() => { TebyanMovieModel model = new TebyanMovieModel { PageUrl = pageUrl }; string tempFilePath = ZlpPathHelper.Combine(UploadedPaths.TempPath, string.Format("{0}.html", Guid.NewGuid())); Aria2CDownloader.DownloadFile(pageUrl, tempFilePath, "", null); if (!ZlpIOHelper.FileExists(tempFilePath)) { return model; } var htmlDocument = new HtmlDocument(); htmlDocument.Load(tempFilePath, Encoding.UTF8); var titleTag = htmlDocument.DocumentNode.Descendants("title").FirstOrDefault(); if (titleTag == null) { return model; } var downloadLink = htmlDocument.DocumentNode.Descendants("a") .FirstOrDefault(q => q.Attributes != null && q.Attributes["class"] != null && q.Attributes["class"].Value.IndexOf("DownloadFilm", StringComparison.InvariantCultureIgnoreCase) > -1); if (downloadLink == null) { return model; } model.IsSuccess = true; model.PageUrl = pageUrl; model.DownloadUrl = downloadLink.GetAttributeValue("href", ""); model.Title = string.Format("{0}, {1}", titleTag.InnerText.Trim(), downloadLink.GetAttributeValue("title", "")); return model; })); }
private void ReportIssueForm_FormClosing( object sender, FormClosingEventArgs e) { PersistanceHelper.SaveValue( @"ReportIssueForm.emailAddressTextBox.Text", emailAddressTextBox.Text); PersistanceHelper.SaveValue( @"ReportIssueForm.additionalRemarksTextBox.Text", additionalRemarksTextBox.Text); WinFormsPersistanceHelper.SaveState(this); foreach (var tempFilePath in _temporaryFilePathsToDelete) { if (ZlpIOHelper.FileExists(tempFilePath)) { ZlpIOHelper.DeleteFile(tempFilePath); } } }
public static bool GetBackup() { var backupPathAttribute = GetRootElement().Attribute(nameof(SettingsModel.BackupPath)); if (string.IsNullOrWhiteSpace(backupPathAttribute?.Value)) { return(false); } var backupPath = backupPathAttribute.Value; if (!ZlpIOHelper.DirectoryExists(backupPath)) { return(false); } var persianDateTimeNow = PersianDateTime.Now; var backupFileName = $"WorkingHourDb {persianDateTimeNow.ToShortDateInt()}.xml"; var dataBaseBackupPath = ZlpPathHelper.Combine(backupPathAttribute.Value, $"/{backupFileName}"); ZlpIOHelper.CopyFile(DataBasePath, dataBaseBackupPath, true); return(true); }
static void Main(string[] args) { //var listFileByte = new List<byte[]>(); //var listFile = new List<string> { @"D:\TestCallPdf\1.pdf", @"D:\TestCallPdf\2.pdf" }; //string fileName = Guid.NewGuid().ToString().Replace("-", "") + ".pdf"; //var pathResult = Path.Combine(@"D:\TestCallPdf\", fileName); //Merge(listFile, pathResult); //foreach (var item in listFile) //{ // listFileByte.Add(GetByteFromFile(item)); //} //var bytesResult = MergePdf.CombineMultiplePdfsByByte(listFileByte); ZlpIOHelper.CopyFile(Path.Combine(@"D:\Idaho\Letter", "Unable to Process.pdf"), Path.Combine(@"D:\SorceCompany\Idaho\Development\Branches\Dev\LibrisWeb\Resources\PrepForms", "Configuration ManagementConfiguration ManagementConfiguration ManagementConfiguration ManagementConfiguration ManagementConfiguration ManagementConfiguration ManagementConfiguration ManagementConfigur.pdf"), true); Console.WriteLine("Success!!! "); Console.ReadKey(); }
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"); } } }