Plugin Engine

From World Wind Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 08:35, 11 January 2018 (edit)
Monday (Talk | contribs)

← Previous diff
Current revision (10:58, 30 January 2018) (edit) (undo)
Bull (Talk | contribs)
m (Reverted edits by Monday (Talk); changed back to last version by 209.44.140.22)
 
Line 1: Line 1:
-hll20180112+A C#/VB/JScript.NET '''Plugin Engine''' was added to World Wind in version 1.3.2.
-http://www.outletmichaelkorsonline.us.com+ 
-http://www.coach-outletonlines.us.com+==Features==
-http://www.mulberry-bags.me.uk+*Dynamic compilation and execution of script code written in the following languages:
-http://www.ralphlaurensale-clearance.me.uk+**C#
-http://www.adidasnmdr1.us.com+**VB.NET
-http://www.ultraboost.us+**JSCript.net
-http://wwwcanadagoose-uk.com.co+*Load plugins from precompiled .dll files
-http://www.longchampoutletus.us.com+*Full access to World Wind internals (same as internal code)
-http://www.philippplein-outlet.com+*Runs at full speed (compilation on load)
-http://www.polooutlets.us.org+ 
-http://www.katespadeonlineoutlet.us.com+==Engine logic==
-http://www.canadagoosesalejackets.us.com+When World Wind starts the following steps are performed:
-http://www.hermes.us.org+*The [http://cvs.sourceforge.net/viewcvs.py/nasa-exp/WorldWind/WorldWind/PluginEngine/PluginCompiler.cs?view=markup PluginCompiler] scans '''bin\Plugins''' directory and the 1st level subdirectories of the plugin directory for files ending in any of the supported file extensions.
-http://www.ralphlaurensale-clearance.org.uk+*When it finds one it tries to compile the source (to memory) with references to the same assemblies as the app has referenced.
-http://www.burberry-outlet-canada.ca+*It then searches the compiled assembly for an implementation of [http://cvs.sourceforge.net/viewcvs.py/nasa-exp/WorldWind/WorldWind/PluginEngine/Plugin.cs?view=markup Plugin].
-http://www.cheapoakleysunglassesofficial.us.com+ 
-http://www.cheapraybans.com.co+==Benefits==
-http://www.air-max2018.us.com+*Since the compiler for C#,VB and JSCript comes with the .Net Framework no additional third party library is required.
-http://www.red-bottoms.us.com+**For other languages (like J#) an install will be needed, and unfortunately I haven't found an easy way of enumerating all available compilers (before .Net 2.0)
-http://www.pandorajewelrypandora.us.com+*Very fast on-the-fly compilation of the scripts.
-http://www.yeezyboost-350.us.com+*Scripts executes with same speed as a precompiled assembly.
-http://www.canadagoosejacketscanada.ca+*Debuggable inside World Wind project (World Wind in debug build loads internal plugins)
-http://www.uggbootsonline.us+*Custom dlls may be dynamically loaded
-http://www.canadagoosesaleoutlet.us.com+ 
-http://www.uggbootswomen.us.com+==Drawbacks==
-http://wwwcanadagoose-jacketsuk.com.co+*Security: The script could wipe out the hard drive or worse. But with a script at least the user can verify the intentions by looking at the source. Even current add-ons (layers) are often .exe installers giving the user no way of identifying evil code.
-http://www.polooutlet.in.net+*To unload a script's assembly from memory completely, WW needs a restarted (there are workarounds (appdomains))
-http://www.canadagooseoutletus.us.com+*With no nailed down limited interface into WW the script could stop working on a new version of WW.
-http://www.airmax-2018.com+ 
-http://www.adidasyeezyboost-350.us.com+==Problems==
-http://www.hermes-handbags.us+*Serializing generic lists (List<SomeClass>) won't work; use a normal array or an ArrayList instead
-http://www.michaelkorsoutlet.us.org+ 
-http://www.cheapnfljerseysnflwholesale.us.com+==Security Lockdown Fix==
-http://www.uggsboots.name+Following this example we should be able to lockdown FileIO to the AppDir
-http://www.adidas-yeezyshoes.us.com+ 
-http://www.ralphlauren-outlet.me.uk+ public static string ReadFile(string filename)
-http://www.ralphlauren.me.uk+ {
-http://www.pandora.us.com+ string appDir = Directory.GetCurrentDirectory();
-http://www.michaelkorsfactoryoutletsale.us.com+ FileIOPermission f = new FileIOPermission(PermissionState.None);
-http://www.pandora-charms.us.org+ f.SetPathList(FileIOPermissionAccess.Read, appDir);
-http://www.uggsoutletonlines.us.com+ f.SetPathList(FileIOPermissionAccess.PathDiscovery, appDir);
-http://www.timberland-outlets.us+ f.PermitOnly();
-http://www.cheapnfljerseysofficial.us.com+
-http://www.harden-vol1.com+ // Use Path.GetFilePath() to canonicalize the file name
-http://www.uggoutletstore.name+ // Use FileStream.OpenRead to open the file
-http://www.toryburchoutletonline.com.co+ // Use FileStream.Read to access and return the data
-http://www.polo-ralphlauren.in.net+ }
-http://www.canadagooseoutlet.name+ 
-http://www.ralphlaurenoutlet.in.net+From [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/THCMCh08.asp Code Access Security in Practice - MSDN]
-http://www.michael-korsoutlet.ca+ 
-http://www.uggoutletonline.name+==Code Translator==
-http://www.cheapjordans.in.net+C#<->VB [http://www.carlosag.net/Tools/CodeTranslator/Default.aspx]
-http://www.nikeoutlet.us.com+So no one can complain about languages. :)
-http://www.nikeairmax.in.net+ 
-http://www.uggs-boots.us.org+==External links==
-http://www.yeezyboost.org.uk+ 
-http://www.nike-store.us.com+[[Category:Plugin development]]
-http://www.uggsaustralia.fr+
-http://www.uggsoutlet.cc+
-http://www.coachfactoryoutlet-storeonline.us.com+
-http://www.moncler-outlet.us.org+
-http://www.air-jordans.us.com+
-http://www.pandoracharms.us.com+
-http://www.oakley.nom.co+
-http://www.coachhandbagsoutlet.us.com+
-http://www.moncleroutlets.us.org+
-http://www.uggscanadaugg.ca+
-http://www.christianlouboutinoutlet.us+
-http://www.outletlouisvuitton.us.com+
-http://www.jordanretro.name+
-http://www.guccihandbagsoutlet.us.com+
-http://www.oakleysunglassesforwomen.us.com+
-http://www.michael-korshandbags.me.uk+
-http://www.outletuggoutlet.us.com+
-http://www.uggs-boots.fr+
-http://www.salvatoreferragamoshoes.us.com+
-http://www.katespadeoutletstoreonline.us.com+
-http://www.canadagoosejacketssale.com.co+
-http://www.canadagooseukjackets.me.uk+
-http://www.nikezoom.us+
-http://www.airmax-97.us+
-http://www.uggoutlet-store.us+
-http://www.canadagooseoutlet-jackets.us+
-http://www.timberlandbootsoutlets.us.com+
-http://www.coachoutlet-onlinesale.us.com+
-http://www.raybansunglasses.net.co+
-http://www.ralph-laurenoutlet.com.co+
-http://www.pandoracharmssaleclearance.uk+
-http://www.canadagooseoutletjackets.com.co+
-http://www.mbtshoessale.us.com+
-http://www.coachoutletstoreonline.com.co+
-http://www.adidasnmd-shoes.us+
-http://www.kate-spade.us.com+
-http://www.louisvuittonoutlet.us.org+
-http://www.michaelkorsoutletclearance.in.net+
-http://www.adidasshoe.us.com+
-http://www.canadagooseoutletjackets.us+
-http://www.michaelkorsoutletonlinemichaelkors.us.com+
-http://www.uggsoutletclearance.us.com+
-http://www.canadagoose-outlet.name+
-http://www.canadagoosejacketsoutlet.name+
-http://www.ralphlaurenoutletonline-polo.us.com+
-http://www.adidas-nmd.us.com+
-http://www.adidasnmd.us.org+
-http://www.katespade.in.net+
-http://www.louboutinshoes.in.net+
-http://www.monclerjacketsoutlet.in.net+
-http://www.uggsoutletstoreonline.us.com+
-http://www.hermesbirkin.in.net+
-http://www.adidas-shoes.us.com+
-http://www.poloralphlaurenoutletonline.us.com+
-http://www.michaelkors-outlet.ca+
-http://www.coachfactory-outletonline.us.org+
-http://www.nikeoutlet.in.net+
-http://www.uggsbootsonline.us.com+
-http://www.cheapmlbjerseyschina.us.com+
-http://www.oakleysunglassessalecheap.us.com+
-http://www.katespadehandbagsclearance.us.com+
-http://www.nikeshoes.in.net+
-http://www.fitflopssale-clearance.us.org+
-http://www.longchamp-outlet.us.com+
-http://www.pandoracharms.name+
-http://www.outletcanadagoose.us+
-http://www.airmax-97.us.com+
-http://www.raybansunglassessalecheap.us.com+
-http://www.uggbootssales.us.com+
-http://www.cheapoakleysunglasses.com.co+
-http://www.coachoutlet-online.us.org+
-http://www.michaelkorsoutletshopping.us.com+
-http://www.ralphlaurenoutletpolo.org.uk+
-http://www.canadiangoose.us.com+
-http://www.pandora-outlet.us.com+
-http://www.jordanshoesforsale.us.com+
-http://www.michaelkorsoutlet1.us.com+
-http://www.ralph-laurenoutlet.org.uk+
-http://www.ralph-laurenuk.org.uk+
-http://www.coach-outletonline.us.org+
-http://www.timberlandbootsoutlet.us.com+
-http://www.raybansunglasse.com+
-http://www.adidas-superstar.us.com+
-http://www.northface-jackets.us.com+
-http://www.coachoutletcanada.ca+
-http://www.canadagooseukjackets.org.uk+
-http://www.michael-korsoutlets.us.com+
-http://www.ralphlaurenoutletsale.us.com+
-http://www.nikeshoes.us.com+
-http://www.supremeclothing.us.org+
-http://www.thenorthfacejacketsoutlet.us.com+
-http://www.monclerjacketsuk.org.uk+
-http://www.uggoutletonlines.us+
-http://www.doudounemonclerpascher.fr+
-http://www.coachoutletus.us.com+
-http://www.outletcoachoutlet.us.com+
-http://www.ugg-boots.net.co+
-http://www.airjordanshoes.in.net+
-http://www.cheapjordans-shoes.us.com+
-http://www.cheapjordanshoes.us.com+
-http://www.raybanssunglassesoutlet.us.com+
-http://www.moncleroutlet.me.uk+
-http://www.michaelkorsoutlet.co.uk+
-http://www.uggbootsoutletstores.us.com+
-http://www.oakley--sunglasses.us.org+
-http://www.louisvuitton-outlet.us.com+
-http://www.cheapjordan-shoes.in.net+
-http://www.uggsoutletus.us.com+
-http://www.adadassuperstar.com+
-http://www.cheapjordans.com.co+
-http://www.catboots.us+
-http://www.ralphlaurenoutletmalls.us.com+
-http://www.vuittonlouis.us.com+
-http://www.cheapuggs.com.co+
-http://www.burberryoutlet.in.net+
-http://www.christianlouboutinshoes.us.org+
-http://www.michaelkorsoutletonlineclearance.in.net+
-http://www.outletcoachonline.us.com+
-http://ugg.bootsoutlet.us.com+
-http://www.valentinoshoesoutlets.us.com+
-http://www.pandoracharmssale-clearance.us.com+
-http://www.fitflopssale.us.com+
-http://www.nfljerseyscheapwholesale.us.com+
-http://www.coach-factory-outlet.us.org+
-http://www.yeezyboost.us.com+
-http://www.thenorthface.us.com+
-http://www.2017nikeairmax.us+
-http://www.monclerjacketssale.us.com+
-http://www.supremenewyork.us.com+
-http://www.coachfactoryonlineoutlet.com.co+
-http://www.coach-factoryoutletonline.us.org+
-http://www.pandorastore.us.com+
-http://www.ralphlauren-outletpolo.us.com+
-http://www.coachoutletonlinecoachfactoryoutlet.us.com+
-http://www.coach-factoryoutlet-online.us.com+
-http://www.ugg-outlets.us+
-http://www.canadagoosejacketscoats.org.uk+
-http://www.fredperrypoloshirts.us+
-http://www.adidascampusshoes.us+
-http://www.coachoutletmalls.us.com+
-http://www.canadagoosejackets-outlet.us+
-http://wwwmonclerjacketsuk.com.co+
-http://www.ugg-outletstores.us.com+
-http://www.ferragamo-outlet.us.com+
-http://www.adidas.us.com+
-http://www.redbottomsshoes.us.com+
-http://www.burberry.us.com+
-http://www.canadagoosejacketsofficial.us.com+
-http://www.korsmichaeloutlet.us.com+
-http://www.coachoutletsonlines.us.com+
-http://www.michael-kors-handbags.us.org+
-http://www.airjordans.us.com+
-http://www.canadagooseoutletjackets.us.com+
-http://www.supreme-clothing.us.com+
-http://www.uggsbootscanada.ca+
-http://www.pandora-jewelryoutlet.us.com+
-http://www.longchamphandbagsuk.org.uk+
-http://www.coachfactory-outletstore.us.com+
-http://www.poloralphlaurenoutletpolo.us.com+
-http://www.uggoutlet-clearance.us.com+
-http://www.uggbootsoutletsale.us.com+
-http://www.northfacejacketssale.us.com+
-http://www.canadagooseoutletcanada.com.co+
-http://www.columbiasportswear.us.com+
-http://www.canadagoosesoutlet.ca+
-http://www.canadagooseoutletjackets.ca+
-http://www.coachoutletstoreonlineclearances.in.net+
-http://www.burberryoutletsale.com.co+
-http://www.cheapuggssale.com.co+
-http://www.mulberryoutlet.org.uk+
-http://www.coach-outlets.us.com+
-http://www.hermesbag.us.com+
-http://www.yeezyboost-350.co.uk+
-http://www.northfaceoutlet.us.com+
-http://www.supremeclothing.org.uk+
-http://www.uggsoutlets.name+
-http://www.adidas-yeezyboost.us.com+
-http://www.coachfactory-outlet.us.com+
-http://www.canadagooseoutlets.us+
-http://www.adidas-outlet.us.com+
-http://www.canadagooseclothing.us.com+
-http://www.michaelkorsoutlets.us.com+
-http://www.rayban-sunglasseoutlet.us.com+
-http://www.northfacejacketsoutlet.com.co+
-http://www.birkenstocks.us+
-http://www.philipppleinshirt.com+
-http://www.jacketscanadagoose.org.uk+
-http://www.fitflops-sale-clearance.us.com+
-http://www.cheapuggs.net.co+
-http://www.adidasoutlet.us.com+
-http://www.canadagooseoutletonlines.us+
-http://www.uggsbootsaustralia.us.com+
-http://www.coachfactoryoutletsonlines.us.com+
-http://www.coachoutlets.us.org+
-http://www.cheapuggboots.us.com+
-http://www.michael-korsoutlet.us.com+
-http://www.moncler-outlets.us.com+
-http://www.pandoracharms-uk.org.uk+
-http://www.pandoracharms.com.co+
-http://www.uggs-boots.us+
-http://www.adidasyeezyshoes.us.com+
-http://www.canadagooseoutletstores.us+
-http://www.nikeoutletonline.us.com+
-http://www.uggshoes.us.com+
-http://www.coachcanadaoutlet.ca+
-http://www.mbtshoes.name+
-http://www.pandorajewelryoutlet.in.net+
-http://www.cheapuggs-boots.us.com+
-http://www.outletcanadagooseoutlet.us.com+
-http://www.moncleroutletonlines.us.com+
-http://www.guccioutlets.us.org+
-http://www.uggoutlets.name+
-hll20180112+

Current revision

A C#/VB/JScript.NET Plugin Engine was added to World Wind in version 1.3.2.

Contents

[edit] Features

  • Dynamic compilation and execution of script code written in the following languages:
    • C#
    • VB.NET
    • JSCript.net
  • Load plugins from precompiled .dll files
  • Full access to World Wind internals (same as internal code)
  • Runs at full speed (compilation on load)

[edit] Engine logic

When World Wind starts the following steps are performed:

  • The PluginCompiler scans bin\Plugins directory and the 1st level subdirectories of the plugin directory for files ending in any of the supported file extensions.
  • When it finds one it tries to compile the source (to memory) with references to the same assemblies as the app has referenced.
  • It then searches the compiled assembly for an implementation of Plugin.

[edit] Benefits

  • Since the compiler for C#,VB and JSCript comes with the .Net Framework no additional third party library is required.
    • For other languages (like J#) an install will be needed, and unfortunately I haven't found an easy way of enumerating all available compilers (before .Net 2.0)
  • Very fast on-the-fly compilation of the scripts.
  • Scripts executes with same speed as a precompiled assembly.
  • Debuggable inside World Wind project (World Wind in debug build loads internal plugins)
  • Custom dlls may be dynamically loaded

[edit] Drawbacks

  • Security: The script could wipe out the hard drive or worse. But with a script at least the user can verify the intentions by looking at the source. Even current add-ons (layers) are often .exe installers giving the user no way of identifying evil code.
  • To unload a script's assembly from memory completely, WW needs a restarted (there are workarounds (appdomains))
  • With no nailed down limited interface into WW the script could stop working on a new version of WW.

[edit] Problems

  • Serializing generic lists (List<SomeClass>) won't work; use a normal array or an ArrayList instead

[edit] Security Lockdown Fix

Following this example we should be able to lockdown FileIO to the AppDir

public static string ReadFile(string filename)
{
  string appDir = Directory.GetCurrentDirectory();
  FileIOPermission f = new FileIOPermission(PermissionState.None);
  f.SetPathList(FileIOPermissionAccess.Read, appDir);
  f.SetPathList(FileIOPermissionAccess.PathDiscovery, appDir);
  f.PermitOnly(); 

  // Use Path.GetFilePath() to canonicalize the file name
  // Use FileStream.OpenRead to open the file
  // Use FileStream.Read to access and return the data
}

From Code Access Security in Practice - MSDN

[edit] Code Translator

C#<->VB [1] So no one can complain about languages. :)

[edit] External links

Personal tools