public static void CreateDirectory(string path) { var dirInf1 = new DirectoryInfo(path); dirInf1.Create(); Success?.Invoke($"{dirInf1.FullName} созданa!"); }
public static void DeleteFile(string path) { var fileInf2 = new FileInfo(path); fileInf2.Delete(); Success?.Invoke($"Фаил {fileInf2.FullName} удалён!"); }
public static void DeleteDirectory(string path) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; try { var dirInfo2 = new DirectoryInfo(path); if (!dirInfo2.Exists) { return; } dirInfo2.Delete(true); Success?.Invoke($"Каталог {dirInfo2.FullName} удален"); } catch (UnauthorizedAccessException ex) { Error?.Invoke(ex.Message); } }
public static void CopyDir(string path1, string path2) { var dirInf3 = new DirectoryInfo(path1); if (!dirInf3.Exists || Directory.Exists(path2) != false) { return; } dirInf3.MoveTo(path2); Success?.Invoke($"Каталог скопирован в {dirInf3.FullName}"); }
public static void CopyFile(string path1, string path2) { var fileInf3 = new FileInfo(path1); if (!fileInf3.Exists) { return; } fileInf3.CopyTo(path2, true); Success?.Invoke($"Фаил скопирован в {fileInf3.FullName}"); }
public static void CreateFile(string path) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; using var fileInf1 = File.Create(path); Success?.Invoke($"{fileInf1.Name} создан!"); }
public static void CreateDirectory(string path) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; var dirInf1 = new DirectoryInfo(path); dirInf1.Create(); Success?.Invoke($"{dirInf1.FullName} созданa!"); }
public static void DeleteFile(string path) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; var fileInf2 = new FileInfo(path); fileInf2.Delete(); Success?.Invoke($"Фаил {fileInf2.FullName} удалён!"); }
public static void DeleteDirectory(string path) { try { var dirInfo2 = new DirectoryInfo(path); if (!dirInfo2.Exists) { return; } dirInfo2.Delete(true); Success?.Invoke($"Каталог {dirInfo2.FullName} удален"); } catch (UnauthorizedAccessException ex) { Error?.Invoke(ex.Message); } }
public static void CopyDir(string path1, string path2) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; var dirInf3 = new DirectoryInfo(path1); if (!dirInf3.Exists || Directory.Exists(path2) != false) { return; } dirInf3.MoveTo(path2); Success?.Invoke($"Каталог скопирован в {dirInf3.FullName}"); }
public static void CopyFile(string path1, string path2) { var logger = new LogToFile(); Error += LogToConsole.Error; Error += logger.Error; Info += LogToConsole.Info; Info += logger.Info; Success += LogToConsole.Successfully; Success += logger.Successfully; var fileInf3 = new FileInfo(path1); if (!fileInf3.Exists) { return; } fileInf3.CopyTo(path2, true); Success?.Invoke($"Фаил скопирован в {fileInf3.FullName}"); }
public static void CreateFile(string path) { using var fileInf1 = File.Create(path); Success?.Invoke($"{fileInf1.Name} создан!"); }