Skip to content

Commit

Permalink
Merging from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
raulssorban committed Jun 12, 2024
2 parents eb2325a + 9a26f04 commit 4626417
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@
path = Carbon.Core/Carbon.Hooks/Carbon.Hooks.Internal
url = https://github.com/CarbonCommunity/Carbon.Hooks.git
branch = main
[submodule "Carbon.Core/Carbon.Components/Carbon.Test"]
path = Carbon.Core/Carbon.Components/Carbon.Test
url = https://github.com/CarbonCommunity/Carbon.Test.git
branch = .
1 change: 1 addition & 0 deletions Carbon.Core/Carbon.Components/Carbon.Test
Submodule Carbon.Test added at 9bfbf5
27 changes: 27 additions & 0 deletions Carbon.Core/Carbon.Core.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Carbon.Hooks.Oxide", "Carbo
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Carbon.Common.Client", "Carbon.Components\Carbon.Common.Client\Carbon.Common.Client.csproj", "{268C4DA0-D58A-42A4-A395-3089DC9BDD83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Carbon.Test", "Carbon.Components\Carbon.Test\Carbon.Test.csproj", "{6F8322EF-79DA-475B-B39C-EAC40771A46F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -309,6 +311,30 @@ Global
{268C4DA0-D58A-42A4-A395-3089DC9BDD83}.ReleaseUnix|Any CPU.Build.0 = ReleaseUnix|x64
{268C4DA0-D58A-42A4-A395-3089DC9BDD83}.ReleaseUnix|x64.ActiveCfg = ReleaseUnix|x64
{268C4DA0-D58A-42A4-A395-3089DC9BDD83}.ReleaseUnix|x64.Build.0 = ReleaseUnix|x64
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Debug|x64.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Debug|x64.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.DebugUnix|Any CPU.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.DebugUnix|Any CPU.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.DebugUnix|x64.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.DebugUnix|x64.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Minimal|Any CPU.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Minimal|Any CPU.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Minimal|x64.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Minimal|x64.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.MinimalUnix|Any CPU.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.MinimalUnix|Any CPU.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.MinimalUnix|x64.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.MinimalUnix|x64.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Release|Any CPU.Build.0 = Release|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Release|x64.ActiveCfg = Release|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.Release|x64.Build.0 = Release|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.ReleaseUnix|Any CPU.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.ReleaseUnix|Any CPU.Build.0 = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.ReleaseUnix|x64.ActiveCfg = Debug|Any CPU
{6F8322EF-79DA-475B-B39C-EAC40771A46F}.ReleaseUnix|x64.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -324,6 +350,7 @@ Global
{CD6421B4-1106-4D99-9830-C2C2201EED9C} = {F89EDA47-1AE3-4F86-9F6D-578BB3E307E8}
{3AFD9CF3-D1AB-494F-869E-698F687CBBBA} = {F89EDA47-1AE3-4F86-9F6D-578BB3E307E8}
{268C4DA0-D58A-42A4-A395-3089DC9BDD83} = {31982314-60E6-4740-98FC-2FCDDFB5E35A}
{6F8322EF-79DA-475B-B39C-EAC40771A46F} = {31982314-60E6-4740-98FC-2FCDDFB5E35A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {28C89D3B-47B2-45D4-88D4-08EE9E94E67A}
Expand Down
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon.Hooks/Carbon.Hooks.Base
6 changes: 6 additions & 0 deletions Carbon.Core/Carbon/src/Community.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ internal void _installProcessors()

_registerProcessors();
}
internal void _installTest()
{
Carbon.Test.Integrations.Logger = new Logger();
Carbon.Logger.Log($"Initialized Carbon.Test backend");
}
internal void _registerProcessors()
{
if (ScriptProcessor != null) ScriptProcessor?.Start();
Expand Down Expand Up @@ -167,6 +172,7 @@ public override void Initialize()

_handleThreads();
_installProcessors();
_installTest();

Events.Subscribe(CarbonEvent.HooksInstalled, args =>
{
Expand Down
2 changes: 1 addition & 1 deletion Carbon.Core/Carbon/src/Loaders/ScriptLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public IEnumerator Compile()
{
if (AsyncLoader.Exceptions != null && AsyncLoader.Exceptions.Count > 0)
{
Logger.Error($"Failed compiling '{AsyncLoader.InitialSource.ContextFilePath}':");
Logger.Error($"Failed compiling '{AsyncLoader.InitialSource.ContextFileName}':");
for (int i = 0; i < AsyncLoader.Exceptions.Count; i++)
{
var error = AsyncLoader.Exceptions[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Emit;
using Oxide.Plugins;

/*
*
Expand Down Expand Up @@ -165,7 +164,7 @@ internal void _injectReference(string id, string name, List<MetadataReference> r

using var mem = new MemoryStream(raw);
var processedReference = MetadataReference.CreateFromStream(mem);

references.Add(processedReference);
_referenceCache[name] = processedReference;
Logger.Debug(id, $"Added common reference '{name}'", 4);
Expand Down Expand Up @@ -195,7 +194,6 @@ internal List<MetadataReference> _addReferences()
var id = Path.GetFileNameWithoutExtension(InitialSource.FilePath);

_injectReference(id, "0Harmony", references, _libraryDirectories);
_injectReference(id, "Newtonsoft.Json", references, _libraryDirectories, true);

foreach (var item in Community.Runtime.AssemblyEx.RefWhitelist)
{
Expand All @@ -218,8 +216,7 @@ internal List<MetadataReference> _addReferences()
var processedReference = MetadataReference.CreateFromStream(mem);

references.Add(processedReference);
if (!_referenceCache.ContainsKey(name)) _referenceCache.Add(name, processedReference);
else _referenceCache[name] = processedReference;
_referenceCache[name] = processedReference;
}
catch (System.Exception ex)
{
Expand Down Expand Up @@ -271,7 +268,10 @@ public override void Start()
using var dllStream = new MemoryStream(requiredPlugin);
references.Add(MetadataReference.CreateFromStream(dllStream));
}
catch { /* do nothing */ }
catch (Exception exception)
{
Logger.Error($"Failed loading required plugin for '{InitialSource.ContextFileName}': {require}", exception);
}
}

foreach (var reference in References)
Expand All @@ -295,11 +295,14 @@ public override void Start()
var managedFile = Path.Combine(Defines.GetRustManagedFolder(), $"{reference}.dll");
if (OsEx.File.Exists(managedFile))
{
_injectReference(reference, managedFile, references, _libraryDirectories );
_injectReference(reference, managedFile, references, _libraryDirectories);
continue;
}
}
catch { /* do nothing */ }
catch (Exception exception)
{
Logger.Error($"Failed loading reference for '{InitialSource.ContextFileName}': {reference}", exception);
}
}

base.Start();
Expand Down

0 comments on commit 4626417

Please sign in to comment.