Пример #1
0
        private static void RunMarkdownReplacementsOnName(DashboardInfo_Widget1 widget, AppConfig appConfig)
        {
            if (widget.isNameConfigurable)
            {
                var findIndex = widget.name.IndexOf(appConfig.SourceTeamName, StringComparison.InvariantCultureIgnoreCase);
                if (findIndex > -1 && !appConfig.SourceAsProject && !appConfig.TargetAsProject)
                {
                    widget.name = widget.name.Remove(findIndex, appConfig.SourceTeamName.Length);
                    widget.name = widget.name.Insert(findIndex, appConfig.TargetTeamName);
                }

                if (appConfig.MarkdownFindAndReplace != null)
                {
                    foreach (var item in appConfig.MarkdownFindAndReplace)
                    {
                        if (!string.IsNullOrEmpty(item.Find) && !string.IsNullOrEmpty(item.Replace))
                        {
                            findIndex = widget.name.IndexOf(item.Find, StringComparison.InvariantCultureIgnoreCase);
                            while (findIndex > -1)
                            {
                                widget.name = widget.name.Remove(findIndex, item.Find.Length);
                                widget.name = widget.name.Insert(findIndex, item.Replace);
                                findIndex   = widget.name.IndexOf(item.Find, findIndex + item.Replace.Length, StringComparison.InvariantCultureIgnoreCase);
                            }
                        }
                    }
                }
            }
        }
Пример #2
0
        private static string GetWidgetPositionDisplay(DashboardInfo_Widget1 widget)
        {
            var display = widget.position.row.ToString();

            if (widget.size.rowSpan > 1)
            {
                display += $"-{widget.position.row + widget.size.rowSpan - 1 }";
            }
            display += $",{widget.position.column}";
            if (widget.size.columnSpan > 1)
            {
                display += $"-{widget.position.column + widget.size.columnSpan - 1 }";
            }
            return(display);
        }