blob: a0b92769b029985a320d5e1f64170b37bd4e1762 (
plain)
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
|
using System.IO;
namespace Com.Xagasoft.Gats
{
public abstract class GatsObject
{
public abstract void Read( Stream s, char cType );
public abstract void Write( Stream s );
public static GatsObject Read( Stream s )
{
int b = s.ReadByte();
if( b == -1 )
throw new GatsException( GatsException.Type.PrematureEnd );
char type = (char)b;
GatsObject goRet = null;
switch( type )
{
case 'i':
goRet = new GatsInteger();
break;
case 's':
goRet = new GatsString();
break;
case '0':
case '1':
goRet = new GatsBoolean();
break;
case 'l':
// goRet = new GatsList();
break;
case 'd':
// goRet = new GatsDictionary();
break;
case 'f':
case 'F':
// goRet = new GatsFloat();
break;
case 'n':
// goRet = new GatsNull();
break;
case 'e':
return null;
default:
throw new GatsException( GatsException.Type.InvalidType );
}
goRet.Read( s, type );
return goRet;
}
}
}
|