本文整理汇总了C#中System.IO.BinaryReader.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadBoolean方法的具体用法?C# BinaryReader.ReadBoolean怎么用?C# BinaryReader.ReadBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: fromFile
public Boolean fromFile(String path)
{
FileStream fs = new FileStream(path, FileMode.Open);
BinaryReader reader = new BinaryReader(fs);
try
{
String h = reader.ReadString();
float v = BitConverter.ToSingle(reader.ReadBytes(sizeof(float)), 0);
drawFloorModel = reader.ReadBoolean();
showAlwaysFloorMap = reader.ReadBoolean();
lockMapSize = reader.ReadBoolean();
mapXsize = reader.ReadInt32();
mapYsize = reader.ReadInt32();
//edgeXのxはmapX-1
//yはmapYsize
return true;
}
catch (EndOfStreamException eex)
{
//握りつぶす
return false;
}
finally
{
reader.Close();
}
}
示例2: Read
/// <summary>
/// バイナリ読み込み
/// </summary>
/// <param name="reader">バイナリリーダー</param>
public void Read(BinaryReader reader)
{
int version = reader.ReadInt32();
if (version == VERSION)
{
isFullScreen = reader.ReadBoolean();
isMouseWheelSendMessage = reader.ReadBoolean();
isEffect = reader.ReadBoolean();
isSkipUnread = reader.ReadBoolean();
isStopSkipInSelection = reader.ReadBoolean();
messageSpeed = reader.ReadSingle();
autoBrPageSpeed = reader.ReadSingle();
messageWindowTransparency = reader.ReadSingle();
soundMasterVolume = reader.ReadSingle();
bgmVolume = reader.ReadSingle();
seVolume = reader.ReadSingle();
ambienceVolume = reader.ReadSingle();
voiceVolume = reader.ReadSingle();
voiceStopType = (VoiceStopType)(reader.ReadInt32());
int num = reader.ReadInt32();
isVoiceActiveArray = new bool[num];
for (int i = 0; i < num; i++)
{
isVoiceActiveArray[i] = reader.ReadBoolean();
}
isAutoBrPage = reader.ReadBoolean();
}
else
{
Debug.LogError(LanguageErrorMsg.LocalizeTextFormat(ErrorMsg.UnknownVersion, version));
}
}
示例3: Deserialize
public virtual void Deserialize(BinaryReader reader)
{
RoutineID = reader.ReadUInt16();
InstructionPointer = reader.ReadUInt16();
Caller = reader.ReadInt16();
Callee = reader.ReadInt16();
StackObject = reader.ReadInt16();
CodeOwnerGUID = reader.ReadUInt32();
var localN = reader.ReadInt32();
if (localN > -1)
{
Locals = new short[localN];
for (int i = 0; i < localN; i++) Locals[i] = reader.ReadInt16();
}
var argsN = reader.ReadInt32();
if (argsN > -1)
{
Args = new short[argsN];
for (int i = 0; i < argsN; i++) Args[i] = reader.ReadInt16();
}
if (Version > 3) DiscardResult = reader.ReadBoolean();
ActionTree = reader.ReadBoolean();
}
示例4: Deserialize
public void Deserialize(BinaryReader reader)
{
Width = reader.ReadInt32();
Height = reader.ReadInt32();
Stories = reader.ReadInt32();
var size = Width * Height;
Walls = new WallTile[Stories][];
for (int l=0;l<Stories;l++)
{
Walls[l] = new WallTile[size];
for (int i = 0; i < size; i++) Walls[l][i] = WallTileSerializer.Deserialize(reader);
}
Floors = new FloorTile[Stories][];
for (int l = 0; l < Stories; l++)
{
Floors[l] = new FloorTile[size];
for (int i = 0; i < size; i++) Floors[l][i] = new FloorTile { Pattern = reader.ReadUInt16() };
}
WallsDirty = reader.ReadBoolean();
FloorsDirty = reader.ReadBoolean();
}
示例5: LoadBody
public void LoadBody(byte[] array)
{
BinaryReader br = new BinaryReader(new MemoryStream(array));
// matname = br.ReadPackString();
int lodcount = br.ReadInt32();
LODs = new List<Model>();
for (int i = 0; i < lodcount; i++)
{
SubSet[] LodSubset = new SubSet[br.ReadInt32()];
for (int j = 0; j < LodSubset.Length; j++)
{
string[] names = new string[br.ReadInt32()];
for (int n = 0; n < names.Length; n++)
names[n] = br.ReadPackString();
LodSubset[j] = new SubSet(names);
}
LODs.Add(new Model(LodSubset));
}
IsShadowCaster = br.ReadBoolean();
IsShadowReceiver = br.ReadBoolean();
NeedRotate = br.ReadBoolean();
isTransparent = br.ReadBoolean();
isSelfIllumination = br.ReadBoolean();
}
示例6: Deserialize
public void Deserialize(BinaryReader reader)
{
var stackN = reader.ReadInt32();
Stack = new VMStackFrameMarshal[stackN];
for (int i = 0; i < stackN; i++) {
var type = reader.ReadByte();
Stack[i] = (type==1)?new VMRoutingFrameMarshal():new VMStackFrameMarshal();
Stack[i].Deserialize(reader);
}
var queueN = reader.ReadInt32();
Queue = new VMQueuedActionMarshal[queueN];
for (int i = 0; i < queueN; i++)
{
Queue[i] = new VMQueuedActionMarshal();
Queue[i].Deserialize(reader);
}
TempRegisters = new short[20];
for (int i = 0; i < 20; i++) TempRegisters[i] = reader.ReadInt16();
TempXL = new int[2];
for (int i = 0; i < 2; i++) TempXL[i] = reader.ReadInt32();
LastStackExitCode = (VMPrimitiveExitCode)reader.ReadByte();
if (reader.ReadBoolean())
{
BlockingDialog = new VMDialogResult();
BlockingDialog.Deserialize(reader);
}
else BlockingDialog = null;
Interrupt = reader.ReadBoolean();
ActionUID = reader.ReadUInt16();
DialogCooldown = reader.ReadInt32();
}
示例7: DeserializeImpl
/* The serialized format of the anti-XSRF token is as follows:
* Version: 1 byte integer
* SecurityToken: 16 byte binary blob
* IsSessionToken: 1 byte Boolean
* [if IsSessionToken = true]
* +- IsClaimsBased: 1 byte Boolean
* | [if IsClaimsBased = true]
* | `- ClaimUid: 32 byte binary blob
* | [if IsClaimsBased = false]
* | `- Username: UTF-8 string with 7-bit integer length prefix
* `- AdditionalData: UTF-8 string with 7-bit integer length prefix
*/
private static AntiForgeryToken DeserializeImpl(BinaryReader reader)
{
// we can only consume tokens of the same serialized version that we generate
byte embeddedVersion = reader.ReadByte();
if (embeddedVersion != TokenVersion) {
return null;
}
AntiForgeryToken deserializedToken = new AntiForgeryToken();
byte[] securityTokenBytes = reader.ReadBytes(AntiForgeryToken.SecurityTokenBitLength / 8);
deserializedToken.SecurityToken = new BinaryBlob(AntiForgeryToken.SecurityTokenBitLength, securityTokenBytes);
deserializedToken.IsSessionToken = reader.ReadBoolean();
if (!deserializedToken.IsSessionToken) {
bool isClaimsBased = reader.ReadBoolean();
if (isClaimsBased) {
byte[] claimUidBytes = reader.ReadBytes(AntiForgeryToken.ClaimUidBitLength / 8);
deserializedToken.ClaimUid = new BinaryBlob(AntiForgeryToken.ClaimUidBitLength, claimUidBytes);
} else {
deserializedToken.Username = reader.ReadString();
}
deserializedToken.AdditionalData = reader.ReadString();
}
// if there's still unconsumed data in the stream, fail
if (reader.BaseStream.ReadByte() != -1) {
return null;
}
// success
return deserializedToken;
}
示例8: 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;
}
}
示例9: EffectTemplate
public EffectTemplate(string file)
{
BinaryReader reader = new BinaryReader(File.OpenRead(file));
NumParticles = reader.ReadInt32();
Offset = new Vector2(reader.ReadSingle(),reader.ReadSingle());
SizeModRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
SpeedRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
LifeTimeRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
int numRanges = reader.ReadInt32();
AngleRanges = new List<Vector2>();
_normalizedAngleRangeLength = new float[numRanges];
for (int x = 0; x < numRanges; x++)
{
Vector2 newRange = new Vector2(reader.ReadSingle(), reader.ReadSingle());
_totalAngleRangeSum += (float)(((newRange.Y - newRange.X) + Math.PI * 2) % Math.PI * 2);
_normalizedAngleRangeLength[x] = (float)(((newRange.Y - newRange.X) + Math.PI * 2) % Math.PI * 2);
AngleRanges.Add(newRange);
}
for (int x = 0; x < numRanges; x++)
{
_normalizedAngleRangeLength[x] /= _totalAngleRangeSum;
}
_normalizedAngleRangeLength = new float[AngleRanges.Count];
InitialSpeedFactor = reader.ReadSingle();
string textureName = reader.ReadString();
Collides = reader.ReadBoolean();
Sticky = reader.ReadBoolean();
}
示例10: RaceSfv
public void RaceSfv()
{
CleanTestFilesOutput();
Race race = UploadSfvFile ();
FileInfo fileInfo = new FileInfo (Misc.PathCombine (race.CurrentRaceData.DirectoryPath, Config.FileNameRace));
using (FileStream stream = new FileStream (fileInfo.FullName,
FileMode.OpenOrCreate,
FileAccess.ReadWrite,
FileShare.None))
{
using (BinaryReader reader = new BinaryReader (stream))
{
stream.Seek (0, SeekOrigin.Begin);
Assert.AreEqual (4, reader.ReadInt32 (), "Expected integer value (4)");
stream.Seek(256 * 1, SeekOrigin.Begin);
Assert.AreEqual("infected.part1.rar", reader.ReadString(), "infected.part1.rar");
Assert.AreEqual("2e04944c", reader.ReadString(), "2e04944c");
Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
stream.Seek(256 * 2, SeekOrigin.Begin);
Assert.AreEqual("infected.part2.rar", reader.ReadString(), "infected.part2.rar");
Assert.AreEqual("1c7c24a5", reader.ReadString(), "1c7c24a5");
Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
stream.Seek(256 * 3, SeekOrigin.Begin);
Assert.AreEqual("infected.part3.rar", reader.ReadString(), "infected.part3.rar");
Assert.AreEqual("d5d617e3", reader.ReadString(), "d5d617e3");
Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
stream.Seek(256 * 4, SeekOrigin.Begin);
Assert.AreEqual("infected.part4.rar", reader.ReadString(), "infected.part4.rar");
Assert.AreEqual("0edb20ea", reader.ReadString(), "0edb20ea");
Assert.AreEqual(false, reader.ReadBoolean(), "FileUploaded");
}
}
}
示例11: BeyondDemons
public BeyondDemons(BinaryReader inStream)
{
Unknown0 = inStream.ReadInt32();
Unknown1 = inStream.ReadInt32();
Flag0 = inStream.ReadBoolean();
Flag1 = inStream.ReadBoolean();
}
示例12: Unserialize
public override void Unserialize(BinaryReader br, UInt32 mapVersion)
{
Location = Vector4.Read(br);
Quaternion = Vector4.Read(br);
if (((((mapVersion <= 50) ? 1 : 0) - 1) & 20) + 10 > 0)
{
var count = (UInt32)(((((mapVersion <= 50) ? 1 : 0) - 1) & 20) + 10);
for (var i = 0U; i < count; ++i)
ItemsTypes.Add(ItemType.Read(br));
}
if (mapVersion >= 39)
{
StoreName = br.ReadLengthedString();
MinLevel = br.ReadUInt32();
MaxLevel = br.ReadUInt32();
}
if (mapVersion > 40)
IsJunkyard = br.ReadBoolean();
if (mapVersion >= 50)
IsVehicleStore = br.ReadBoolean();
if (mapVersion >= 61)
IsSouvenirStore = br.ReadBoolean();
}
示例13: NPCMaster
public NPCMaster(BinaryReader inStream)
{
Index0 = inStream.ReadInt32();
Unknown1 = inStream.ReadInt32();
Flag0 = inStream.ReadBoolean();
Flag1 = inStream.ReadBoolean();
Unknown2 = inStream.ReadInt32();
Unknown3 = inStream.ReadInt32();
Flag2 = inStream.ReadBoolean();
Unknown4 = inStream.ReadInt32();
Unknown5 = inStream.ReadInt32();
Unknown6 = inStream.ReadInt32();
Unknown7 = inStream.ReadInt32();
Unknown8 = inStream.ReadInt32();
Unknown9 = inStream.ReadInt32();
Unknown10 = inStream.ReadInt32();
Unknown11 = inStream.ReadInt32();
Unknown12 = inStream.ReadInt32();
Unknown13 = inStream.ReadInt32();
Unknown14 = inStream.ReadInt32();
Unknown15 = inStream.ReadInt32();
Unknown16 = inStream.ReadInt32();
Unknown17 = inStream.ReadInt32();
Unknown18 = inStream.ReadInt32();
Unknown19 = inStream.ReadInt32();
}
示例14: StateLoad
public override void StateLoad(BinaryReader reader)
{
ntReg1 = reader.ReadByte();
ntReg2 = reader.ReadByte();
ntRom = reader.ReadBoolean();
mirroring = reader.ReadBoolean();
}
示例15: StateLoad
public override void StateLoad(BinaryReader reader)
{
irqCounter = reader.ReadByte();
irqLatch = reader.ReadByte();
irqReload = reader.ReadBoolean();
irqEnable = reader.ReadBoolean();
}