本文整理汇总了C#中System.IO.BinaryReader.ReadDouble方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadDouble方法的具体用法?C# BinaryReader.ReadDouble怎么用?C# BinaryReader.ReadDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadDouble方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeBody
public override void DeserializeBody(BinaryReader br)
{
n = br.ReadInt32();
x = br.ReadDouble();
y = br.ReadDouble();
zoom = br.ReadDouble();
}
示例2: StatisticRead
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();
}
示例3: Read
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;
}
示例4: ParseStations
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;
}
}
示例5: Load
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;
}
示例6: ReadFromRecorder
public override void ReadFromRecorder(BinaryReader reader)
{
PredictedLeftLegAngle = reader.ReadDouble();
PredictedRightLegAngle = reader.ReadDouble();
PredictedPersonHeading = reader.ReadDouble();
IsLearned = reader.ReadDouble() == 1d;
}
示例7: Load
/// <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;
}
示例8: Initialize
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;
}
示例9: Poly
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());
}
示例10: Read
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());
}
示例11: Read
/// <summary>
/// データ 読み込み
/// </summary>
/// <param name="strm"></param>
public void Read(BinaryReader strm)
{
strm.ReadInt32(); // 要素数
wdPosX = strm.ReadDouble();
wdPosY = strm.ReadDouble();
}
示例12: Node
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;
}
示例13: Read
public void Read(BinaryReader reader, UInt16 version)
{
float x, y;
x = (float)reader.ReadDouble();
y = (float)reader.ReadDouble();
Location = new PointF(x, y);
}
示例14: Read
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());
}
示例15: Molecule
public Molecule(BinaryReader reader)
{
AtomCount = FileUtils.ReadInt32Array(reader);
AtomType = FileUtils.ReadInt32Array(reader);
MolecularWeight = reader.ReadDouble();
MonoIsotopicMass = reader.ReadDouble();
mostLikelyMass = reader.ReadDouble();
}