// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Modification.java
// @NamedQueries({
//     @NamedQuery(
//             name = "modifications",
//             query = "select m from Modification m"
//     )
//     ,
//     @NamedQuery(
//             name = "modifications.id",
//             query = "select m from Modification m where m.id=:id"
//     )
//     ,
//     @NamedQuery(
//             name = "modifications.config",
//             query = "select m from Modification m where m.configPath=:configPath"
//     )
// })
// @Entity
// public class Modification extends EntityCompareAndHash {
// 
//     @Id
//     @GeneratedValue
//     private long aid;
//     //basics
//     protected String configPath;
//     protected int id;
//     protected String name;
//     protected String version;
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.DELETE,CascadeType.PERSIST})
//     private LazyText description;
//     //connection
//     @OneToMany(fetch = FetchType.LAZY, mappedBy="mod")
//     protected Set<Patch> patches = new HashSet<>();
//     @ManyToMany(fetch = FetchType.LAZY)
//     protected Set<Modification> overwrite = new HashSet<>();
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.ALL})
//     protected Colliding collides = new Colliding();
// 
//     public Modification() {
//     }
// 
//     public Modification(String configPath, int id) {
//         this.configPath = configPath;
//         this.id = id;
//     }
// 
//     @Override
//     public long getAid() {
//         return aid;
//     }
// 
//     @Override
//     public void setAid(long aid) {
//         this.aid = aid;
//     }
// 
//     public Set<Patch> getFiles() {
//         return patches;
//     }
// 
//     public void setFiles(Set<Patch> files) {
//         this.patches = files;
//     }
// 
//     public Colliding getCollides() {
//         return collides;
//     }
// 
//     public void setCollides(Colliding collides) {
//         this.collides = collides;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getConfigPath() {
//         return configPath;
//     }
// 
//     public void setConfigPath(String configPath) {
//         this.configPath = configPath;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getVersion() {
//         return version;
//     }
// 
//     public void setVersion(String version) {
//         this.version = version;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public Set<Modification> getOverwrite() {
//         return overwrite;
//     }
// 
//     public void setOverwrite(Set<Modification> overwrite) {
//         this.overwrite = overwrite;
//     }
// 
//     public String getDescription() {
//         if(null == description) {
//             description = new LazyText();
//         }
//         return description.getText();
//     }
// 
//     public void setDescription(String description) {
//         if(null == this.description) {
//             this.description = new LazyText();
//         }
//         this.description.setText(description);
//     }
// 
//     public Set<Patch> getPatches() {
//         return patches;
//     }
// 
//     public void setPatches(Set<Patch> files) {
//         this.patches = files;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java
// public interface FileSystemLocation {
//     public File get();
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java
// public interface ProcessTask {
// 
//     List<ProcessTask> handle(EntityManager manager) throws Exception;
//     String getIdentifier();
// }


import com.github.sarxos.winreg.RegistryException;
import de.idrinth.stellaris.modtools.persistence.entity.Modification;
import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation;
import java.io.File;
import java.io.IOException;
import de.idrinth.stellaris.modtools.process.ProcessTask;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import org.apache.commons.io.FileUtils;
/*
 * Copyright (C) 2017 Björn Büttner
 *
 * 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.idrinth.stellaris.modtools.process1datacollection;


class ConfigParser implements ProcessTask {

    private final File configuration;
    private final ArrayList<ProcessTask> todo = new ArrayList<>();
    private final FileSystemLocation modDir;

// Path: src/main/java/de/idrinth/stellaris/modtools/persistence/entity/Modification.java
// @NamedQueries({
//     @NamedQuery(
//             name = "modifications",
//             query = "select m from Modification m"
//     )
//     ,
//     @NamedQuery(
//             name = "modifications.id",
//             query = "select m from Modification m where m.id=:id"
//     )
//     ,
//     @NamedQuery(
//             name = "modifications.config",
//             query = "select m from Modification m where m.configPath=:configPath"
//     )
// })
// @Entity
// public class Modification extends EntityCompareAndHash {
// 
//     @Id
//     @GeneratedValue
//     private long aid;
//     //basics
//     protected String configPath;
//     protected int id;
//     protected String name;
//     protected String version;
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.DELETE,CascadeType.PERSIST})
//     private LazyText description;
//     //connection
//     @OneToMany(fetch = FetchType.LAZY, mappedBy="mod")
//     protected Set<Patch> patches = new HashSet<>();
//     @ManyToMany(fetch = FetchType.LAZY)
//     protected Set<Modification> overwrite = new HashSet<>();
//     @OneToOne(fetch = FetchType.LAZY)
//     @Cascade({CascadeType.ALL})
//     protected Colliding collides = new Colliding();
// 
//     public Modification() {
//     }
// 
//     public Modification(String configPath, int id) {
//         this.configPath = configPath;
//         this.id = id;
//     }
// 
//     @Override
//     public long getAid() {
//         return aid;
//     }
// 
//     @Override
//     public void setAid(long aid) {
//         this.aid = aid;
//     }
// 
//     public Set<Patch> getFiles() {
//         return patches;
//     }
// 
//     public void setFiles(Set<Patch> files) {
//         this.patches = files;
//     }
// 
//     public Colliding getCollides() {
//         return collides;
//     }
// 
//     public void setCollides(Colliding collides) {
//         this.collides = collides;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getConfigPath() {
//         return configPath;
//     }
// 
//     public void setConfigPath(String configPath) {
//         this.configPath = configPath;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
//     public String getVersion() {
//         return version;
//     }
// 
//     public void setVersion(String version) {
//         this.version = version;
//     }
// 
//     public int getId() {
//         return id;
//     }
// 
//     public void setId(int id) {
//         this.id = id;
//     }
// 
//     public Set<Modification> getOverwrite() {
//         return overwrite;
//     }
// 
//     public void setOverwrite(Set<Modification> overwrite) {
//         this.overwrite = overwrite;
//     }
// 
//     public String getDescription() {
//         if(null == description) {
//             description = new LazyText();
//         }
//         return description.getText();
//     }
// 
//     public void setDescription(String description) {
//         if(null == this.description) {
//             this.description = new LazyText();
//         }
//         this.description.setText(description);
//     }
// 
//     public Set<Patch> getPatches() {
//         return patches;
//     }
// 
//     public void setPatches(Set<Patch> files) {
//         this.patches = files;
//     }
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/filesystem/FileSystemLocation.java
// public interface FileSystemLocation {
//     public File get();
// }
// 
// Path: src/main/java/de/idrinth/stellaris/modtools/process/ProcessTask.java
// public interface ProcessTask {
// 
//     List<ProcessTask> handle(EntityManager manager) throws Exception;
//     String getIdentifier();
// }


// Path: src/main/java/de/idrinth/stellaris/modtools/process1datacollection/ConfigParser.java
import com.github.sarxos.winreg.RegistryException;
import de.idrinth.stellaris.modtools.persistence.entity.Modification;
import de.idrinth.stellaris.modtools.filesystem.FileSystemLocation;
import java.io.File;
import java.io.IOException;
import de.idrinth.stellaris.modtools.process.ProcessTask;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.persistence.EntityManager;
import org.apache.commons.io.FileUtils;

/*
 * Copyright (C) 2017 Björn Büttner
 *
 * 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.idrinth.stellaris.modtools.process1datacollection;


class ConfigParser implements ProcessTask {

    private final File configuration;
    private final ArrayList<ProcessTask> todo = new ArrayList<>();
    private final FileSystemLocation modDir;

    public ConfigParser(File configuration, FileSystemLocation modDir) {