本文整理汇总了C#中BinaryReader.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadBoolean方法的具体用法?C# BinaryReader.ReadBoolean怎么用?C# BinaryReader.ReadBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryReader
的用法示例。
在下文中一共展示了BinaryReader.ReadBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Reads from the provided file name all parameters and data for a
/// heightmap. If the data for the heightmap does not exist, then
/// no data is written to the provided texture.
/// </summary>
/// <param name='fileName'>
/// The file name. This can be relative or fully-qualified.
/// </param>
/// <param name='no'>
/// The <see cref="NormalOptions" /> that will store read-in parameters.
/// </param>
/// <param name='co'>
/// The <see cref="CloudOptions" /> that will store read-in parameters for
/// <see cref="CloudFractal" />.
/// </param>
/// <param name='wo'>
/// The <see cref="WorleyOptions" /> that will store read-in parameters for
/// <see cref="WorleyNoise" />.
/// </param>
/// <param name='tex'>
/// The <code>Texture2D</code> containing the heightmap data.
/// </param>
public static void Read(string fileName, ref NormalOptions no,
ref CloudOptions co, ref VoronoiOptions vo,
ref Texture2D tex)
{
using(BinaryReader r = new BinaryReader(File.OpenRead(fileName)))
{
no.size = r.ReadInt32();
no.seed = r.ReadInt32();
no.cloudInf = r.ReadSingle();
no.voronoiInf = r.ReadSingle();
no.useThermalErosion = r.ReadBoolean();
no.useHydroErosion = r.ReadBoolean();
no.showSeams = r.ReadBoolean();
co.upperLeftStart = r.ReadSingle();
co.lowerLeftStart = r.ReadSingle();
co.lowerRightStart = r.ReadSingle();
co.upperRightStart = r.ReadSingle();
vo.metric = (DistanceFunctions.DistanceMetric)r.ReadInt32();
vo.combiner = (CombinerFunctions.CombineFunction)r.ReadInt32();
vo.numberOfFeaturePoints = r.ReadInt32();
vo.numberOfSubregions = r.ReadInt32();
vo.multiplier = r.ReadSingle();
tex.Resize(no.size, no.size);
int bLeft = (int)(r.BaseStream.Length - r.BaseStream.Position);
if(bLeft > 0)
tex.LoadImage(r.ReadBytes(bLeft));
}
}
示例2: Read
public void Read(BinaryReader reader)
{
ID=reader.ReadInt32();
Name=reader.ReadStringNative();
IP = reader.ReadStringNative();
Location = reader.ReadStringNative();
lng=reader.ReadSingle();
lat=reader.ReadSingle();
Connected=reader.ReadBoolean();
Available=reader.ReadBoolean();
}
示例3: readStack
public void readStack(){
TextAsset asset = Resources.Load(stackLevel) as TextAsset;
Stream s = new MemoryStream(asset.bytes);
using (BinaryReader b = new BinaryReader(s)){
int pBase = b.ReadInt32();
int size = b.ReadInt32();
puzzle = new Puzzle(size);
puzzle.baseState = pBase;
puzzle.isZoomedIn = b.ReadBoolean();
puzzle.isStackOrder = b.ReadBoolean();
for (int j=0; j<size; j++)
puzzle.tiles[j] = b.ReadInt32();
}
}
示例4: Parse
public static NetworkResponse Parse(MemoryStream dataStream)
{
ResponseConvergePriorAttempt response = new ResponseConvergePriorAttempt();
using (BinaryReader br = new BinaryReader(dataStream, Encoding.UTF8)) {
int playerId = br.ReadInt32 ();
int ecosystemId = br.ReadInt32 ();
int attemptId = br.ReadInt32 ();
bool allowHints = br.ReadBoolean ();
int hintId = br.ReadInt32 ();
short fldSize = br.ReadInt16 ();
String config = System.Text.Encoding.UTF8.GetString (br.ReadBytes (fldSize));
fldSize = br.ReadInt16 ();
String csv = System.Text.Encoding.UTF8.GetString (br.ReadBytes (fldSize));
ConvergeAttempt attempt = new ConvergeAttempt (playerId,
ecosystemId,
attemptId,
allowHints,
hintId,
config,
csv
//null
);
response.attempt = attempt;
}
return response;
}
示例5: Read
public void Read(BinaryReader r)
{
//if (r == null) throw new ArgumentNullException("r");
FResult = new StringBuilder(r.ReadString());
FSeparator = r.ReadString();
FEmpty = r.ReadBoolean();
}
示例6: Load
public override void Load(BinaryReader br) {
base.Load(br);
dir = br.ReadBoolean() ? 1 : -1;
height = br.ReadByte();
sin = br.ReadSingle();
sinSpeed = br.ReadSingle();
}
示例7: load
public void load(BinaryReader buf)
{
_lasteState = buf.ReadBoolean();
_nameObjectToHide = buf.ReadString();
_strObjectToHide = buf.ReadString();
//_objectToHide = transform.Find(_nameObjectToHide);
_objectToHide = new List<Transform>();
if(_objectToHide.Count==0)
{
// _objectToHide = new List<Transform>();
// foreach (Transform child in transform)
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren)
{
if(_nameObjectToHide.CompareTo(_plageName)==0)
{
if(child.name.Contains(_nameObjectToHide))
_objectToHide.Add(child);
if(child.name.Contains(_lowWallName))
_objectToHide.Add(child);
}
else
{
if(child.name.Contains(_nameObjectToHide))
_objectToHide.Add(child);
}
}
//_objectToHide = transform.Find(_nameObjectToHide);
// _lasteState = _hide;
}
DoAction();
}
示例8: Load
public static void Load()
{
if (!File.Exists("Settings.dat"))
{
var a = Screen.resolutions[Screen.resolutions.Length - 1];
windowWidth = a.width;
windowHeight = a.height;
refreshRate = a.refreshRate;
Screen.SetResolution(windowWidth, windowHeight, true, refreshRate);
Save();
return;
}
BinaryReader br = new BinaryReader(new FileStream("Settings.dat", FileMode.Open));
try
{
windowWidth = br.ReadInt32();
windowHeight = br.ReadInt32();
refreshRate = br.ReadInt32();
isFullscreen = br.ReadBoolean();
Screen.SetResolution(windowWidth, windowHeight, isFullscreen, refreshRate);
highscore = br.ReadInt32();
}
catch { }
br.Close();
}
示例9: load
public void load(BinaryReader buf)
{
_lasteState = buf.ReadBoolean();
_nameObjectToOpen = buf.ReadString();
_nameObjectToClose = buf.ReadString();
_strObjectToHide = buf.ReadString();
_objectToClose = new List<Transform>();
if(_objectToClose.Count==0)
{
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren)
{
if(child.name.Contains(_nameObjectToClose))
_objectToClose.Add(child);
}
}
_objectToOpen = new List<Transform>();
if(_objectToOpen.Count==0)
{
Transform[] allChildren = GetComponentsInChildren<Transform>();
foreach (Transform child in allChildren)
{
if(child.name.Contains(_nameObjectToOpen))
_objectToOpen.Add(child);
}
}
DoAction();
}
示例10: Load
public override void Load(BinaryReader br) {
base.Load(br);
hue = br.ReadSingle();
hueSpeed = br.ReadSingle();
rot1 = br.ReadSingle();
rotSpeed1 = br.ReadSingle();
flipped = br.ReadBoolean();
}
示例11: Load
public override void Load(BinaryReader br) {
base.Load(br);
color = NetworkHelper.ReadColor(br);
rot1 = br.ReadSingle();
rotSpeed1 = br.ReadSingle();
rot2 = br.ReadSingle();
rotSpeed2 = br.ReadSingle();
chaos = br.ReadBoolean();
}
示例12: TcpDiscoverySpi
/// <summary>
/// Initializes a new instance of the <see cref="TcpDiscoverySpi"/> class.
/// </summary>
/// <param name="reader">The reader.</param>
internal TcpDiscoverySpi(BinaryReader reader)
{
IpFinder = reader.ReadBoolean() ? TcpDiscoveryIpFinderBase.ReadInstance(reader) : null;
SocketTimeout = reader.ReadLongAsTimespan();
AckTimeout = reader.ReadLongAsTimespan();
MaxAckTimeout = reader.ReadLongAsTimespan();
NetworkTimeout = reader.ReadLongAsTimespan();
JoinTimeout = reader.ReadLongAsTimespan();
}
示例13: SetExpertMode
private static void SetExpertMode(string source, string dest, bool expertMode)
{
BinaryReader reader = new BinaryReader(new FileStream(source, FileMode.Open));
int version = reader.ReadInt32();
if (version < 149) {
MessageBox.Show("Error: Outdated terraria version");
return;
}
ulong magic = reader.ReadUInt64();
if ((magic & 72057594037927935uL) != 27981915666277746uL) {
MessageBox.Show("Error: Invalid header");
return;
}
// Skip other file metadata...
reader.ReadBytes(12);
int positionCount = reader.ReadInt16();
int afterMetadataPos = reader.ReadInt32();
int afterHeaderPos = reader.ReadInt32();
// Skip positions...
reader.ReadBytes((positionCount - 2) * 4);
// Skip frame importance...
reader.ReadBytes(reader.ReadInt16() / 8 + 1);
if (reader.BaseStream.Position != afterMetadataPos) {
MessageBox.Show("After Metadata Position Mismatch: expected " +
afterMetadataPos + ", was " + reader.BaseStream.Position);
return;
}
// Skip the first part of the header...
reader.ReadString();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
reader.ReadInt32();
// Get the offset...
long expertModeFlagOffset = reader.BaseStream.Position;
bool wasExpertMode = reader.ReadBoolean();
reader.Dispose();
// Notify the user if the world is changed...
if (wasExpertMode == expertMode) {
MessageBox.Show(expertMode ? "World was already Expert Mode." : "World was already not Expert Mode.");
return;
}
BinaryWriter writer = new BinaryWriter(new FileStream(dest, FileMode.Open));
writer.BaseStream.Position = expertModeFlagOffset;
writer.Write(expertMode);
writer.Dispose();
MessageBox.Show(expertMode ? "World is now Expert Mode!" : "World is no longer Expert Mode!");
}
示例14: Tbl_SynMixEnchant_Record
public Tbl_SynMixEnchant_Record(BinaryReader br)
{
isSkill = br.ReadBoolean();
enchantLevel_1 = br.ReadInt32();
enchantGrade_1 = (Item.eGRADE)br.ReadInt32();
enchantType_1 = (Tbl_SoulStoneEnchant_Record.eTYPE)br.ReadInt32();
enchantLevel_2 = br.ReadInt32();
enchantGrade_2 = (Item.eGRADE)br.ReadInt32();
enchantType_2 = (Tbl_SoulStoneEnchant_Record.eTYPE)br.ReadInt32();
cost = br.ReadInt32();
}
示例15: init
//Инициализация параметров программы
public static void init()
{
try
{
//Пробуем загрузить настройки, если они были сохранены
BinaryReader file = new BinaryReader(new FileStream(ParametersFile, FileMode.Open));
WindowsPosirion.X = file.ReadInt32();
WindowsPosirion.Y = file.ReadInt32();
WindowsPosirion.Width = file.ReadInt32();
WindowsPosirion.Heidht = file.ReadInt32();
WindowsPosirion.Max = file.ReadBoolean();
file.Close();
}
catch { }
}