本文整理汇总了C#中Pointer类的典型用法代码示例。如果您正苦于以下问题:C# Pointer类的具体用法?C# Pointer怎么用?C# Pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pointer类属于命名空间,在下文中一共展示了Pointer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NextSpan
protected override Span NextSpan(Pointer.Type pointer)
{
if (_start == null)
{
if (pointer == Pointer.Type.Future)
{
var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday);
saturdayRepeater.Now = Now;
var nextSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Future);
_start = nextSaturdaySpan.Start.Value;
}
else if (pointer == Pointer.Type.Past)
{
var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday);
saturdayRepeater.Now = Now.Value.AddSeconds(RepeaterDay.DAY_SECONDS);
var lastSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Past);
_start = lastSaturdaySpan.Start.Value;
}
}
else
{
var direction = (pointer == Pointer.Type.Future) ? 1 : -1;
_start = _start.Value.AddSeconds(direction * RepeaterWeek.WEEK_SECONDS);
}
return new Span(
_start.Value,
_start.Value.AddSeconds(RepeaterWeekend.WEEKEND_SECONDS));
}
示例2: CurrentSpan
protected override Span CurrentSpan(Pointer.Type pointer)
{
Span thisSpan;
if (pointer == Pointer.Type.Future || pointer == Pointer.Type.None)
{
var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday);
saturdayRepeater.Now = Now;
var thisSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Future);
thisSpan = new Span(
thisSaturdaySpan.Start.Value,
thisSaturdaySpan.Start.Value.AddSeconds(WEEKEND_SECONDS));
}
else if (pointer == Pointer.Type.Past)
{
var saturdayRepeater = new RepeaterDayName(DayOfWeek.Saturday);
saturdayRepeater.Now = Now;
var lastSaturdaySpan = saturdayRepeater.GetNextSpan(Pointer.Type.Past);
thisSpan = new Span(
lastSaturdaySpan.Start.Value,
lastSaturdaySpan.Start.Value.AddSeconds(RepeaterWeekend.WEEKEND_SECONDS));
}
else
{
throw new ArgumentException("Unable to handle pointer " + pointer + ".", "pointer");
}
return thisSpan;
}
示例3: ArchAddressSpace
private ArchAddressSpace(L4Handle value, Pointer UTCBStart, int utcb_size_log2)
{
this._value = value;
this.UTCBStart = UTCBStart;
this.utcb_num = (1 << utcb_size_log2) / ArchDefinition.UTCBOffset;
this.allocated_utcb = 0;
}
示例4: GetOffset
public override Span GetOffset(Span span, int amount,
Pointer.Type pointer)
{
int direction = (pointer == Pointer.Type.Future) ? 1 : -1;
// WARN: Does not use Calendar
return span.Add(direction * amount * RepeaterSecond.SECOND_SECONDS);
}
示例5: NextSpan
protected override Span NextSpan(Pointer.Type pointer)
{
if (_start == null)
{
var now = Now.Value;
if (pointer == Pointer.Type.Future)
{
_start = Time.New(now.Date.Year + 1);
}
else if (pointer == Pointer.Type.Past)
{
_start = Time.New(now.Date.Year - 1);
}
else
{
throw new ArgumentException("Unable to handle pointer " + pointer + ".", "pointer");
}
}
else
{
var direction = (int)pointer;
_start = _start.Value.AddYears(direction * 1);
}
return new Span(_start.Value, _start.Value.AddYears(1));
}
示例6: AppendFromSelf
public bool AppendFromSelf(int offset, int len)
{
int spaceLeft = _length - _index;
if(_index <= offset - 1u)
{
// -1u catches offset==0
return false;
}
var op = new Pointer(_buffer, _index);
if(len <= 16 && offset >= 8 && spaceLeft >= 16)
{
var src = new Pointer(_buffer, _index - offset);
op.Copy64(src);
op.Copy64(src + 8, 8);
}
else
{
if(spaceLeft >= len + CompressorConstants.MaxIncrementCopyOverflow)
IncrementalCopyFastPath(op - offset, op, len);
else
{
if(spaceLeft < len)
return false;
IncrementalCopy(op - offset, op, len);
}
}
_index += len;
return true;
}
示例7: GetOffset
public override Span GetOffset(Span span, int amount, Pointer.Type pointer)
{
var direction = (int)pointer;
var newBegin = BuildOffsetTime(span.Start.Value, amount, direction);
var newEnd = BuildOffsetTime(span.End.Value, amount, direction);
return new Span(newBegin, newEnd);
}
示例8: CurrentSpan
protected override Span CurrentSpan(Pointer.Type pointer)
{
var now = Now.Value;
DateTime minuteBegin;
DateTime minuteEnd;
if (pointer == Pointer.Type.Future)
{
minuteBegin = now;
minuteEnd = Time.New(now, now.Hour, now.Minute);
}
else if (pointer == Pointer.Type.Past)
{
minuteBegin = Time.New(now, now.Hour, now.Minute);
minuteEnd = now;
}
else if (pointer == Pointer.Type.None)
{
minuteBegin = Time.New(now, now.Hour, now.Minute);
minuteEnd = Time.New(now, now.Hour, now.Minute).AddSeconds(RepeaterMinute.MINUTE_SECONDS);
}
else
{
throw new ArgumentException("Unable to handle pointer " + pointer + ".");
}
return new Span(minuteBegin, minuteEnd);
}
示例9: CurrentSpan
protected override Span CurrentSpan(Pointer.Type pointer)
{
DateTime monthStart;
DateTime monthEnd;
var now = Now.Value;
if (pointer == Pointer.Type.Future)
{
monthStart = now.Date.AddDays(1);
monthEnd = Time.New(now.Year, now.Month).AddMonths(1);
}
else if (pointer == Pointer.Type.Past)
{
monthStart = Time.New(now.Year, now.Month);
monthEnd = now.Date;
}
else if (pointer == Pointer.Type.None)
{
monthStart = Time.New(now.Year, now.Month);
monthEnd = Time.New(now.Year, now.Month).AddMonths(1);
}
else
{
throw new ArgumentException("Unable to handle pointer " + pointer + ".", "pointer");
}
return new Span(monthStart, monthEnd);
}
示例10: CmpPtrIntPtrInt
public void CmpPtrIntPtrInt()
{
Pointer p1 = new Pointer(PrimitiveType.Int32, 4);
Pointer p2 = new Pointer(PrimitiveType.Int32, 4);
DataTypeComparer c = new DataTypeComparer();
Assert.AreEqual(0, c.Compare(p1, p2));
}
示例11: Intersect
public override bool Intersect(Ray r, Pointer<float> tHit, Pointer<float> rayEpsilon, Pointer<DifferentialGeometry> dg)
{
Ray ray = (WorldToObject)[r];
if (MathHelper.Abs(ray.Direction.Z) < 1e-7) return false;
float thit = (Height - ray.Origin.Z) / ray.Direction.Z;
if (thit < ray.MinT || thit > ray.MaxT)
return false;
Point phit = ray[thit];
float dist2 = phit.X * phit.X + phit.Y * phit.Y;
if (dist2 > Radius * Radius || dist2 < InnerRadius * InnerRadius)
return false;
float phi = MathHelper.Atan2(phit.Y, phit.X);
if (phi < 0) phi += 2.0f * MathHelper.PI;
if (phi > PhiMax)
return false;
float u = phi / PhiMax;
float oneMinusV = ((MathHelper.Sqrt(dist2) - InnerRadius) /
(Radius - InnerRadius));
float invOneMinusV = (oneMinusV > 0.0f) ? (1.0f / oneMinusV) : 0.0f;
float v = 1.0f - oneMinusV;
Vector dpdu = new Vector(-PhiMax * phit.Y, PhiMax * phit.X, 0);
Vector dpdv = new Vector(-phit.X * invOneMinusV, -phit.Y * invOneMinusV, 0);
dpdu *= PhiMax * MathHelper.InvTwoPI;
dpdv *= (Radius - InnerRadius) / Radius;
Normal dndu = new Normal(0, 0, 0), dndv = new Normal(0, 0, 0);
Transform o2w = ObjectToWorld;
dg[0] = new DifferentialGeometry(o2w[phit], o2w[dpdu], o2w[dpdv],
o2w[dndu], o2w[dndv], u, v, this);
tHit[0] = thit;
rayEpsilon[0] = 5e-4f * ~tHit;
return true;
}
示例12: AddPointers
public void AddPointers()
{
var a = new Pointer(_buffer);
var b = new Pointer(_buffer, 8);
Assert.That(b, Is.EqualTo(a + 8));
}
示例13: memcpy
static public void memcpy(Pointer<byte> destination, Pointer<byte> source, int num)
{
for (int n = 0; n < num; n++)
{
destination[n] = source[n];
}
}
示例14: SubtractPointers
public void SubtractPointers()
{
var a = new Pointer(_buffer);
var b = new Pointer(_buffer, 8);
Assert.That((int )(b - a), Is.EqualTo(8));
}
示例15: Activate
public bool Activate(GameObject character, Pointer pointer)
{
StopAllCoroutines();
Screen.lockCursor = false;
StartCoroutine("ZoomToPanel", character);
return true;
}