Mistři v programování na #hovnokod

Visual Basic #569

Public Overrides Sub OnViewInitialized()
            Dim userId As String = _guard.GetCurrentUserId()

            BindGroups()
            Bind()
            DoHackyStuff()
        End Sub

        Private Function GetUrls() As Dictionary(Of String, String)

            Dim dic As New Dictionary(Of String, String)
            For Each assembly In AppDomain.CurrentDomain.GetAssemblies()
                For Each type In assembly.GetTypes.Where(Function(q) q.FullName.EndsWith("Url"))
                    Dim url = CType(_container.GetByType(type), IUrl).Page
                    Dim name = type.FullName.Split(".".ToCharArray)

                    dic.Add(url, name.Reverse.First + ", " + name.Reverse.Skip(1).First)
                Next
            Next
            Return dic

        End Function

        Private Sub DoHackyStuff()

            Dim siteMap = _container.Get(Of ISiteMapGenerator)().GetSiteMap()
            Dim urls = GetUrls()

            Dim sb As New StringBuilder
            For Each top In siteMap.Nodes

                sb.AppendLine(String.Format("<top display-name=""{0}"" id=""{1}"">", top.Name, urls(top.Url)))
                For Each group In top.Nodes
                    sb.AppendLine(String.Format("<group display-name=""{0}"">", group.Name))
                    For Each item1 In group.Nodes
                        sb.AppendLine(String.Format("<item display-name=""{0}"" id=""{1}""/>", item1.Name, urls(item1.Url)))
                    Next
                    sb.Append("</group>")
                Next
                sb.Append("</top>")
            Next

        End Sub

HovnoKod,