aboutsummaryrefslogtreecommitdiff
path: root/cs-dotnet/src/gatsboolean.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cs-dotnet/src/gatsboolean.cs40
1 files changed, 40 insertions, 0 deletions
diff --git a/cs-dotnet/src/gatsboolean.cs b/cs-dotnet/src/gatsboolean.cs
new file mode 100644
index 0000000..e7e07e6
--- /dev/null
+++ b/cs-dotnet/src/gatsboolean.cs
@@ -0,0 +1,40 @@
1using System.IO;
2
3namespace Com.Xagasoft.Gats
4{
5 public class GatsBoolean : GatsObject
6 {
7 public bool Value { get; set; }
8
9 public GatsBoolean()
10 {
11 }
12
13 public GatsBoolean( bool val )
14 {
15 Value = val;
16 }
17
18 public override string ToString()
19 {
20 return Value.ToString();
21 }
22
23 public override void Read( Stream s, char type )
24 {
25 if( type == '0' )
26 Value = false;
27 else
28 Value = true;
29 }
30
31 public override void Write( Stream s )
32 {
33 if( Value )
34 s.WriteByte( (int)'1' );
35 else
36 s.WriteByte( (int)'0' );
37 }
38 }
39}
40