mirror of
https://github.com/chylex/Code-Statistics.git
synced 2025-06-05 06:34:03 +02:00
Change TreeNode usage to Node in debug form to remove WinForms dependencies
This commit is contained in:
parent
c53f0a7eda
commit
bcc8dba7a0
CodeStatistics/Forms/Project
CodeStatisticsCore/Handling/Files
@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CodeStatistics.Data;
|
using CodeStatistics.Data;
|
||||||
using CodeStatistics.Handling;
|
using CodeStatistics.Handling;
|
||||||
|
using CodeStatisticsCore.Collections;
|
||||||
using CodeStatisticsCore.Handling;
|
using CodeStatisticsCore.Handling;
|
||||||
using CodeStatisticsCore.Handling.Files;
|
using CodeStatisticsCore.Handling.Files;
|
||||||
using CodeStatisticsCore.Input;
|
using CodeStatisticsCore.Input;
|
||||||
@ -64,11 +65,13 @@ namespace CodeStatistics.Forms.Project{
|
|||||||
if (item == null)return;
|
if (item == null)return;
|
||||||
|
|
||||||
AbstractLanguageFileHandler handler = GetLanguageHandler(item.File);
|
AbstractLanguageFileHandler handler = GetLanguageHandler(item.File);
|
||||||
|
|
||||||
SetTextBoxContents(handler.PrepareFileContents(item.File.Contents));
|
SetTextBoxContents(handler.PrepareFileContents(item.File.Contents));
|
||||||
|
|
||||||
treeViewData.Nodes.Clear();
|
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){
|
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);
|
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){
|
private static AbstractLanguageFileHandler GetLanguageHandler(File file){
|
||||||
return (AbstractLanguageFileHandler)HandlerList.GetFileHandler(file);
|
return (AbstractLanguageFileHandler)HandlerList.GetFileHandler(file);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
|
||||||
using CodeStatisticsCore.Collections;
|
using CodeStatisticsCore.Collections;
|
||||||
using CodeStatisticsCore.Handling.Utils;
|
using CodeStatisticsCore.Handling.Utils;
|
||||||
using CodeStatisticsCore.Input;
|
using CodeStatisticsCore.Input;
|
||||||
@ -90,7 +89,7 @@ namespace CodeStatisticsCore.Handling.Files{
|
|||||||
|
|
||||||
protected abstract object GetFileObject(FileIntValue fi, Variables.Root variables);
|
protected abstract object GetFileObject(FileIntValue fi, Variables.Root variables);
|
||||||
public abstract string PrepareFileContents(string contents);
|
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{
|
private class State{
|
||||||
public readonly TopElementList<FileIntValue> MaxLines = new TopElementList<FileIntValue>(8, FileIntValue.SortMax);
|
public readonly TopElementList<FileIntValue> MaxLines = new TopElementList<FileIntValue>(8, FileIntValue.SortMax);
|
||||||
|
Loading…
Reference in New Issue
Block a user