Skip to content

Commit

Permalink
Completely stripped away ZipDevScriptProcessor from release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
raulssorban committed Oct 12, 2023
1 parent 9b88774 commit d72a49c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon.Components/Carbon.Common
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon.Components/Carbon.Compat
7 changes: 6 additions & 1 deletion Carbon.Core/Carbon/src/Community.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ internal void _installProcessors()
ScriptProcessor = gameObject.AddComponent<ScriptProcessor>();
WebScriptProcessor = gameObject.AddComponent<WebScriptProcessor>();
ZipScriptProcessor = gameObject.AddComponent<ZipScriptProcessor>();
#if DEBUG
ZipDevScriptProcessor = gameObject.AddComponent<ZipDevScriptProcessor>();
#endif
CarbonProcessor = gameObject.AddComponent<CarbonProcessor>();
HookManager = gameObject.AddComponent<PatchManager>();
ModuleProcessor = new ModuleProcessor();
Expand All @@ -94,7 +96,9 @@ internal void _registerProcessors()
if (ScriptProcessor != null) ScriptProcessor?.Start();
if (WebScriptProcessor != null) WebScriptProcessor?.Start();
if (ZipScriptProcessor != null) ZipScriptProcessor?.Start();
#if DEBUG
if (ZipDevScriptProcessor != null) ZipDevScriptProcessor?.Start();
#endif

if (ScriptProcessor != null) ScriptProcessor.InvokeRepeating(() => { RefreshConsoleInfo(); }, 1f, 1f);
Carbon.Logger.Log("Registered processors");
Expand All @@ -108,8 +112,9 @@ internal void _uninstallProcessors()
if (ScriptProcessor != null) ScriptProcessor?.Dispose();
if (WebScriptProcessor != null) WebScriptProcessor?.Dispose();
if (ZipScriptProcessor != null) ZipScriptProcessor?.Dispose();
#if DEBUG
if (ZipDevScriptProcessor != null) ZipDevScriptProcessor?.Dispose();

#endif
if (ModuleProcessor != null) ModuleProcessor?.Dispose();
if (CarbonProcessor != null) CarbonProcessor?.Dispose();
}
Expand Down
7 changes: 5 additions & 2 deletions Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ public static void LoadAll()
var extensionPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetExtensionsFolder(), "cs");
var plugins = OsEx.Folder.GetFilesWithExtension(Defines.GetScriptFolder(), "cs", option: config.ScriptWatcherOption);
var zipPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetScriptFolder(), "cszip", option: config.ScriptWatcherOption);
var zipDevPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetZipDevFolder(), "cs", option: SearchOption.AllDirectories);

ExecuteProcess(Community.Runtime.ScriptProcessor, false, extensionPlugins, plugins);
ExecuteProcess(Community.Runtime.ZipScriptProcessor, false, zipPlugins);
ExecuteProcess(Community.Runtime.ZipDevScriptProcessor, true, zipDevPlugins);

#if DEBUG
var zipDevPlugins = OsEx.Folder.GetFilesWithExtension(Defines.GetZipDevFolder(), "cs", option: SearchOption.AllDirectories);
ExecuteProcess(Community.Runtime.ZipDevScriptProcessor, true, zipDevPlugins);
#endif
void ExecuteProcess(IScriptProcessor processor, bool folderMode, params string[][] folders)
{
processor.Clear();
Expand Down
4 changes: 3 additions & 1 deletion Carbon.Core/Carbon/src/Processors/ZipDevScriptProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#if DEBUG
using System;
using System.Collections;
using System.IO;
using System.IO.Compression;
Expand Down Expand Up @@ -246,3 +247,4 @@ public override void Process(string file, string input, out string output)
}
}
}
#endif

0 comments on commit d72a49c

Please sign in to comment.