package org.lodder.subtools.multisubdownloader.util;

import java.io.File;

import org.lodder.subtools.multisubdownloader.lib.xml.XMLExclude;
import org.lodder.subtools.multisubdownloader.settings.SettingsControl;
import org.lodder.subtools.sublibrary.logging.Logger;
import org.lodder.subtools.sublibrary.xml.XMLMappingTvdbScene;

/**
 * Created by IntelliJ IDEA.
 * User: lodder
 * Date: 4/20/11
 * Time: 7:52 AM
 * To change this template use File | Settings | File Templates.
 */
public class Export {

    private final SettingsControl settingsControl;

    public enum ExportListType {
        EXCLUDE, TRANSLATE, PREFERENCES
    }

    public Export(SettingsControl settingsControl) {
        this.settingsControl = settingsControl;
    }

    public void exclude(File file) {
        doExport(ExportListType.EXCLUDE, file);
    }

    public void translate(File file) {
        doExport(ExportListType.TRANSLATE, file);
    }

    public void preferences(File file){
        doExport(ExportListType.PREFERENCES, file);
    }

    public void doExport(ExportListType listType, File file) {
        try {
            if (listType == ExportListType.PREFERENCES){
                settingsControl.exportPreferences(file);
            }else if (listType == ExportListType.EXCLUDE) {
                XMLExclude.write(settingsControl.getSettings().getExcludeList(), file);
            } else if (listType == ExportListType.TRANSLATE) {
                XMLMappingTvdbScene.write(settingsControl.getSettings().getMappingSettings().getMappingList(), file);
            }
        } catch (final Throwable e) {
            Logger.instance.error(Logger.stack2String(e));
        }
    }
}

@@ -249,85 +249,88 @@
 ary.
-logging.Logger;%0Aimport org.lodder.subtools.sublibrary.xml.XMLMappingTvdbScene
+xml.XMLMappingTvdbScene;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory
 ;%0A%0A/
@@ -360,19 +360,16 @@
 iJ IDEA.
-%0A *
  User: l
@@ -373,19 +373,16 @@
 : lodder
-%0A *
  Date: 4
@@ -387,19 +387,16 @@
  4/20/11
-%0A *
  Time: 7
@@ -401,19 +401,16 @@
  7:52 AM
-%0A *
  To chan
@@ -429,16 +429,19 @@
 late use
+%0A *
  File %7C 
@@ -494,18 +494,16 @@
 port %7B%0A%0A
-  
   privat
@@ -543,19 +543,95 @@
 ontrol;%0A
-%0A
   
+private static final Logger LOGGER = LoggerFactory.getLogger(Export.class);%0A%0A
   public
@@ -657,20 +657,16 @@
 e %7B%0A    
-   
- 
 EXCLUDE,
@@ -689,25 +689,21 @@
 ERENCES%0A
-  
   %7D%0A%0A
-  
   public
@@ -749,20 +749,16 @@
 ) %7B%0A    
- 
-   
 this.set
@@ -789,25 +789,21 @@
 ontrol;%0A
-  
   %7D%0A%0A
-  
   public
@@ -821,36 +821,32 @@
 de(File file) %7B%0A
-    
     doExport(Exp
@@ -869,33 +869,29 @@
 UDE, file);%0A
-  
   %7D%0A%0A
-  
   public voi
@@ -915,28 +915,24 @@
 file) %7B%0A    
- 
-   
 doExport(Exp
@@ -957,35 +957,31 @@
 ATE, file);%0A
-  
   %7D%0A%0A  
- 
- 
 public void 
@@ -1002,26 +1002,23 @@
 le file)
+ 
 %7B%0A    
-   
- 
 doExport
@@ -1057,17 +1057,13 @@
 e);%0A
-  
   %7D%0A%0A
-  
   pu
@@ -1123,20 +1123,16 @@
 ) %7B%0A    
- 
-   
 try %7B%0A  
@@ -1135,22 +1135,16 @@
 %7B%0A      
-   
-   
 if (list
@@ -1178,16 +1178,17 @@
 ERENCES)
+ 
 %7B%0A      
@@ -1189,24 +1189,16 @@
         
-       
- 
 settings
@@ -1236,23 +1236,18 @@
 ;%0A      
-      
 %7D
+ 
 else if 
@@ -1293,24 +1293,16 @@
         
-   
-     
 XMLExclu
@@ -1361,30 +1361,24 @@
 t(), file);%0A
-      
       %7D else
@@ -1418,32 +1418,24 @@
 RANSLATE) %7B%0A
-        
         XMLM
@@ -1498,32 +1498,45 @@
 appingSettings()
+%0A            
 .getMappingList(
@@ -1551,28 +1551,18 @@
 ;%0A      
-  
-    %7D%0A    
+%7D%0A
     %7D ca
@@ -1597,73 +1597,43 @@
     
-      Logger.instance.error(Logger.stack2String(e)
+LOGGER.error(%22doExport%22, e
 );%0A    
- 
-   %7D%0A  
+%7D%0A
   %7D%0A

Convert Export from old logger to new LOGGER slf4j