ReadDouble() public method

public ReadDouble ( ) : double
return double
Example #1
0
 public override void DeserializeBody(BinaryReader br)
 {
     n = br.ReadInt32();
     x = br.ReadDouble();
     y = br.ReadDouble();
     zoom = br.ReadDouble();
 }
        public void StatisticRead(string FileName)
        {
            // Read the file.
            FileStream fs;
            // Create the reader for data.
            fs = new FileStream(FileName, FileMode.Open, FileAccess.Read);
            BinaryReader r = new BinaryReader(fs);
            // Read data from Test.data.
            double[] ar = new double [FileLenght];

            string str = "";
            //		StatisticalData [] stat = new StatisticalData[FileLenght];
            for (int i = 0; i < FileLenght; i++)
            {
            //		ar[i] = r.ReadDouble();
                stat[i].mean = r.ReadByte();
                stat[i].sigma = r.ReadByte();
                stat[i].K = r.ReadDouble();
                stat[i].P = r.ReadDouble();
                stat[i].Z = r.ReadDouble();
                //		str = str + ";" + ar[i].ToString();
                //	Console.WriteLine(r.ReadInt32());
            }

            //	MessageBox.Show("Loaded data is: " + str);
            str.Remove(0,str.Length);
            r.Close();
            fs.Close();
        }
Example #3
0
		public override object Read(BinaryReader reader)
		{
			reader.ReadByte();
			int id = reader.ReadInt32();
			InstrumentType type = (InstrumentType)reader.ReadByte();
			string symbol = reader.ReadString();
			string description = reader.ReadString();
			byte currencyId = reader.ReadByte();
			string exchange = reader.ReadString();
			Instrument instrument = new Instrument(id, type, symbol, description, currencyId, exchange);
			instrument.tickSize = reader.ReadDouble();
			instrument.maturity = new DateTime(reader.ReadInt64());
			instrument.factor = reader.ReadDouble();
			instrument.strike = reader.ReadDouble();
			instrument.putcall = (PutCall)reader.ReadByte();
			instrument.margin = reader.ReadDouble();
			int num = reader.ReadInt32();
			for (int i = 0; i < num; i++)
			{
				AltId altId = new AltId();
				altId.providerId = reader.ReadByte();
				altId.symbol = reader.ReadString();
				altId.exchange = reader.ReadString();
				instrument.altId.Add(altId);
			}
			return instrument;
		}
Example #4
0
        public static IList<Station> ParseStations(Stream stream)
        {
            using (var reader = new BinaryReader (stream, System.Text.Encoding.UTF8, true)) {
                var count = reader.ReadInt32 ();
                var stations = new Station[count];
                for (int i = 0; i < count; i++) {
                    stations [i] = new Station {
                        Id = reader.ReadInt32 (),
                        Street = reader.ReadString (),
                        Name = reader.ReadString(),
                        StationType = reader.ReadInt32(),
                        b = reader.ReadBoolean(),
                        su = reader.ReadBoolean(),
                        t = reader.ReadBoolean(),
                        bk = reader.ReadBoolean(),
                        bl = reader.ReadBoolean(),
                        Latitude = reader.ReadDouble(),
                        Longitude = reader.ReadDouble(),
                        EmptySlotCount = reader.ReadInt32(),
                        dx = reader.ReadInt32(),
                        BikeCount = reader.ReadInt32(),
                        bx = reader.ReadInt32()
                    };
                }

                return stations;
            }
        }
Example #5
0
        public static Room Load(string filename)
        {
            Room newRoom;
            if (!File.Exists(filename)) return null;
            using (var stream = File.Open(filename, FileMode.Open))
            using (var reader = new BinaryReader(stream, Encoding.UTF8))
            {

                var hd = Encoding.UTF8.GetBytes(Header);
                var buffer = new byte[hd.Length];
                reader.Read(buffer, 0, buffer.Length);
                var readHeader = Encoding.UTF8.GetString(buffer);
                if (readHeader != Header) return null;

                //writer.Write(hd, 0, hd.Length);
                var posX = reader.ReadDouble();
                //writer.Write(room.Position.X);
                var posY = reader.ReadDouble();
                // writer.Write(room.Position.Y);
                var tilesLength = reader.ReadInt32();
                //writer.Write(room.Tiles.Length);
                newRoom = new Room(new Point(posX, posY))
                {
                    Tiles = new Tile[tilesLength]
                };

                for (var i = 0; i < tilesLength; i++)
                {
                    var tt = (TileTypes)reader.ReadInt32();
                    newRoom.Tiles[i] = new Tile() { TileType = tt };
                }
            }
            return newRoom;

        }
 public override void ReadFromRecorder(BinaryReader reader)
 {
     PredictedLeftLegAngle = reader.ReadDouble();
     PredictedRightLegAngle = reader.ReadDouble();
     PredictedPersonHeading = reader.ReadDouble();
     IsLearned = reader.ReadDouble() == 1d;
 }
Example #7
0
        /// <summary>
        /// Loads a room data and image file
        /// </summary>
        /// <param name="dataFile">Room data file</param>
        /// <param name="imageFile">Room image file</param>
        /// <returns></returns>
        public static Room Load(string dataFile,string imageFile)
        {
            var dataFileWithPath = Directory.GetParent(Directory.GetCurrentDirectory())[email protected]"\Images\"+dataFile;
            Room newRoom;
            if (!File.Exists(dataFileWithPath)) return null;
            using (var stream = File.Open(dataFileWithPath, FileMode.Open))
            using (var reader = new BinaryReader(stream, Encoding.UTF8))
            {

                var hd = Encoding.UTF8.GetBytes(Header);
                var buffer = new byte[hd.Length];
                reader.Read(buffer, 0, buffer.Length);
                var readHeader = Encoding.UTF8.GetString(buffer);
                if (readHeader != Header) return null;

                var posX = reader.ReadDouble();
                var posY = reader.ReadDouble();
                var tilesLength = reader.ReadInt32();
                newRoom = new Room(new Vector2((float)posX,(float)posY),imageFile)
                {
                    Tiles = new Tile[tilesLength]
                };

                for (var i = 0; i < tilesLength; i++)
                {
                    var tt = (TileTypes)reader.ReadInt32();
                    newRoom.Tiles[i] = new Tile() { TileType = tt };
                }
            }
            return newRoom;

        }
Example #8
0
		public override void Initialize(DrawArgs drawArgs)
		{
			FileInfo boundaryFileInfo = new FileInfo(this._boundaryFilePath);
			if(!boundaryFileInfo.Exists)
			{
				this.isInitialized = true;
				return;
			}

			using( FileStream boundaryFileStream = boundaryFileInfo.OpenRead() )
			using( BinaryReader boundaryFileReader = new BinaryReader(boundaryFileStream, System.Text.Encoding.ASCII) ) {
				int numBoundaries = boundaryFileReader.ReadInt32();
				int count = boundaryFileReader.ReadInt32();
				this.vertices = new CustomVertex.PositionColored[count];

				for(int i = 0; i < count; i++) {
					double lat = boundaryFileReader.ReadDouble();
					double lon = boundaryFileReader.ReadDouble();
					Vector3 v = MathEngine.SphericalToCartesian((float)lat, (float)lon, (float)(this._parentWorld.EquatorialRadius + this._distanceAboveSurface));
					this.vertices[i].X = v.X;
					this.vertices[i].Y = v.Y;
					this.vertices[i].Z = v.Z;
					this.vertices[i].Color = this._color;
				}

			}
			this.isInitialized = true;
		}
Example #9
0
        public Poly(BinaryReader file, int shapeType, string entryType, int misc, string country)
        {
            ShapeType = shapeType;
            EntryType = entryType;
            Misc = misc;
            Country = country;

            //read Poly from Shapefile
            float minX = (float)file.ReadDouble();
            float minY = (float)file.ReadDouble();
            float maxX = (float)file.ReadDouble();
            float maxY = (float)file.ReadDouble();
            box = new RectangleF(minX, minY, maxX - minX, maxY - minY);

            int numParts = file.ReadInt32();
            parts = new PointF[numParts][];

            int numPoints = file.ReadInt32(); //total number of points
            file.ReadInt32(); //skip first part index (which should always be 0)
            int prevPartIndex = 0;

            for (int i = 0; i < numParts - 1; i++)
            {
                int partIndex = file.ReadInt32(); //index to first point in (next) part
                parts[i] = new PointF[partIndex - prevPartIndex];
                prevPartIndex = partIndex;
            }
            parts[parts.Length - 1] = new PointF[numPoints - prevPartIndex]; //final part

            for (int i = 0; i < numParts; i++)
                for (int j = 0; j < parts[i].Length; j++)
                    parts[i][j] = new PointF((float)file.ReadDouble(), (float)file.ReadDouble());
        }
Example #10
0
 public override object Read(BinaryReader reader, byte version)
 {
     if (version == 0)
         return new Bid(new DateTime(reader.ReadInt64()), reader.ReadByte(), reader.ReadInt32(), reader.ReadDouble(), reader.ReadInt32());
     else
         return new Bid(new DateTime(reader.ReadInt64()), new DateTime(reader.ReadInt64()), reader.ReadByte(), reader.ReadInt32(), reader.ReadDouble(), reader.ReadInt32());
 }
        /// <summary>
        /// データ 読み込み
        /// </summary>
        /// <param name="strm"></param>
        public void Read(BinaryReader strm)
        {
            strm.ReadInt32(); // 要素数

            wdPosX = strm.ReadDouble();
            wdPosY = strm.ReadDouble();
        }
Example #12
0
        public Node(System.IO.Stream stream)
        {
            int id;
            double lat,lon;

            try{
                byte[] array = new byte[sizeof(int) + sizeof(double) * 2];
                stream.Read(array, 0, array.Length);
            //                ByteBuffer buffer = new ByteBuffer(array);
                MemoryStream ms = new MemoryStream(array);
                BinaryReader buffer = new BinaryReader(ms);

                id = buffer.ReadInt32();
                lat = buffer.ReadDouble();
                lon = buffer.ReadDouble();
            //                BinaryReader by = new BinaryReader(stream);
                //id = by.ReadInt32();
                //lat = by.ReadDouble();
                //lon = by.ReadDouble();
            }
            catch(Exception e)
            {
                id = 0;
                lat = 0.0;
                lon = 0.0;
            }

            this.id = id;
            this.lat = lat;
            this.lon = lon;
        }
Example #13
0
            public void Read(BinaryReader reader, UInt16 version)
            {
                float x, y;
                x = (float)reader.ReadDouble();
                y = (float)reader.ReadDouble();

                Location = new PointF(x, y);
            }
Example #14
0
		public override object Read(BinaryReader reader)
		{
			if (reader.ReadByte() == 0)
			{
				return new Ask(new DateTime(reader.ReadInt64()), reader.ReadByte(), reader.ReadInt32(), reader.ReadDouble(), reader.ReadInt32());
			}
			return new Ask(new DateTime(reader.ReadInt64()), new DateTime(reader.ReadInt64()), reader.ReadByte(), reader.ReadInt32(), reader.ReadDouble(), reader.ReadInt32());
		}
Example #15
0
 public Molecule(BinaryReader reader)
 {
     AtomCount = FileUtils.ReadInt32Array(reader);
     AtomType = FileUtils.ReadInt32Array(reader);
     MolecularWeight = reader.ReadDouble();
     MonoIsotopicMass = reader.ReadDouble();
     mostLikelyMass = reader.ReadDouble();
 }
Example #16
0
 public CubicSpline(BinaryReader reader)
 {
     x = FileUtils.ReadDoubleArray(reader);
     Y = FileUtils.ReadDoubleArray(reader);
     Yp1 = reader.ReadDouble();
     Ypn = reader.ReadDouble();
     y2 = FileUtils.ReadDoubleArray(reader);
 }
Example #17
0
 public void Read(BinaryReader reader, UInt16 version)
 {
     float x, y;
     x = (float)reader.ReadDouble();
     y = (float)reader.ReadDouble();
     Location = new PointF(x, y);
     Size = (float)reader.ReadDouble();
     Color = FileFormat.ReadColor(reader);
 }
Example #18
0
 public static GeoPoint ParseFromStream(Stream stream)
 {
     using (var reader = new BinaryReader (stream, System.Text.Encoding.UTF8, true)) {
         return new GeoPoint {
             Lat = reader.ReadDouble (),
             Lon = reader.ReadDouble ()
         };
     }
 }
Example #19
0
        public Point(BinaryReader file, int shapeType, string entryType, int misc, string country)
        {
            ShapeType = shapeType;
            EntryType = entryType;
            Misc = misc;
            Country = country;

            point = new PointF((float)file.ReadDouble(), (float)file.ReadDouble());
        }
Example #20
0
 public void Read(BinaryReader r)
 {
     e = (StEvent) r.ReadInt32();
     userId = r.ReadInt32();
     discussionId = r.ReadInt32();
     topicId = r.ReadInt32();
     devType = (DeviceType) r.ReadInt32();
     StickHeight = r.ReadDouble();
     Span = TimeSpan.FromSeconds(r.ReadDouble());
 }
 public LinearInterpolator(BinaryReader reader)
 {
     int len = reader.ReadInt32();
     xvals = new double[len];
     yvals = new double[len];
     for (int i = 0; i < len; i++){
         xvals[i] = reader.ReadDouble();
         yvals[i] = reader.ReadDouble();
     }
 }
Example #22
0
 public void Load(BinaryReader Input)
 {
     this.objID = Input.ReadInt32 ();
     this.stddev = Input.ReadDouble();
     this.mean = Input.ReadDouble();
     this.last_near = Input.ReadDouble();
     this.first_far = Input.ReadDouble();
     this.num_near= Input.ReadInt32();
     this.num_far=Input.ReadInt32();
 }
 public static BottomProfilePoint[] ToBottomProfileArray(this byte[] blob)
 {
     if (blob == null) return null;
     using (var reader = new BinaryReader(new MemoryStream(blob)))
     {
         var result = new BottomProfilePoint[reader.ReadInt32()];
         for (var index = 0; index < result.Length; index++) result[index] = new BottomProfilePoint { Range = reader.ReadDouble(), Depth = reader.ReadDouble() };
         return result;
     }
 }
		public override object Read(BinaryReader reader)
		{
			reader.ReadByte();
			return new ExecutionReport
			{
				DateTime = new DateTime(reader.ReadInt64()),
				instrumentId = reader.ReadInt32(),
				commandID = reader.ReadInt32(),
				currencyId = reader.ReadByte(),
				execType = (ExecType)reader.ReadInt32(),
				ordType = (OrderType)reader.ReadInt32(),
				side = (OrderSide)reader.ReadInt32(),
				timeInForce = (TimeInForce)reader.ReadInt32(),
				ordStatus = (OrderStatus)reader.ReadInt32(),
				lastPx = reader.ReadDouble(),
				avgPx = reader.ReadDouble(),
				ordQty = reader.ReadDouble(),
				cumQty = reader.ReadDouble(),
				lastQty = reader.ReadDouble(),
				leavesQty = reader.ReadDouble(),
				price = reader.ReadDouble(),
				stopPx = reader.ReadDouble(),
				commission = reader.ReadDouble()
			};
		}
Example #25
0
 public static Matrix3D Read(this Matrix3D m3D, BinaryReader strm)
 {
     char test = strm.ReadChar();
     if (test == 'I')
     {
         m3D.SetIdentity();
     }
     else
     {
         m3D.M11 = strm.ReadDouble();
         m3D.M12 = strm.ReadDouble();
         m3D.M13 = strm.ReadDouble();
         m3D.M14 = strm.ReadDouble();
         m3D.M21 = strm.ReadDouble();
         m3D.M22 = strm.ReadDouble();
         m3D.M23 = strm.ReadDouble();
         m3D.M24 = strm.ReadDouble();
         m3D.M31 = strm.ReadDouble();
         m3D.M32 = strm.ReadDouble();
         m3D.M33 = strm.ReadDouble();
         m3D.M34 = strm.ReadDouble();
         m3D.OffsetX = strm.ReadDouble();
         m3D.OffsetY = strm.ReadDouble();
         m3D.OffsetZ = strm.ReadDouble();
         m3D.M44 = strm.ReadDouble();
     }
     return m3D;
 }
Example #26
0
 public virtual void DeSerialize(BinaryReader r)
 {
     var x = r.ReadDouble();
     var y = r.ReadDouble();
     var d = r.ReadDouble();
     var m = r.ReadDouble();
     IsMoving = r.ReadBoolean();
     Position = new Vector(x,y);
     Direction = d;
     MoveSpeed = m;
 }
Example #27
0
            public void Read(BinaryReader reader, UInt16 version)
            {
                float x, y;

                x = (float)reader.ReadDouble();
                y = (float)reader.ReadDouble();

                LightColor = FileFormat.ReadColor(reader);
                LightRadius = (float)reader.ReadDouble();

                LightAttenuation = FileFormat.ReadVec3(reader);
            }
Example #28
0
        public Command(byte[] data)
        {
            MemoryStream ms = new MemoryStream(data);
            BinaryReader br = new BinaryReader(ms);

            this.entity_id = br.ReadInt32();
            this.ct = (CommandType)br.ReadByte();
            this.position.X = (float)br.ReadDouble();
            this.position.Y = (float)br.ReadDouble();
            this.direction.X = (float)br.ReadDouble();
            this.direction.Y = (float)br.ReadDouble();
        }
Example #29
0
 public static PixelBuffer OpenBinary(Stream s)
 {
     using (var w = new BinaryReader (s)) {
         var width = w.ReadInt32 ();
         var height = w.ReadInt32 ();
         var pb = new PixelBuffer (width, height);
         for (var i = 0; i < width*height; i++) {
             pb.Buffer [i].X = w.ReadDouble ();
             pb.Buffer [i].Y = w.ReadDouble ();
             pb.Buffer [i].Z = w.ReadDouble ();
         }
         return pb;
     }
 }
Example #30
0
		public override object Read(BinaryReader reader)
		{
			reader.ReadByte();
			return new Fill
			{
				dateTime = new DateTime(reader.ReadInt64()),
				instrumentId = reader.ReadInt32(),
				currencyId = reader.ReadByte(),
				side = (OrderSide)Enum.Parse(typeof(OrderSide), reader.ReadString()),
				qty = reader.ReadDouble(),
				price = reader.ReadDouble(),
				text = reader.ReadString()
			};
		}