summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/MultiManifestAction.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/MultiManifestAction.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/MultiManifestAction.java')
-rw-r--r--NET/worlds/scape/MultiManifestAction.java144
1 files changed, 144 insertions, 0 deletions
diff --git a/NET/worlds/scape/MultiManifestAction.java b/NET/worlds/scape/MultiManifestAction.java
new file mode 100644
index 0000000..659947c
--- /dev/null
+++ b/NET/worlds/scape/MultiManifestAction.java
@@ -0,0 +1,144 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.network.URL;
+/* */ import java.io.File;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class MultiManifestAction
+/* */ extends Action
+/* */ implements LoadedURLSelf
+/* */ {
+/* */ private String _directory;
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 31 */ Object ret = null;
+/* 32 */ switch (index - offset) {
+/* */ case 0:
+/* 34 */ if (mode == 0) {
+/* 35 */ ret = StringPropertyEditor.make(new Property(this, index,
+/* 36 */ "Directory"));
+/* 37 */ } else if (mode == 1) {
+/* 38 */ if (this._directory == null)
+/* 39 */ this._directory = new String();
+/* 40 */ ret = new String(this._directory);
+/* 41 */ } else if (mode == 2) {
+/* 42 */ this._directory = ((String)value).trim();
+/* */ }
+/* 44 */ break;
+/* */ default:
+/* 46 */ ret = super.properties(index, offset + 1, mode, value);
+/* */ }
+/* 48 */ return ret;
+/* */ }
+/* */
+/* 51 */ private static Object classCookie = new Object();
+/* */ private String[] _files;
+/* */
+/* 54 */ public void saveState(Saver s) throws IOException { s.saveVersion(0, classCookie);
+/* 55 */ super.saveState(s);
+/* 56 */ s.saveString(this._directory);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException {
+/* 60 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 0:
+/* 62 */ super.restoreState(r);
+/* 63 */ this._directory = r.restoreString();
+/* 64 */ break;
+/* */ default:
+/* 66 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */
+/* */ public Persister trigger(Event e, Persister seqId) {
+/* 71 */ if (seqId == null) {
+/* 72 */ System.out.println("MMAState:starting");
+/* 73 */ this._dir = new File(this._directory);
+/* 74 */ this._files = this._dir.list(new ExtensionFilter(".world"));
+/* 75 */ this._curFile = 0;
+/* */
+/* 77 */ startFile();
+/* */ }
+/* */
+/* 80 */ if (this._curFile >= this._files.length) {
+/* 81 */ return null;
+/* */ }
+/* 83 */ return this;
+/* */ }
+/* */
+/* */
+/* */
+/* */ private File _dir;
+/* */
+/* */
+/* */ private int _curFile;
+/* */
+/* */
+/* */ private String _file;
+/* */
+/* */
+/* */ public void startFile()
+/* */ {
+/* 99 */ if (this._curFile >= this._files.length) {
+/* 100 */ System.out.println("MMAState:Done");
+/* 101 */ return;
+/* */ }
+/* */
+/* 104 */ this._file = new File(this._dir, this._files[this._curFile]).getAbsolutePath();
+/* 105 */ System.out.println("MMAState:Loading: " + this._file);
+/* 106 */ World.load(URL.make(this._file), this);
+/* */ }
+/* */
+/* */ public void loadedURLSelf(URLSelf o, URL url, String err) {
+/* 110 */ if ((err != null) || (!(o instanceof World))) {
+/* 111 */ if (err == null) {
+/* 112 */ err = Console.message("No-contain-world");
+/* 113 */ o.decRef();
+/* */ }
+/* */
+/* 116 */ Console.println(Console.message("Cant-load-remote") + url + "' ");
+/* */ } else {
+/* 118 */ World w = (World)o;
+/* */
+/* 120 */ String mftname = this._file.substring(0, this._file.lastIndexOf(".world")) +
+/* 121 */ ".mft";
+/* 122 */ System.out.println("MMAState:Manifesting: " + mftname);
+/* */ try {
+/* 124 */ Manifest mft = new Manifest(mftname);
+/* 125 */ mft.saveProps(w);
+/* 126 */ mft.done();
+/* */ } catch (Exception ex) {
+/* 128 */ ex.printStackTrace(System.out);
+/* */ }
+/* */
+/* 131 */ if (w != Pilot.getActive().getWorld())
+/* 132 */ w.discard();
+/* */ }
+/* 134 */ this._curFile += 1;
+/* */
+/* 136 */ startFile();
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\MultiManifestAction.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file