summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/BizCard.java
blob: ce8edb504cd91ab567c9e8713c71c6ad3c13a446 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/*     */ 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
 */