|
123456789101112131415161718192021222324252627282930313233343536 |
- using SIE.IVSDK.Services;
- using System;
- using System.IO;
- using System.Text.RegularExpressions;
-
- namespace SIE.VSDK.Services
- {
- public class PathService : IPathService
- {
- public bool IsValidPath(string path, bool allowRelativePaths = false)
- {
- bool isValid = true;
-
- try
- {
- string fullPath = Path.GetFullPath(path);
-
- if (allowRelativePaths)
- {
- isValid = Path.IsPathRooted(path);
- }
- else
- {
- string root = Path.GetPathRoot(path);
- isValid = string.IsNullOrEmpty(root.Trim(new char[] { '\\', '/' })) == false;
- }
- }
- catch (Exception ex)
- {
- isValid = false;
- }
-
- return isValid;
- }
- }
- }
|