Commit 2ce7ecc6 authored by Syndesi's avatar Syndesi
Browse files

removed empty/inactive lines

parent 9c6bef98
......@@ -7,11 +7,10 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import dev.syndesi.colorconverter.Color;
public class FormatGimp extends FileParser {
public Color[] importFile (String path) throws IOException {
......@@ -20,13 +19,10 @@ public class FormatGimp extends FileParser {
boolean isHeader = true;
for (int i = 0; i < s.size(); i++) {
String line = s.get(i);
//System.out.println(line);
if (line.length() == 0) {
// don't parse empty lines
continue;
}
if (line.matches("^[\\s\\d]{3}\\s+[\\s\\d]{3}\\s+[\\s\\d]{3}\\s+.*$")) {
try {
Color c = this.parseLine(line);
......
......@@ -3,12 +3,12 @@ package dev.syndesi.colorconverter.runtime.command;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import dev.syndesi.colorconverter.Color;
import dev.syndesi.colorconverter.parser.file.FileParser;
import dev.syndesi.colorconverter.parser.file.FormatGimp;
import dev.syndesi.colorconverter.runtime.Command;
public class ListCommand extends Command {
public ListCommand() {
......@@ -29,18 +29,15 @@ public class ListCommand extends Command {
try {
c = fg.importFile(args[0]);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (int i = 0; i < c.length; i++) {
System.out.println("rgb(" + (c[i].getRed() & 0xff) + ", " + (c[i].getGreen() & 0xff) + ", " + (c[i].getBlue() & 0xff) + "): " + c[i].getTitle());
}
System.out.println("finished");
try {
fg.exportFile("./src/assets/Material-Design.copy.gpl", c);
System.out.println("palette successfully exported");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment