public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); PluginHost.OnBufferClick += (program, buffer) => { BufferView bvv = new BufferView( program.Instance, buffer, program.Dimensions.x, program.Dimensions.y ); Views.Add(bvv); bvv.Show(); }; PluginHost.OnInternalBufferClick += (program, buffer) => { BufferView bvv = new BufferView( program.Instance, buffer, program.Dimensions.x, program.Dimensions.y ); Views.Add(bvv); bvv.Show(); }; }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); WFCFLBufferSerializer wfcbuf = new WFCFLBufferSerializer(); PluginHost.BufferSerializer.AddSerializer(typeof(SerializableWaveFunctionCollapseFLBuffer), wfcbuf); }
/// <summary> /// Adds All Plugins that are compatible to the Host Specified in data.Host /// </summary> /// <param name="data">The Assembly Data</param> public static void AddPluginsFromLoaderResult(PluginAssemblyPointer data) { PluginLoaderResult res = GetAllPluginsCompatibleForHost(data); foreach (IPlugin re in res.LoadedPlugins) { PluginManager.AddPlugin(re, data); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); PluginHost.AddInstructionWithDefaultCreator <DefineVarFLInstruction>( "def", "DV", "Defines a variable in the local scope and assigns a value to it" ); PluginHost.AddInstructionWithDefaultCreator <DefineGlobalVarFLInstruction>( "gdef", "DV", "Defines a variable in global scope and assigns a value to it" ); PluginHost.AddInstructionWithDefaultCreator <DecrementVarFLInstruction>( "dec", "D|DV|DD", "Decrements a variable by 1 if no arguments specified." ); PluginHost.AddInstructionWithDefaultCreator <IncrementVarFLInstruction>( "inc", "D|DV|DD", "Increments a variable by 1 if no arguments specified." ); PluginHost.AddInstructionWithDefaultCreator <MultiplyVarFLInstruction>( "multiply", "DV|DD", "Multiplies a variable by the arguments Specified." ); PluginHost.AddInstructionWithDefaultCreator <DivideVarFLInstruction>( "divide", "DV|DD", "Divides a variable by the arguments Specified." ); PluginHost.AddInstructionWithDefaultCreator <BranchLessOrEqualFLInstruction>( "ble", "DVX|VVX|DDX", "Branches to the Specified function or script when firstparameter <= secondparameter" ); PluginHost.AddInstructionWithDefaultCreator <BranchGreaterOrEqualFLInstruction>( "bge", "DVX|VVX|DDX", "Branches to the Specified function or script when firstparameter >= secondparameter" ); PluginHost.AddInstructionWithDefaultCreator <BranchLessThanFLInstruction>( "blt", "DVX|VVX|DDX", "Branches to the Specified function or script when firstparameter < secondparameter" ); PluginHost.AddInstructionWithDefaultCreator <BranchGreaterThanFLInstruction>( "bgt", "DVX|VVX|DDX", "Branches to the Specified function or script when firstparameter > secondparameter" ); }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); PluginHost.AddInstruction(new KernelFLInstructionCreator(PluginHost.Database)); if (PluginHost.Database.TryGetClKernel("_arrange", out CLKernel arrangeKernel)) { PluginHost.AddInstruction(new GPUArrangeInstructionCreator(arrangeKernel)); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); Application.ApplicationExit += Application_ApplicationExit; string styleDir = Path.Combine(PluginPaths.GetPluginConfigDirectory(PluginAssemblyData), "styles"); Directory.CreateDirectory(styleDir); StyleManager_OnReload(); }
public override void OnLoad(PluginAssemblyPointer ptr) { //Call the Base OnLoad to Automatically do the registration. base.OnLoad(ptr); if (!isEmbedded) //Make sure that the Folder Packer is listed in the Init List and its one of the first things that get loaded. { LoadOrder.MoveToTop(LoadOrderQueue.Default, ptr.PluginName, true); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); sfdScript = new SaveFileDialog(); sfdScript.DefaultExt = "fl"; sfdScript.FileName = "FLFile"; sfdScript.Filter = "FLScript|*.fl|Exported FL Script|*.flc|Exported Image|*.png"; sfdScript.Title = "Save FL Script"; PluginHost.Editor.OnLoadStartupFile += OnInitLoad; }
private static void ProcessAttributes(IPlugin plugin, PluginAssemblyPointer ptr) { Dictionary <MemberInfo, Attribute[]> attribs = plugin.GetMemberAttributes <Attribute>( true, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic ); foreach (KeyValuePair <MemberInfo, Attribute[]> keyValuePair in attribs) { keyValuePair.Value.ToList().ForEach(x => AttributeManager.Handle(plugin, ptr, keyValuePair.Key, x)); } }
/// <summary> /// Loads all Plugins that are compatible to a Host /// </summary> /// <param name="data">The Pointer to the Package that should be searched.</param> /// <returns>Plugin Loader Result containing the Plugins</returns> public static PluginLoaderResult GetAllPluginsCompatibleForHost(PluginAssemblyPointer data) { Assembly asm = SaveLoadFrom(data); if (asm == null) { return(PluginLoaderResult.EmptyOrError); } List <IPlugin> plugins = CreateTypesFromInterface(asm, data.Host); return(new PluginLoaderResult { LoadedPlugins = plugins.ToArray() }); }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); if (isEmbedded) { return; } List <string> initList = ListHelper.LoadList(PluginPaths.InitPluginListFile).ToList(); if (!initList.Contains(PluginPaths.GetPluginAssemblyFile(ptr))) { initList.Add(PluginPaths.GetPluginAssemblyFile(ptr)); ListHelper.SaveList(PluginPaths.InitPluginListFile, initList.ToArray()); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); Type[] ts = Assembly.GetExecutingAssembly().GetExportedTypes(); Type target = typeof(ASerializableBufferCreator); for (int i = 0; i < ts.Length; i++) { if (target != ts[i] && target.IsAssignableFrom(ts[i])) { ASerializableBufferCreator bc = (ASerializableBufferCreator)Activator.CreateInstance(ts[i]); PluginHost.AddBufferCreator(bc); } } }
/// <summary> /// Activates a Package in the Plugin System. /// </summary> /// <param name="packageName">The Package to be activated.</param> /// <param name="addToExistingHosts">When True will add all plugins in the Package to Compatible Loaded Hosts.</param> internal static void ActivatePackage(string packageName, bool addToExistingHosts = false) { List <BasePluginPointer> globalPackages = ListHelper.LoadList(PluginPaths.GlobalPluginListFile).Select(x => new BasePluginPointer(x)).ToList(); BasePluginPointer packageKey = globalPackages.FirstOrDefault(x => x.PluginName == packageName); if (packageKey != null) { List <string> installedPackages = ListHelper.LoadList(PluginPaths.PluginListFile).ToList(); string key = packageKey.ToKeyPair(); if (!installedPackages.Contains(key)) { ActivatePackageEventArgs args = new ActivatePackageEventArgs(packageKey, true); OnActivatePackage?.Invoke(args); if (args.Cancel) { return; } installedPackages.Add(key); ListHelper.SaveList(PluginPaths.PluginListFile, installedPackages.ToArray()); if (addToExistingHosts) { foreach (KeyValuePair <IPluginHost, List <IPlugin> > loadedPlugin in LoadedPlugins) { PluginAssemblyPointer ptr = new PluginAssemblyPointer( packageKey.PluginName, packageKey.PluginFile, packageKey.PluginOrigin, packageKey.PluginVersion.ToString(), loadedPlugin.Key ); PluginLoader.AddPluginsFromLoaderResult(ptr); } } //UnloadPlugins(PluginHost); //LoadPlugins(PluginHost); AfterActivatePackage?.Invoke(new ActivatePackageEventArgs(packageKey, false)); } } }
private void CheckOriginsExists(PluginAssemblyPointer ptr) { string file = RepositoryPlugin.GetOriginFilePath(ptr); Directory.CreateDirectory(Path.GetDirectoryName(file)); if (!File.Exists(file)) { bool res = FLData.ShowDialog( "[repo]", $"{ptr.PluginName}: First Startup.", "Do you want to create the default Origins File?" ); if (res) { WriteDefaultOrigin(file); } } }
private RepositoryPlugin GetPlugin() { if (repoPlugin == null) { repoPlugin = PluginManager.GetPlugins <RepositoryPlugin>().FirstOrDefault(); if (repoPlugin == null) { repoPlugin = new RepositoryPlugin(); PluginAssemblyPointer ptr = GetDefaultRepoPluginPointer(); PluginManager.AddPlugin( repoPlugin, ptr ); } } return(repoPlugin); }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); PluginHost.AddInstructionWithDefaultCreator <JumpFLInstruction>( "jmp", "X", "Jumps to a Script or Function and returns. The active channels and buffer will not be cleared" ); PluginHost.AddInstructionWithDefaultCreator <SetActiveFLInstruction>( "setactive", "E|EV|EVV|EVVV|EVVVV|VVVV|VVV|VV|V", "Sets the active buffer and active channel states." ); PluginHost.AddInstructionWithDefaultCreator <RandomFLInstruction>( "rnd", "|B", "Writes random values to all active channels of the active buffer" ); PluginHost.AddInstructionWithDefaultCreator <URandomFLInstruction>( "urnd", "|B", "Writes random values to all active channels of the active buffer, the channels of a pixel will have the same color(grayscale)" ); PluginHost.AddInstructionWithDefaultCreator <PrintLineFLInstruction>( "print", "A|AA|AAA|AAAA|AAAAA|AAAAAA|AAAAAAA|AAAAAAAA|AAAAAAAAA|AAAAAAAAAA|AAAAAAAAAAA|AAAAAAAAAAAA", "Prints text or all kinds of variables to the console." ); PluginHost.AddInstructionWithDefaultCreator <CPUArrangeFLInstruction>( "arrange", "V|VV|VVV|VVVV", "Swaps the channels based on the arguments provided" ); PluginHost.AddInstructionWithDefaultCreator <ArraySetFLInstruction>( "arrset", "CVV", "sets the specified value at the specified index." ); }
/// <summary> /// Adds a Plugin to the Host specified in the PluginPointer Data /// </summary> /// <param name="plugin">Plugin to Add</param> /// <param name="data">The Plugin Pointer</param> public static void AddPlugin(IPlugin plugin, PluginAssemblyPointer data) { if (!IsInitialized) { throw new Exception("Can not use the plugin System when its not initialized."); } if (!LoadedPlugins.ContainsKey(data.Host)) { LoadPlugins(data.Host, false); } if (!LoadedPlugins[data.Host].Contains(plugin)) { if (!data.Host.IsAllowedPlugin(plugin)) { return; } AddPluginEventArgs args = new AddPluginEventArgs(data, plugin, true); OnAddPlugin?.Invoke(args); if (args.Cancel) { return; } SendLog($"Adding {plugin.GetType().Name} to {data.Host.GetType().Name}"); data.EnsureDirectoriesExist(); PointerMap[plugin] = data; LoadedPlugins[data.Host].Add(plugin); plugin.OnLoad(data); data.Host.OnPluginLoad(plugin, data); ProcessAttributes(plugin, data); AfterAddPlugin?.Invoke(new AddPluginEventArgs(data, plugin, false)); } }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); List <FLProgramCheck> checks = new List <FLProgramCheck>(); checks.AddRange( Assembly.GetExecutingAssembly().GetTypes() .Where( y => !y.IsAbstract && typeof(FLProgramCheck) .IsAssignableFrom(y) && y != typeof(FLProgramCheck) ) .Select( y => (FLProgramCheck)Activator .CreateInstance(y) ) .Where(y => (y.CheckType & PluginHost.StartProfile) != 0) ); checks.ForEach(x => PluginHost.AddProgramCheck(x)); }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); ManifestReader.RegisterAssembly(typeof(ExampleInformation).Assembly); }
public override void OnLoad(PluginAssemblyPointer ptr) { StartupSequence.CustomStartupActions += Initialize; }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); MessageBox.Show("Test Plugin loaded."); }
/// <summary> /// Ensures that the Directory structure of a Pointer exists. /// Loads all Plugins From a Pointer. /// </summary> /// <param name="data">The Pointer to load.</param> private static void AddFromLoaderResult(PluginAssemblyPointer data) { data.EnsureDirectoriesExist(); PluginLoader.AddPluginsFromLoaderResult(data); }
public static void Handle <T>(IPlugin plugin, PluginAssemblyPointer ptr, MemberInfo info, T attribute) where T : Attribute { Handlers.ForEach(x => x.Handle(plugin, ptr, info, attribute)); }
public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); ManifestReader.RegisterAssembly(Assembly.GetExecutingAssembly()); }
/// <summary> /// Gets Called when this Plugin is detached from a host /// </summary> public virtual void OnUnload() { PluginAssemblyData = null; }
/// <summary> /// Gets Called when this Plugin is attached to a Host. /// </summary> /// <param name="ptr">The Pointer that is used to Query File Paths and other Plugin Specific Data</param> public virtual void OnLoad(PluginAssemblyPointer ptr) { PluginAssemblyData = ptr; }
public PluginPackageConverterForm(PluginAssemblyPointer ptr) { InitializeComponent(); Pointer = ptr; }
/// <summary> /// Gets Called when this Plugin is attached to a Host. /// </summary> /// <param name="ptr">The Pointer that is used to Query File Paths and other Plugin Specific Data</param> public override void OnLoad(PluginAssemblyPointer ptr) { base.OnLoad(ptr); PluginPacker.AddPackerFormat(this); }
/// <summary> /// Loads a C# Assembly from a Pointer /// </summary> /// <param name="data">Pointer Data</param> /// <returns>Loaded Assembly</returns> public static Assembly SaveLoadFrom(PluginAssemblyPointer data) { return(SaveLoadFrom(PluginPaths.GetPluginAssemblyFile(data))); }