From d6f4413ea91249c70b213e7558bb75a310428473 Mon Sep 17 00:00:00 2001 From: beu Date: Thu, 19 Dec 2024 16:09:13 +0100 Subject: [PATCH] rename interfaces to packs --- Classes/LayerConfig.as | 2 +- .../{InterfacesConfig.as => PackConfig.as} | 6 +++--- InterfacesManager.as => PackManager.as | 21 +++++++++---------- RenderManager.as | 12 +++++------ main.as | 4 ++-- 5 files changed, 22 insertions(+), 23 deletions(-) rename Classes/{InterfacesConfig.as => PackConfig.as} (89%) rename InterfacesManager.as => PackManager.as (89%) diff --git a/Classes/LayerConfig.as b/Classes/LayerConfig.as index 1a8d8d3..2376aab 100644 --- a/Classes/LayerConfig.as +++ b/Classes/LayerConfig.as @@ -11,7 +11,7 @@ class LayerConfig { Path = Path::Join(_ParentPath, _Data['Path']); const string Manialink = GetManialink(); - Name = InterfacesManager::GetLayerName(Manialink); + Name = PacksManager::GetLayerName(Manialink); if (Name.Length == 0) { throw('Can\'t find Manialink name'); diff --git a/Classes/InterfacesConfig.as b/Classes/PackConfig.as similarity index 89% rename from Classes/InterfacesConfig.as rename to Classes/PackConfig.as index c0da5b6..cf5fe01 100644 --- a/Classes/InterfacesConfig.as +++ b/Classes/PackConfig.as @@ -1,4 +1,4 @@ -class InterfacesConfig { +class PackConfig { string Name; string Author; string Version; @@ -6,9 +6,9 @@ class InterfacesConfig { array Layers; array UnloadModules; - InterfacesConfig() {} + PackConfig() {} - InterfacesConfig(const string &in _ParentPath, const string &in _Json) { + PackConfig(const string &in _ParentPath, const string &in _Json) { const Json::Value@ Data = Json::Parse(_Json); Name = Data['Name']; diff --git a/InterfacesManager.as b/PackManager.as similarity index 89% rename from InterfacesManager.as rename to PackManager.as index 4e0d01e..b1f5ef5 100644 --- a/InterfacesManager.as +++ b/PackManager.as @@ -1,4 +1,4 @@ -namespace InterfacesManager { +namespace PacksManager { uint G_UILayersCount; dictionary G_Configs; array G_EnabledConfigs; @@ -23,30 +23,29 @@ namespace InterfacesManager { } if (IO::FileExists(Path)) { - trace('Invalid Interface Config: "' + Path + '" is a file'); + trace('Invalid Pack Config: "' + Path + '" is a file'); continue; } const string InfoFile = Path::Join(Path, 'info.json'); if (!IO::FileExists(InfoFile)) { - trace('Invalid Interface Config: "' + Path + '" has no info.json file'); + trace('Invalid Pack Config: "' + Path + '" has no info.json file'); continue; } IO::File File(InfoFile, IO::FileMode::Read); - if (File.Size() <= 0) { - trace('Invalid Interface Config: "' + Path + '" is not readable'); + trace('Invalid Pack Config: "' + InfoFile + '" is not readable'); continue; } const string FileContent = File.ReadToEnd(); try { - const InterfacesConfig Config(Path, FileContent); + const PackConfig Config(Path, FileContent); G_Configs[Id] = Config; } catch { - warn('Invalid Interface Config: "'+ Path +'" is an invalid\nException Message: '+ getExceptionInfo()); + warn('Invalid Pack Config: "'+ Path +'" is an invalid\nException Message: '+ getExceptionInfo()); } } @@ -78,7 +77,7 @@ namespace InterfacesManager { for (uint i = 0; i < G_EnabledConfigs.Length; i++) { const string Id = G_EnabledConfigs[i]; - const InterfacesConfig@ Config = InterfacesManager::GetConfig(Id); + const PackConfig@ Config = PacksManager::GetConfig(Id); // TODO Check ModePattern if (Regex::IsMatch(ServerInfo.CurScriptRelName, Config.ModePattern)) { @@ -150,9 +149,9 @@ namespace InterfacesManager { S_EnabledConfigs = string::Join(G_EnabledConfigs, ','); } - InterfacesConfig@ GetConfig(const string &in _Id) { - if (InterfacesManager::G_Configs.Exists(_Id)) { - return cast(InterfacesManager::G_Configs[_Id]); + PackConfig@ GetConfig(const string &in _Id) { + if (PacksManager::G_Configs.Exists(_Id)) { + return cast(PacksManager::G_Configs[_Id]); } return null; } diff --git a/RenderManager.as b/RenderManager.as index 2739409..f96c416 100644 --- a/RenderManager.as +++ b/RenderManager.as @@ -12,7 +12,7 @@ namespace RenderManager { UI::SameLine(); if (UI::Button('Reload')) { - InterfacesManager::LoadConfigs(); + PacksManager::LoadConfigs(); } if (UI::BeginTable('configs', 5, UI::TableFlags(UI::TableFlags::Resizable | UI::TableFlags::Sortable | UI::TableFlags::NoSavedSettings | UI::TableFlags::BordersInnerV | UI::TableFlags::SizingStretchProp | UI::TableFlags::ScrollY))) { @@ -23,11 +23,11 @@ namespace RenderManager { UI::TableSetupColumn("Enable", UI::TableFlags(UI::TableColumnFlags::NoResize | UI::TableColumnFlags::WidthFixed), 60.); UI::TableHeadersRow(); - const array ConfigIds = InterfacesManager::G_Configs.GetKeys(); + const array ConfigIds = PacksManager::G_Configs.GetKeys(); for (uint i = 0; i < ConfigIds.Length; i++) { const string Id = ConfigIds[i]; - const InterfacesConfig@ Config = InterfacesManager::GetConfig(Id); + const PackConfig@ Config = PacksManager::GetConfig(Id); UI::TableNextRow(); UI::TableNextColumn(); @@ -40,14 +40,14 @@ namespace RenderManager { UI::Text(Config.ModePattern); UI::TableNextColumn(); - const int index = InterfacesManager::G_EnabledConfigs.Find(Id); + const int index = PacksManager::G_EnabledConfigs.Find(Id); const bool enabled = (index >= 0); const bool newValue = UI::Checkbox('###'+ Id, enabled); if (newValue != enabled) { if (enabled) { - InterfacesManager::DisableInterface(Id); + PacksManager::DisableInterface(Id); } else { - InterfacesManager::EnableInterface(Id); + PacksManager::EnableInterface(Id); } } } diff --git a/main.as b/main.as index 5432fb9..b185a1a 100755 --- a/main.as +++ b/main.as @@ -1,9 +1,9 @@ void Main() { - InterfacesManager::LoadConfigs(); + PacksManager::LoadConfigs(); while (true) { yield(); - InterfacesManager::Yield(); + PacksManager::Yield(); } }