1
0
mirror of https://github.com/chylex/Code-Statistics.git synced 2025-07-26 04:59:07 +02:00

Rework abstract handlers into interfaces

This commit is contained in:
chylex 2016-02-17 14:19:58 +01:00
parent ab62b6e676
commit f27f4aed5e
5 changed files with 32 additions and 14 deletions

View File

@ -74,12 +74,14 @@
<Compile Include="Handlers\Objects\Java\Tabs\JavaNamesTab.cs" />
<Compile Include="Handlers\Objects\Java\Tabs\JavaPrimitivesTab.cs" />
<Compile Include="Handlers\Objects\Java\Tabs\JavaSyntaxTab.cs" />
<Compile Include="Handling\IFolderHandler.cs" />
<Compile Include="Handling\General\AssetHandler.cs" />
<Compile Include="Handling\General\UnknownHandler.cs" />
<Compile Include="Handling\Languages\JavaHandler.cs" />
<Compile Include="Handling\ParseUtils.cs" />
<Compile Include="Handlers\ProjectAnalyzer.cs" />
<Compile Include="Handling\FileHandler.cs" />
<Compile Include="Handling\IFileHandler.cs" />
<Compile Include="Handling\HandlerList.cs" />
<Compile Include="Handling\Variables.cs" />
<Compile Include="Input\File.cs" />
<Compile Include="Input\FileSearch.cs" />

View File

@ -1,13 +0,0 @@
using CodeStatistics.Input;
namespace CodeStatistics.Handling{
abstract class FileHandler{
public abstract int Weight { get; }
public bool IsFileValid(File file){
return true;
}
public abstract void Process(File file, Variables.Root variables);
}
}

View File

@ -0,0 +1,16 @@
using CodeStatistics.Handling.General;
using System.Collections.Generic;
namespace CodeStatistics.Handling{
class HandlerList{
public interface IWeightedEntry{
int Weight { get; }
}
private static readonly Dictionary<string,IFileHandler> fileHandlers = new Dictionary<string,IFileHandler>(8);
private static readonly List<IFolderHandler> folderHandlers = new List<IFolderHandler>(1);
static HandlerList(){
}
}
}

View File

@ -0,0 +1,8 @@
using CodeStatistics.Input;
namespace CodeStatistics.Handling{
interface IFileHandler : HandlerList.IWeightedEntry{
bool IsFileValid(File file);
void Process(File file, Variables.Root variables);
}
}

View File

@ -0,0 +1,5 @@
namespace CodeStatistics.Handling{
interface IFolderHandler : HandlerList.IWeightedEntry{
void Process(string folder, Variables.Root variables);
}
}