/* * Copyright (C) 2007-2013 Xagasoft, All rights reserved. * * This file is part of the libgats library and is released under the * terms of the license contained in the file LICENSE. */ using System; using System.IO; using Com.Xagasoft.Gats; public class Test { public static void Write( double d, Stream s ) { GatsFloat gf = new GatsFloat( d ); gf.Write( s ); Console.WriteLine("Wrote: " + d ); } public static void Read( Stream s ) { GatsObject o = GatsObject.Read( s ); Console.WriteLine("Read type: " + o.GetType() ); Console.WriteLine("Read vlaue: " + o ); } public static void Main() { MemoryStream ms = new MemoryStream(); Write( Math.PI, ms ); ms.Seek( 0, SeekOrigin.Begin ); Read( ms ); try { FileStream fs = new FileStream("float.gats", FileMode.Open, FileAccess.Read ); Read( fs ); } catch( Exception e ) { Console.WriteLine("Can't test files: " + e.Message ); } } }