public Effect(Characteristics target, float amount, EffectTypes type, int duration, DurationTypes durType) { Target = target; Amount = amount; Type = type; Duration = duration; DurType = durType; }
internal RetentionPolicy(GcRule gcRule, string gcExpression) : this() { if (gcRule.MaxNumVersions != 0) { Duration = DurationTypes.Versions; MaxAge = gcRule.MaxNumVersions; } else if (gcRule.MaxAge.Nanos != 0) { // The protobufs I've seen don't support nanos // But there are artifacts (like .Nanos) all over // that make me think it would work. Maybe as part // of the release-to-world, that feature was depreciated. // It probably works, though, so handle it. MaxAge = gcRule.MaxAge.Nanos / 1000; Duration = DurationTypes.Milliseconds; } else if (gcRule.MaxAge.Seconds != 0) { var span = TimeSpan.FromSeconds(gcRule.MaxAge.Seconds); if (span.TotalDays > 365) { Duration = DurationTypes.Years; MaxAge = (long)(span.TotalDays / 365); } else if (span.TotalDays > 0) { Duration = DurationTypes.Days; MaxAge = (long)span.TotalDays; } else if (span.TotalHours > 0) { Duration = DurationTypes.Hours; MaxAge = (long)span.TotalHours; } else if (span.TotalMinutes > 0) { Duration = DurationTypes.Minutes; MaxAge = (long)span.TotalMinutes; } else if (span.TotalSeconds > 0) { Duration = DurationTypes.Seconds; MaxAge = (long)span.TotalSeconds; } } if (!String.IsNullOrEmpty(gcExpression)) { _expression = gcExpression; } }
public ColumnFamilyAttribute(long maxAge, DurationTypes units) { RetentionPolicy = new RetentionPolicy(maxAge, units); }
public RetentionPolicy(long maxAge, DurationTypes units) : this() { MaxAge = maxAge; Duration = units; }
public GcPolicy(long maxAge, DurationTypes units) { MaxAge = maxAge; Duration = units; }
public static SharpDX.Direct2D1.Bitmap RedrawRestNoteBitmapCache(RenderTarget renderTargetSource, Color color, DurationTypes durationType) { ImagingFactory factory = new ImagingFactory(); SharpDX.Direct2D1.Factory factory2 = new SharpDX.Direct2D1.Factory(); SharpDX.DirectWrite.Factory factory3 = new SharpDX.DirectWrite.Factory(); SharpDX.WIC.Bitmap wicBitmap = new SharpDX.WIC.Bitmap(factory, 0x20, 0x30, SharpDX.WIC.PixelFormat.Format32bppPBGRA, BitmapCreateCacheOption.CacheOnDemand); RenderTargetProperties renderTargetProperties = new RenderTargetProperties(RenderTargetType.Default, new SharpDX.Direct2D1.PixelFormat(Format.Unknown, SharpDX.Direct2D1.AlphaMode.Unknown), 0f, 0f, RenderTargetUsage.None, FeatureLevel.Level_DEFAULT); WicRenderTarget renderTarget = new WicRenderTarget(factory2, wicBitmap, renderTargetProperties); try { PointF[] pathPoints; renderTarget.BeginDraw(); renderTarget.Clear(new RawColor4?(Color.Transparent.ToRawColor4(1f))); RawVector2 pos = new RawVector2(18f, 44f); using (GraphicsPath path = new GraphicsPath()) { DurationTypes types = durationType; if (types <= DurationTypes.Eighth) { switch (types) { case DurationTypes.The32nd: pos = new RawVector2(pos.X, (pos.Y - (8f * (((float)McMeasure.StaveSpacing) / 2f))) + 3f); path.AddLine(pos.X, pos.Y, pos.X + 1.6f, pos.Y); path.AddLine(pos.X + 1.6f, pos.Y, (pos.X - 8f) + 2.4f, pos.Y + 41f); path.AddLine((float)((pos.X - 8f) + 2.4f), (float)(pos.Y + 41f), (float)((pos.X - 8f) - 0.8f), (float)(pos.Y + 41f)); path.AddLine((pos.X - 8f) - 0.8f, pos.Y + 41f, pos.X, pos.Y); DrawRestDotPart(renderTarget, pos, color); DrawRestDotPart(renderTarget, new RawVector2(pos.X - 2.2f, pos.Y + 11f), color); DrawRestDotPart(renderTarget, new RawVector2(pos.X - 4.4f, pos.Y + 22f), color); break; case DurationTypes.The16th: pos = new RawVector2(pos.X, (pos.Y - (6f * (((float)McMeasure.StaveSpacing) / 2f))) + 3f); path.AddLine(pos.X, pos.Y, pos.X + 1.6f, pos.Y); path.AddLine(pos.X + 1.6f, pos.Y, (pos.X - 8f) + 2.4f, pos.Y + 30f); path.AddLine((float)((pos.X - 8f) + 2.4f), (float)(pos.Y + 30f), (float)((pos.X - 8f) - 0.8f), (float)(pos.Y + 30f)); path.AddLine((pos.X - 8f) - 0.8f, pos.Y + 30f, pos.X, pos.Y); DrawRestDotPart(renderTarget, pos, color); DrawRestDotPart(renderTarget, new RawVector2(pos.X - 2.4f, pos.Y + 11f), color); break; case DurationTypes.Eighth: goto Label_06F6; } } else { switch (types) { case DurationTypes.Quarter: pos = new RawVector2(pos.X - 11f, pos.Y - (7f * (((float)McMeasure.StaveSpacing) / 2f))); path.AddLine(pos.X, pos.Y, pos.X + 7f, pos.Y + 9.5f); path.AddBezier((float)(pos.X + 7f), (float)(pos.Y + 9.5f), (float)(pos.X + 3f), (float)(pos.Y + 16f), (float)(pos.X + 3f), (float)(pos.Y + 16f), (float)(pos.X + 8f), (float)(pos.Y + 24f)); path.AddBezier((float)(pos.X + 8f), (float)(pos.Y + 24f), (float)(pos.X - 0f), (float)(pos.Y + 21f), (float)(pos.X - 1f), (float)(pos.Y + 26f), (float)(pos.X + 4f), (float)(pos.Y + 34f)); path.AddBezier((float)(pos.X + 4f), (float)(pos.Y + 34f), (float)(pos.X - 8f), (float)(pos.Y + 28f), (float)(pos.X - 4f), (float)(pos.Y + 17f), (float)(pos.X + 4.5f), (float)(pos.Y + 21f)); path.AddLine((float)(pos.X + 4.5f), (float)(pos.Y + 21f), (float)(pos.X - 1f), (float)(pos.Y + 14f)); path.AddBezier((float)(pos.X - 1f), (float)(pos.Y + 14f), (float)(pos.X + 3.5f), (float)(pos.Y + 11f), (float)(pos.X + 4f), (float)(pos.Y + 7f), (float)(pos.X - 1f), (float)(pos.Y + 2f)); goto Label_0AD7; case DurationTypes.Half: pos = new RawVector2(pos.X - 8f, pos.Y - (4f * (((float)McMeasure.StaveSpacing) / 2f))); path.AddLine(pos.X - 7f, pos.Y, pos.X + 7f, pos.Y); path.AddLine(pos.X + 7f, pos.Y, pos.X + 7f, pos.Y - 5f); path.AddLine((float)(pos.X + 7f), (float)(pos.Y - 5f), (float)(pos.X - 7f), (float)(pos.Y - 5f)); path.AddLine(pos.X - 7f, pos.Y - 5f, pos.X - 7f, pos.Y); path.AddLine(pos.X - 7f, pos.Y, pos.X - 10f, pos.Y); path.AddLine(pos.X - 10f, pos.Y, pos.X - 10f, pos.Y + 1f); path.AddLine((float)(pos.X - 10f), (float)(pos.Y + 1f), (float)(pos.X + 10f), (float)(pos.Y + 1f)); path.AddLine(pos.X + 10f, pos.Y + 1f, pos.X + 10f, pos.Y); goto Label_0AD7; } if (types == DurationTypes.Whole) { pos = new RawVector2(pos.X - 8f, pos.Y - (6f * (((float)McMeasure.StaveSpacing) / 2f))); path.AddLine(pos.X - 7f, pos.Y, pos.X + 7f, pos.Y); path.AddLine(pos.X + 7f, pos.Y, pos.X + 7f, pos.Y + 5f); path.AddLine((float)(pos.X + 7f), (float)(pos.Y + 5f), (float)(pos.X - 7f), (float)(pos.Y + 5f)); path.AddLine(pos.X - 7f, pos.Y + 5f, pos.X - 7f, pos.Y); path.AddLine(pos.X - 7f, pos.Y, pos.X - 10f, pos.Y); path.AddLine(pos.X - 10f, pos.Y, pos.X - 10f, pos.Y - 1f); path.AddLine((float)(pos.X - 10f), (float)(pos.Y - 1f), (float)(pos.X + 10f), (float)(pos.Y - 1f)); path.AddLine(pos.X + 10f, pos.Y - 1f, pos.X + 10f, pos.Y); } } goto Label_0AD7; Label_06F6: pos = new RawVector2(pos.X - 2f, (pos.Y - (6f * (((float)McMeasure.StaveSpacing) / 2f))) + 3f); path.AddLine(pos.X, pos.Y, pos.X + 1.6f, pos.Y); path.AddLine(pos.X + 1.6f, pos.Y, (pos.X - 8f) + 2.4f, pos.Y + 19f); path.AddLine((float)((pos.X - 8f) + 2.4f), (float)(pos.Y + 19f), (float)((pos.X - 8f) - 0.8f), (float)(pos.Y + 19f)); path.AddLine((pos.X - 8f) - 0.8f, pos.Y + 19f, pos.X, pos.Y); DrawRestDotPart(renderTarget, pos, color); Label_0AD7: path.Flatten(); pathPoints = path.PathPoints; path.Dispose(); } PathGeometry geometry = new PathGeometry(factory2); if (pathPoints.Length > 1) { GeometrySink sink = geometry.Open(); sink.SetSegmentFlags(PathSegment.ForceRoundLineJoin); sink.BeginFigure(new RawVector2(pathPoints[0].X, pathPoints[0].Y), FigureBegin.Filled); for (int i = 1; i < pathPoints.Length; i++) { sink.AddLine(new RawVector2(pathPoints[i].X, pathPoints[i].Y)); } sink.EndFigure(FigureEnd.Closed); sink.Close(); sink.Dispose(); } SolidColorBrush brush = new SolidColorBrush(renderTarget, color.ToRawColor4(1f)); renderTarget.FillGeometry(geometry, brush); brush.Dispose(); geometry.Dispose(); renderTarget.EndDraw(); } catch (Exception) { factory.Dispose(); factory2.Dispose(); factory3.Dispose(); wicBitmap.Dispose(); renderTarget.Dispose(); return(null); } SharpDX.Direct2D1.Bitmap bitmap2 = SharpDX.Direct2D1.Bitmap.FromWicBitmap(renderTargetSource, wicBitmap); factory.Dispose(); factory2.Dispose(); factory3.Dispose(); wicBitmap.Dispose(); renderTarget.Dispose(); return(bitmap2); }