//
// Tools_LoadedFileList.h
//
// Created by Richard Rice - 08/05/2003
// 
// Copyright (C) 2003 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
    #pragma once
#endif

#ifndef __TOOLS_LOADEDFILELIST_H__
#define __TOOLS_LOADEDFILELIST_H__

//This keeps track of loaded asura files , so the tools can determine which of the required files
//still need to be loaded (and avoid those annoying asserts from files being loaded multiple times).
//RAR 08/05/03

template <class T> class Asura_TemplateHashTree;
struct Tools_LoadedFile;


class Tools_LoadedFileList
{
public :
	static void Initialise();
	static void Shutdown();
	static void Reset();


	static void AddFile(const char* pszFilename,bool bStoreModifiedTime = true);
	static bool IsFileLoaded(const char* pszFilename);

	//stores the modified time of a file , without flagging it for tracking
	//modifications
	static void StoreModifiedTime(const char* pszFilename);
	
	//Adds file to list of those to be checked for modification outside of tools
	static void TrackExternalModification(const char* pszFilename);
	//Updates the stored modified time for the specified file. Should be used
	//after succesfully saving a file
	static void UpdateModifiedTime(const char* pszFilename,bool bCheckNetwork = false);
	//Returns true if the file specified has had its modified time altered behind
	//the system's back  , and hasn't been explicitly unlocked to allow
	//saving regardless
	static bool IsLockedBecauseOfExternalModification(const char* pszFilename);
	//Scans through all loaded files for any externally modified files ,and 
	//displays a warning message if there are any new ones
	static void CheckForExternallyModifiedFiles(bool bDisplayMessages);

	//Displays overlay for unlocking files that were modified externally
	static void UnlockFiles();


private :
	static class Asura_StringTree* s_pxLoadedFileTree;

	//seperate hash tree for tracking modified file times for certain files
	static Asura_TemplateHashTree<Tools_LoadedFile>* s_pxFileTree;

};



#endif // __TOOLS_LOADEDFILELIST_H__
