From fbc06f217a74f904f4e8c876ac28f4d642123fc8 Mon Sep 17 00:00:00 2001 From: yakovypg Date: Fri, 1 Jul 2022 21:11:32 +0300 Subject: [PATCH] Cleaned the code --- core/IndexEngine/Containers/ActiveDate.cs | 4 +--- core/IndexEngine/Containers/ActiveDateParser.cs | 7 +------ core/IndexEngine/Containers/DynamicMessage.cs | 3 --- core/IndexEngine/Containers/Project.cs | 6 +----- core/IndexEngine/Data/Paths/ProjectData.cs | 2 -- core/IndexEngine/Data/Paths/ProjectInfo.cs | 2 -- core/IndexEngine/Data/Paths/ToolInfo.cs | 7 ++----- core/IndexEngine/Indexes/Index.cs | 4 +--- core/IndexEngine/Indexes/IndexHelper.cs | 6 +----- core/IndexEngine/Indexes/SituationIndex.cs | 4 ---- core/IndexEngine/Indexes/TagsetIndex.cs | 3 --- core/IndexEngine/Indexes/UserDictsIndex.cs | 6 +----- core/IndexEngine/Search/LuceneService.cs | 3 --- core/IndexEngine/Search/NGramAnalyzer.cs | 1 - core/IndexEngine/Search/RakeAlgorithm.cs | 5 +---- 15 files changed, 9 insertions(+), 54 deletions(-) diff --git a/core/IndexEngine/Containers/ActiveDate.cs b/core/IndexEngine/Containers/ActiveDate.cs index 676c310..a599bcd 100644 --- a/core/IndexEngine/Containers/ActiveDate.cs +++ b/core/IndexEngine/Containers/ActiveDate.cs @@ -1,6 +1,4 @@ -using System; - -namespace IndexEngine.Containers +namespace IndexEngine.Containers { // Do not use MessageId in the Equals(), GetHashCode(), operator==() diff --git a/core/IndexEngine/Containers/ActiveDateParser.cs b/core/IndexEngine/Containers/ActiveDateParser.cs index ecb95f9..dd3a26e 100644 --- a/core/IndexEngine/Containers/ActiveDateParser.cs +++ b/core/IndexEngine/Containers/ActiveDateParser.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace IndexEngine.Containers +namespace IndexEngine.Containers { public static class ActiveDateParser { diff --git a/core/IndexEngine/Containers/DynamicMessage.cs b/core/IndexEngine/Containers/DynamicMessage.cs index 95f9d22..1b0b718 100644 --- a/core/IndexEngine/Containers/DynamicMessage.cs +++ b/core/IndexEngine/Containers/DynamicMessage.cs @@ -1,9 +1,6 @@ using IndexEngine.Data.Paths; using IndexEngine.Indexes; using Lucene.Net.Documents; -using System; -using System.Collections.Generic; -using System.Linq; namespace IndexEngine.Containers { diff --git a/core/IndexEngine/Containers/Project.cs b/core/IndexEngine/Containers/Project.cs index e178c0e..ade1131 100644 --- a/core/IndexEngine/Containers/Project.cs +++ b/core/IndexEngine/Containers/Project.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; - -namespace IndexEngine.Containers +namespace IndexEngine.Containers { public class Project { diff --git a/core/IndexEngine/Data/Paths/ProjectData.cs b/core/IndexEngine/Data/Paths/ProjectData.cs index eb002a0..0d55f4d 100644 --- a/core/IndexEngine/Data/Paths/ProjectData.cs +++ b/core/IndexEngine/Data/Paths/ProjectData.cs @@ -1,7 +1,5 @@ using CSharpTest.Net.Collections; using IndexEngine.Containers; -using System; -using System.Collections.Generic; using System.Drawing; namespace IndexEngine.Data.Paths diff --git a/core/IndexEngine/Data/Paths/ProjectInfo.cs b/core/IndexEngine/Data/Paths/ProjectInfo.cs index 0fc5457..3629eb4 100644 --- a/core/IndexEngine/Data/Paths/ProjectInfo.cs +++ b/core/IndexEngine/Data/Paths/ProjectInfo.cs @@ -1,7 +1,5 @@ using IndexEngine.Containers; using IndexEngine.Indexes; -using System.Collections.Generic; -using System.IO; using System.Reflection; namespace IndexEngine.Data.Paths diff --git a/core/IndexEngine/Data/Paths/ToolInfo.cs b/core/IndexEngine/Data/Paths/ToolInfo.cs index d0908ea..72032a3 100644 --- a/core/IndexEngine/Data/Paths/ToolInfo.cs +++ b/core/IndexEngine/Data/Paths/ToolInfo.cs @@ -1,7 +1,4 @@ -using System; -using System.IO; - -namespace IndexEngine.Data.Paths +namespace IndexEngine.Data.Paths { public static class ToolInfo { @@ -16,7 +13,7 @@ public static class ToolInfo public static string ExtractorConfigPath { get; private set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\CCA\extractorconfig.txt"; public static string HistogramsPath { get; private set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\CCA\histograms.json"; - + public static string RecentProjectsPath { get; private set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\CCA\recentprojects.txt"; public static string TagsetColorIndexPath { get; private set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\CCA\tagsetscolors.txt"; public static string UserDictsPath { get; private set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\CCA\user_dicts.txt"; diff --git a/core/IndexEngine/Indexes/Index.cs b/core/IndexEngine/Indexes/Index.cs index 5b1982f..0b34bd0 100644 --- a/core/IndexEngine/Indexes/Index.cs +++ b/core/IndexEngine/Indexes/Index.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -namespace IndexEngine.Indexes +namespace IndexEngine.Indexes { public interface IIndex : IUnloadable { diff --git a/core/IndexEngine/Indexes/IndexHelper.cs b/core/IndexEngine/Indexes/IndexHelper.cs index 6001154..cc207d4 100644 --- a/core/IndexEngine/Indexes/IndexHelper.cs +++ b/core/IndexEngine/Indexes/IndexHelper.cs @@ -4,11 +4,7 @@ using IndexEngine.Search; using Lucene.Net.Documents; using SoftCircuits.CsvParser; -using System; -using System.Collections.Generic; using System.Drawing; -using System.IO; -using System.Linq; using Wintellect.PowerCollections; namespace IndexEngine.Indexes @@ -432,7 +428,7 @@ public static int PopulateIndex(string filePath, string[] allFields, bool header //TODO: Still need to redesign this. Rework storing/indexing paradigm. } - + LuceneService.Writer.AddDocument(document); if (count % PERIOD_OF_SAVING_INTERMEDIATE_RESULTS_OF_POPULATING_INDEX == 0) diff --git a/core/IndexEngine/Indexes/SituationIndex.cs b/core/IndexEngine/Indexes/SituationIndex.cs index 9d90545..efb62b3 100644 --- a/core/IndexEngine/Indexes/SituationIndex.cs +++ b/core/IndexEngine/Indexes/SituationIndex.cs @@ -1,9 +1,5 @@ using IndexEngine.Data.Paths; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; namespace IndexEngine.Indexes { diff --git a/core/IndexEngine/Indexes/TagsetIndex.cs b/core/IndexEngine/Indexes/TagsetIndex.cs index b70054e..b2a7bd8 100644 --- a/core/IndexEngine/Indexes/TagsetIndex.cs +++ b/core/IndexEngine/Indexes/TagsetIndex.cs @@ -2,10 +2,7 @@ using CSharpTest.Net.Collections; using IndexEngine.Data.Paths; using Newtonsoft.Json; -using System; -using System.Collections.Generic; using System.Drawing; -using System.IO; namespace IndexEngine.Indexes { diff --git a/core/IndexEngine/Indexes/UserDictsIndex.cs b/core/IndexEngine/Indexes/UserDictsIndex.cs index 9ab20f1..32548a2 100644 --- a/core/IndexEngine/Indexes/UserDictsIndex.cs +++ b/core/IndexEngine/Indexes/UserDictsIndex.cs @@ -1,9 +1,5 @@ using IndexEngine.Data.Paths; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; namespace IndexEngine.Indexes { @@ -76,7 +72,7 @@ public void ReadIndexFromDisk() { if (!CheckFiles()) return; - + ImportIndex(ToolInfo.UserDictsPath); } diff --git a/core/IndexEngine/Search/LuceneService.cs b/core/IndexEngine/Search/LuceneService.cs index 463b9a4..f5aeceb 100644 --- a/core/IndexEngine/Search/LuceneService.cs +++ b/core/IndexEngine/Search/LuceneService.cs @@ -9,9 +9,6 @@ using Lucene.Net.Search; using Lucene.Net.Store; using Lucene.Net.Util; -using System.Collections.Generic; -using System.IO; -using System.Linq; namespace IndexEngine.Search { diff --git a/core/IndexEngine/Search/NGramAnalyzer.cs b/core/IndexEngine/Search/NGramAnalyzer.cs index 1693c3f..a522e78 100644 --- a/core/IndexEngine/Search/NGramAnalyzer.cs +++ b/core/IndexEngine/Search/NGramAnalyzer.cs @@ -3,7 +3,6 @@ using Lucene.Net.Analysis.Shingle; using Lucene.Net.Analysis.Standard; using Lucene.Net.Util; -using System.IO; namespace IndexEngine.Search diff --git a/core/IndexEngine/Search/RakeAlgorithm.cs b/core/IndexEngine/Search/RakeAlgorithm.cs index b503d4c..8d59fd4 100644 --- a/core/IndexEngine/Search/RakeAlgorithm.cs +++ b/core/IndexEngine/Search/RakeAlgorithm.cs @@ -1,7 +1,4 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; +using System.Reflection; using System.Text.RegularExpressions; namespace IndexEngine.Search