mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move get_file_extension_type to FileClassifier.h
This commit is contained in:
parent
2ec0df1f3d
commit
0d1d4960c1
|
@ -15,6 +15,7 @@
|
|||
#pragma endregion
|
||||
|
||||
#include "core/FileStream.hpp"
|
||||
#include "core/Path.hpp"
|
||||
#include "FileClassifier.h"
|
||||
#include "rct12/SawyerChunkReader.h"
|
||||
|
||||
|
@ -151,3 +152,19 @@ static bool TryClassifyAsTD4_TD6(IStream * stream, ClassifiedFile * result)
|
|||
|
||||
return success;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
uint32 get_file_extension_type(const utf8 * path)
|
||||
{
|
||||
auto extension = Path::GetExtension(path);
|
||||
if (String::Equals(extension, ".dat", true)) return FILE_EXTENSION_DAT;
|
||||
if (String::Equals(extension, ".sc4", true)) return FILE_EXTENSION_SC4;
|
||||
if (String::Equals(extension, ".sv4", true)) return FILE_EXTENSION_SV4;
|
||||
if (String::Equals(extension, ".td4", true)) return FILE_EXTENSION_TD4;
|
||||
if (String::Equals(extension, ".sc6", true)) return FILE_EXTENSION_SC6;
|
||||
if (String::Equals(extension, ".sv6", true)) return FILE_EXTENSION_SV6;
|
||||
if (String::Equals(extension, ".td6", true)) return FILE_EXTENSION_TD6;
|
||||
return FILE_EXTENSION_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,24 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "common.h"
|
||||
|
||||
enum
|
||||
{
|
||||
FILE_EXTENSION_UNKNOWN,
|
||||
FILE_EXTENSION_DAT,
|
||||
FILE_EXTENSION_SC4,
|
||||
FILE_EXTENSION_SV4,
|
||||
FILE_EXTENSION_TD4,
|
||||
FILE_EXTENSION_SC6,
|
||||
FILE_EXTENSION_SV6,
|
||||
FILE_EXTENSION_TD6,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <string>
|
||||
|
||||
interface IStream;
|
||||
|
||||
enum class FILE_TYPE
|
||||
|
@ -38,3 +53,15 @@ struct ClassifiedFile
|
|||
|
||||
bool TryClassifyFile(const std::string &path, ClassifiedFile * result);
|
||||
bool TryClassifyFile(IStream * stream, ClassifiedFile * result);
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
uint32 get_file_extension_type(const utf8 * path);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "../core/Exception.hpp"
|
||||
#include "../core/Guard.hpp"
|
||||
#include "../core/Path.hpp"
|
||||
#include "../FileClassifier.h"
|
||||
#include "../ParkImporter.h"
|
||||
#include "../rct2/S6Exporter.h"
|
||||
#include "CommandLine.hpp"
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "audio/audio.h"
|
||||
#include "drawing/drawing.h"
|
||||
#include "editor.h"
|
||||
#include "FileClassifier.h"
|
||||
#include "game.h"
|
||||
#include "interface/viewport.h"
|
||||
#include "interface/window.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "config/Config.h"
|
||||
#include "Context.h"
|
||||
#include "editor.h"
|
||||
#include "FileClassifier.h"
|
||||
#include "game.h"
|
||||
#include "input.h"
|
||||
#include "interface/Screenshot.h"
|
||||
|
|
|
@ -135,16 +135,3 @@ const utf8 *get_file_path(sint32 pathId)
|
|||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
uint32 get_file_extension_type(const utf8 *path)
|
||||
{
|
||||
const utf8 *extension = path_get_extension(path);
|
||||
if (strcicmp(extension, ".dat") == 0) return FILE_EXTENSION_DAT;
|
||||
if (strcicmp(extension, ".sc4") == 0) return FILE_EXTENSION_SC4;
|
||||
if (strcicmp(extension, ".sv4") == 0) return FILE_EXTENSION_SV4;
|
||||
if (strcicmp(extension, ".td4") == 0) return FILE_EXTENSION_TD4;
|
||||
if (strcicmp(extension, ".sc6") == 0) return FILE_EXTENSION_SC6;
|
||||
if (strcicmp(extension, ".sv6") == 0) return FILE_EXTENSION_SV6;
|
||||
if (strcicmp(extension, ".td6") == 0) return FILE_EXTENSION_TD6;
|
||||
return FILE_EXTENSION_UNKNOWN;
|
||||
}
|
||||
|
|
|
@ -143,17 +143,6 @@ enum {
|
|||
PATH_ID_END
|
||||
};
|
||||
|
||||
enum {
|
||||
FILE_EXTENSION_UNKNOWN,
|
||||
FILE_EXTENSION_DAT,
|
||||
FILE_EXTENSION_SC4,
|
||||
FILE_EXTENSION_SV4,
|
||||
FILE_EXTENSION_TD4,
|
||||
FILE_EXTENSION_SC6,
|
||||
FILE_EXTENSION_SV6,
|
||||
FILE_EXTENSION_TD6,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -170,8 +159,6 @@ sint32 rct2_init_directories();
|
|||
const char *get_file_path(sint32 pathId);
|
||||
void rct2_quit();
|
||||
|
||||
uint32 get_file_extension_type(const utf8 *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../audio/audio.h"
|
||||
#include "../cheats.h"
|
||||
#include "../config/Config.h"
|
||||
#include "../FileClassifier.h"
|
||||
#include "../game.h"
|
||||
#include "../interface/viewport.h"
|
||||
#include "../localisation/date.h"
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "../config/Config.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../FileClassifier.h"
|
||||
#include "../game.h"
|
||||
#include "../input.h"
|
||||
#include "../interface/viewport.h"
|
||||
|
|
Loading…
Reference in New Issue