protected abstract bool Initialize(PluginMetadata meta, JObject featureData);
public virtual void AfterInit(PluginMetadata plugin, object pluginInstance) => AfterInit(plugin);
public void RemoveResultsExcept(PluginMetadata metadata) { Results.RemoveAll(r => r.Result.PluginID != metadata.ID); }
public GtxtPlugin() { Metadata = new PluginMetadata("GTXT", "onepiecefreak", "The main image resource in Professor Layton Spectre's Call by Level5."); }
public MtArcPlugin() { Metadata = new PluginMetadata("MT ARC", "onepiecefreak", "The main archive resource in Capcom games using the MT Framework."); }
private void Uninstall(PluginMetadata plugin) { // Marked for deletion. Will be deleted on next start up using var _ = File.CreateText(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")); }
public PackPlugin() { Metadata = new PluginMetadata("PACK", "onepiecefreak", "The resource archive for Dragon Quest XI."); }
private void addPluginMetadata(Dictionary <string, CustomizedPluginConfig> configs, PluginMetadata metadata) { configs[metadata.ID] = new CustomizedPluginConfig { ID = metadata.ID, Name = metadata.Name, ActionKeywords = metadata.ActionKeywords, Disabled = false }; }
public Task <bool> DownloadPlugin(PluginMetadata metadata) { return(AppInfo.PluginManager.DownloadPlugin(metadata)); }
public MtexPlugin() { Metadata = new PluginMetadata("TOTEXK", "Megaflan", "The image format found in Tales of Abyss 3DS"); }
/// <summary> /// Ensures a plugin's assembly is loaded. Do not use unless you need to. /// </summary> /// <param name="plugin">the plugin to ensure is loaded.</param> protected void RequireLoaded(PluginMetadata plugin) => PluginLoader.Load(plugin);
/// <summary> /// Called after a plugin has been fully initialized, whether or not there is an `Init` method. This should never throw an exception. /// </summary> /// <param name="plugin">the plugin that was just initialized</param> public virtual void AfterInit(PluginMetadata plugin) { }
/// <summary> /// Called before a plugin's `Init` method is called. This will not be called if there is no `Init` method. This should never throw an exception. An exception will abort the loading of the plugin with an error. /// </summary> /// <param name="plugin">the plugin to be initialized</param> /// <returns>whether or not to call the Init method</returns> public virtual bool BeforeInit(PluginMetadata plugin) => true;
private void UnInstallPlugin(PluginMetadata plugin) { string content = string.Format("Do you want to uninstall following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author); if (MessageBox.Show(content, "Wox", MessageBoxButtons.YesNo) == DialogResult.Yes) { File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close(); if (MessageBox.Show( "You have uninstalled plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?", "Install plugin", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ProcessStartInfo Info = new ProcessStartInfo(); Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + Application.ExecutablePath + "\""; Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.FileName = "cmd.exe"; Process.Start(Info); context.API.CloseApp(); } } }
public PacPlugin() { Metadata = new PluginMetadata("PAC", "onepiecefreak", "The main resource in Mario Party 10."); }
/// <summary> /// Called before a plugin is loaded. This should never throw an exception. An exception will abort the loading of the plugin with an error. /// </summary> /// <remarks> /// The assembly will still be loaded, but the plugin will not be constructed if this returns <see langword="false" />. /// Any features it defines, for example, will still be loaded. /// </remarks> /// <param name="plugin">the plugin about to be loaded</param> /// <returns>whether or not the plugin should be loaded</returns> public virtual bool BeforeLoad(PluginMetadata plugin) => true;
internal static void Install(string path) { if (File.Exists(path)) { string tempFoler = Path.Combine(Path.GetTempPath(), "wox\\plugins"); if (Directory.Exists(tempFoler)) { Directory.Delete(tempFoler, true); } UnZip(path, tempFoler, true); string iniPath = Path.Combine(tempFoler, "plugin.json"); if (!File.Exists(iniPath)) { MessageBox.Show("Install failed: plugin config is missing"); return; } PluginMetadata plugin = GetMetadataFromJson(tempFoler); if (plugin == null || plugin.Name == null) { MessageBox.Show("Install failed: plugin config is invalid"); return; } string pluginFolerPath = PluginManager.PluginDirectory; string newPluginName = plugin.Name .Replace("/", "_") .Replace("\\", "_") .Replace(":", "_") .Replace("<", "_") .Replace(">", "_") .Replace("?", "_") .Replace("*", "_") .Replace("|", "_") + "-" + Guid.NewGuid(); string newPluginPath = Path.Combine(pluginFolerPath, newPluginName); string content = string.Format( "Do you want to install following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author); PluginPair existingPlugin = PluginManager.GetPluginForId(plugin.ID); if (existingPlugin != null) { content = string.Format( "Do you want to update following plugin?\r\n\r\nName: {0}\r\nOld Version: {1}\r\nNew Version: {2}\r\nAuthor: {3}", plugin.Name, existingPlugin.Metadata.Version, plugin.Version, plugin.Author); } DialogResult result = System.Windows.Forms.MessageBox.Show(content, "Install plugin", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (existingPlugin != null && Directory.Exists(existingPlugin.Metadata.PluginDirectory)) { //when plugin is in use, we can't delete them. That's why we need to make plugin folder a random name File.Create(Path.Combine(existingPlugin.Metadata.PluginDirectory, "NeedDelete.txt")).Close(); } UnZip(path, newPluginPath, true); Directory.Delete(tempFoler, true); //exsiting plugins may be has loaded by application, //if we try to delelte those kind of plugins, we will get a error that indicate the //file is been used now. //current solution is to restart wox. Ugly. //if (MainWindow.Initialized) //{ // Plugins.Init(); //} if (MessageBox.Show("You have installed plugin " + plugin.Name + " successfully.\r\n Restart Wox to take effect?", "Install plugin", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { ProcessStartInfo Info = new ProcessStartInfo(); Info.Arguments = "/C ping 127.0.0.1 -n 1 && \"" + System.Windows.Forms.Application.ExecutablePath + "\""; Info.WindowStyle = ProcessWindowStyle.Hidden; Info.CreateNoWindow = true; Info.FileName = "cmd.exe"; Process.Start(Info); PluginManager.API.CloseApp(); } } } }
public SangoBinPlugin() { Metadata = new PluginMetadata("BIN", "onepiecefreak", "One file archive found in Yo-Kai Watch Sangokushi."); }
public RawJtexPlugin() { Metadata = new PluginMetadata("RawJTEX", "onepiecefreak", "The image format used in 3DS games."); }
public PluginPair(PluginMetadata metadata, IPlugin plugin) { Metadata = metadata; Plugin = plugin; }
internal static void Install(string path) { if (File.Exists(path)) { string tempFoler = Path.Combine(Path.GetTempPath(), "wox\\plugins"); if (Directory.Exists(tempFoler)) { Directory.Delete(tempFoler, true); } UnZip(path, tempFoler, true); string iniPath = Path.Combine(tempFoler, "plugin.json"); if (!File.Exists(iniPath)) { MessageBox.Show("Install failed: plugin config is missing"); return; } PluginMetadata plugin = GetMetadataFromJson(tempFoler); if (plugin == null || plugin.Name == null) { MessageBox.Show("Install failed: plugin config is invalid"); return; } string pluginFolerPath = Infrastructure.Constant.PluginsDirectory; string newPluginName = plugin.Name .Replace("/", "_") .Replace("\\", "_") .Replace(":", "_") .Replace("<", "_") .Replace(">", "_") .Replace("?", "_") .Replace("*", "_") .Replace("|", "_") + "-" + Guid.NewGuid(); string newPluginPath = Path.Combine(pluginFolerPath, newPluginName); string content = $"Do you want to install following plugin?{Environment.NewLine}{Environment.NewLine}" + $"Name: {plugin.Name}{Environment.NewLine}" + $"Version: {plugin.Version}{Environment.NewLine}" + $"Author: {plugin.Author}"; PluginPair existingPlugin = PluginManager.GetPluginForId(plugin.ID); if (existingPlugin != null) { content = $"Do you want to update following plugin?{Environment.NewLine}{Environment.NewLine}" + $"Name: {plugin.Name}{Environment.NewLine}" + $"Old Version: {existingPlugin.Metadata.Version}" + $"{Environment.NewLine}New Version: {plugin.Version}" + $"{Environment.NewLine}Author: {plugin.Author}"; } var result = MessageBox.Show(content, "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { if (existingPlugin != null && Directory.Exists(existingPlugin.Metadata.PluginDirectory)) { //when plugin is in use, we can't delete them. That's why we need to make plugin folder a random name File.Create(Path.Combine(existingPlugin.Metadata.PluginDirectory, "NeedDelete.txt")).Close(); } UnZip(path, newPluginPath, true); Directory.Delete(tempFoler, true); //existing plugins could be loaded by the application, //if we try to delete those kind of plugins, we will get a error that indicate the //file is been used now. //current solution is to restart wox. Ugly. //if (MainWindow.Initialized) //{ // Plugins.Initialize(); //} if (MessageBox.Show($"You have installed plugin {plugin.Name} successfully.{Environment.NewLine}" + "Restart Wox to take effect?", "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { PluginManager.API.RestarApp(); } } } }
public GcBnrPlugin() { Metadata = new PluginMetadata("BNR", "onepiecefreak", "The GameCube Banner format."); }
public BchPlugin() { Metadata = new PluginMetadata("BCH", "onepiecefreak", "The object resource for games on Nintendo 3DS."); }
public void RemoveResultsFor(PluginMetadata metadata) { Results.RemoveAll(r => r.Result.PluginID == metadata.ID); }
public SegPlugin() { Metadata = new PluginMetadata("SEG", "onepiecefreak", "The SEG format in Super Robot Taisen Z."); }
protected override bool Initialize(PluginMetadata meta, JObject featureData) { throw new NotImplementedException(); }
public ChnkPlugin() { Metadata = new PluginMetadata("CHNK", "onepiecefreak", "Image resource in Metal Max 3."); }
public virtual void BeforeInit(PluginMetadata plugin) { }
public DpkPlugin() { Metadata = new PluginMetadata("DPK", "onepiecefreak", "The main resource for Final Fantasy 1 3DS."); }
private void UnInstalledPlugins(PluginMetadata plugin) { string content = string.Format("Do you want to uninstall following plugin?\r\n\r\nName: {0}\r\nVersion: {1}\r\nAuthor: {2}", plugin.Name, plugin.Version, plugin.Author); if (MessageBox.Show(content, "Wox", MessageBoxButtons.YesNo) == DialogResult.Yes) { File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close(); MessageBox.Show("This plugin has been removed, restart Wox to take effect"); } }
public IrarcPlugin() { Metadata = new PluginMetadata("IRARC", "onepiecefreak", "An archive for Azure Striker Gunvolt on 3DS."); }
private void UnInstallPlugin(PluginMetadata plugin) { string content = $"Do you want to uninstall following plugin?{Environment.NewLine}{Environment.NewLine}" + $"Name: {plugin.Name}{Environment.NewLine}" + $"Version: {plugin.Version}{Environment.NewLine}" + $"Author: {plugin.Author}"; if (MessageBox.Show(content, "Wox", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { File.Create(Path.Combine(plugin.PluginDirectory, "NeedDelete.txt")).Close(); var result = MessageBox.Show($"You have uninstalled plugin {plugin.Name} successfully.{Environment.NewLine}" + "Restart Wox to take effect?", "Install plugin", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { context.API.RestarApp(); } } }
/// <summary> /// Initializes the feature with the parameters provided in the definition. /// /// Note: When no parenthesis are provided, <paramref name="parameters"/> is an empty array. /// </summary> /// <remarks> /// This gets called BEFORE *your* `Init` method. /// /// Returning <see langword="false" /> does *not* prevent the plugin from being loaded. It simply prevents the feature from being used. /// </remarks> /// <param name="meta">the metadata of the plugin that is being prepared</param> /// <param name="parameters">the parameters passed to the feature definition, or null</param> /// <returns><see langword="true"/> if the feature is valid for the plugin, <see langword="false"/> otherwise</returns> public abstract bool Initialize(PluginMetadata meta, string[] parameters);