34 lines
986 B
C#
Raw Normal View History

2022-06-04 12:04:02 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RageCoop.Core.Scripting;
2022-06-04 18:09:42 +08:00
using System.IO;
2022-06-04 12:04:02 +08:00
namespace RageCoop.Server.Scripting
{
internal class Engine:ScriptingEngine
{
2022-06-04 18:09:42 +08:00
public Engine() : base("RageCoop.Server.Scripting.ServerScript", Program.Logger)
2022-06-04 12:04:02 +08:00
{
}
2022-06-04 18:09:42 +08:00
public void LoadAll()
2022-06-04 12:04:02 +08:00
{
2022-06-04 18:09:42 +08:00
var path = Path.Combine("Resources", "Server");
Directory.CreateDirectory(path);
foreach (var resource in Directory.GetDirectories(path))
{
Logger.Info($"Loading resource: {Path.GetFileName(resource)}");
LoadResource(resource);
}
}
private void LoadResource(string path)
{
foreach(var assembly in Directory.GetFiles(path,"*.dll",SearchOption.AllDirectories))
2022-06-04 18:09:42 +08:00
{
LoadScriptsFromAssembly(assembly);
}
2022-06-04 12:04:02 +08:00
}
}
}