Beispiel #1
0
        public static string Format(string text)
        {
            var customRepoPath = WindowTitleSettings.RepositoryPath;

            _Tags[BranchKey] = GetBranchName();
            if (string.IsNullOrEmpty(customRepoPath))
            {
                GitUtility.TryFindRepositoryDirUpwards(ProjectPath, out customRepoPath);
            }

            if (!string.IsNullOrEmpty(customRepoPath))
            {
                _Tags[RepoPathKey] = Path.GetFullPath(customRepoPath).TrimEnd(Path.DirectorySeparatorChar);
            }
            _Tags[RepoDirNameKey] = GetRepoDirName();
            foreach (var kvp in _Tags)
            {
                text = text.Replace(kvp.Key, kvp.Value);
            }

            return(text);
        }