/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.core.IniFile; /* */ import java.io.DataInputStream; /* */ import java.io.DataOutputStream; /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class BizCard /* */ extends Attribute /* */ { /* 25 */ String[] _line = { "", "", "", "", "" }; /* */ /* */ public BizCard(int attrID) /* */ { /* 29 */ super(attrID); /* 30 */ loadIni(); /* */ } /* */ /* */ /* */ /* */ /* */ public BizCard() {} /* */ /* */ /* */ /* */ /* */ private void loadIni() /* */ { /* 43 */ for (int i = 0; i < 5; i++) /* 44 */ this._line[i] = IniFile.gamma().getIniString("BizCard" + i, this._line[i]); /* */ } /* */ /* */ public String[] get() { /* 48 */ return this._line; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void set(String[] lines) /* */ { /* 59 */ int total = 0; /* */ /* 61 */ for (int i = 0; i < this._line.length; i++) /* */ { /* 63 */ int l = lines[i].length(); /* 64 */ total += l; /* 65 */ if ((total >= 200) || (lines[i] == null)) { /* 66 */ this._line[i] = ""; /* */ } else { /* 68 */ this._line[i] = lines[i]; /* */ } /* */ } /* 71 */ noteChange(); /* */ } /* */ /* */ protected void noteAddingTo(SuperRoot owner) /* */ { /* 76 */ set(this._line); /* */ } /* */ /* */ public void generateNetData(DataOutputStream s) throws IOException /* */ { /* 81 */ s.writeInt(this._line.length); /* 82 */ for (int i = 0; i < this._line.length; i++) { /* 83 */ s.writeUTF(this._line[i]); /* */ } /* */ } /* */ /* */ public void setFromNetData(DataInputStream ds, int len) throws IOException { /* 88 */ int nLines = ds.readInt(); /* 89 */ String[] serverLines = new String[nLines]; /* 90 */ for (int i = 0; i < nLines; i++) { /* 91 */ serverLines[i] = ds.readUTF(); /* */ } /* 93 */ set(serverLines); /* */ } /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 102 */ Object ret = null; /* 103 */ switch (index - offset) { /* */ case 0: /* */ case 1: /* */ case 2: /* */ case 3: /* */ case 4: /* 109 */ if (mode == 0) { /* 110 */ ret = StringPropertyEditor.make( /* 111 */ new Property(this, index, "Line " + (index - offset))); /* 112 */ } else if (mode == 1) { /* 113 */ ret = this._line[(index - offset)]; /* 114 */ } else if (mode == 2) /* */ { /* 116 */ this._line[(index - offset)] = ((String)value); /* 117 */ set(this._line); /* */ } /* 119 */ break; /* */ default: /* 121 */ ret = super.properties(index, offset + 5, mode, value); /* */ } /* */ /* 124 */ return ret; /* */ } /* */ /* */ /* 128 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 132 */ s.saveVersion(0, classCookie); /* 133 */ super.saveState(s); /* */ /* 135 */ s.saveInt(this._line.length); /* 136 */ for (int i = 0; i < this._line.length; i++) { /* 137 */ s.saveString(this._line[i]); /* */ } /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException { /* 142 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 144 */ super.restoreState(r); /* 145 */ int nLines = r.restoreInt(); /* 146 */ this._line = new String[nLines]; /* 147 */ for (int i = 0; i < nLines; i++) /* 148 */ this._line[i] = r.restoreString(); /* 149 */ break; /* */ default: /* 151 */ throw new TooNewException(); /* */ } /* 153 */ set(this._line); /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\BizCard.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */