AcTools.Utils.FileUtils.IsAffected C# (CSharp) 메소드

IsAffected() 공개 정적인 메소드

Is A in any way a parent of B?
public static IsAffected ( [ parent, [ child ) : bool
parent [ For example, “C:\Windows”
child [ For example, “c:/windows/system32”
리턴 bool
        public static bool IsAffected([NotNull] string parent, [NotNull] string child) {
            if (parent == null) throw new ArgumentNullException(nameof(parent));
            if (child == null) throw new ArgumentNullException(nameof(child));

            parent = parent.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
            child = child.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);

            if (string.Equals(parent, child, StringComparison.OrdinalIgnoreCase)) return true;

            var s = child.SubstringExt(parent.Length);
            return s.Length > 0 && s[0] == Path.DirectorySeparatorChar;
        }