// Path: src/com/ganggarrison/gmdec/DeferredReferenceCreatorNotifier.java
// public class DeferredReferenceCreatorNotifier {
// 	private Set<DeferredReferenceCreator> drcSet = new HashSet<DeferredReferenceCreator>();
// 
// 	public void addDeferredReferenceCreator(DeferredReferenceCreator drc) {
// 		drcSet.add(drc);
// 	}
// 
// 	public void createReferences(GmFile gmf) {
// 		for (DeferredReferenceCreator drc : drcSet) {
// 			drc.createReferences(gmf);
// 		}
// 	}
// }
// 
// Path: src/com/ganggarrison/gmdec/ResourceTreeEntry.java
// public class ResourceTreeEntry {
// 	public String name;
// 	public String filename;
// 	public Type type;
// 
// 	public ResourceTreeEntry(String name, String filename, Type type) {
// 		this.name = name;
// 		this.filename = filename;
// 		this.type = type;
// 	}
// 
// 	public ResourceTreeEntry() {
// 	}
// 
// 	public String getFilename() {
// 		String result;
// 		if (filename != null && !filename.isEmpty()) {
// 			result = filename;
// 		} else {
// 			result = name;
// 		}
// 		if (FileTools.isGoodFilename(result)) {
// 			return result;
// 		} else {
// 			throw new IllegalStateException("Bad filename in resource list: " + result);
// 		}
// 	}
// 
// 	public static enum Type {
// 		RESOURCE, GROUP
// 	}
// }
// 
// Path: src/com/ganggarrison/gmdec/xml/TimelineXmlFormat.java
// public class TimelineXmlFormat extends XmlFormat<Timeline> {
// 
// 	@Override
// 	public void write(Timeline timeline, XmlWriter writer) {
// 		writer.startElement("timeline");
// 		{
// 			writeIdAttribute(timeline, writer);
// 			for (Moment moment : timeline.moments) {
// 				writer.startElement("moment");
// 				writer.putAttribute("stepNo", moment.stepNo);
// 				ActionXmlFormat actionFormat = new ActionXmlFormat();
// 				for (Action action : moment.actions) {
// 					actionFormat.write(action, writer);
// 				}
// 				writer.endElement();
// 			}
// 		}
// 		writer.endElement();
// 	}
// 
// 	@Override
// 	public Timeline read(XmlReader reader, DeferredReferenceCreatorNotifier notifier) {
// 		Timeline timeline = new Timeline();
// 		reader.enterElement("timeline");
// 		{
// 			readIdAttribute(timeline, reader);
// 			while (reader.hasNextElement()) {
// 				Moment moment = timeline.addMoment();
// 				reader.enterElement("moment");
// 				moment.stepNo = reader.getIntAttribute("stepNo");
// 				ActionXmlFormat actionFormat = new ActionXmlFormat();
// 				while (reader.hasNextElement()) {
// 					moment.actions.add(actionFormat.read(reader, notifier));
// 				}
// 				reader.leaveElement();
// 			}
// 		}
// 		reader.leaveElement();
// 		return timeline;
// 	}
// }


import java.io.File;
import java.io.IOException;
import org.lateralgm.file.GmFile;
import org.lateralgm.resources.Timeline;
import com.ganggarrison.gmdec.DeferredReferenceCreatorNotifier;
import com.ganggarrison.gmdec.ResourceTreeEntry;
import com.ganggarrison.gmdec.xml.TimelineXmlFormat;
/*
 * Copyright (C) 2010 Medo <smaxein@googlemail.com>
 * 
 * This file is part of GmkSplitter.
 * GmkSplitter is free software and comes with ABSOLUTELY NO WARRANTY.
 * See LICENSE for details.
 */
package com.ganggarrison.gmdec.files;




public class TimelineFormat extends ResourceFormat<Timeline> {
	@Override
	public Timeline read(File path, ResourceTreeEntry entry, DeferredReferenceCreatorNotifier drcn) throws IOException {
// Path: src/com/ganggarrison/gmdec/DeferredReferenceCreatorNotifier.java
// public class DeferredReferenceCreatorNotifier {
// 	private Set<DeferredReferenceCreator> drcSet = new HashSet<DeferredReferenceCreator>();
// 
// 	public void addDeferredReferenceCreator(DeferredReferenceCreator drc) {
// 		drcSet.add(drc);
// 	}
// 
// 	public void createReferences(GmFile gmf) {
// 		for (DeferredReferenceCreator drc : drcSet) {
// 			drc.createReferences(gmf);
// 		}
// 	}
// }
// 
// Path: src/com/ganggarrison/gmdec/ResourceTreeEntry.java
// public class ResourceTreeEntry {
// 	public String name;
// 	public String filename;
// 	public Type type;
// 
// 	public ResourceTreeEntry(String name, String filename, Type type) {
// 		this.name = name;
// 		this.filename = filename;
// 		this.type = type;
// 	}
// 
// 	public ResourceTreeEntry() {
// 	}
// 
// 	public String getFilename() {
// 		String result;
// 		if (filename != null && !filename.isEmpty()) {
// 			result = filename;
// 		} else {
// 			result = name;
// 		}
// 		if (FileTools.isGoodFilename(result)) {
// 			return result;
// 		} else {
// 			throw new IllegalStateException("Bad filename in resource list: " + result);
// 		}
// 	}
// 
// 	public static enum Type {
// 		RESOURCE, GROUP
// 	}
// }
// 
// Path: src/com/ganggarrison/gmdec/xml/TimelineXmlFormat.java
// public class TimelineXmlFormat extends XmlFormat<Timeline> {
// 
// 	@Override
// 	public void write(Timeline timeline, XmlWriter writer) {
// 		writer.startElement("timeline");
// 		{
// 			writeIdAttribute(timeline, writer);
// 			for (Moment moment : timeline.moments) {
// 				writer.startElement("moment");
// 				writer.putAttribute("stepNo", moment.stepNo);
// 				ActionXmlFormat actionFormat = new ActionXmlFormat();
// 				for (Action action : moment.actions) {
// 					actionFormat.write(action, writer);
// 				}
// 				writer.endElement();
// 			}
// 		}
// 		writer.endElement();
// 	}
// 
// 	@Override
// 	public Timeline read(XmlReader reader, DeferredReferenceCreatorNotifier notifier) {
// 		Timeline timeline = new Timeline();
// 		reader.enterElement("timeline");
// 		{
// 			readIdAttribute(timeline, reader);
// 			while (reader.hasNextElement()) {
// 				Moment moment = timeline.addMoment();
// 				reader.enterElement("moment");
// 				moment.stepNo = reader.getIntAttribute("stepNo");
// 				ActionXmlFormat actionFormat = new ActionXmlFormat();
// 				while (reader.hasNextElement()) {
// 					moment.actions.add(actionFormat.read(reader, notifier));
// 				}
// 				reader.leaveElement();
// 			}
// 		}
// 		reader.leaveElement();
// 		return timeline;
// 	}
// }


// Path: src/com/ganggarrison/gmdec/files/TimelineFormat.java
import java.io.File;
import java.io.IOException;
import org.lateralgm.file.GmFile;
import org.lateralgm.resources.Timeline;
import com.ganggarrison.gmdec.DeferredReferenceCreatorNotifier;
import com.ganggarrison.gmdec.ResourceTreeEntry;
import com.ganggarrison.gmdec.xml.TimelineXmlFormat;

/*
 * Copyright (C) 2010 Medo <smaxein@googlemail.com>
 * 
 * This file is part of GmkSplitter.
 * GmkSplitter is free software and comes with ABSOLUTELY NO WARRANTY.
 * See LICENSE for details.
 */
package com.ganggarrison.gmdec.files;




public class TimelineFormat extends ResourceFormat<Timeline> {
	@Override
	public Timeline read(File path, ResourceTreeEntry entry, DeferredReferenceCreatorNotifier drcn) throws IOException {
		Timeline timeline = new TimelineXmlFormat().read(getXmlFile(path, entry), drcn);