/* * @(#)SaveProject.java * * This file is part of webCDwriter - Network CD Writing. * * Copyright (C) 2001-2004 Jörg P. M. Haeger * * webCDwriter is free software. See CDcreator.java for details. * * Jörg Haeger, 05.2001 */ import java.io.*; /** * SaveProject command * * @version 20040317 * @author Jörg P. M. Haeger */ public class SaveProject extends Command { protected CDNode CDRoot; protected DataOutputStream outStream; public SaveProject(CDNode aCDRoot) { CDRoot = aCDRoot; outStream = CDcreator.outStream; } public void run() { execCommand("saveProject " + spaceToEsc(State.sessionID)); String type = null; if (Mode.type == Mode.audio) type = "audio"; else if (Mode.type == Mode.data) if (Mode.makeImage) type = "data"; else type = "image"; if (type != null) execCommand("type " + type); execCommand("medium " + Mode.media.getSelectedItem()); if (Mode.type == Mode.audio) { for (int i = 0; i < CDRoot.getChildCount(); i++) { String cmd = "add " + Command.spaceToEsc( ((CDNode)CDRoot.getChildAt(i)) .getFile().getPath()) + " /"; execCommand(cmd); } } else for (int i = 0; i < Project.getNumOfCommands(); i++) { String cmd = Project.getCommandType(i) + " " + spaceToEsc(Project.getCommandArg1(i)); if (Project.getCommandArg2(i).length() > 0) cmd = cmd + " " + spaceToEsc(Project.getCommandArg2(i)); execCommand(cmd); } if (Options.bootImage != null) execCommand("boot " + spaceToEsc(Options.bootImage)); execCommand("noop"); super.run(); } }