<commit_before>#include "PrecompiledHeader.h"
#include "FileReadBackends/DirectStorage/DirectXContext.h"
#include "FileSearcher.h"
#include "Utilities/AsynchronousPeriodicTimer.h"
#include "Utilities/FileEnumerator.h"
#include "Utilities/PathUtils.h"
#include "Utilities/ScopedStackAllocator.h"
#include "Utilities/StringUtils.h"

FileSearcher::FileSearcher(SearchInstructions&& searchInstructions) :
	m_RefCount(1),
	m_SearchInstructions(std::move(searchInstructions)),
	m_StringSearcher(m_SearchInstructions),
	m_SearchResultReporter(m_SearchInstructions),
	m_FileReadWorkQueue(m_StringSearcher, m_SearchInstructions, m_SearchResultReporter),
	m_FinishedSearchingFileSystem(false),
	m_IsFinished(false),
	m_FailedInit(false)
{
	if (m_SearchInstructions.SearchInFileContents())
	{
		SYSTEM_INFO systemInfo;
		GetNativeSystemInfo(&systemInfo);

		if (DirectXContext::GetDStorageFactory() == nullptr)
		{
			m_SearchInstructions.onError(L"Failed to initialize DirectStorage!");
			m_FailedInit = true;
		}
		else if (DirectXContext::GetD3D12Device() == nullptr)
		{
			m_SearchInstructions.onError(L"Failed to initialize DirectX 12!");
			m_FailedInit = true;
		}
		else
		{
			m_FileReadWorkQueue.Initialize();
		}
	}
}

void FileSearcher::AddRef()
{
	InterlockedIncrement(&m_RefCount);
}

void FileSearcher::Release()
{
	if (InterlockedDecrement(&m_RefCount) == 0)
		delete this;
}

void FileSearcher::Search()
{
	const uint32_t kProgressReportIntervalInMilliseconds = 100;<commit_msg>Delete unnecessary code.<commit_after>#include "PrecompiledHeader.h"
#include "FileReadBackends/DirectStorage/DirectXContext.h"
#include "FileSearcher.h"
#include "Utilities/AsynchronousPeriodicTimer.h"
#include "Utilities/FileEnumerator.h"
#include "Utilities/PathUtils.h"
#include "Utilities/ScopedStackAllocator.h"
#include "Utilities/StringUtils.h"

FileSearcher::FileSearcher(SearchInstructions&& searchInstructions) :
	m_RefCount(1),
	m_SearchInstructions(std::move(searchInstructions)),
	m_StringSearcher(m_SearchInstructions),
	m_SearchResultReporter(m_SearchInstructions),
	m_FileReadWorkQueue(m_StringSearcher, m_SearchInstructions, m_SearchResultReporter),
	m_FinishedSearchingFileSystem(false),
	m_IsFinished(false),
	m_FailedInit(false)
{
	if (m_SearchInstructions.SearchInFileContents())
	{
		if (DirectXContext::GetDStorageFactory() == nullptr)
		{
			m_SearchInstructions.onError(L"Failed to initialize DirectStorage!");
			m_FailedInit = true;
		}
		else if (DirectXContext::GetD3D12Device() == nullptr)
		{
			m_SearchInstructions.onError(L"Failed to initialize DirectX 12!");
			m_FailedInit = true;
		}
		else
		{
			m_FileReadWorkQueue.Initialize();
		}
	}
}

void FileSearcher::AddRef()
{
	InterlockedIncrement(&m_RefCount);
}

void FileSearcher::Release()
{
	if (InterlockedDecrement(&m_RefCount) == 0)
		delete this;
}

void FileSearcher::Search()
{
	const uint32_t kProgressReportIntervalInMilliseconds = 100;
{'fraction_non_alphanumeric': 0.11301369863013698, 'fraction_numerical': 0.00821917808219178, 'mean_word_length': 7.745508982035928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '912557', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1009, 'n_words': 140}