Bladeren bron

refactor of izpl-Main part 1

LH 10 jaren geleden
bovenliggende
commit
02438bbcac

+ 1 - 1
iZpl/build.gradle

@@ -8,7 +8,7 @@ apply plugin: 'java'
 apply plugin: 'application'
 apply from: "$rootDir/utils/IO.gradle"
 
-version = '0.6.0.0'
+version = '0.7.0.0'
 mainClassName = 'de.nplusc.izc.iZpl.Main'
 //'de.nplusc.izc.iZpl.Main'
 

+ 13 - 10
iZpl/src/main/java/de/nplusc/izc/iZpl/API/IZPLApi.java

@@ -50,7 +50,7 @@ public class IZPLApi
      */
     public static boolean isNEwGUIMode()
     {
-        return Main.isStandaloneGUI();
+        return Main.CONFIG.isStandaloneMode();
     }
     
     /**
@@ -59,7 +59,7 @@ public class IZPLApi
      */
     public static String getSkinPath()
     {
-        return Main.getSelectedSkinPath();
+        return Main.getPluginManager().getSelectedSkinPath();
     }
     /**
      * Exits the program without saving the statefile for the current session. Recommended in case of a error
@@ -75,7 +75,7 @@ public class IZPLApi
      */
     public static PlaybackPlugin getCurrentPlaybackPlugin()
     {
-        return Main.getSelectedPlaybackPlugin();
+        return Main.getPluginManager().getSelectedPlaybackPlugin();
     }
     
     /**
@@ -84,7 +84,7 @@ public class IZPLApi
      */
     public static UIPlugin getUIPlugin()
     {
-        return Main.getSelectedUIPlugin();
+        return Main.getPluginManager().getSelectedUIPlugin();
     }
     /**
      * Saves the state of the session and then exits the program
@@ -110,7 +110,7 @@ public class IZPLApi
      */
     public static List<UIPlugin> getDetectedUIPlugins()
     {
-        return Main.getRegisteredUIs();
+        return Main.getPluginManager().getRegisteredUIs();
     }
     /**
      * Obtains the List of the currently registered Playback-Backends
@@ -118,7 +118,7 @@ public class IZPLApi
      */
     public static List<PlaybackPlugin> getDetectedPlaybackPlugins()
     {
-        return Main.getRegisteredPlayBackAdapters();
+        return Main.getPluginManager().getRegisteredPlayBackAdapters();
     }
     /**
      * Obtains the list of the currently detected skins
@@ -126,7 +126,7 @@ public class IZPLApi
      */
     public static List<String> getAvailableSkins()
     {
-        return Main.getDetectedSkins();
+        return Main.getPluginManager().getDetectedSkins();
     }
     
     /**
@@ -144,7 +144,7 @@ public class IZPLApi
      */
     public static boolean isVerboseMode()
     {
-        return Main.isVerboseMode();
+        return Main.getStts().verboseMode;
     }
     
     /**
@@ -173,7 +173,7 @@ public class IZPLApi
     
     public static FeaturePlugin getSelectedFeature()
     {
-        return Main.getSelectedFeaturePlugin();
+        return Main.getPluginManager().getSelectedFeaturePlugin();
     }
     
     public static void saveFile(PlayListFile f)
@@ -181,5 +181,8 @@ public class IZPLApi
         PLFileIO.writePLFile(f);
     }
     
-    
+    public static PluginManager getPluginManager()
+    {
+        return Main.getPluginManager();
+    }
 }

+ 376 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/API/PluginManager.java

@@ -0,0 +1,376 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.API;
+
+import de.nplusc.izc.iZpl.GUI.IZplGUIDefault;
+import de.nplusc.izc.iZpl.GUI.IZplGUISkinnable;
+import de.nplusc.izc.iZpl.Main;
+import de.nplusc.izc.iZpl.Utils.VlcInterface;
+import de.nplusc.izc.tools.IOtools.FileTK;
+import de.nplusc.izc.tools.baseTools.Detectors;
+import de.schlichtherle.truezip.file.TFile;
+import de.schlichtherle.truezip.file.TFileReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.yaml.snakeyaml.Yaml;
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class PluginManager
+{
+    private static final Logger l = LogManager.getLogger();
+    
+    
+    
+    private final List<PlaybackPlugin> registeredPlayBackAdapters = new ArrayList<>();
+    private final List<FeaturePlugin> registeredFeatures = new ArrayList<>();
+    private final List<UIPlugin> registeredUIs = new ArrayList<>();
+    private PlaybackPlugin selectedPlaybackPlugin;
+
+    private static final List<String> detectedSkins = new ArrayList<>();
+    
+    private boolean allowPluginLoad=false;
+    
+    private static boolean firstrunmode = false;
+    
+    private static boolean updateInit=false;
+    
+    
+    private UIPlugin selectedUIPlugin;
+    
+    private boolean featurePluginMode;  //X
+    private String featurePluginID; //X
+    private String pluginParameter; //X
+    
+    
+    private String selectedSkinPath;
+    private boolean skinParameterSet = false;
+    
+    private FeaturePlugin selectedFeaturePlugin;
+    
+    private static final Yaml y = new Yaml();
+    
+    private boolean pluginsAlreadyLoaded=false;
+    
+    private int uimodestate=Main.UIMODE_NONE;
+    
+    @SuppressWarnings("element-type-mismatch")
+    public void initializePlugins()
+    {
+         
+        new File(IZPLApi.PLUGINPATH).mkdirs();
+        if(!detectedSkins.contains(selectedSkinPath))
+        {
+            Main.CONFIG.setSkinSelected("default");
+            skinParameterSet=true;
+        }
+        if(skinParameterSet||uimodestate!=Main.UIMODE_NONE)
+        {
+            try
+            {
+                y.dump(Main.CONFIG, new FileWriter(Main.CONFIGPATH));
+            }
+            catch (IOException ex)
+            {
+                ex.printStackTrace();
+            }
+        }
+        if(!allowPluginLoad)
+            IZPLApi.quickQuitWithoutSaving();
+
+        if (selectedSkinPath.equals("default"))
+        {
+            selectedSkinPath = IZPLApi.DEFAULT_SKIN_PATH;
+        }
+        else
+        {
+            selectedSkinPath = IZPLApi.APPDIR + File.separator + "skins" + File.separator + selectedSkinPath;
+        }
+        pluginInitCore();
+        
+        //pluginhandling interception: abort load if only enumerating of Features is wanted
+        if(featurePluginMode && featurePluginID.equals(""))
+        {
+            //NOLOG
+            System.out.println("Features available:");
+            for (FeaturePlugin featurePlugin : registeredFeatures) 
+            {
+                //NOLOG
+                System.out.println(featurePlugin.getPluginName());
+            }
+            IZPLApi.quickQuitWithoutSaving();
+        }
+        
+        
+        
+        //PluginHandling stage 2: call the prepareUpgrade handler
+        if(firstrunmode||updateInit)
+        {
+            for (PlaybackPlugin playbackPlugin : registeredPlayBackAdapters)
+            {
+                if (playbackPlugin.getPluginName().equals(Main.CONFIG.getMediaPlayerForStandalone()))
+                {
+
+                    playbackPlugin.prepareUpgrade();
+                    selectedPlaybackPlugin = playbackPlugin;
+                }
+            }
+            for (UIPlugin uIPlugin : registeredUIs)
+            {
+                if (uIPlugin.getPluginName().equals(Main.CONFIG.getUsedPluginUI()))
+                {                                                               //incase of a dualPlugin
+                    if(!(uIPlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(uIPlugin))
+                        uIPlugin.prepareUpgrade();
+                    selectedUIPlugin = uIPlugin;
+                }
+            }
+            for (FeaturePlugin featurePlugin : registeredFeatures)
+            {
+                  if(!(featurePlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(featurePlugin)&&
+                          !(featurePlugin instanceof UIPlugin )&&!registeredUIs.contains(featurePlugin))
+                      featurePlugin.prepareUpgrade();
+            }
+        }
+        //PluginHandling stage 3: initialize the plugins
+        for (PlaybackPlugin playbackPlugin : registeredPlayBackAdapters)
+        {
+            if (playbackPlugin.getPluginName().equals(Main.CONFIG.getMediaPlayerForStandalone()))
+            {
+                if(firstrunmode||updateInit)
+                    playbackPlugin.initializePlugin();
+                selectedPlaybackPlugin = playbackPlugin;
+            }
+        }
+        for (UIPlugin uIPlugin : registeredUIs)
+        {
+            if (uIPlugin.getPluginName().equals(Main.CONFIG.getUsedPluginUI()))
+            {                                                               //incase of a dualPlugin
+                if((firstrunmode||updateInit)&&!(uIPlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(uIPlugin))
+                    uIPlugin.initializePlugin();
+                selectedUIPlugin = uIPlugin;
+            }
+        }
+        
+        for (FeaturePlugin featurePlugin : registeredFeatures)
+        {
+            if(featurePlugin.getPluginName().equals(featurePluginID)||(firstrunmode||updateInit))
+            {
+                selectedFeaturePlugin=featurePlugin;
+                featurePlugin.initializePlugin();
+            }
+        }
+        if(featurePluginMode&&selectedFeaturePlugin==null)
+        {
+            l.error("NO valid FeaturePlugin given");
+            IZPLApi.quickQuitWithoutSaving();
+        }
+        if(featurePluginMode)
+        {
+            if(selectedFeaturePlugin.requiresLoadedPlayList()&&!(Main.isFilemode()||Main.isStatefile()))
+            {
+                l.error("The selected FeaturePlugin requires a Playlist to be loaded");
+                System.out.println("The selected FeaturePlugin requires a Playlist to be loaded");
+                IZPLApi.quickQuitWithoutSaving();
+            }
+        }
+        if(!firstrunmode&&!updateInit&&!featurePluginMode)
+        {       
+            if (selectedPlaybackPlugin != null)
+            {
+                selectedPlaybackPlugin.initializePlugin();
+            }
+            if (selectedUIPlugin != null && selectedUIPlugin != selectedPlaybackPlugin)
+            {
+                selectedUIPlugin.initializePlugin();
+            }
+        }
+
+    }
+
+    public void pluginInitCore()
+    {
+        if(pluginsAlreadyLoaded)
+        {
+            return;
+        }
+        pluginsAlreadyLoaded=true;
+        //registeredPlayBackAdapters.add()
+        String[] osdata = Detectors.getSystemClassification();
+        //TODO Plugins abfragen
+        if(osdata[0].equals("windows"))
+            registeredPlayBackAdapters.add(new VlcInterface()); //nur unter windoof bis auf weiteres
+        registeredUIs.add(new IZplGUIDefault());
+        registeredUIs.add(new IZplGUISkinnable());
+        //pluginhandling stage 1
+        String[] jarsInPluginFolder = FileTK.getDirectoryContent(IZPLApi.PLUGINPATH);
+        for (String plugin : jarsInPluginFolder)
+        {
+            TFile pluginattributes = new TFile(plugin + File.separator + "plugin.yml");
+            if (pluginattributes.exists())
+            {
+                try
+                {
+                    TFileReader r =new TFileReader(pluginattributes);
+                    HashMap<String, Object> plugindata = (HashMap<String, Object>) y.load(r);
+                    r.close();
+                    
+                    List<String> supportedOSes = (List<String>) plugindata.get("supportedoses");
+                    List<String> supportedArchs = (List<String>) plugindata.get("supportedarchitectures");
+                    if (supportedOSes.contains(osdata[0]) && supportedArchs.contains(osdata[1]))
+                    {
+                        Class clazz = new URLClassLoader(new URL[]
+                        {
+                            new File(plugin).toURI().toURL()
+                        }).loadClass((String) plugindata.get("pluginbaseclass"));
+                        // holen der Interfaces die die Klasse impementiert
+                        Class[] interfaces = clazz.getInterfaces();
+                        // Durchlaufen durch die Interfaces der Klasse und nachsehn ob es das passende Plugin implementiert
+                        boolean isplugin = false;
+                        boolean isPlaybackPlugin = false;
+                        boolean isUIPlugin = false;
+                        boolean isFeaturePlugin=false;
+                        for (int i = 0; i < interfaces.length && !isplugin; i++)
+                        {
+                            if (interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.PlaybackPlugin"))
+                            {
+                                isplugin = true;
+                                isPlaybackPlugin = true;
+                                
+                            }
+                            if (interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.UIPlugin"))
+                            {
+                                isplugin = true;
+                                isUIPlugin = true;
+                                
+                            }
+                            if(interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.FeaturePlugin"))
+                            {
+                                isplugin=isFeaturePlugin=true;
+                            }
+                        }
+                        if (isplugin)
+                        {
+                            Plugin pluginInstance = (Plugin) clazz.newInstance();
+                            if (isUIPlugin)
+                            {
+                                registeredUIs.add((UIPlugin) pluginInstance);
+                            }
+                            if (isPlaybackPlugin)
+                            {
+                                registeredPlayBackAdapters.add((PlaybackPlugin) pluginInstance);
+                            }
+                            if(isFeaturePlugin)
+                            {
+                                registeredFeatures.add((FeaturePlugin)pluginInstance);
+                            }
+                        }
+                    }
+                }
+                catch (FileNotFoundException | ClassNotFoundException | MalformedURLException | InstantiationException | IllegalAccessException ex)
+                {
+                    ex.printStackTrace();
+                }
+                catch (IOException ex)
+                {
+                    ex.printStackTrace();
+                }
+                
+            }
+        }
+    }
+
+    public  List<String> getAvailableFeaturePlugins(boolean requireUI)
+    {
+        List<String> pluginsAvailable = new ArrayList<>();
+        for (FeaturePlugin featurePlugin : registeredFeatures)
+        {
+            if(requireUI&&!featurePlugin.hasUserInterface())
+                continue;
+            pluginsAvailable.add(featurePlugin.getPluginName());
+        }
+        return pluginsAvailable;
+    }
+
+    public String getSelectedSkinPath()
+    {
+        return selectedSkinPath;
+    }
+
+    public void setSelectedSkinPath(String selectedSkinPath)
+    {
+        this.selectedSkinPath = selectedSkinPath;
+    }
+    
+    public static void detectSkins()
+    {
+        new File(IZPLApi.SKINPATH).mkdirs();
+        //new File().mkdirs();
+        detectedSkins.clear();
+        detectedSkins.add("default"); //hardwired da immer enthalten
+        String[] skinsAvailable = FileTK.getDirectoryContent(IZPLApi.SKINPATH,true);
+        detectedSkins.addAll(Arrays.asList(skinsAvailable));
+    }
+
+    public PlaybackPlugin getSelectedPlaybackPlugin()
+    {
+        return selectedPlaybackPlugin;
+    }
+
+    public UIPlugin getSelectedUIPlugin()
+    {
+        return selectedUIPlugin;
+    }
+
+    public FeaturePlugin getSelectedFeaturePlugin()
+    {
+        return selectedFeaturePlugin;
+    }
+
+    List<UIPlugin> getRegisteredUIs()
+    {
+        return registeredUIs;
+    }
+
+    public List<PlaybackPlugin> getRegisteredPlayBackAdapters()
+    {
+        return registeredPlayBackAdapters;
+    }
+
+    public List<FeaturePlugin> getRegisteredFeatures()
+    {
+        return registeredFeatures;
+    }
+
+    public static List<String> getDetectedSkins()
+    {
+        return detectedSkins;
+    }
+    
+    
+}

+ 272 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/CommandLineParsing.java

@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl;
+
+import static de.nplusc.izc.iZpl.Main.UIMODE_NEW;
+import static de.nplusc.izc.iZpl.Main.UIMODE_NONE;
+import static de.nplusc.izc.iZpl.Main.UIMODE_OLD;
+import static de.nplusc.izc.iZpl.Main.quickQuit;
+import de.nplusc.izc.iZpl.Utils.Utilities;
+import de.nplusc.izc.tools.baseTools.Detectors;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.OptionGroup;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class CommandLineParsing
+{
+    private static final Logger l = LogManager.getLogger();
+    public static CommandLineStatus processCommandLine(String[] args) throws ParseException
+    {
+        
+        boolean verboseMode=false;
+        boolean firstrunmode=false;
+        boolean updateInit=false;
+        boolean menumode=false;
+        boolean filemode=false;
+        String file_path="";
+        boolean loadConfigMode=false;
+        boolean statefile=false;
+        boolean featurePluginMode=false;
+        String featurePluginID="";
+        String pluginParameter="";
+        boolean forcePregen=false;
+        boolean burnDisc=false;
+        boolean skinParameterSet=false;
+        String selectedSkinPath="";
+        boolean allowPluginLoad=false;
+        int uimodestate=UIMODE_NONE;
+        CommandLineParser parser = new DefaultParser();
+        Options options = new Options();
+        OptionGroup modes = new OptionGroup();
+        OptionGroup uimodes = new OptionGroup();
+        
+        //gopvsferbicuxm
+        //bcefgimoprsuvx
+        uimodes.addOption(OptionBuilder.withLongOpt("newgui")
+                .withDescription("enables the Standalone GUI mode. Starts program straight if --file or --resume is set")
+                .create("g"));
+        uimodes.addOption(OptionBuilder.withLongOpt("oldgui")
+                .withDescription("enables External VLC Player UIMode. Starts program straight if --file or --resume is set")
+                .create("o"));
+        options.addOption("p", "pregen", false, "Pregens a standalone playlist with the randomisation included. Use togehter only with --file");
+        options.addOption("v", "verbose", false, "Enables verbose VLCJ logging");
+        
+        
+        options.addOption(OptionBuilder.withLongOpt("pluginparameter")
+                .withDescription("uses the given pluginParameter to initialize the selected FeaturePlugin")
+                .hasOptionalArg()
+                .withArgName("PluginParameter")
+                .create("x"));
+        
+        options.addOption(OptionBuilder.withLongOpt("featureplugin")
+                .withDescription("loads the specified FeaturePlugin. Lists them if no plugin name given")
+                .hasOptionalArg()
+                .withArgName("plugin")
+                .create("e"));
+        
+        
+        options.addOption(OptionBuilder.withLongOpt("skin")
+                .withDescription("load FILE as skin. No file specified means default skin")
+                .hasOptionalArg()
+                .withArgName("FILE")
+                .create("s"));
+        modes.addOption(OptionBuilder.withLongOpt("file")
+                .withDescription("load FILE as iZpl-File")
+                .hasArg()
+                .withArgName("FILE")
+                .create("f"));
+        modes.addOption(OptionBuilder.withLongOpt("menu")
+                .withDescription("starts the MainMenu")
+                .create("m"));
+        modes.addOption(OptionBuilder.withLongOpt("resume")
+                .withDescription("load FILE as iZpl-Statefile to resume the playback session")
+                .hasArg()
+                .withArgName("FILE")
+                .create("r"));
+        modes.addOption(OptionBuilder.withLongOpt("burn")
+                .withDescription("load FILE as iZpl-File and then sends it to the Burn Disc-compilation GUI")
+                .hasArg()
+                .withArgName("FILE")
+                .create("b"));
+        modes.addOption(OptionBuilder.withLongOpt("initialize")
+                .withDescription("Loads the Setup-finalize-GUI to get the last steps configured")
+                .create("i"));
+        modes.addOption(OptionBuilder.withLongOpt("configure")
+                .withDescription("Loads the Configuration UI")
+                .create("c"));
+        modes.addOption(OptionBuilder.withLongOpt("upgrade")
+                .withDescription("Reextracts the natives and does the init without affecting custom Data")
+                .create("u"));
+        options.addOptionGroup(modes);
+        options.addOptionGroup(uimodes);
+        
+        if(Detectors.getSystemClassification()[0].equals("windows"))
+        {
+            options.addOption(OptionBuilder.withLongOpt("registerfileextensions")
+                .withDescription("Registers the FileExtensions. ")
+                .create());
+        }
+        
+        
+        CommandLine cl = parser.parse(options, args);
+        Main.setupLogging(cl.hasOption("verbose"));
+        verboseMode=cl.hasOption("verbose");
+        if (cl.hasOption("i"))
+        {
+            firstrunmode=true;
+        }
+        
+        if (cl.hasOption("u"))
+        {
+            updateInit=true;
+        }
+        
+        if (cl.hasOption("m"))
+        {
+            menumode=true;
+        }
+        
+        
+        if (cl.hasOption("c"))
+        {
+            loadConfigMode=true;
+        }
+        if (cl.hasOption("file"))
+        {
+            filemode = true;
+            file_path = cl.getOptionValue("file");
+        }
+        if (cl.hasOption("registerfileextensions"))
+        {
+            Utilities.registerFileExtensions();
+            quickQuit();
+        }
+        
+
+        
+        if (cl.hasOption("resume"))
+        {
+            if (filemode)
+            {
+                l.error("Error: --file & --resume  & --burn can't be specified at the same time");
+                System.exit(9263);
+            }
+            statefile = true;
+            file_path = cl.getOptionValue("resume");
+        }
+        
+        if(cl.hasOption("e"))
+        {
+            boolean listmode=true;
+            
+            if(cl.getOptionValue("e")!=null)
+            {
+                listmode=false;
+                featurePluginID=cl.getOptionValue("e");
+                l.trace("Listmode disabled due to e param=\""+featurePluginID+"\"");
+            }
+                                        //handling für den ListPluginMode
+            pluginParameter="";
+            featurePluginMode=true;
+            if(listmode)
+            {
+                featurePluginID="";
+                l.trace("\"\"");
+            }
+            l.trace("Parameter of e is now:\""+pluginParameter+"\"");
+        }
+        
+        if(cl.hasOption("x"))
+        {
+            pluginParameter="";
+            if(cl.getOptionValue("e")!=null)
+            {
+                pluginParameter = cl.getOptionValue("x");
+            }
+        }
+        
+        
+        if (cl.hasOption("burn"))
+        {
+            if (filemode || statefile)
+            {
+                l.error("Error: --file & --resume  & --burn can't be specified at the same time");
+                System.exit(9263);
+            }
+            burnDisc = true;
+            file_path = cl.getOptionValue("burn");
+        }
+        if (cl.hasOption("newgui"))
+        {
+            uimodestate=UIMODE_NEW;
+        }
+        if (cl.hasOption("oldgui"))
+        {
+            uimodestate=UIMODE_OLD;
+        }
+        if (cl.hasOption("pregen"))
+        {
+            if (!(filemode))
+            {
+                l.error("Error: pregen only works on --file parameters");
+                System.exit(9263);
+            }
+            forcePregen = true;
+        }
+        
+        //skinPath=DEFAULT_SKIN_PATH;
+        if (cl.hasOption("skin"))
+        {
+            skinParameterSet = true;
+            String sfp_i = cl.getOptionValue("skin");
+
+            if (sfp_i != null)
+            {
+                selectedSkinPath = sfp_i;
+            }
+            else
+            {
+                selectedSkinPath = "default";
+            }
+        }
+        if (!(burnDisc || filemode || statefile || firstrunmode||
+                loadConfigMode||updateInit||featurePluginMode||menumode)
+                &&uimodestate==UIMODE_NONE)
+        {
+            HelpFormatter formatter = new HelpFormatter();
+            formatter.printHelp("izpl", options);
+            System.exit(0);
+        }
+        if(burnDisc||filemode||statefile||firstrunmode||loadConfigMode||updateInit||featurePluginMode)
+        {
+            allowPluginLoad=true;
+        }
+        return new CommandLineStatus(filemode, statefile, verboseMode, burnDisc, file_path, burnDisc, forcePregen, featurePluginMode,
+                featurePluginID, pluginParameter, loadConfigMode, menumode, firstrunmode, updateInit, allowPluginLoad,skinParameterSet,selectedSkinPath,uimodestate);
+    }
+}

+ 83 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/CommandLineStatus.java

@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl;
+
+/**
+ * Class used inside the Core to pass around the state of the commandLine
+ * @author iZc <nplusc.de>
+ */
+public class CommandLineStatus
+{
+    public final boolean filemode;
+    public final boolean statefile;
+    public final boolean verboseMode;
+    public final boolean useGUI;
+    public final String file_path;
+    public final boolean burnDisc;
+    public final boolean forcePregen;
+    
+    public final boolean featurePluginMode;  //X
+    public final String featurePluginID; //X
+    public final String pluginParameter; //X
+    
+    public final boolean loadConfigMode; //X
+    
+    public final boolean menumode;
+
+    public final boolean firstrunmode;
+    
+    public final boolean updateInit;
+    
+    public final boolean allowPluginLoad;
+    
+    public final boolean skinParameterSet;
+    public final String selectedSkinPath;
+    public  final int uimodestate;
+    
+    public CommandLineStatus(boolean filemode, boolean statefile, boolean verboseMode, boolean useGUI, String file_path, boolean burnDisc, boolean forcePregen, boolean featurePluginMode, String featurePluginID, 
+            String pluginParameter, boolean loadConfigMode, boolean menumode, boolean firstrunmode, boolean updateInit, boolean allowPluginLoad,boolean skinParameterSet,String selectedSkinPath,int uimodestate)
+    {
+        this.filemode = filemode;
+        this.statefile = statefile;
+        this.verboseMode = verboseMode;
+        this.useGUI = useGUI;
+        this.file_path = file_path;
+        this.burnDisc = burnDisc;
+        this.forcePregen = forcePregen;
+        this.featurePluginMode = featurePluginMode;
+        this.featurePluginID = featurePluginID;
+        this.pluginParameter = pluginParameter;
+        this.loadConfigMode = loadConfigMode;
+        this.menumode = menumode;
+        this.firstrunmode = firstrunmode;
+        this.updateInit = updateInit;
+        this.allowPluginLoad = allowPluginLoad;
+        this.skinParameterSet=skinParameterSet;
+        this.selectedSkinPath=selectedSkinPath;
+        this.uimodestate=uimodestate;
+    }
+    
+    
+    
+    public CommandLineStatus changeUseGUI(boolean pGUI)
+    {
+        return new CommandLineStatus(filemode, statefile, verboseMode, pGUI, file_path, burnDisc, forcePregen, featurePluginMode,
+                featurePluginID, pluginParameter, loadConfigMode, menumode, firstrunmode, updateInit, allowPluginLoad,skinParameterSet,selectedSkinPath,uimodestate);
+    }
+    
+    
+}

+ 2 - 1
iZpl/src/main/java/de/nplusc/izc/iZpl/EditorLoader.java

@@ -19,6 +19,7 @@ package de.nplusc.izc.iZpl;
 import com.sun.net.httpserver.Headers;
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpHandler;
+import de.nplusc.izc.iZpl.API.IZPLApi;
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -35,7 +36,7 @@ public class EditorLoader implements HttpHandler
     @Override
     public void handle(HttpExchange t) throws IOException
     {
-        Main.getSelectedUIPlugin().loadPlayListEditScreen();
+        IZPLApi.getPluginManager().getSelectedUIPlugin().loadPlayListEditScreen();
         String response = "Loaded GUI....";
         t.sendResponseHeaders(200, response.length());
         Headers responseHeaders = t.getResponseHeaders();

+ 1 - 1
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/ConfigureScreen.java

@@ -381,7 +381,7 @@ public class ConfigureScreen extends javax.swing.JFrame
 
     private void btnReloadSkinListActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnReloadSkinListActionPerformed
     {//GEN-HEADEREND:event_btnReloadSkinListActionPerformed
-        Main.detectSkins();
+        IZPLApi.getPluginManager().detectSkins();
         ((DefaultListModel)lstSkins.getModel()).removeAllElements();
         for (String skinFileName : IZPLApi.getAvailableSkins())
         {

+ 2 - 1
iZpl/src/main/java/de/nplusc/izc/iZpl/GUI/MainMenu.java

@@ -6,6 +6,7 @@
 
 package de.nplusc.izc.iZpl.GUI;
 
+import de.nplusc.izc.iZpl.API.IZPLApi;
 import de.nplusc.izc.iZpl.Main;
 import de.nplusc.izc.tools.IOtools.FileTK;
 import de.nplusc.izc.tools.baseTools.Tools;
@@ -269,7 +270,7 @@ public class MainMenu extends javax.swing.JFrame
     private void pluginLaunchInitActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_pluginLaunchInitActionPerformed
     {//GEN-HEADEREND:event_pluginLaunchInitActionPerformed
         DefaultListModel lm = (DefaultListModel) lstFeraturePlugins.getModel();
-        List<String> plugins = Main.getAvailableFeaturePlugins(true);
+        List<String> plugins = IZPLApi.getPluginManager().getAvailableFeaturePlugins(true);
         
         Collections.sort(plugins);
         for (String plugin : plugins)

+ 135 - 700
iZpl/src/main/java/de/nplusc/izc/iZpl/Main.java

@@ -16,25 +16,17 @@
  */
 package de.nplusc.izc.iZpl;
 
-import de.nplusc.izc.iZpl.API.FeaturePlugin;
 import de.nplusc.izc.iZpl.API.IZPLApi;
-import de.nplusc.izc.iZpl.API.PlaybackPlugin;
-import de.nplusc.izc.iZpl.API.Plugin;
-import de.nplusc.izc.iZpl.API.UIPlugin;
+import de.nplusc.izc.iZpl.API.PluginManager;
 import de.nplusc.izc.iZpl.GUI.ConfigureScreen;
 import de.nplusc.izc.iZpl.GUI.FirstRunScreen;
-import de.nplusc.izc.iZpl.GUI.IZplGUIDefault;
-import de.nplusc.izc.iZpl.GUI.IZplGUISkinnable;
 import de.nplusc.izc.iZpl.GUI.MainMenu;
 import de.nplusc.izc.iZpl.Utils.BurnMe;
-import de.nplusc.izc.iZpl.Utils.VlcInterface;
 import de.nplusc.izc.tools.IOtools.FileTK;
 import de.nplusc.izc.tools.baseTools.Detectors;
 import de.nplusc.izc.tools.baseTools.Messagers;
 import de.nplusc.izc.tools.baseTools.Tools;
 import de.schlichtherle.truezip.file.TFile;
-import de.schlichtherle.truezip.file.TFileReader;
-import java.awt.Desktop;
 import java.awt.EventQueue;
 import java.awt.Image;
 import java.io.BufferedReader;
@@ -43,23 +35,9 @@ import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
 import javax.imageio.ImageIO;
 import javax.swing.JTextArea;
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.DefaultParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.OptionGroup;
-import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
@@ -76,74 +54,29 @@ import org.yaml.snakeyaml.Yaml;
 @SuppressWarnings("CallToPrintStackTrace")
 public class Main extends javax.swing.JFrame
 {
+    private static PluginManager p = new PluginManager();
+    
+    
     private static Logger l;
     
-    private static boolean verboseMode=false;
-
     private static final String jarschiv = Main.class.getProtectionDomain().getCodeSource().getLocation().getPath();
     public static final String CONFIGPATH = IZPLApi.APPDIR + File.separator + "config" + File.separator + "config.yml";
     public static final Yaml y = new Yaml();
     
-    private static final int UIMODE_NONE=0,UIMODE_OLD=1,UIMODE_NEW=2;
-    private static int uimodestate=UIMODE_NONE;
-    
-    // public static LogStream stdout;
-    private static final List<PlaybackPlugin> registeredPlayBackAdapters = new ArrayList<>();
-    private static final List<FeaturePlugin> registeredFeatures = new ArrayList<>();
-    private static final List<UIPlugin> registeredUIs = new ArrayList<>();
-    private static final List<String> detectedSkins = new ArrayList<>();
+    public static final int UIMODE_NONE=0,UIMODE_OLD=1,UIMODE_NEW=2;
+    //private static int uimodestate=UIMODE_NONE;
     private static boolean loadedVLC = false;
     private static PLServer ps = null;
 
     private static boolean issueDetected = false;
-    private static boolean useGUI = false;
-    //--newGUI
-    
-    private static boolean filemode = false;//X
-    private static boolean statefile = false;//X
-    private static String file_path = ""; //X
-    //--file path
-    //--state path
-    
-    private static boolean burnDisc = false; //X
-    //--burn path
-    
-    private static Boolean forcePregen = false;//X
-    //--pregen
-    
-    private static boolean featurePluginMode;  //X
-    private static String featurePluginID; //X
-    private static String pluginParameter; //X
-    
-    private static boolean loadConfigMode=false; //X
-    
-    private static boolean menumode = false;
-    
-    private static boolean firstrunmode = false;
-    
-    private static boolean updateInit=false;
-    
-    private static boolean allowPluginLoad=false;
-
     public static Configuration CONFIG;
     // ../config/config.yml
     
-    private static String selectedSkinPath;
-    private static boolean skinParameterSet = false;
-
-    private static PlaybackPlugin selectedPlaybackPlugin;
-
-    private static UIPlugin selectedUIPlugin;
+    private static CommandLineStatus stts;
     private static FirstRunScreen frs;
     
     private static Image playListIcon;
-    
-    private static FeaturePlugin selectedFeaturePlugin;
-
-
-    
-    private static boolean pluginsAlreadyLoaded=false;
-    
+        
     
     // <editor-fold defaultstate="collapsed" desc="Gefruzel::Main">    
     /**
@@ -174,7 +107,7 @@ public class Main extends javax.swing.JFrame
             }
             else
             {
-                processCommandLine(args);
+                CommandLineStatus stts = CommandLineParsing.processCommandLine(args);
                 logStart();
                 
                 mainProcessing();
@@ -196,113 +129,11 @@ public class Main extends javax.swing.JFrame
         LoggerContext cx = (LoggerContext) LogManager.getContext(false);
         Runtime.getRuntime().addShutdownHook(new Shitdown());
     }
-    // </editor-fold> 
-    public static void UIMain(boolean pFfilemode,boolean pStatemode,String pFile,boolean pForcePregen,
-            boolean pBurnDisc,boolean pLoadConfigMode,boolean pFeatureMode,String pFeaturePluginID)
-    {
-        menumode=false;//hardwired da man vom menü wieder raus will
-        filemode=pFfilemode;
-        statefile = pStatemode;
-        file_path = pFile;
-        forcePregen = pForcePregen;
-        burnDisc=pBurnDisc;
-        loadConfigMode=pLoadConfigMode;
-        featurePluginMode = pFeatureMode;
-        featurePluginID = pFeaturePluginID;
-        
-        if(burnDisc||filemode||statefile||loadConfigMode||featurePluginMode)
-        {
-            allowPluginLoad=true;
-        }
-        mainProcessing();
-    }
     
-    public static void spawnUI()
-    {
-        pluginInitCore(); //sorgt dafür dass plugins bereits registriert sind
-        EventQueue.invokeLater(()->{
-        MainMenu m = new MainMenu();
-        m.setIconImage(IZPLApi.getProgramIcon());
-        m.setVisible(true);
-        });
-    }
-    
-    private static void processCommandLine(String[] args) throws ParseException
+    public static void setupLogging(boolean verbose)
     {
-        CommandLineParser parser = new DefaultParser();
-        Options options = new Options();
-        OptionGroup modes = new OptionGroup();
-        OptionGroup uimodes = new OptionGroup();
-        
-        //gopvsferbicuxm
-        //bcefgimoprsuvx
-        uimodes.addOption(OptionBuilder.withLongOpt("newgui")
-                .withDescription("enables the Standalone GUI mode. Starts program straight if --file or --resume is set")
-                .create("g"));
-        uimodes.addOption(OptionBuilder.withLongOpt("oldgui")
-                .withDescription("enables External VLC Player UIMode. Starts program straight if --file or --resume is set")
-                .create("o"));
-        options.addOption("p", "pregen", false, "Pregens a standalone playlist with the randomisation included. Use togehter only with --file");
-        options.addOption("v", "verbose", false, "Enables verbose VLCJ logging");
         
         
-        options.addOption(OptionBuilder.withLongOpt("pluginparameter")
-                .withDescription("uses the given pluginParameter to initialize the selected FeaturePlugin")
-                .hasOptionalArg()
-                .withArgName("PluginParameter")
-                .create("x"));
-        
-        options.addOption(OptionBuilder.withLongOpt("featureplugin")
-                .withDescription("loads the specified FeaturePlugin. Lists them if no plugin name given")
-                .hasOptionalArg()
-                .withArgName("plugin")
-                .create("e"));
-        
-        
-        options.addOption(OptionBuilder.withLongOpt("skin")
-                .withDescription("load FILE as skin. No file specified means default skin")
-                .hasOptionalArg()
-                .withArgName("FILE")
-                .create("s"));
-        modes.addOption(OptionBuilder.withLongOpt("file")
-                .withDescription("load FILE as iZpl-File")
-                .hasArg()
-                .withArgName("FILE")
-                .create("f"));
-        modes.addOption(OptionBuilder.withLongOpt("menu")
-                .withDescription("starts the MainMenu")
-                .create("m"));
-        modes.addOption(OptionBuilder.withLongOpt("resume")
-                .withDescription("load FILE as iZpl-Statefile to resume the playback session")
-                .hasArg()
-                .withArgName("FILE")
-                .create("r"));
-        modes.addOption(OptionBuilder.withLongOpt("burn")
-                .withDescription("load FILE as iZpl-File and then sends it to the Burn Disc-compilation GUI")
-                .hasArg()
-                .withArgName("FILE")
-                .create("b"));
-        modes.addOption(OptionBuilder.withLongOpt("initialize")
-                .withDescription("Loads the Setup-finalize-GUI to get the last steps configured")
-                .create("i"));
-        modes.addOption(OptionBuilder.withLongOpt("configure")
-                .withDescription("Loads the Configuration UI")
-                .create("c"));
-        modes.addOption(OptionBuilder.withLongOpt("upgrade")
-                .withDescription("Reextracts the natives and does the init without affecting custom Data")
-                .create("u"));
-        options.addOptionGroup(modes);
-        options.addOptionGroup(uimodes);
-        
-        if(Detectors.getSystemClassification()[0].equals("windows"))
-        {
-            options.addOption(OptionBuilder.withLongOpt("registerfileextensions")
-                .withDescription("Registers the FileExtensions. ")
-                .create());
-        }
-        
-        CommandLine cl = parser.parse(options, args);
-        
         //if(!cl.hasOption("verbose")&&!(System.getProperty("log4j.configurationFile")==null))
         //{
         //    System.setProperty("log4j.configurationFile", "file:///"+jarschiv+"!log4j2NonVerbose.xml");
@@ -313,9 +144,9 @@ public class Main extends javax.swing.JFrame
         LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME); 
         LoggerConfig externalloggerConfig = config.getLoggerConfig("External"); 
 
-        if (cl.hasOption("verbose"))
+        if (verbose)
         {
-            verboseMode=true;
+            
             loggerConfig.setLevel(Level.TRACE);
             externalloggerConfig.setLevel(Level.TRACE);
         }
@@ -325,143 +156,44 @@ public class Main extends javax.swing.JFrame
             externalloggerConfig.setLevel(Level.INFO);
         }
         cx.updateLoggers();
+    }
+    
+    
+    
+    // </editor-fold> 
+    public static void UIMain(boolean pFfilemode,boolean pStatemode,String pFile,boolean pForcePregen,
+            boolean pBurnDisc,boolean pLoadConfigMode,boolean pFeatureMode,String pFeaturePluginID)
+    {
         
-        
-        
-        
-        
-        
-        if (cl.hasOption("i"))
-        {
-            firstrunmode=true;
-        }
-        
-        if (cl.hasOption("u"))
-        {
-            updateInit=true;
-        }
-        
-        if (cl.hasOption("m"))
-        {
-            menumode=true;
-        }
-        
-        
-        if (cl.hasOption("c"))
-        {
-            loadConfigMode=true;
-        }
-        if (cl.hasOption("file"))
-        {
-            filemode = true;
-            file_path = cl.getOptionValue("file");
-        }
-        if (cl.hasOption("registerfileextensions"))
-        {
-            registerFileExtensions();
-            quickQuit();
-        }
-        
-
-        
-        if (cl.hasOption("resume"))
-        {
-            if (filemode)
-            {
-                l.error("Error: --file & --resume  & --burn can't be specified at the same time");
-                System.exit(9263);
-            }
-            statefile = true;
-            file_path = cl.getOptionValue("resume");
-        }
-        
-        if(cl.hasOption("e"))
-        {
-            boolean listmode=true;
-            
-            if(cl.getOptionValue("e")!=null)
-            {
-                listmode=false;
-                featurePluginID=cl.getOptionValue("e");
-                l.trace("Listmode disabled due to e param=\""+featurePluginID+"\"");
-            }
-                                        //handling für den ListPluginMode
-            pluginParameter="";
-            featurePluginMode=true;
-            if(listmode)
-            {
-                featurePluginID="";
-                l.trace("\"\"");
-            }
-            l.trace("Parameter of e is now:\""+pluginParameter+"\"");
-        }
-        
-        if(cl.hasOption("x"))
-        {
-            pluginParameter="";
-            if(cl.getOptionValue("e")!=null)
-            {
-                pluginParameter = cl.getOptionValue("x");
-            }
-        }
-        
-        
-        if (cl.hasOption("burn"))
-        {
-            if (filemode || statefile)
-            {
-                l.error("Error: --file & --resume  & --burn can't be specified at the same time");
-                System.exit(9263);
-            }
-            burnDisc = true;
-            file_path = cl.getOptionValue("burn");
-        }
-        if (cl.hasOption("newgui"))
-        {
-            uimodestate=UIMODE_NEW;
-        }
-        if (cl.hasOption("oldgui"))
-        {
-            uimodestate=UIMODE_OLD;
-        }
-        if (cl.hasOption("pregen"))
-        {
-            if (!(filemode))
-            {
-                l.error("Error: pregen only works on --file parameters");
-                System.exit(9263);
-            }
-            forcePregen = true;
-        }
-        
-        //skinPath=DEFAULT_SKIN_PATH;
-        if (cl.hasOption("skin"))
-        {
-            skinParameterSet = true;
-            String sfp_i = cl.getOptionValue("skin");
-
-            if (sfp_i != null)
-            {
-                selectedSkinPath = sfp_i;
-            }
-            else
-            {
-                selectedSkinPath = "default";
-            }
-        }
-        if (!(burnDisc || filemode || statefile || firstrunmode||
-                loadConfigMode||updateInit||featurePluginMode||menumode)
-                &&uimodestate==UIMODE_NONE)
-        {
-            HelpFormatter formatter = new HelpFormatter();
-            formatter.printHelp("izpl", options);
-            System.exit(0);
-        }
-        if(burnDisc||filemode||statefile||firstrunmode||loadConfigMode||updateInit||featurePluginMode)
+        boolean menumode=false;//hardwired da man vom menü wieder raus will
+        boolean filemode=pFfilemode;
+        boolean statefile = pStatemode;
+        String file_path = pFile;
+        boolean forcePregen = pForcePregen;
+        boolean burnDisc=pBurnDisc;
+        boolean loadConfigMode=pLoadConfigMode;
+        boolean featurePluginMode = pFeatureMode;
+        String featurePluginID = pFeaturePluginID;
+        boolean allowPluginLoad=false;
+        if(burnDisc||filemode||statefile||loadConfigMode||featurePluginMode)
         {
             allowPluginLoad=true;
         }
+        stts=new CommandLineStatus(filemode, statefile, false, true, file_path, burnDisc, forcePregen, 
+                featurePluginMode, featurePluginID, null, loadConfigMode, menumode, false,false, allowPluginLoad,false,null,UIMODE_NONE);
+        mainProcessing();
     }
+    
+    public static void spawnUI()
+    {
+        p.pluginInitCore(); //sorgt dafür dass plugins bereits registriert sind
+        EventQueue.invokeLater(()->{
+        MainMenu m = new MainMenu();
+        m.setIconImage(IZPLApi.getProgramIcon());
+        m.setVisible(true);
+        });
+    }
+
 
     private static void mainProcessing()
     {
@@ -487,14 +219,14 @@ public class Main extends javax.swing.JFrame
 
         }
         //</editor-fold>
-        if(menumode)
+        if(stts.menumode)
         {
             spawnUI();
             return;
         }
         
         
-        if (firstrunmode)
+        if (stts.firstrunmode)
         {
             java.awt.EventQueue.invokeLater(() ->
             {
@@ -510,69 +242,15 @@ public class Main extends javax.swing.JFrame
         loadConfigs();
         if (CONFIG.isStandaloneMode())
         {
-            useGUI = true;
+            stts= stts.changeUseGUI(true);
         }
-        detectSkins();
+        p.detectSkins();
         l.info("Initializing the plugins now. This may take a while");
-        initializePlugins();
+        p.initializePlugins();
         l.info("Plugins initialized");
             //TODO:  GUI-Editor zum Erzeugen von iZpl-S
 
-        /* go to Stage 2 of the loading */
-        java.awt.EventQueue.invokeLater(() ->
-        {
-            if ((filemode || statefile||featurePluginMode) && !(firstrunmode || loadConfigMode))
-            {
-                final Main b = new Main();
-                pload.setIndeterminate(true);
-                b.setIconImage(playListIcon);
-                b.setVisible(true);
-
-                Thread t1 = new Thread(() ->
-                {
-                    startup();
-                });
-                t1.setName("IZPL-Backend");
-                t1.start();
-                Thread t2 = new Thread(() ->
-                {
-                    try
-                    {
-                        while (!loadedVLC)
-                        {
-                            Thread.sleep(150);
-                        }
-                        if (!useGUI)  //ladebalken hinter UI macht keinen sinn
-                        {
-                            Thread.sleep(1500);
-                        }
-                    }
-                    catch (InterruptedException ex)
-                    {
-                        ex.printStackTrace();
-                    }
-                    b.setVisible(false);
-                });
-                t2.setName("LoadCloser");
-                t2.start();
-            }
-            else
-            {
-                if (burnDisc)
-                {
-                    BurnMe.InitializeBurnDisc(file_path);
-                    //quickQuit();
-                }
-                if (firstrunmode || loadConfigMode)
-                {
-                    if (!loadConfigMode)
-                    {
-                        frs.setVisible(false);
-                    }
-                    new ConfigureScreen(firstrunmode).setVisible(true);
-                }
-            }
-        });
+        mainProcessingStage2();
     }
 
     @SuppressWarnings(
@@ -611,14 +289,14 @@ public class Main extends javax.swing.JFrame
                 ex.printStackTrace();
             }
         }
-        if (skinParameterSet)
+        if (stts.skinParameterSet)
         {
-            CONFIG.setSkinSelected(selectedSkinPath);
+            CONFIG.setSkinSelected(stts.selectedSkinPath);
         }
-        selectedSkinPath = CONFIG.getSkinSelected();
-        if(uimodestate!=UIMODE_NONE)
+        p.setSelectedSkinPath(CONFIG.getSkinSelected());
+        if(stts.uimodestate!=UIMODE_NONE)
         {
-            if(uimodestate==UIMODE_NEW)
+            if(stts.uimodestate==UIMODE_NEW)
             {
                 CONFIG.setStandaloneMode(true);
             }
@@ -637,241 +315,70 @@ public class Main extends javax.swing.JFrame
         }
     }
 
-    public static void detectSkins()
-    {
-        new File(IZPLApi.SKINPATH).mkdirs();
-        //new File().mkdirs();
-        detectedSkins.clear();
-        detectedSkins.add("default"); //hardwired da immer enthalten
-        String[] skinsAvailable = FileTK.getDirectoryContent(IZPLApi.SKINPATH,true);
-        detectedSkins.addAll(Arrays.asList(skinsAvailable));
-    }
-    
-    @SuppressWarnings("element-type-mismatch")
-    private static void initializePlugins()
+    private static void mainProcessingStage2()
     {
-        
-        new File(IZPLApi.PLUGINPATH).mkdirs();
-        if(!detectedSkins.contains(selectedSkinPath))
-        {
-            CONFIG.setSkinSelected("default");
-            skinParameterSet=true;
-        }
-        if(skinParameterSet||uimodestate!=UIMODE_NONE)
+                /* go to Stage 2 of the loading */
+        java.awt.EventQueue.invokeLater(() ->
         {
-            try
+            if ((stts.filemode || stts.statefile||stts.featurePluginMode) && !(stts.firstrunmode || stts.loadConfigMode))
             {
-                y.dump(CONFIG, new FileWriter(CONFIGPATH));
-            }
-            catch (IOException ex)
-            {
-                ex.printStackTrace();
-            }
-        }
-        if(!allowPluginLoad)
-            quickQuit();
+                final Main b = new Main();
+                pload.setIndeterminate(true);
+                b.setIconImage(playListIcon);
+                b.setVisible(true);
 
-        if (selectedSkinPath.equals("default"))
-        {
-            selectedSkinPath = IZPLApi.DEFAULT_SKIN_PATH;
-        }
-        else
-        {
-            selectedSkinPath = IZPLApi.APPDIR + File.separator + "skins" + File.separator + selectedSkinPath;
-        }
-        pluginInitCore();
-        
-        //pluginhandling interception: abort load if only enumerating of Features is wanted
-        if(featurePluginMode && featurePluginID.equals(""))
-        {
-            //NOLOG
-            System.out.println("Features available:");
-            for (FeaturePlugin featurePlugin : registeredFeatures) 
-            {
-                //NOLOG
-                System.out.println(featurePlugin.getPluginName());
-            }
-            quickQuit();
-        }
-        
-        
-        
-        //PluginHandling stage 2: call the prepareUpgrade handler
-        if(firstrunmode||updateInit)
-        {
-            for (PlaybackPlugin playbackPlugin : registeredPlayBackAdapters)
-            {
-                if (playbackPlugin.getPluginName().equals(CONFIG.getMediaPlayerForStandalone()))
+                Thread t1 = new Thread(() ->
                 {
-
-                    playbackPlugin.prepareUpgrade();
-                    selectedPlaybackPlugin = playbackPlugin;
-                }
-            }
-            for (UIPlugin uIPlugin : registeredUIs)
-            {
-                if (uIPlugin.getPluginName().equals(CONFIG.getUsedPluginUI()))
-                {                                                               //incase of a dualPlugin
-                    if(!(uIPlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(uIPlugin))
-                        uIPlugin.prepareUpgrade();
-                    selectedUIPlugin = uIPlugin;
-                }
-            }
-            for (FeaturePlugin featurePlugin : registeredFeatures)
-            {
-                  if(!(featurePlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(featurePlugin)&&
-                          !(featurePlugin instanceof UIPlugin )&&!registeredUIs.contains(featurePlugin))
-                      featurePlugin.prepareUpgrade();
-            }
-        }
-        //PluginHandling stage 3: initialize the plugins
-        for (PlaybackPlugin playbackPlugin : registeredPlayBackAdapters)
-        {
-            if (playbackPlugin.getPluginName().equals(CONFIG.getMediaPlayerForStandalone()))
-            {
-                if(firstrunmode||updateInit)
-                    playbackPlugin.initializePlugin();
-                selectedPlaybackPlugin = playbackPlugin;
-            }
-        }
-        for (UIPlugin uIPlugin : registeredUIs)
-        {
-            if (uIPlugin.getPluginName().equals(CONFIG.getUsedPluginUI()))
-            {                                                               //incase of a dualPlugin
-                if((firstrunmode||updateInit)&&!(uIPlugin instanceof PlaybackPlugin )&&!registeredPlayBackAdapters.contains(uIPlugin))
-                    uIPlugin.initializePlugin();
-                selectedUIPlugin = uIPlugin;
-            }
-        }
-        
-        for (FeaturePlugin featurePlugin : registeredFeatures)
-        {
-            if(featurePlugin.getPluginName().equals(featurePluginID)||(firstrunmode||updateInit))
-            {
-                selectedFeaturePlugin=featurePlugin;
-                featurePlugin.initializePlugin();
-            }
-        }
-        if(featurePluginMode&&selectedFeaturePlugin==null)
-        {
-            l.error("NO valid FeaturePlugin given");
-            quickQuit();
-        }
-        if(featurePluginMode)
-        {
-            if(selectedFeaturePlugin.requiresLoadedPlayList()&&!(filemode||statefile))
-            {
-                l.error("The selected FeaturePlugin requires a Playlist to be loaded");
-                System.out.println("The selected FeaturePlugin requires a Playlist to be loaded");
-                quickQuit();
-            }
-        }
-        if(!firstrunmode&&!updateInit&&!featurePluginMode)
-        {       
-            if (selectedPlaybackPlugin != null)
-            {
-                selectedPlaybackPlugin.initializePlugin();
-            }
-            if (selectedUIPlugin != null && selectedUIPlugin != selectedPlaybackPlugin)
-            {
-                selectedUIPlugin.initializePlugin();
-            }
-        }
-
-    }
-
-    public static void pluginInitCore()
-    {
-        if(pluginsAlreadyLoaded)
-        {
-            return;
-        }
-        pluginsAlreadyLoaded=true;
-        //registeredPlayBackAdapters.add()
-        String[] osdata = Detectors.getSystemClassification();
-        //TODO Plugins abfragen
-        if(osdata[0].equals("windows"))
-            registeredPlayBackAdapters.add(new VlcInterface()); //nur unter windoof bis auf weiteres
-        registeredUIs.add(new IZplGUIDefault());
-        registeredUIs.add(new IZplGUISkinnable());
-        //pluginhandling stage 1
-        String[] jarsInPluginFolder = FileTK.getDirectoryContent(IZPLApi.PLUGINPATH);
-        for (String plugin : jarsInPluginFolder)
-        {
-            TFile pluginattributes = new TFile(plugin + File.separator + "plugin.yml");
-            if (pluginattributes.exists())
-            {
-                try
+                    startup();
+                });
+                t1.setName("IZPL-Backend");
+                t1.start();
+                Thread t2 = new Thread(() ->
                 {
-                    TFileReader r =new TFileReader(pluginattributes);
-                    HashMap<String, Object> plugindata = (HashMap<String, Object>) y.load(r);
-                    r.close();
-                    
-                    List<String> supportedOSes = (List<String>) plugindata.get("supportedoses");
-                    List<String> supportedArchs = (List<String>) plugindata.get("supportedarchitectures");
-                    if (supportedOSes.contains(osdata[0]) && supportedArchs.contains(osdata[1]))
+                    try
                     {
-                        Class clazz = new URLClassLoader(new URL[]
-                        {
-                            new File(plugin).toURI().toURL()
-                        }).loadClass((String) plugindata.get("pluginbaseclass"));
-                        // holen der Interfaces die die Klasse impementiert
-                        Class[] interfaces = clazz.getInterfaces();
-                        // Durchlaufen durch die Interfaces der Klasse und nachsehn ob es das passende Plugin implementiert
-                        boolean isplugin = false;
-                        boolean isPlaybackPlugin = false;
-                        boolean isUIPlugin = false;
-                        boolean isFeaturePlugin=false;
-                        for (int i = 0; i < interfaces.length && !isplugin; i++)
+                        while (!loadedVLC)
                         {
-                            if (interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.PlaybackPlugin"))
-                            {
-                                isplugin = true;
-                                isPlaybackPlugin = true;
-                                
-                            }
-                            if (interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.UIPlugin"))
-                            {
-                                isplugin = true;
-                                isUIPlugin = true;
-                                
-                            }
-                            if(interfaces[i].getName().equals("de.nplusc.izc.iZpl.API.FeaturePlugin"))
-                            {
-                                isplugin=isFeaturePlugin=true;
-                            }
+                            Thread.sleep(150);
                         }
-                        if (isplugin)
+                        if (!stts.useGUI)  //ladebalken hinter UI macht keinen sinn
                         {
-                            Plugin pluginInstance = (Plugin) clazz.newInstance();
-                            if (isUIPlugin)
-                            {
-                                registeredUIs.add((UIPlugin) pluginInstance);
-                            }
-                            if (isPlaybackPlugin)
-                            {
-                                registeredPlayBackAdapters.add((PlaybackPlugin) pluginInstance);
-                            }
-                            if(isFeaturePlugin)
-                            {
-                                registeredFeatures.add((FeaturePlugin)pluginInstance);
-                            }
+                            Thread.sleep(1500);
                         }
                     }
-                }
-                catch (FileNotFoundException | ClassNotFoundException | MalformedURLException | InstantiationException | IllegalAccessException ex)
+                    catch (InterruptedException ex)
+                    {
+                        ex.printStackTrace();
+                    }
+                    b.setVisible(false);
+                });
+                t2.setName("LoadCloser");
+                t2.start();
+            }
+            else
+            {
+                if (stts.burnDisc)
                 {
-                    ex.printStackTrace();
+                    BurnMe.InitializeBurnDisc(stts.file_path);
+                    //quickQuit();
                 }
-                catch (IOException ex)
+                if (stts.firstrunmode || stts.loadConfigMode)
                 {
-                    ex.printStackTrace();
+                    if (!stts.loadConfigMode)
+                    {
+                        frs.setVisible(false);
+                    }
+                    new ConfigureScreen(stts.firstrunmode).setVisible(true);
                 }
-                
             }
-        }
+        });
     }
+    
+    
+    
 
+    
+    
     private static void startup()
     {
         String time = "";
@@ -880,7 +387,7 @@ public class Main extends javax.swing.JFrame
         l.info("IZPL-Core:initialized at:" + time);
         String vlcpath = CONFIG.getMPExecutablePath();
         l.info("vlcpath=" + vlcpath);
-        if(!(useGUI||featurePluginMode)&&vlcpath.equals("")&&!new File(vlcpath).exists())
+        if(!(stts.useGUI||stts.featurePluginMode)&&vlcpath.equals("")&&!new File(vlcpath).exists())
         {
             l.error("ungültige MediaPlayer executable");
             quickQuit();
@@ -898,15 +405,15 @@ public class Main extends javax.swing.JFrame
         try
         {
 
-            l.trace("fpl|" + forcePregen + "|shitmp|" + isShittyPlayer + "|a1|" + file_path + "|vp|" + vlcpath);
+            l.trace("fpl|" + stts.forcePregen + "|shitmp|" + isShittyPlayer + "|a1|" + stts.file_path + "|vp|" + vlcpath);
             if (
-                    (filemode && !(forcePregen || isShittyPlayer))                      ||
-                    (featurePluginMode&&selectedFeaturePlugin.requiresLoadedPlayList()))
+                    (stts.filemode && !(stts.forcePregen || isShittyPlayer))                      ||
+                    (stts.featurePluginMode&&p.getSelectedFeaturePlugin().requiresLoadedPlayList()))
             {
-                l.trace("usegui=" + useGUI);
-                l.trace("featurePlugin=" + featurePluginMode);
+                l.trace("usegui=" + stts.useGUI);
+                l.trace("featurePlugin=" + stts.featurePluginMode);
                 
-                ps = new PLServer(/*"D:\\mp3\\iZpl\\rxe.izpl"/*/file_path/**/, !(useGUI||featurePluginMode));//DBG_CD3
+                ps = new PLServer(/*"D:\\mp3\\iZpl\\rxe.izpl"/*/stts.file_path/**/, !(stts.useGUI||stts.featurePluginMode));//DBG_CD3
                 if (issueDetected)
                 {
                     quickQuit();
@@ -914,8 +421,8 @@ public class Main extends javax.swing.JFrame
             }
             else//RELOADER
             {
-                if (!(forcePregen || isShittyPlayer||
-                        (featurePluginMode&&!selectedFeaturePlugin.requiresLoadedPlayList())))
+                if (!(stts.forcePregen || isShittyPlayer||
+                        (stts.featurePluginMode&&!p.getSelectedFeaturePlugin().requiresLoadedPlayList())))
                 {
                     reload();
                 }
@@ -925,10 +432,10 @@ public class Main extends javax.swing.JFrame
                 }
             }
             //http://localhost:9263/lst.m3u
-            if (isShittyPlayer || forcePregen)
+            if (isShittyPlayer || stts.forcePregen)
             {
                 PlProcessorV2 ppp = new PlProcessorV2();
-                ppp.InitializeOnPath(file_path);
+                ppp.InitializeOnPath(stts.file_path);
                 if (issueDetected)
                 {
                     quickQuit();
@@ -960,20 +467,20 @@ public class Main extends javax.swing.JFrame
 
             if (!isWMShit && !isOtherShit)
             {
-                if (useGUI&&!featurePluginMode)
+                if (stts.useGUI&&!stts.featurePluginMode)
                 {
                     EventQueue.invokeLater(() ->
                     {
-                        selectedUIPlugin.initializeUI();
-                        selectedUIPlugin.setVisible(true);
+                        p.getSelectedUIPlugin().initializeUI();
+                        p.getSelectedUIPlugin().setVisible(true);
                     });
                     loadedVLC = true;
                 }
                 else
                 {
-                    if(featurePluginMode)
+                    if(stts.featurePluginMode)
                     {
-                        selectedFeaturePlugin.parseParameter(pluginParameter);
+                        p.getSelectedFeaturePlugin().parseParameter(stts.pluginParameter);
                     loadedVLC = true;
                     }
                     else
@@ -997,13 +504,13 @@ public class Main extends javax.swing.JFrame
                 }
                 else
                 {
-                    if (!forcePregen)
+                    if (!stts.forcePregen)
                     {
                         Tools.runSingleCmd(false, true, false, true, new JTextArea(), vlcpath, new File("wmpload.m3u").getAbsolutePath());
                     }
                 }
             }
-            if (!(useGUI||featurePluginMode))
+            if (!(stts.useGUI||stts.featurePluginMode))
             {
                 checkpointedExit(isShittyPlayer);
             }
@@ -1018,47 +525,11 @@ public class Main extends javax.swing.JFrame
         }
     }
 
-    private static void registerFileExtensions()
-    {
-        String extensionPath = (IZPLApi.APPDIR+File.separator+"bin"+File.separator+"iZpl.bat").replace("\\", "\\\\");
-        String iconMain=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izpl.ico,0").replace("\\", "\\\\");
-        String iconResume=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izplresume.ico,0").replace("\\", "\\\\");     
-        String regPatternPlayList="Windows Registry Editor Version 5.00\n" +
-        "\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\shell\\open\\command]\n" +
-        "@=\"cmd.exe /D /C "+extensionPath+" --file \\\"%1\\\"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izpl]\n" +
-        "@=\"izplaylist.playlist\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\DefaultIcon]\n" +
-        "@=\""+iconMain+"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\shell\\open\\command]\n" +
-        "@=\"cmd.exe /D /C "+extensionPath+" --resume \\\"%1\\\"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcont]\n" +
-        "@=\"izplaylist.resumefile\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcontinue]\n" +
-        "@=\"izplaylist.resumefile\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\DefaultIcon]\n" +  // nicht die Software\\Classes\\ kkomponente im pfad vergesse.!!!
-        "@=\""+iconResume+"\"";
-        //regedit /fickDich
-        
-        try
-        {
-            new File(IZPLApi.APPDIR+File.separator+"res").mkdirs();
-            FileWriter fw = new FileWriter(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
-            fw.write(regPatternPlayList);
-            fw.flush();
-            fw.close();
-            Desktop.getDesktop().open(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
-        }
-        catch (IOException ex)
-        {
-            ex.printStackTrace();
-        }
-    }
+
     
     private static void reload() throws FileNotFoundException, IOException
     {
-        String tpath = file_path;
+        String tpath = stts.file_path;
         boolean sym = true;
         boolean newPPP = false;
         int redirs = 0;
@@ -1103,8 +574,8 @@ public class Main extends javax.swing.JFrame
             pp.InitializeOnPath(((PlProcessor) u).getPath());
         }
         plf.close();
-        l.trace("usegui=" + useGUI);
-        ps = new PLServer(pp, !useGUI);
+        l.trace("usegui=" + stts.useGUI);
+        ps = new PLServer(pp, !stts.useGUI);
     }
 
     public static void checkpointedExit(boolean isShittyPlayer)
@@ -1114,7 +585,7 @@ public class Main extends javax.swing.JFrame
         l.info("IZPL-Core:Checkpoint erstellen:" + time);
         //muss nen StateSaver hier reintoasten....; done...
         //statefile immer gleich genannt wie originaldatei; ermöglicht mehrere states...
-        if (!(forcePregen || isShittyPlayer))
+        if (!(stts.forcePregen || isShittyPlayer))
         {
             String pp = y.dump(ps.ppp);
             String fp = ps.ppp.getPath();
@@ -1183,10 +654,6 @@ public class Main extends javax.swing.JFrame
         return ps;
     }
     
-    public static boolean isStandaloneGUI()
-    {
-        return useGUI;
-    }
 
     public static void gotAIssue()
     {
@@ -1199,61 +666,29 @@ public class Main extends javax.swing.JFrame
         issueDetected = issue;
     }
 
-    public static String getSelectedSkinPath()
-    {
-        return selectedSkinPath;
-    }
-
-    public static PlaybackPlugin getSelectedPlaybackPlugin()
-    {
-        return selectedPlaybackPlugin;
-    }
 
-    public static UIPlugin getSelectedUIPlugin()
+    public static Image getPlayListIcon()
     {
-        return selectedUIPlugin;
+        return playListIcon;
     }
-
-    public static List<PlaybackPlugin> getRegisteredPlayBackAdapters()
+    public static boolean isFilemode()
     {
-        return registeredPlayBackAdapters;
+        return stts.filemode;
     }
 
-    public static List<UIPlugin> getRegisteredUIs()
+    public static boolean isStatefile()
     {
-        return registeredUIs;
+        return stts.statefile;
     }
 
-    public static List<String> getDetectedSkins()
+    public static CommandLineStatus getStts()
     {
-        return detectedSkins;
+        return stts;
     }
 
-    public static Image getPlayListIcon()
+    public static PluginManager getPluginManager()
     {
-        return playListIcon;
-    }
-    
-    public static List<String> getAvailableFeaturePlugins(boolean requireUI)
-    {
-        List<String> pluginsAvailable = new ArrayList<>();
-        for (FeaturePlugin featurePlugin : registeredFeatures)
-        {
-            if(requireUI&&!featurePlugin.hasUserInterface())
-                continue;
-            pluginsAvailable.add(featurePlugin.getPluginName());
-        }
-        return pluginsAvailable;
-    }
-    
-    public static boolean isVerboseMode()
-    {
-        return verboseMode;
-    }
-    
-        public static FeaturePlugin getSelectedFeaturePlugin()
-    {
-        return selectedFeaturePlugin;
+        return p;
     }
     
     
@@ -1297,6 +732,6 @@ public class Main extends javax.swing.JFrame
      * V0.4.1.1 Bugfixes
      * V0.5.0.0 MainMenu added
      * V0.6.0.0 Editor basics, Bugfixxes & rewrite of the Reader code whic resides now in PLFileIO.java 
+     * V0.7.0.0 Refactor of the main class to shrink it
      */
-
 }

+ 68 - 0
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/Utilities.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.Utils;
+
+import de.nplusc.izc.iZpl.API.IZPLApi;
+import java.awt.Desktop;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class Utilities
+{
+    public static void registerFileExtensions()
+    {
+        String extensionPath = (IZPLApi.APPDIR+File.separator+"bin"+File.separator+"iZpl.bat").replace("\\", "\\\\");
+        String iconMain=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izpl.ico,0").replace("\\", "\\\\");
+        String iconResume=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izplresume.ico,0").replace("\\", "\\\\");     
+        String regPatternPlayList="Windows Registry Editor Version 5.00\n" +
+        "\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\shell\\open\\command]\n" +
+        "@=\"cmd.exe /D /C "+extensionPath+" --file \\\"%1\\\"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izpl]\n" +
+        "@=\"izplaylist.playlist\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\DefaultIcon]\n" +
+        "@=\""+iconMain+"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\shell\\open\\command]\n" +
+        "@=\"cmd.exe /D /C "+extensionPath+" --resume \\\"%1\\\"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcont]\n" +
+        "@=\"izplaylist.resumefile\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcontinue]\n" +
+        "@=\"izplaylist.resumefile\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\DefaultIcon]\n" +  // nicht die Software\\Classes\\ kkomponente im pfad vergesse.!!!
+        "@=\""+iconResume+"\"";
+        //regedit /fickDich
+        
+        try
+        {
+            new File(IZPLApi.APPDIR+File.separator+"res").mkdirs();
+            FileWriter fw = new FileWriter(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
+            fw.write(regPatternPlayList);
+            fw.flush();
+            fw.close();
+            Desktop.getDesktop().open(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
+        }
+        catch (IOException ex)
+        {
+            ex.printStackTrace();
+        }
+    }
+}