/* * 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 . */ package de.nplusc.izc.InstallPak; import de.nplusc.izc.tools.IOtools.FileTK; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.Map; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; /** * * @author LH */ public class CreateSampleFile { public static void main(String[] devnulled) throws FileNotFoundException, IOException { //SHARED DumperOptions yamlOptions = new DumperOptions(); yamlOptions.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); Yaml y = new Yaml(yamlOptions); /* Map izsetup = new LinkedHashMap<>(); izsetup.put("comment:type","izsetup"); ArrayList rootEntries=new ArrayList<>(); rootEntries.add("Group1"); rootEntries.add("Runtimes"); rootEntries.add("nichtWin8"); izsetup.put("Segments",rootEntries); Map group1 = new LinkedHashMap<>(); group1.put("Condition",new String[]{"IsWin8"}); group1.put("ifnode",new String[]{"Group1Win8"}); group1.put("postCond",new String[]{"Group1Post"}); izsetup.put("Group1",group1); Map group1win8 = new LinkedHashMap<>(); group1win8.put("Condition",new String[]{"Is64Bit"}); group1win8.put("elsenode",new String[]{"Group1Win8_32"}); izsetup.put("Group1",group1); Map group1win8_32 = new LinkedHashMap<>(); group1win8_32.put("Exec1",new String[]{"Installiere was 32-bit spezifisches","program","ping","google.de"}); group1win8_32.put("Comment:exec",new String[]{"Beschreibung","Typ","Parameter1","...","parameterN"}); izsetup.put("Group1Win8_32",group1win8_32); Map group1post = new LinkedHashMap<>(); group1post.put("Exec1",new String[]{"Group1Post","program","ping","amazon.de"}); izsetup.put("Group1Post",group1post); Map runtimes = new LinkedHashMap<>(); runtimes.put("Exec1",new String[]{"Runtime1","program","ping","ccc.de"}); runtimes.put("Exec2",new String[]{"Runtime2","program","ping","microsoft.de"}); izsetup.put("Runtimes",runtimes); Map nonwin8 = new LinkedHashMap<>(); nonwin8.put("Condition",new String[]{"IsWin8"}); nonwin8.put("elsenode",new String[]{"nonwin8Impl"}); izsetup.put("nichtWin8",nonwin8); Map nonwin8Impl = new LinkedHashMap<>(); nonwin8Impl.put("Exec1",new String[]{"Nicht für wind00f 8","program","ping","example.com"}); izsetup.put("nonwin8Impl",nonwin8Impl);*/ Map izsetup = new LinkedHashMap<>(); ArrayList rootEntries=new ArrayList<>(); rootEntries.add("GamesTls"); izsetup.put("Segments",rootEntries); Map addons = new LinkedHashMap<>(); addons.put("Exec1",new String[]{"NOOP","program","ping","localhost"}); izsetup.put("GamesTls", addons); String izbo = "000|izsetup|3.0.0|: valides YAML und trotzdem kompatibel" +"\n"+y.dump(izsetup); FileTK.writeFile(izbo, "D:\\src\\izsetup\\gamestls.izsetup"); //izpackage /* Map izpackage = new LinkedHashMap<>(); izpackage.put("comment:type","izpackage"); ArrayList flags = new ArrayList<>(); flags.add("multidisk"); izpackage.put("flags",flags); izpackage.put("comment:packagebases","Namen der IDs der echten Packages die auch in der Liste auftauchen\nDer Rest ist von diesen referenziert"); ArrayList packageBases=new ArrayList<>(); packageBases.add("BaseSystem"); packageBases.add("Addons"); packageBases.add("XPTools"); packageBases.add("Games"); packageBases.add("Game-Tools"); izpackage.put("packagebases",packageBases); Map BaseSystem = new LinkedHashMap<>(); BaseSystem.put("Name","BaseSystem"); BaseSystem.put("script","#basedir#\\pack001.izsetup"); BaseSystem.put("detectInstall","File://C:\\kernel.etl2"); BaseSystem.put("desc","Die minimal nötigen Tools und Komponenten fürs System"); BaseSystem.put("defaultEnabled","true"); izpackage.put("BaseSystem",BaseSystem); Map Addons = new LinkedHashMap<>(); Addons.put("Name","AddOns"); Addons.put("dependsOn","BaseSystem"); Addons.put("script","#basedir#\\addons.izsetup"); Addons.put("detectInstall","File://%userprofile%\\appdata\\programname\\datei1.dat"); Addons.put("desc","Addons und sosntiges was nicht zwingend notwendig ist"); Addons.put("defaultEnabled","true"); izpackage.put("Addons",Addons); Map XPAddons = new LinkedHashMap<>(); XPAddons.put("Condition","IsWin7"); XPAddons.put("Comment:Condition","Bei Erfüllt das Package aus If enablen, sonst das aus Else verwenden"); XPAddons.put("ifnode","XPAddonsIf"); izpackage.put("XPTools", XPAddons); Map XPAddonsIf = new LinkedHashMap<>(); XPAddonsIf.put("Name","XPAddOns"); XPAddonsIf.put("dependsOn","BaseSystem"); XPAddonsIf.put("script","#basedir#\\xprevocer.izsetup"); XPAddonsIf.put("detectInstall","File://C:\\ornder2\\datei2.bin"); XPAddonsIf.put("desc","Sach das bei XP defult war aber dort fehlt"); XPAddonsIf.put("defaultEnabled","true"); izpackage.put("XPAddonsIf", XPAddonsIf); Map Games = new LinkedHashMap<>(); Games.put("Name","Games"); Games.put("comment:waitDisk","Prüft ob spezifizierte datei vorhanden ist und fordert zum einlegen der disk auf falls nicht\n spezifisierte datei sollte nur auf der entsprechenden disk sein"); Games.put("waitDisk", "#basedir#\\games.izsetup"); Games.put("comment:waitMessage","WaitMessage ist optional, defaulted wenn nur waitDisk"); Games.put("waitMessage","Bitte Games-Disk einlegen"); Games.put("dependsOn","BaseSystem"); Games.put("script","#basedir#\\games.izsetup"); Games.put("detectInstall","File://C:\\Program Files\\ImgBurn\\ImgBurn.exexexe"); Games.put("desc","Die Games die nicht fehlen dürfen"); Games.put("defaultEnabled","true"); izpackage.put("Games",Games); Map Gamest = new LinkedHashMap<>(); Gamest.put("Name","game-Tools"); Gamest.put("waitDisk", "#basedir#\\gamestls.izsetup"); Gamest.put("comment:dependsOn","Dependency geht zu games und zu den dependencys von games"); Gamest.put("dependsOn","Games"); Gamest.put("script","#basedir#\\gamestls.izsetup"); Gamest.put("detectInstall","File://C:\\Program Files\\ImgBurn\\ImgBurn.exexexe"); Gamest.put("desc","Tools für die games aus dem Package"); Gamest.put("defaultEnabled","true"); izpackage.put("Game-Tools", Gamest); //Yaml y = new Yaml(); String izbo = "000|izsetup|3.0.0|: valides YAML und trotzdem kompatibel" +"\n"+y.dump(izpackage); FileTK.writeFile(izbo, "D:\\src\\izsetup\\sample.izpackage"); */ //bundle.izmeta /* Map izbundle = new LinkedHashMap<>(); izbundle.put("comment:type","izbundle"); izbundle.put("meta:isZipped","true"); izbundle.put("comment:meta:isZipped","bei false sind die dateien als normale dateien neben dieser bundle gelagert -> kein entzippern\n" + "CMM|in tempdir nötig. Muss bei multidisk-bundles deaktiviert sein. bei diskbundles wird Deaktivierung empfohlen\n" + "CMM|da es die Festplatte nicht so vollstopft"); izbundle.put("bundlename","Sample"); izbundle.put("packagedata","sample.iZpackage"); izbundle.put("description","Beispieldaten und testdaten"); izbundle.put("extractSize","123556"); String izbo = "000|izsetup|3.0.0|: valides YAML und trotzdem kompatibel" +"\n"+y.dump(izbundle); FileTK.writeFile(izbo, "D:\\src\\izsetup\\bundle.izmeta"); */ //temp code //FileTK.writeFile(y.dump(y.load(new FileInputStream("D:\\src\\izsetup\\sample.izpackage"))), "D:\\src\\izsetup\\valid"); /*System.out.println(FileTK.fileAsString("D:\\src\\izsetup\\valid")); */ } }