This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Stanislav_Mykhailenko/Lesson_5/Task_1/Classes/Validation.cs
Stanislav Mykhailenko 42aebfd7c7
Update Lesson 5 Task 1
2023-04-11 22:59:46 +03:00

20 lines
531 B
C#

namespace Lesson5.Classes;
using Lesson5.Interfaces;
public class Validation : IValidation
{
public static string Check(string source, string destination)
{
if (File.Exists(destination))
throw new PathConflictException();
if (Directory.Exists(destination))
destination = Path.Combine(destination, Path.GetFileName(source));
if (File.Exists(destination) || Directory.Exists(destination))
throw new PathConflictException();
return destination;
}
}