コード例 #1
0
ファイル: CourseManager.cs プロジェクト: kontur-edu/uLearn
		private FileSystemInfo GetNewPathForFileAfterMoving(FileSystemInfo file, DirectoryInfo sourceDirectory, DirectoryInfo destinationDirectory)
		{
			if (!file.IsInDirectory(sourceDirectory))
				return file;

			var relativePath = file.GetRelativePath(sourceDirectory.FullName);
			var newPath = Path.Combine(destinationDirectory.FullName, relativePath);

			if (file is DirectoryInfo)
				return new DirectoryInfo(newPath);
			return new FileInfo(newPath);
		}