Optimize imports
This commit is contained in:
@ -76,7 +76,7 @@ namespace RageCoop.Client.Scripting
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Main.Logger.Error(ex);
|
||||
Log.Error(ex);
|
||||
SetLastResult(ex.ToString());
|
||||
return 0;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ namespace RageCoop.Client.Scripting
|
||||
{
|
||||
var args = new CustomEventReceivedArgs { Hash = p.Hash, Args = p.Args };
|
||||
|
||||
// Main.Logger.Debug($"CustomEvent:\n"+args.Args.DumpWithType());
|
||||
// Log.Debug($"CustomEvent:\n"+args.Args.DumpWithType());
|
||||
|
||||
if (CustomEventHandlers.TryGetValue(p.Hash, out var handlers))
|
||||
handlers.ForEach(x => { x.Invoke(args); });
|
||||
@ -400,7 +400,7 @@ namespace RageCoop.Client.Scripting
|
||||
[Remoting]
|
||||
public static ClientResource GetResource(string name)
|
||||
{
|
||||
if (Main.Resources.LoadedResources.TryGetValue(name, out var resource))
|
||||
if (MainRes.LoadedResources.TryGetValue(name, out var resource))
|
||||
return resource;
|
||||
|
||||
return null;
|
||||
|
@ -34,7 +34,7 @@ namespace RageCoop.Client.Scripting
|
||||
|
||||
public Resources()
|
||||
{
|
||||
Logger = Main.Logger;
|
||||
Logger = Log;
|
||||
}
|
||||
|
||||
private Logger Logger { get; }
|
||||
@ -52,20 +52,18 @@ namespace RageCoop.Client.Scripting
|
||||
Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories).Where(x => x.CanBeIgnored())
|
||||
.ForEach(File.Delete);
|
||||
|
||||
// TODO Core.ScheduleLoad()...
|
||||
// TODO: Core.ScheduleLoad()...
|
||||
}
|
||||
|
||||
public void Unload()
|
||||
{
|
||||
// TODO Core.ScheduleUnload()...
|
||||
// TODO: Core.ScheduleUnload()...
|
||||
}
|
||||
|
||||
private ClientResource Unpack(string zipPath, string dataFolderRoot)
|
||||
{
|
||||
var r = new ClientResource
|
||||
{
|
||||
Logger = Logger,
|
||||
Scripts = new List<ClientScript>(),
|
||||
Name = Path.GetFileNameWithoutExtension(zipPath),
|
||||
DataFolder = Path.Combine(dataFolderRoot, Path.GetFileNameWithoutExtension(zipPath)),
|
||||
ScriptsDirectory = Path.Combine(TempPath, Path.GetFileNameWithoutExtension(zipPath))
|
||||
@ -86,7 +84,6 @@ namespace RageCoop.Client.Scripting
|
||||
IsDirectory = true,
|
||||
Name = dir.Substring(scriptsDir.Length + 1).Replace('\\', '/')
|
||||
});
|
||||
var assemblies = new Dictionary<ResourceFile, Assembly>();
|
||||
foreach (var file in Directory.GetFiles(scriptsDir, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
if (Path.GetFileName(file).CanBeIgnored())
|
||||
@ -105,9 +102,8 @@ namespace RageCoop.Client.Scripting
|
||||
}
|
||||
|
||||
var relativeName = file.Substring(scriptsDir.Length + 1).Replace('\\', '/');
|
||||
var rfile = new ResourceFile
|
||||
var rfile = new ClientFile
|
||||
{
|
||||
GetStream = () => { return new FileStream(file, FileMode.Open, FileAccess.Read); },
|
||||
IsDirectory = false,
|
||||
Name = relativeName
|
||||
};
|
||||
|
Reference in New Issue
Block a user