diff --git a/CodeStatistics/Forms/Project/ProjectDebugForm.cs b/CodeStatistics/Forms/Project/ProjectDebugForm.cs index 694170d..ac2d0cb 100644 --- a/CodeStatistics/Forms/Project/ProjectDebugForm.cs +++ b/CodeStatistics/Forms/Project/ProjectDebugForm.cs @@ -6,6 +6,7 @@ using System.Runtime.InteropServices; using System.Windows.Forms; using CodeStatistics.Data; using CodeStatistics.Handling; +using CodeStatisticsCore.Collections; using CodeStatisticsCore.Handling; using CodeStatisticsCore.Handling.Files; using CodeStatisticsCore.Input; @@ -64,11 +65,13 @@ namespace CodeStatistics.Forms.Project{ if (item == null)return; AbstractLanguageFileHandler handler = GetLanguageHandler(item.File); - SetTextBoxContents(handler.PrepareFileContents(item.File.Contents)); treeViewData.Nodes.Clear(); - foreach(TreeNode node in handler.GenerateTreeViewData(GenerateVariables(item.File), item.File))treeViewData.Nodes.Add(node); + + foreach(Node node in handler.GenerateTreeViewData(GenerateVariables(item.File), item.File)){ + treeViewData.Nodes.Add(ConvertNode(node)); + } } private void btnLoadOriginal_Click(object sender, EventArgs e){ @@ -99,6 +102,16 @@ namespace CodeStatistics.Forms.Project{ textBoxCode.Text = text.Replace("\r", "").Replace("\n", Environment.NewLine); } + private static TreeNode ConvertNode(Node node){ + TreeNode treeNode = new TreeNode(node.Text); + + foreach(Node childNode in node.Children){ + treeNode.Nodes.Add(ConvertNode(childNode)); + } + + return treeNode; + } + private static AbstractLanguageFileHandler GetLanguageHandler(File file){ return (AbstractLanguageFileHandler)HandlerList.GetFileHandler(file); } diff --git a/CodeStatisticsCore/Handling/Files/AbstractLanguageFileHandler.cs b/CodeStatisticsCore/Handling/Files/AbstractLanguageFileHandler.cs index 15e8bfa..12dea0f 100644 --- a/CodeStatisticsCore/Handling/Files/AbstractLanguageFileHandler.cs +++ b/CodeStatisticsCore/Handling/Files/AbstractLanguageFileHandler.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Windows.Forms; using CodeStatisticsCore.Collections; using CodeStatisticsCore.Handling.Utils; using CodeStatisticsCore.Input; @@ -90,7 +89,7 @@ namespace CodeStatisticsCore.Handling.Files{ protected abstract object GetFileObject(FileIntValue fi, Variables.Root variables); public abstract string PrepareFileContents(string contents); - public abstract IEnumerable<TreeNode> GenerateTreeViewData(Variables.Root variables, File file); + public abstract IEnumerable<Node> GenerateTreeViewData(Variables.Root variables, File file); private class State{ public readonly TopElementList<FileIntValue> MaxLines = new TopElementList<FileIntValue>(8, FileIntValue.SortMax);