示例#1
0
        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);
                }
            }
        }