本文整理汇总了C#中Plugin类的典型用法代码示例。如果您正苦于以下问题:C# Plugin类的具体用法?C# Plugin怎么用?C# Plugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Plugin类属于命名空间,在下文中一共展示了Plugin类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: loadXML
private void loadXML()
{
XmlDocument store = new XmlDocument();
try
{
store.Load("store.xml");
}
catch(Exception e)
{
MessageBox.Show("Impossible d'ouvrir le fichier : store.xml\nVeuillez mettre à jour votre liste de plugins.");
return;
}
XmlNode plugins = store.DocumentElement.SelectSingleNode("/plugins");
foreach(XmlNode node in plugins.ChildNodes)
{
Plugin p = new Plugin();
p.Creator = node.SelectSingleNode("creator").InnerText;
p.Description = node.SelectSingleNode("description").InnerText;
p.Name = node.SelectSingleNode("name").InnerText;
p.Url = node.SelectSingleNode("url").InnerText;
p.Version = node.SelectSingleNode("version").InnerText;
p.Download = node.SelectSingleNode("download").InnerText;
this.plugins.Add(p);
listBox1.Items.Add(p.Name);
}
}
开发者ID:mythseur,项目名称:Manga-Downloader,代码行数:30,代码来源:AddPluginWindow.cs
示例2: OnConnection
/// <summary>
/// Implements the OnConnection method of the IDTExtensibility2 interface.
/// Receives notification that the Add-in is being loaded.
/// </summary>
/// <param name="application">The application.</param>
/// <param name="connectMode">The connect mode.</param>
/// <param name="addInInst">The add in inst.</param>
/// <param name="custom">The custom.</param>
/// <seealso class="IDTExtensibility2"/>
public void OnConnection(object application, ext_ConnectMode connectMode,
object addInInst, ref Array custom)
{
if (_gitPlugin == null)
{
var cultureInfo = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = cultureInfo;
_gitPlugin =
new Plugin((DTE2)application, (AddIn)addInInst, "GitExtensions", "GitPlugin.Connect");
}
switch (connectMode)
{
case ext_ConnectMode.ext_cm_UISetup:
// Install CommandBar permanently (only runs once per AddIn)
GitPluginUISetup();
break;
case ext_ConnectMode.ext_cm_Startup:
// The add-in was marked to load on startup
// Do nothing at this point because the IDE may not be fully initialized
// Visual Studio will call OnStartupComplete when fully initialized
GitPluginUIUpdate();
break;
case ext_ConnectMode.ext_cm_AfterStartup:
// The add-in was loaded by hand after startup using the Add-In Manager
// Initialize it in the same way that when is loaded on startup
GitPluginInit();
break;
}
}
开发者ID:HuChundong,项目名称:gitextensions,代码行数:42,代码来源:Connect.cs
示例3: PluginViewModel
public PluginViewModel(Plugin plugin)
{
this.Plugin = plugin;
var notifiers = plugin.OfType<INotifier>().ToArray();
if (notifiers.Length >= 1) this.notifier = new AggregateNotifier(notifiers);
}
开发者ID:NatLee,项目名称:KanColleViewer,代码行数:7,代码来源:PluginViewModel.cs
示例4: Run
public static bool Run(Plugin plugin, ICore core)
{
var gcList = from Geocache gc in core.Geocaches
where gc.FoundDate!=null
&& ((DateTime)gc.FoundDate).Month == gc.PublishedTime.Month
&& ((DateTime)gc.FoundDate).Day == gc.PublishedTime.Day
select gc;
//mass update, so within begin and end
core.Geocaches.BeginUpdate();
//reset current selection
foreach (Geocache gc in core.Geocaches)
{
gc.Selected = false;
}
//set the intended selection
foreach (Geocache gc in gcList)
{
gc.Selected = true;
}
core.Geocaches.EndUpdate();
return true;
}
开发者ID:GlobalcachingEU,项目名称:GAPP,代码行数:25,代码来源:Select+founddate+is+hiddendate.cs
示例5: AddChatCommand
public void AddChatCommand(string name, Plugin plugin, string callback_name)
{
var command_name = name.ToLowerInvariant();
ChatCommand cmd;
if (chatCommands.TryGetValue(command_name, out cmd))
{
var previous_plugin_name = cmd.Plugin?.Name ?? "an unknown plugin";
var new_plugin_name = plugin?.Name ?? "An unknown plugin";
var msg = $"{new_plugin_name} has replaced the '{command_name}' chat command previously registered by {previous_plugin_name}";
Interface.Oxide.LogWarning(msg);
}
cmd = new ChatCommand(command_name, plugin, callback_name);
// Add the new command to collections
chatCommands[command_name] = cmd;
var commandAttribute = new CommandAttribute("/" + command_name, string.Empty);
var action = (Action<CommandInfo>)Delegate.CreateDelegate(typeof(Action<CommandInfo>), this, GetType().GetMethod("HandleCommand", BindingFlags.NonPublic | BindingFlags.Instance));
commandAttribute.Method = action;
if (CommandManager.RegisteredCommands.ContainsKey(command_name))
{
var new_plugin_name = plugin?.Name ?? "An unknown plugin";
var msg = $"{new_plugin_name} has replaced the '{command_name}' chat command";
Interface.Oxide.LogWarning(msg);
}
CommandManager.RegisteredCommands[command_name] = commandAttribute;
// Hook the unload event
if (plugin) plugin.OnRemovedFromManager += plugin_OnRemovedFromManager;
}
开发者ID:906507516,项目名称:Oxide,代码行数:32,代码来源:Command.cs
示例6: WebRequest
/// <summary>
/// Initializes a new instance of the WebRequest class
/// </summary>
/// <param name="url"></param>
/// <param name="callback"></param>
/// <param name="owner"></param>
public WebRequest(string url, Action<int, string> callback, Plugin owner)
{
URL = url;
Callback = callback;
Owner = owner;
removedFromManager = Owner?.OnRemovedFromManager.Add(owner_OnRemovedFromManager);
}
开发者ID:yas-online,项目名称:Oxide,代码行数:13,代码来源:WebRequests.cs
示例7: Run
public static bool Run(Plugin plugin, ICore core)
{
DateTime dt = DateTime.Now.AddDays(-7);
var gcList = from Geocache gc in core.Geocaches
where gc.DataFromDate < dt
select gc;
//mass update, so within begin and end
core.Geocaches.BeginUpdate();
//reset current selection
foreach (Geocache gc in core.Geocaches)
{
gc.Selected = false;
}
//set the intended selection
foreach (Geocache gc in gcList)
{
gc.Selected = true;
}
if (MessageBox.Show(LanguageSupport.Instance.GetTranslation("Automatically archive selected geocaches?"),LanguageSupport.Instance.GetTranslation("Archive"), MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)== DialogResult.Yes)
{
foreach (Geocache gc in gcList)
{
gc.Archived = true;
gc.Available = false;
}
}
core.Geocaches.EndUpdate();
return true;
}
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:33,代码来源:Select+geocache+not+updated+for+a+week.cs
示例8: GameServer
public GameServer(ref Config uc, ref GameData gd, ref Plugin[] plugs, ref ExtensionHandler ext)
{
UserConfig = uc;
gameData = gd;
Plugins = plugs;
extensions = ext;
}
开发者ID:neo1106,项目名称:l2script,代码行数:7,代码来源:GameServer.cs
示例9: AddConsoleCommand
public void AddConsoleCommand(string name, Plugin plugin, string callback_name)
{
// Hook the unload event
if (plugin) plugin.OnRemovedFromManager += plugin_OnRemovedFromManager;
var full_name = name.Trim();
ConsoleCommand cmd;
if (consoleCommands.TryGetValue(full_name, out cmd))
{
// This is a custom command which was already registered by another plugin
var previous_plugin_name = cmd.PluginCallbacks[0].Plugin?.Name ?? "An unknown plugin";
var new_plugin_name = plugin?.Name ?? "An unknown plugin";
var msg = $"{new_plugin_name} has replaced the {name} console command which was previously registered by {previous_plugin_name}";
Interface.Oxide.LogWarning(msg);
consoleCommands.Remove(full_name);
}
// The command either does not already exist or is replacing a previously registered command
cmd = new ConsoleCommand(full_name);
cmd.AddCallback(plugin, callback_name);
// Add the new command to collections
consoleCommands[full_name] = cmd;
}
开发者ID:CypressCube,项目名称:Oxide,代码行数:25,代码来源:Command.cs
示例10: RegisteredCommand
/// <summary>
/// Initializes a new instance of the RegisteredCommand class
/// </summary>
/// <param name="source"></param>
/// <param name="command"></param>
/// <param name="callback"></param>
public RegisteredCommand(Plugin source, string command, string callback)
{
// Store fields
Source = source;
Command = command;
Callback = callback;
}
开发者ID:906507516,项目名称:Oxide,代码行数:13,代码来源:Covalence.cs
示例11: LoadPlugins
// --- functions ---
/// <summary>Loads all non-runtime plugins.</summary>
internal static void LoadPlugins()
{
UnloadPlugins();
string folder = Program.FileSystem.GetDataFolder("Plugins");
string[] files = Directory.GetFiles(folder);
List<Plugin> list = new List<Plugin>();
foreach (string file in files) {
if (file.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) {
try {
Plugin plugin = new Plugin(file);
Assembly assembly = Assembly.LoadFile(file);
Type[] types = assembly.GetTypes();
foreach (Type type in types) {
if (type.IsSubclassOf(typeof(OpenBveApi.Textures.TextureInterface))) {
plugin.Texture = (OpenBveApi.Textures.TextureInterface)assembly.CreateInstance(type.FullName);
}
if (type.IsSubclassOf(typeof(OpenBveApi.Sounds.SoundInterface))) {
plugin.Sound = (OpenBveApi.Sounds.SoundInterface)assembly.CreateInstance(type.FullName);
}
if (type.IsSubclassOf(typeof(OpenBveApi.Objects.ObjectInterface))) {
plugin.Object = (OpenBveApi.Objects.ObjectInterface)assembly.CreateInstance(type.FullName);
}
}
if (plugin.Texture != null | plugin.Sound != null | plugin.Object != null) {
plugin.Load();
list.Add(plugin);
}
} catch {
// TODO //
}
}
}
LoadedPlugins = list.ToArray();
}
开发者ID:sladen,项目名称:openbve,代码行数:36,代码来源:Plugins.cs
示例12: RequestBootstrapFile
/// <summary>
/// Requests the bootstrap file.
/// </summary>
/// <param name="projectService">The project service.</param>
/// <param name="plugin">The plugin.</param>
internal void RequestBootstrapFile(
IProjectService projectService,
Plugin plugin)
{
TraceService.WriteLine("PluginService::RequestBootstrapFile plugin=" + plugin.FriendlyName);
string bootstrapFileName = plugin.FriendlyName + "PluginBootstrap.cs";
//// check if the file already exists
IProjectItemService projectItemService = projectService.GetProjectItem(bootstrapFileName);
if (projectItemService == null)
{
//// get the currently requested plugins.
string currentPlugins = this.settingsService.PluginsToAdd;
string newPlugins = currentPlugins + "+" + bootstrapFileName;
//// and now save the new requested plugins.
this.settingsService.PluginsToAdd = newPlugins;
TraceService.WriteLine("***plugins for" + projectService.Name + " " + newPlugins);
}
}
开发者ID:RobGibbens,项目名称:NinjaCoderForMvvmCross,代码行数:30,代码来源:PluginService.cs
示例13: EnqueuePost
public void EnqueuePost(string url, string postdata, string callback, Plugin owner, Dictionary<string, string> headers = null)
{
Interface.Oxide.GetLibrary<WebRequests>("WebRequests").EnqueuePost(url, postdata, (a, b) =>
{
owner.CallHook(callback, a, b);
}, owner, headers);
}
开发者ID:906507516,项目名称:Oxide,代码行数:7,代码来源:JavaScriptWebRequests.cs
示例14: UnRegister
public static void UnRegister(Plugin plugin)
{
if (Find(plugin) == null)
throw new Exception("This plugin doesnt have this event registered!");
else
events.Remove(Find(plugin));
}
开发者ID:Nerketur,项目名称:ForgeCraft,代码行数:7,代码来源:OnPlayerChatEvent.cs
示例15: WebRequest
/// <summary>
/// Initializes a new instance of the WebRequest class
/// </summary>
/// <param name="url"></param>
/// <param name="callback"></param>
/// <param name="owner"></param>
public WebRequest(string url, Action<int, string> callback, Plugin owner)
{
URL = url;
Callback = callback;
Owner = owner;
if (Owner != null) Owner.OnRemovedFromManager += owner_OnRemovedFromManager;
}
开发者ID:906507516,项目名称:Oxide,代码行数:13,代码来源:WebRequests.cs
示例16: Configure
public void Configure(Plugin plugin)
{
foreach (var rule in _setterRules)
{
plugin.UseSetterRule(rule);
}
}
开发者ID:rhyss,项目名称:structuremap,代码行数:7,代码来源:SetterRules.cs
示例17: Register
public static void Register(Player.OnPlayerChat method, Priority priority, Plugin plugin)
{
if (Find(plugin) != null)
throw new Exception("The user tried to register 2 of the same event!");
events.Add(new OnPlayerChatEvent(method, priority, plugin));
Organize();
}
开发者ID:Nerketur,项目名称:ForgeCraft,代码行数:7,代码来源:OnPlayerChatEvent.cs
示例18: PluginCache
static PluginCache()
{
_setterRules = new List<Predicate<PropertyInfo>>();
_plugins = new Cache<Type, Plugin>(t =>
{
var plugin = new Plugin(t);
foreach (var rule in _setterRules)
{
plugin.UseSetterRule(rule);
}
return plugin;
});
_builders = new Cache<Type, IInstanceBuilder>(t =>
{
try
{
Plugin plugin = _plugins[t];
return BuilderCompiler.CreateBuilder(plugin);
}
catch (Exception e)
{
throw new StructureMapException(245, e, t.AssemblyQualifiedName);
}
});
}
开发者ID:smerrell,项目名称:structuremap,代码行数:27,代码来源:PluginCache.cs
示例19: ConnecitvityChanged
void ConnecitvityChanged (object sender, Plugin.Connectivity.Abstractions.ConnectivityChangedEventArgs e)
{
Device.BeginInvokeOnMainThread(() =>
{
OfflineStack.IsVisible = !e.IsConnected;
});
}
开发者ID:jv9,项目名称:app-coffeecups,代码行数:7,代码来源:CoffeesPage.xaml.cs
示例20: LoadPlugin
/// <summary>
/// Loads a given plugin
/// </summary>
/// <param name="plugin"></param>
/// <param name="waitingForAccess"></param>
protected void LoadPlugin(Plugin plugin, bool waitingForAccess = false)
{
if (!File.Exists(plugin.Filename))
{
LoadingPlugins.Remove(plugin.Name);
Interface.Oxide.LogWarning("Script no longer exists: {0}", plugin.Name);
return;
}
try
{
plugin.Load();
Interface.Oxide.UnloadPlugin(plugin.Name);
LoadingPlugins.Remove(plugin.Name);
Interface.Oxide.PluginLoaded(plugin);
}
catch (IOException)
{
if (!waitingForAccess) Interface.Oxide.LogWarning("Waiting for another application to stop using script: {0}", plugin.Name);
Interface.Oxide.GetLibrary<Timer>().Once(.5f, () => LoadPlugin(plugin, true));
}
catch (Exception ex)
{
LoadingPlugins.Remove(plugin.Name);
Interface.Oxide.LogException($"Failed to load plugin {plugin.Name}", ex);
}
}
开发者ID:906507516,项目名称:Oxide,代码行数:32,代码来源:PluginLoader.cs
注:本文中的Plugin类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论