本文整理汇总了C#中PluginManager.Load方法的典型用法代码示例。如果您正苦于以下问题:C# PluginManager.Load方法的具体用法?C# PluginManager.Load怎么用?C# PluginManager.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PluginManager
的用法示例。
在下文中一共展示了PluginManager.Load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load_WhenTheSamePluginIsLoadedTwice_TheSameInstanceIsReturned
public void Load_WhenTheSamePluginIsLoadedTwice_TheSameInstanceIsReturned()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
FakeCalculatorPlugin firstLoad = pluginManager.Load<FakeCalculatorPlugin>();
FakeCalculatorPlugin secondLoad = pluginManager.Load<FakeCalculatorPlugin>();
Assert.Equal(firstLoad, secondLoad);
}
示例2: Load_WhenTwoVersionsOfThePluginAreLoaded_OperationIsSuccessfull
public void Load_WhenTwoVersionsOfThePluginAreLoaded_OperationIsSuccessfull()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
FakeCalculatorPlugin plugin = pluginManager.Load<FakeCalculatorPlugin>();
FakeAnotherCalculatorPlugin anotherPlugin = pluginManager.Load<FakeAnotherCalculatorPlugin>();
Assert.NotNull(plugin);
Assert.NotNull(anotherPlugin);
}
示例3: Load_WhenTheTypeIsSpecified_ItIsLoaded
public void Load_WhenTheTypeIsSpecified_ItIsLoaded()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
FakeCalculatorPlugin fakePlugin = pluginManager.Load<FakeCalculatorPlugin>();
Assert.NotNull(fakePlugin);
}
示例4: IsLoaded_WhenPluginIsLoaded_ReturnsTrue
public void IsLoaded_WhenPluginIsLoaded_ReturnsTrue()
{
var pluginManager = new PluginManager(_addInRootPath);
ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();
Assert.True(pluginManager.IsLoaded<ICalculatorPlugin>());
}
示例5: Load_WhenThePluginExists_ReturnPluginInstance
public void Load_WhenThePluginExists_ReturnPluginInstance()
{
var pluginManager = new PluginManager(_addInRootPath);
ICalculatorPlugin calculatorPlugin = pluginManager.Load<ICalculatorPlugin>();
Assert.NotNull(calculatorPlugin);
}
示例6: Render
public Render(Ox ox)
: base(ox)
{
Priority = (int)PriorityBase.Render -1;
new Collision(Ox);
plugins = new PluginManager<IOxRenderComponentPlugin>(Ox.Paths.Application);
plugins.Load(new object[] { Ox, this });
Ox.OnEvent += new OxEventHandler(Ox_OnEvent);
}
示例7: Run
public void Run()
{
string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
PluginManager<IUpdatePlugin> plugins = new PluginManager<IUpdatePlugin>(dir);
plugins.Load(new object[] { });
foreach (IUpdatePlugin plugin in plugins.Plugins)
plugin.Run();
plugins.Unload();
}
示例8: Load_WhenThePluginIsSpecified_IsIsLoadedIntoDifferentApplicationDomain
public void Load_WhenThePluginIsSpecified_IsIsLoadedIntoDifferentApplicationDomain()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
FakeCalculatorPlugin fakePlugin = pluginManager.Load<FakeCalculatorPlugin>();
string currentDomainName = AppDomain.CurrentDomain.FriendlyName;
_testOutputHelper.WriteLine("Current Domain: {0}", currentDomainName);
_testOutputHelper.WriteLine("Plugin Domain: {0}", fakePlugin.AppDomainName);
Assert.NotEqual(currentDomainName, fakePlugin.AppDomainName);
}
示例9: Viewer
public Viewer(int windowWidth, int windowHeight, int mode)
{
new Controller(this);
new Calculator(this);
if (mode == (int)Loader.ModeType.Normal)
{
r_plugins = new PluginManager<IOxRenderPlugin>(this.Paths.Application);
r_plugins.Load(new object[] { this });
if (r_plugins.Plugins == null)
mode = (int)Loader.ModeType.Silent;
}
if (mode == (int)Loader.ModeType.Silent)
new SilentRender(this);
DataStore.Width = windowWidth;
DataStore.Height = windowHeight;
}
示例10: Load_WhenTheLifetimeIsExpired_ThePluginIsUnloaded
public void Load_WhenTheLifetimeIsExpired_ThePluginIsUnloaded(int waitMilliseconds)
{
using (var autoResetEvent = new AutoResetEvent(false))
{
var fakePluginLifetimeManagerFactory = new FakePluginLifetimeManagerFactory(autoResetEvent);
var pluginManager = new PluginManager(
AppDomain.CurrentDomain.BaseDirectory,
TimeSpan.FromMilliseconds(waitMilliseconds),
TimeSpan.FromMilliseconds(waitMilliseconds),
fakePluginLifetimeManagerFactory);
var plugin = pluginManager.Load<FakeCalculatorPlugin>();
autoResetEvent.WaitOne(TimeSpan.FromMinutes(1));
var pluginLifetimeManager = fakePluginLifetimeManagerFactory.LastPluginLifetimeManager as FakePluginLifetimeManager<FakeCalculatorPlugin>;
Assert.True(pluginLifetimeManager.Unloaded);
}
}
示例11: InitPlugin
private void InitPlugin()
{
if (plugins != null)
CleanupPlugin();
string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
plugins = new PluginManager<IViewerPlugin>(dir);
plugins.Load(new object[] { width, height, mode });
}
示例12: Unload_WhenThePluginHasBeenLoaded_TheUnloadWillBeSuccessfull
public void Unload_WhenThePluginHasBeenLoaded_TheUnloadWillBeSuccessfull()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
var plugin = pluginManager.Load<FakeCalculatorPlugin>();
pluginManager.Unload<FakeCalculatorPlugin>();
Assert.Throws<AppDomainUnloadedException>(() => plugin.IsPrime(3));
}
示例13: IsLoaded_WhenTheTypeWasUnloaded_ReturnsFalse
public void IsLoaded_WhenTheTypeWasUnloaded_ReturnsFalse()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
pluginManager.Load<FakeCalculatorPlugin>();
pluginManager.Unload<FakeCalculatorPlugin>();
Assert.False(pluginManager.IsLoaded<FakeCalculatorPlugin>());
}
示例14: Unload_WhenOneVersionOfThePluginIsUnloaded_TheSecondExists
public void Unload_WhenOneVersionOfThePluginIsUnloaded_TheSecondExists()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
pluginManager.Load<FakeCalculatorPlugin>();
pluginManager.Load<FakeAnotherCalculatorPlugin>();
pluginManager.Unload<FakeCalculatorPlugin>();
Assert.True(pluginManager.IsLoaded<FakeAnotherCalculatorPlugin>());
}
示例15: Unload_WhenThePluginUnloadedSecondTime_TheExceptionOccurs
public void Unload_WhenThePluginUnloadedSecondTime_TheExceptionOccurs()
{
var pluginManager = new PluginManager(AppDomain.CurrentDomain.BaseDirectory);
pluginManager.Load<FakeCalculatorPlugin>();
pluginManager.Unload<FakeCalculatorPlugin>();
Assert.Throws<InvalidOperationException>(() => pluginManager.Unload<FakeCalculatorPlugin>());
}