mirror of
https://github.com/Novetus/Novetus_src.git
synced 2025-01-31 17:53:01 +02:00
optimization for initial file list
This commit is contained in:
parent
c01b4965aa
commit
cc14235219
@ -2920,21 +2920,56 @@ public class GlobalFuncs
|
||||
|
||||
public static void CreateInitialFileListIfNeededMulti()
|
||||
{
|
||||
if (!File.Exists(GlobalPaths.ConfigDir + "\\InitialFileList.txt"))
|
||||
string filePath = GlobalPaths.ConfigDir + "\\InitialFileList.txt";
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
Thread t = new Thread(CreateInitialFileList);
|
||||
t.Start();
|
||||
}
|
||||
else
|
||||
{
|
||||
int lineCount = File.ReadLines(filePath).Count();
|
||||
int fileCount = 0;
|
||||
|
||||
string filterPath = GlobalPaths.ConfigDir + @"\\" + GlobalPaths.InitialFileListIgnoreFilterName;
|
||||
string[] fileListToIgnore = File.ReadAllLines(filterPath);
|
||||
|
||||
DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.RootPath);
|
||||
FileInfo[] Files = dinfo.GetFiles("*.*", SearchOption.AllDirectories);
|
||||
foreach (FileInfo file in Files)
|
||||
{
|
||||
DirectoryInfo localdinfo = new DirectoryInfo(file.DirectoryName);
|
||||
string directory = localdinfo.Name;
|
||||
if (!fileListToIgnore.Contains(file.Name, StringComparer.InvariantCultureIgnoreCase) && !fileListToIgnore.Contains(directory, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
fileCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//MessageBox.Show(lineCount + "\n" + fileCount);
|
||||
|
||||
if (lineCount != fileCount)
|
||||
{
|
||||
Thread t = new Thread(CreateInitialFileList);
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void CreateInitialFileList()
|
||||
{
|
||||
string filterPath = GlobalPaths.ConfigDir + @"\\" + GlobalPaths.InitialFileListIgnoreFilterName;
|
||||
string[] fileListToIgnore = File.ReadAllLines(filterPath);
|
||||
string FileName = GlobalPaths.ConfigDir + "\\InitialFileList.txt";
|
||||
|
||||
using (var txt = File.CreateText(GlobalPaths.ConfigDir + "\\InitialFileList.txt"))
|
||||
using (var txt = File.CreateText(FileName))
|
||||
{
|
||||
DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.BasePath);
|
||||
DirectoryInfo dinfo = new DirectoryInfo(GlobalPaths.RootPath);
|
||||
FileInfo[] Files = dinfo.GetFiles("*.*", SearchOption.AllDirectories);
|
||||
foreach (FileInfo file in Files)
|
||||
{
|
||||
|
@ -40,6 +40,8 @@ public partial class NovetusSDK : Form
|
||||
#region Form Events
|
||||
private void NovetusSDK_Load(object sender, EventArgs e)
|
||||
{
|
||||
GlobalFuncs.CreateInitialFileListIfNeededMulti();
|
||||
|
||||
if (!File.Exists(GlobalPaths.DataDir + "\\RSG.exe"))
|
||||
{
|
||||
DisableApp(SDKApps.ScriptGenerator);
|
||||
|
Loading…
Reference in New Issue
Block a user