本文整理汇总了C#中System.Collections.Specialized.BitVector32类的典型用法代码示例。如果您正苦于以下问题:C# BitVector32类的具体用法?C# BitVector32怎么用?C# BitVector32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BitVector32类属于System.Collections.Specialized命名空间,在下文中一共展示了BitVector32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FrameworkPropertyMetadata
public FrameworkPropertyMetadata(object defaultValue, FrameworkPropertyMetadataOptions options,
PropertyInvalidatedCallback propertyInvalidatedCallback,
GetValueOverride getValueOverride, SetValueOverride setValueOverride)
: base(defaultValue, propertyInvalidatedCallback, getValueOverride, setValueOverride)
{
_options = new BitVector32((int)options);
}
示例2: Mask
/// <summary>
/// Initializes a new instance of the <see cref="Mask"/> class.
/// </summary>
/// <param name="reader">The reader to use to initialize the instance.</param>
/// <param name="layer">The layer this mask belongs to.</param>
internal Mask(BinaryReverseReader reader, Layer layer)
{
Layer = layer;
uint num1 = reader.ReadUInt32();
if (num1 <= 0U)
{
return;
}
long position = reader.BaseStream.Position;
rect = new Rect();
rect.y = reader.ReadInt32();
rect.x = reader.ReadInt32();
rect.height = reader.ReadInt32() - rect.y;
rect.width = reader.ReadInt32() - rect.x;
DefaultColor = reader.ReadByte();
flags = new BitVector32(reader.ReadByte());
if ((int)num1 == 36)
{
reader.ReadByte(); // bit vector
reader.ReadByte(); // ???
reader.ReadInt32(); // rect Y
reader.ReadInt32(); // rect X
reader.ReadInt32(); // rect total height (actual height = this - Y)
reader.ReadInt32(); // rect total width (actual width = this - Y)
}
reader.BaseStream.Position = position + num1;
}
示例3: AsBitArray
public static BitArray AsBitArray(this OBFingerprint fp)
{
BitArray b = new BitArray(3);
BitVector32 v = new BitVector32(3);
return null;
}
示例4: Indexers
public void Indexers ()
{
BitVector32 b = new BitVector32 (7);
Assertion.Assert ("#1", b [0]);
Assertion.Assert ("#2", b [1]);
Assertion.Assert ("#3", b [2]);
Assertion.Assert ("#4", b [4]);
Assertion.Assert ("#5", !b [8]);
Assertion.Assert ("#6", !b [16]);
b [8] = true;
Assertion.Assert ("#7", b [4]);
Assertion.Assert ("#8", b [8]);
Assertion.Assert ("#9", !b [16]);
b [8] = false;
Assertion.Assert ("#10", b [4]);
Assertion.Assert ("#11", !b [8]);
Assertion.Assert ("#12", !b [16]);
BitVector32.Section s = BitVector32.CreateSection (31);
s = BitVector32.CreateSection (64, s);
// Print (s);
// b = new BitVector32 (0x777777);
BitVector32 b1 = new BitVector32 (0xffff77);
BitVector32 b2 = new BitVector32 (b1 [s]);
//Console.WriteLine (b1.ToString ());
//Console.WriteLine (b2.ToString ());
Assertion.AssertEquals ("#14", 123, b1 [s]);
// b1 [s] = 15;
//Console.WriteLine (b1.ToString ());
}
示例5: Test01
public void Test01()
{
BitVector32 bv32;
BitVector32 bv32Temp; // extra BitVector32 - for comparison
// [] BitVector is constructed as expected
//-----------------------------------------------------------------
bv32 = new BitVector32();
if (bv32.Data != 0)
{
Assert.False(true, string.Format("Error, Data = {0} after default ctor", bv32.Data));
}
string result = bv32.ToString();
if (result.IndexOf("BitVector32") == -1)
{ // "BitVector32" is not a part of ToString()
Assert.False(true, "Error: ToString() doesn't contain \"BitVector32\"");
}
bool item = bv32[1];
if (item)
{
Assert.False(true, string.Format("Error: Item(0) returned {0} instead of {1}", item, false));
}
bv32Temp = new BitVector32();
if (!bv32.Equals(bv32Temp))
{
Assert.False(true, string.Format("Error: two default vectors are not equal"));
}
}
示例6: DesignerHost
public DesignerHost(DesignSurface surface)
{
this._surface = surface;
this._state = new BitVector32();
this._designers = new Hashtable();
this._events = new EventHandlerList();
DesignSurfaceServiceContainer service = this.GetService(typeof(DesignSurfaceServiceContainer)) as DesignSurfaceServiceContainer;
if (service != null)
{
foreach (Type type in DefaultServices)
{
service.AddFixedService(type, this);
}
}
else
{
IServiceContainer container2 = this.GetService(typeof(IServiceContainer)) as IServiceContainer;
if (container2 != null)
{
foreach (Type type2 in DefaultServices)
{
container2.AddService(type2, this);
}
}
}
}
示例7: Serialize
public static void Serialize(SerializationWriter writer, Color color)
{
BitVector32 flags = new BitVector32();
if (color.IsKnownColor)
flags[ColorIsKnown] = true;
else if (color.IsNamedColor)
flags[ColorHasName] = true;
else if (!color.IsEmpty)
{
flags[ColorHasValue] = true;
flags[ColorHasRed] = color.R != 0;
flags[ColorHasGreen] = color.G != 0;
flags[ColorHasBlue] = color.B != 0;
flags[ColorHasAlpha] = color.A != 0;
}
writer.WriteOptimized(flags);
if (color.IsKnownColor)
writer.WriteOptimized((int) color.ToKnownColor());
else if (color.IsNamedColor)
writer.WriteOptimized(color.Name);
else if (!color.IsEmpty)
{
byte component;
if ( (component = color.R) != 0) writer.Write(component);
if ( (component = color.G) != 0) writer.Write(component);
if ( (component = color.B) != 0) writer.Write(component);
if ( (component = color.A) != 0) writer.Write(component);
}
}
示例8: Main
static void Main(string[] args)
{
/*
BitVector32 answers = new BitVector32(-1);
*/
// Creates and initializes a BitVector32 with all bit flags set to FALSE.
BitVector32 myBV = new BitVector32(0);
// Creates masks to isolate each of the first five bit flags.
int myBit1 = BitVector32.CreateMask();
int myBit2 = BitVector32.CreateMask(myBit1);
int myBit3 = BitVector32.CreateMask(myBit2);
int myBit4 = BitVector32.CreateMask(myBit3);
int myBit5 = BitVector32.CreateMask(myBit4);
// Sets the alternating bits to TRUE.
Console.WriteLine("Setting alternating bits to TRUE:");
Console.WriteLine(" Initial: {0}", myBV.ToString());
myBV[myBit1] = true;
Console.WriteLine(" myBit1 = TRUE: {0}", myBV.ToString());
myBV[myBit3] = true;
Console.WriteLine(" myBit3 = TRUE: {0}", myBV.ToString());
myBV[myBit5] = true;
Console.WriteLine(" myBit5 = TRUE: {0}", myBV.ToString());
Console.ReadKey();
}
示例9: Mask
public Mask(Layer layer, Rectangle rect, byte color, BitVector32 flags)
{
Layer = layer;
Rect = rect;
BackgroundColor = color;
this.flags = flags;
}
示例10: GetAverages
public Tuple<ushort, double>[] GetAverages(ushort[] data)
{
Dictionary<ushort, SensorData> sensors = new Dictionary<ushort, SensorData>();
foreach (var d in data)
{
BitVector32 item = new BitVector32(d);
BitVector32.Section checksum = BitVector32.CreateSection(1);
BitVector32.Section sensorData = BitVector32.CreateSection(2067, checksum);
BitVector32.Section sensorCode = BitVector32.CreateSection(7, sensorData);
if (ChecksumOK(item[checksum], d >> 1))
{
ushort code = (ushort)item[sensorCode];
if(!sensors.ContainsKey(code))
{
sensors.Add(code, new SensorData {Sum = 0, Count = 0});
}
sensors[code].Sum += item[sensorData];
sensors[code].Count++;
}
}
Tuple<ushort, double>[] result = new Tuple<ushort, double>[sensors.Count];
int index = 0;
foreach (var sensor in sensors)
{
result[index++] = new Tuple<ushort,double>(sensor.Key, (double)sensor.Value.Sum / sensor.Value.Count);
}
return result;
}
示例11: Indexers
public void Indexers ()
{
BitVector32 b = new BitVector32 (7);
Assert.IsTrue (b [0], "#1");
Assert.IsTrue (b [1], "#2");
Assert.IsTrue (b [2], "#3");
Assert.IsTrue (b [4], "#4");
Assert.IsTrue (!b [8], "#5");
Assert.IsTrue (!b [16], "#6");
b [8] = true;
Assert.IsTrue (b [4], "#7");
Assert.IsTrue (b [8], "#8");
Assert.IsTrue (!b [16], "#9");
b [8] = false;
Assert.IsTrue (b [4], "#10");
Assert.IsTrue (!b [8], "#11");
Assert.IsTrue (!b [16], "#12");
BitVector32.Section s = BitVector32.CreateSection (31);
s = BitVector32.CreateSection (64, s);
// Print (s);
// b = new BitVector32 (0x777777);
BitVector32 b1 = new BitVector32 (0xffff77);
BitVector32 b2 = new BitVector32 (b1 [s]);
//Console.WriteLine (b1.ToString ());
//Console.WriteLine (b2.ToString ());
Assert.AreEqual (123, b1 [s], "#14");
// b1 [s] = 15;
//Console.WriteLine (b1.ToString ());
}
示例12: VectorByte
public VectorByte(params bool[] flags)
{
bitVector = new BitVector32();
for (byte i = 0; i < Math.Min(flags.Length, 8); i++)
{
bitVector[i] = flags[i];
}
}
示例13: DCB
public DCB()
{
this.DCBlength = (uint) Marshal.SizeOf(this);
this.Control = new BitVector32(0);
this.sect1 = BitVector32.CreateSection(15);
this.DTRsect = BitVector32.CreateSection(3, this.sect1);
this.sect2 = BitVector32.CreateSection(0x3f, this.DTRsect);
this.RTSsect = BitVector32.CreateSection(3, this.sect2);
}
示例14: ProjectItem
public ProjectItem(string caption)
{
if ((caption == null) || (caption.Length == 0))
{
throw new ArgumentNullException("caption");
}
this._caption = caption;
this._state = new BitVector32(0);
}
示例15: BitVector32Test
//BitVector32Test
public static void BitVector32Test()
{
var bits = new BitVector32();
int bit1 = BitVector32.CreateMask();
int bit2 = BitVector32.CreateMask(bit1);
int bit3 = BitVector32.CreateMask(bit2);
bits[3] = true;
Console.WriteLine(bits);
}