public static bool IsUncServerRootPath(string path, [NotNullWhen(true)] out string?normalizedPath) { normalizedPath = null; path = path._NonNullTrim(); path = WindowsPathParser.NormalizeDirectorySeparator(path); path = WindowsPathParser.RemoveLastSeparatorChar(path); if (path.StartsWith(@"\\")) { if (path.Length >= 3 && path[2] != '\\') { int r = path.IndexOf(@"\", 2); if (r == -1) { normalizedPath = path; return(true); } } } return(false); }
static string GenerateNewRepositoryDirName(string repoUrl) { repoUrl = repoUrl.Trim().ToLower(); string repoName = LinuxParser.GetFileNameWithoutExtension(LinuxParser.RemoveLastSeparatorChar(repoUrl)); DateTime now = DateTime.Now; for (int i = 1; ; i++) { string name = $"{Lfs.PathParser.MakeSafeFileName(repoName)}_{now.Year:D4}{now.Month:D2}{now.Day:D2}_{Env.ProcessId}_{i:D5}"; string fullPath = Lfs.PathParser.Combine(RepoDir, name); if (Lfs.IsDirectoryExists(fullPath) == false) { return(name); } } }