mirror of
https://github.com/fadden/6502bench.git
synced 2025-01-11 18:29:53 +00:00
parent
8aba1c4fba
commit
e6b0438d5d
@ -154,7 +154,7 @@ namespace SourceGen {
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Numeric offset value. Used to map a line item to the Anattrib. Note this is
|
/// Numeric offset value. Used to map a line item to the Anattrib. Note this is
|
||||||
/// set for all lines, and is the the same for all lines in a multi-line sequence,
|
/// set for all lines, and is the same for all lines in a multi-line sequence,
|
||||||
/// e.g. every line in a long comment has the file offset with which it is associated.
|
/// e.g. every line in a long comment has the file offset with which it is associated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int FileOffset { get; private set; }
|
public int FileOffset { get; private set; }
|
||||||
|
@ -40,7 +40,7 @@ namespace SourceGen.Sandbox {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reference to DomainManager, if we're using one.
|
/// Reference to DomainManager, if we're using one.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public DomainManager DomainManager { get; private set; }
|
public DomainManager DomainMgr { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Collection of loaded plugins, if we're not using a DomainManager.
|
/// Collection of loaded plugins, if we're not using a DomainManager.
|
||||||
@ -60,9 +60,9 @@ namespace SourceGen.Sandbox {
|
|||||||
mProject = proj;
|
mProject = proj;
|
||||||
|
|
||||||
if (!proj.UseMainAppDomainForPlugins) {
|
if (!proj.UseMainAppDomainForPlugins) {
|
||||||
DomainManager = new DomainManager(UseKeepAliveHack);
|
DomainMgr = new DomainManager(UseKeepAliveHack);
|
||||||
DomainManager.CreateDomain("Plugin Domain", PluginDllCache.GetPluginDirPath());
|
DomainMgr.CreateDomain("Plugin Domain", PluginDllCache.GetPluginDirPath());
|
||||||
DomainManager.PluginMgr.SetFileData(proj.FileData);
|
DomainMgr.PluginMgr.SetFileData(proj.FileData);
|
||||||
} else {
|
} else {
|
||||||
mActivePlugins = new Dictionary<string, IPlugin>();
|
mActivePlugins = new Dictionary<string, IPlugin>();
|
||||||
}
|
}
|
||||||
@ -73,9 +73,9 @@ namespace SourceGen.Sandbox {
|
|||||||
/// the object after calling this.
|
/// the object after calling this.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Cleanup() {
|
public void Cleanup() {
|
||||||
if (DomainManager != null) {
|
if (DomainMgr != null) {
|
||||||
DomainManager.Dispose();
|
DomainMgr.Dispose();
|
||||||
DomainManager = null;
|
DomainMgr = null;
|
||||||
}
|
}
|
||||||
mActivePlugins = null;
|
mActivePlugins = null;
|
||||||
mProject = null;
|
mProject = null;
|
||||||
@ -86,16 +86,16 @@ namespace SourceGen.Sandbox {
|
|||||||
/// the list of extension scripts configured into the project has changed.
|
/// the list of extension scripts configured into the project has changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Clear() {
|
public void Clear() {
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
mActivePlugins.Clear();
|
mActivePlugins.Clear();
|
||||||
} else {
|
} else {
|
||||||
DomainManager.PluginMgr.ClearPluginList();
|
DomainMgr.PluginMgr.ClearPluginList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Attempts to load the specified plugin. If the plugin is already loaded, this
|
/// Attempts to load the specified plugin. If the plugin is already loaded, this
|
||||||
/// does nothing. If not, the assembly is loaded an an instance is created.
|
/// does nothing. If not, the assembly is loaded and an instance is created.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scriptIdent">Script identifier.</param>
|
/// <param name="scriptIdent">Script identifier.</param>
|
||||||
/// <param name="report">Report with errors and warnings.</param>
|
/// <param name="report">Report with errors and warnings.</param>
|
||||||
@ -108,7 +108,7 @@ namespace SourceGen.Sandbox {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
if (mActivePlugins.TryGetValue(scriptIdent, out IPlugin plugin)) {
|
if (mActivePlugins.TryGetValue(scriptIdent, out IPlugin plugin)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -118,20 +118,20 @@ namespace SourceGen.Sandbox {
|
|||||||
report = new FileLoadReport(dllPath); // empty report
|
report = new FileLoadReport(dllPath); // empty report
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
IPlugin plugin = DomainManager.PluginMgr.LoadPlugin(dllPath, scriptIdent);
|
IPlugin plugin = DomainMgr.PluginMgr.LoadPlugin(dllPath, scriptIdent);
|
||||||
return plugin != null;
|
return plugin != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IPlugin GetInstance(string scriptIdent) {
|
public IPlugin GetInstance(string scriptIdent) {
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
if (mActivePlugins.TryGetValue(scriptIdent, out IPlugin plugin)) {
|
if (mActivePlugins.TryGetValue(scriptIdent, out IPlugin plugin)) {
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
Debug.Assert(false);
|
Debug.Assert(false);
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return DomainManager.PluginMgr.GetPlugin(scriptIdent);
|
return DomainMgr.PluginMgr.GetPlugin(scriptIdent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,14 +140,14 @@ namespace SourceGen.Sandbox {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Newly-created list of plugin references.</returns>
|
/// <returns>Newly-created list of plugin references.</returns>
|
||||||
public List<IPlugin> GetAllInstances() {
|
public List<IPlugin> GetAllInstances() {
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
List<IPlugin> list = new List<IPlugin>(mActivePlugins.Count);
|
List<IPlugin> list = new List<IPlugin>(mActivePlugins.Count);
|
||||||
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
||||||
list.Add(kvp.Value);
|
list.Add(kvp.Value);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
} else {
|
} else {
|
||||||
return DomainManager.PluginMgr.GetActivePlugins();
|
return DomainMgr.PluginMgr.GetActivePlugins();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,12 +158,12 @@ namespace SourceGen.Sandbox {
|
|||||||
public void PrepareScripts(IApplication appRef) {
|
public void PrepareScripts(IApplication appRef) {
|
||||||
List<PlatSym> platSyms = GeneratePlatSymList();
|
List<PlatSym> platSyms = GeneratePlatSymList();
|
||||||
|
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
||||||
kvp.Value.Prepare(appRef, mProject.FileData, platSyms);
|
kvp.Value.Prepare(appRef, mProject.FileData, platSyms);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DomainManager.PluginMgr.PreparePlugins(appRef, platSyms);
|
DomainMgr.PluginMgr.PreparePlugins(appRef, platSyms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ namespace SourceGen.Sandbox {
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string DebugGetLoadedScriptInfo() {
|
public string DebugGetLoadedScriptInfo() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (DomainManager == null) {
|
if (DomainMgr == null) {
|
||||||
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
foreach (KeyValuePair<string, IPlugin> kvp in mActivePlugins) {
|
||||||
string loc = kvp.Value.GetType().Assembly.Location;
|
string loc = kvp.Value.GetType().Assembly.Location;
|
||||||
sb.Append("[main] ");
|
sb.Append("[main] ");
|
||||||
@ -206,10 +206,10 @@ namespace SourceGen.Sandbox {
|
|||||||
DebugGetScriptInfo(kvp.Value, sb);
|
DebugGetScriptInfo(kvp.Value, sb);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<IPlugin> plugins = DomainManager.PluginMgr.GetActivePlugins();
|
List<IPlugin> plugins = DomainMgr.PluginMgr.GetActivePlugins();
|
||||||
foreach (IPlugin plugin in plugins) {
|
foreach (IPlugin plugin in plugins) {
|
||||||
string loc = DomainManager.PluginMgr.GetPluginAssemblyLocation(plugin);
|
string loc = DomainMgr.PluginMgr.GetPluginAssemblyLocation(plugin);
|
||||||
sb.AppendFormat("[sub {0}] ", DomainManager.Id);
|
sb.AppendFormat("[sub {0}] ", DomainMgr.Id);
|
||||||
sb.Append(loc);
|
sb.Append(loc);
|
||||||
sb.Append("\r\n ");
|
sb.Append("\r\n ");
|
||||||
DebugGetScriptInfo(plugin, sb);
|
DebugGetScriptInfo(plugin, sb);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user