/*
 * @(#)LoadProject.java
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2001 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDcreator.java for details.
 *
 * Jörg Haeger, 11.05.2001
 */

class LoadProject extends Command
{
	void processHint(String str)
	{
//		System.out.println("");
//		System.out.println(str);

		String str1 = "", str2 = "", str3 = "";
		int i = str.indexOf(" ");
		if (i < 0)
				str1 = str;
		else
		{
			str1 = str.substring(0, i);
			str = str.substring(i + 1);
			i = str.indexOf(" ");
			if (i < 0)
				str2 = str;
			else
			{
				str2 = str.substring(0, i);
				str3 = str.substring(i + 1);
			}
		}

		str2 = removeEscChars(str2);
		str3 = removeEscChars(str3);
//		System.out.println(str2);
//		System.out.println(str3);

		if (str1.equals("add"))
			Project.add(str2, str3);
		else
		if (str1.equals("mkdir"))
			Project.mkdir(str2);
		else
		if (str1.equals("mv"))
			Project.rename(str2, str3);
		else
		if (str1.equals("rm"))
			Project.remove(str2);
		else
		if (str1.equals("type"))
		{
			if (str2.equals("audio"))
				Mode.type = Mode.audio;
			else
			if (str2.equals("image"))
			{
				Mode.makeImage = false;
				Mode.type = Mode.data;
			}
			else
			if (str2.equals("data"))
			{
				Mode.makeImage = true;
				Mode.type = Mode.data;
			}
		}
	}

	public void run()
	{
		execCommand("loadProject " + spaceToEsc(State.sessionID));
		super.run();
	}
}
