@@ -0,0 +1,2817 @@
+package com.officialsounding.statparse.utils;%0A%0Aimport org.apache.commons.collections4.IteratorUtils;%0Aimport org.apache.commons.csv.CSVFormat;%0Aimport org.apache.commons.csv.CSVParser;%0Aimport org.apache.commons.csv.CSVRecord;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.awt.*;%0Aimport java.io.*;%0A%0A/**%0A * Created by Peter on 3/13/2018.%0A */%0Apublic class MothershipToCRG %7B%0A    public static void main(String%5B%5D args) throws IOException %7B%0A%0A        CrgExportFormat export = new CrgExportFormat();%0A        MothershipToCRG translator = new MothershipToCRG();%0A%0A        List%3CFile%3E input = new ArrayList%3C%3E();%0A%0A        if(args.length == 0) %7B%0A            FileDialog openFileDialog = new FileDialog(new Frame(), %22Open Mothership CSV Files%22, FileDialog.LOAD);%0A            openFileDialog.setMultipleMode(true);%0A            openFileDialog.setFile(%22*.csv%22);%0A            openFileDialog.setVisible(true);%0A            for (File in : openFileDialog.getFiles()) %7B%0A                input.add(in);%0A            %7D%0A        %7D else %7B%0A            for (String filename : args) %7B%0A                input.add(new File(filename));%0A            %7D%0A        %7D%0A%0A        for (File csv : input) %7B%0A            CrgExportTeam team = translator.teamFromCSV(csv);%0A            export.getTeams().add(team);%0A        %7D%0A%0A%0A        FileDialog saveFileDialog = new FileDialog(new Frame(), %22Save CRG Export%22, FileDialog.SAVE);%0A        saveFileDialog.setFile(%22export.xml%22);%0A        saveFileDialog.setVisible(true);%0A%0A        File output = new File(saveFileDialog.getDirectory(),saveFileDialog.getFile());%0A%0A        if(!output.exists()) %7B%0A            output.createNewFile();%0A        %7D%0A%0A%0A        try(CRGXMLWriter writer = new CRGXMLWriter(new FileOutputStream(output))) %7B%0A            writer.writeOutput(export);%0A        %7D%0A    %7D%0A%0A    public CrgExportTeam teamFromCSV(File csvFile) %7B%0A        CrgExportTeam team = new CrgExportTeam();%0A%0A        try(Reader in = new FileReader(csvFile)) %7B%0A            List%3CCSVRecord%3E records = IteratorUtils.toList(CSVFormat.RFC4180.parse(in).iterator());%0A%0A            // format%0A            // row 0-9: key-value team-level information%0A            // row 10: blank%0A            // row 12: skater info header%0A            // row 13-%5Bn-1%5D: skater info data%0A            // row n: blank%0A%0A            team.setName(records.get(0).get(1));%0A%0A%0A            for(int i = 12; i %3C records.size(); i++) %7B%0A                CrgExportSkater skater = new CrgExportSkater();%0A                skater.setName(records.get(i).get(1));%0A                skater.setNumber(records.get(i).get(0));%0A                team.getSkaters().add(skater);%0A            %7D%0A%0A        %7D catch (FileNotFoundException e) %7B%0A            e.printStackTrace();%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D%0A%0A        return team;%0A    %7D%0A%7D%0A

add Mothership CSV to IGRF parsing capabilities