public static IQueryable <Sample> WithBasicFilters(this IQueryable <Sample> queryBase, SampleFilter filters) { var queryFilter = queryBase; if (filters.Ids.IsSent()) { queryFilter = queryFilter.Where(_ => filters.GetIds().Contains(_.SampleId)); } if (filters.SampleId.IsSent()) { queryFilter = queryFilter.Where(_ => _.SampleId == filters.SampleId); } if (filters.Name.IsSent()) { queryFilter = queryFilter.Where(_ => _.Name.Contains(filters.Name)); } if (filters.Descricao.IsSent()) { queryFilter = queryFilter.Where(_ => _.Descricao.Contains(filters.Descricao)); } if (filters.SampleTypeId.IsSent()) { queryFilter = queryFilter.Where(_ => _.SampleTypeId == filters.SampleTypeId); } if (filters.Ativo.IsSent()) { queryFilter = queryFilter.Where(_ => _.Ativo != null && _.Ativo.Value == filters.Ativo); } if (filters.Age.IsSent()) { queryFilter = queryFilter.Where(_ => _.Age != null && _.Age.Value == filters.Age); } if (filters.Category.IsSent()) { queryFilter = queryFilter.Where(_ => _.Category != null && _.Category.Value == filters.Category); } if (filters.Datetime.IsSent()) { queryFilter = queryFilter.Where(_ => _.Datetime != null && _.Datetime.Value >= filters.Datetime.Value); } if (filters.DatetimeStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.Datetime != null && _.Datetime.Value >= filters.DatetimeStart.Value); } if (filters.DatetimeEnd.IsSent()) { filters.DatetimeEnd = filters.DatetimeEnd.Value.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.Datetime != null && _.Datetime.Value <= filters.DatetimeEnd); } if (filters.Tags.IsSent()) { queryFilter = queryFilter.Where(_ => _.Tags.Contains(filters.Tags)); } if (filters.Valor.IsSent()) { queryFilter = queryFilter.Where(_ => _.Valor != null && _.Valor.Value == filters.Valor); } if (filters.Telefone.IsSent()) { queryFilter = queryFilter.Where(_ => _.Telefone.Contains(filters.Telefone)); } if (filters.Cpf.IsSent()) { queryFilter = queryFilter.Where(_ => _.Cpf.Contains(filters.Cpf)); } if (filters.UserCreateId.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserCreateId == filters.UserCreateId); } if (filters.UserCreateDate.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDate); } if (filters.UserCreateDateStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserCreateDate >= filters.UserCreateDateStart); } if (filters.UserCreateDateEnd.IsSent()) { filters.UserCreateDateEnd = filters.UserCreateDateEnd.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.UserCreateDate <= filters.UserCreateDateEnd); } if (filters.UserAlterId.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserAlterId != null && _.UserAlterId.Value == filters.UserAlterId); } if (filters.UserAlterDate.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value >= filters.UserAlterDate.Value); } if (filters.UserAlterDateStart.IsSent()) { queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value >= filters.UserAlterDateStart.Value); } if (filters.UserAlterDateEnd.IsSent()) { filters.UserAlterDateEnd = filters.UserAlterDateEnd.Value.AddDays(1).AddMilliseconds(-1); queryFilter = queryFilter.Where(_ => _.UserAlterDate != null && _.UserAlterDate.Value <= filters.UserAlterDateEnd); } return(queryFilter); }
public static IQueryable <Sample> WithCustomFilters(this IQueryable <Sample> queryBase, SampleFilter filters) { var queryFilter = queryBase; return(queryFilter); }
/// <summary> /// Function to build a sampler state from the information provided by the sprite data. /// </summary> /// <param name="graphics">The graphics interface to use.</param> /// <param name="filter">The filter to use.</param> /// <param name="borderColor">The color of the border to use.</param> /// <param name="hWrap">Horizontal wrapping mode.</param> /// <param name="vWrap">Vertical wrapping mode.</param> /// <returns>The sampler state.</returns> private static GorgonSamplerState CreateSamplerState(GorgonGraphics graphics, SampleFilter filter, GorgonColor borderColor, TextureWrap hWrap, TextureWrap vWrap) { var builder = new GorgonSamplerStateBuilder(graphics); switch (filter) { case SampleFilter.MinMagMipLinear when(hWrap == TextureWrap.Clamp) && (vWrap == TextureWrap.Clamp) && (borderColor == GorgonColor.White): return(null); case SampleFilter.MinMagMipPoint when(hWrap == TextureWrap.Clamp) && (vWrap == TextureWrap.Clamp) && (borderColor == GorgonColor.White): return(GorgonSamplerState.PointFiltering); case SampleFilter.MinMagMipLinear when(hWrap == TextureWrap.Wrap) && (vWrap == TextureWrap.Wrap) && (borderColor == GorgonColor.White): return(GorgonSamplerState.Wrapping); case SampleFilter.MinMagMipPoint when(hWrap == TextureWrap.Wrap) && (vWrap == TextureWrap.Wrap) && (borderColor == GorgonColor.White): return(GorgonSamplerState.PointFilteringWrapping); default: return(builder.Wrapping(hWrap, vWrap, borderColor: borderColor) .Filter(filter) .Build()); } }
/// <summary> /// Function to load a version 1.x Gorgon sprite. /// </summary> /// <param name="graphics">The graphics interface used to create states.</param> /// <param name="reader">Binary reader to use to read in the data.</param> /// <param name="overrideTexture">The texture to assign to the sprite instead of the texture associated with the name stored in the file.</param> /// <returns>The sprite from the stream data.</returns> private static GorgonSprite LoadSprite(GorgonGraphics graphics, GorgonBinaryReader reader, GorgonTexture2DView overrideTexture) { Version version; string imageName = string.Empty; string headerVersion = reader.ReadString(); if ((!headerVersion.StartsWith("GORSPR", StringComparison.OrdinalIgnoreCase)) || (headerVersion.Length < 7) || (headerVersion.Length > 9)) { throw new GorgonException(GorgonResult.CannotRead, Resources.GOR2DIO_ERR_INVALID_HEADER); } var sprite = new GorgonSprite(); // Get the version information. switch (headerVersion.ToUpperInvariant()) { case "GORSPR1": version = new Version(1, 0); break; case "GORSPR1.1": version = new Version(1, 1); break; case "GORSPR1.2": version = new Version(1, 2); break; default: throw new GorgonException(GorgonResult.CannotRead, string.Format(Resources.GOR2DIO_ERR_VERSION_MISMATCH, headerVersion)); } // We don't need the sprite name. reader.ReadString(); // Find out if we have an image. if (reader.ReadBoolean()) { bool isRenderTarget = reader.ReadBoolean(); imageName = reader.ReadString(); // We won't be supporting reading render targets from sprites in this version. if (isRenderTarget) { // Skip the target data. reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); reader.ReadBoolean(); reader.ReadBoolean(); } } // We don't use "inherited" values anymore. But we need them because // the file doesn't include inherited data. bool InheritAlphaMaskFunction = reader.ReadBoolean(); bool InheritAlphaMaskValue = reader.ReadBoolean(); bool InheritBlending = reader.ReadBoolean(); bool InheritHorizontalWrapping = reader.ReadBoolean(); bool InheritSmoothing = reader.ReadBoolean(); bool InheritStencilCompare = reader.ReadBoolean(); bool InheritStencilEnabled = reader.ReadBoolean(); bool InheritStencilFailOperation = reader.ReadBoolean(); bool InheritStencilMask = reader.ReadBoolean(); bool InheritStencilPassOperation = reader.ReadBoolean(); bool InheritStencilReference = reader.ReadBoolean(); bool InheritStencilZFailOperation = reader.ReadBoolean(); bool InheritVerticalWrapping = reader.ReadBoolean(); bool InheritDepthBias = true; bool InheritDepthTestFunction = true; bool InheritDepthWriteEnabled = true; // Get version 1.1 fields. if ((version.Major == 1) && (version.Minor >= 1)) { InheritDepthBias = reader.ReadBoolean(); InheritDepthTestFunction = reader.ReadBoolean(); InheritDepthWriteEnabled = reader.ReadBoolean(); } // Get the size of the sprite. sprite.Size = new DX.Size2F(reader.ReadSingle(), reader.ReadSingle()); // Older versions of the sprite object used pixel space for their texture coordinates. We will have to // fix up these coordinates into texture space once we have a texture loaded. At this point, there's no guarantee // that the texture was loaded safely, so we'll have to defer it until later. // Also, older versions used the size the determine the area on the texture to cover. So use the size to // get the texture bounds. var textureOffset = new DX.Vector2(reader.ReadSingle(), reader.ReadSingle()); // Read the anchor. // Gorgon v3 anchors are relative, so we need to convert them based on our sprite size. sprite.Anchor = new DX.Vector2(reader.ReadSingle() / sprite.Size.Width, reader.ReadSingle() / sprite.Size.Height); // Get vertex offsets. sprite.CornerOffsets.UpperLeft = new DX.Vector3(reader.ReadSingle(), reader.ReadSingle(), 0); sprite.CornerOffsets.UpperRight = new DX.Vector3(reader.ReadSingle(), reader.ReadSingle(), 0); sprite.CornerOffsets.LowerRight = new DX.Vector3(reader.ReadSingle(), reader.ReadSingle(), 0); sprite.CornerOffsets.LowerLeft = new DX.Vector3(reader.ReadSingle(), reader.ReadSingle(), 0); // Get vertex colors. sprite.CornerColors.UpperLeft = new GorgonColor(reader.ReadInt32()); sprite.CornerColors.UpperRight = new GorgonColor(reader.ReadInt32()); sprite.CornerColors.LowerLeft = new GorgonColor(reader.ReadInt32()); sprite.CornerColors.LowerRight = new GorgonColor(reader.ReadInt32()); // Skip shader information. Version 1.0 had shader information attached to the sprite. if ((version.Major == 1) && (version.Minor < 1)) { if (reader.ReadBoolean()) { reader.ReadString(); reader.ReadBoolean(); if (reader.ReadBoolean()) { reader.ReadString(); } } } // We no longer have an alpha mask function. if (!InheritAlphaMaskFunction) { reader.ReadInt32(); } if (!InheritAlphaMaskValue) { // Direct 3D 9 used a value from 0..255 for alpha masking, we use // a scalar value so convert to a scalar. sprite.AlphaTest = new GorgonRangeF(0.0f, reader.ReadInt32() / 255.0f); } // Set the blending mode. if (!InheritBlending) { // Skip the blending mode. We don't use it per-sprite. reader.ReadInt32(); reader.ReadInt32(); reader.ReadInt32(); } // Get alpha blending mode. if ((version.Major == 1) && (version.Minor >= 2)) { // Skip the blending mode information. We don't use it per-sprite. reader.ReadInt32(); reader.ReadInt32(); } TextureWrap hWrap = TextureWrap.Clamp; TextureWrap vWrap = TextureWrap.Clamp; SampleFilter filter = SampleFilter.MinMagMipLinear; GorgonColor samplerBorder = GorgonColor.White; // Get horizontal wrapping mode. if (!InheritHorizontalWrapping) { hWrap = ConvertImageAddressToTextureAddress(reader.ReadInt32()); } // Get smoothing mode. if (!InheritSmoothing) { filter = ConvertSmoothingToFilter(reader.ReadInt32()); } // Get stencil stuff. if (!InheritStencilCompare) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritStencilEnabled) { // We don't enable stencil in the same way anymore, so skip this value. reader.ReadBoolean(); } if (!InheritStencilFailOperation) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritStencilMask) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritStencilPassOperation) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritStencilReference) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritStencilZFailOperation) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } // Get vertical wrapping mode. if (!InheritVerticalWrapping) { vWrap = ConvertImageAddressToTextureAddress(reader.ReadInt32()); } // Get depth info. if ((version.Major == 1) && (version.Minor >= 1)) { if (!InheritDepthBias) { // Depth bias values are quite different on D3D9 than they are on D3D11, so skip this. reader.ReadSingle(); } if (!InheritDepthTestFunction) { // We don't use depth/stencil info per sprite anymore. reader.ReadInt32(); } if (!InheritDepthWriteEnabled) { // We don't use depth/stencil info per sprite anymore. reader.ReadBoolean(); } samplerBorder = new GorgonColor(reader.ReadInt32()); // The border in the older version defaults to black. To make it more performant, reverse this value to white. if (samplerBorder == GorgonColor.Black) { samplerBorder = GorgonColor.White; } } // Get flipped flags. sprite.HorizontalFlip = reader.ReadBoolean(); sprite.VerticalFlip = reader.ReadBoolean(); GorgonTexture2DView textureView; // Bind the texture (if we have one bound to this sprite) if it's already loaded, otherwise defer it. if ((!string.IsNullOrEmpty(imageName)) && (overrideTexture == null)) { GorgonTexture2D texture = graphics.LocateResourcesByName <GorgonTexture2D>(imageName).FirstOrDefault(); textureView = texture?.GetShaderResourceView(); } else { textureView = overrideTexture; } // If we cannot load the image, then fall back to the standard coordinates. if (textureView == null) { sprite.TextureRegion = new DX.RectangleF(0, 0, 1, 1); } else { sprite.TextureRegion = new DX.RectangleF(textureOffset.X / textureView.Width, textureOffset.Y / textureView.Height, sprite.Size.Width / textureView.Width, sprite.Size.Height / textureView.Height); sprite.TextureSampler = CreateSamplerState(graphics, filter, samplerBorder, hWrap, vWrap); } sprite.Texture = textureView; return(sprite); }
internal void _CaptureRaceTest(Action <string> onComplete, IEnumerable <DataSample> samples) { var overlayData = new OverlayData(); var removalEdits = new RemovalEdits(overlayData.RaceEvents); var commentaryMessages = new CommentaryMessages(overlayData); var videoCapture = new VideoCapture(); var recordPitStop = new RecordPitStop(commentaryMessages); var fastestLaps = new RecordFastestLaps(overlayData); var replayControl = new ReplayControl(samples.First().SessionData, incidents, removalEdits, TrackCameras); var sessionDataCapture = new SessionDataCapture(overlayData); var captureLeaderBoardEveryHalfSecond = new SampleFilter(TimeSpan.FromSeconds(0.5), new CaptureLeaderBoard(overlayData, commentaryMessages, removalEdits).Process); var captureCamDriverEveryQuaterSecond = new SampleFilter(TimeSpan.FromSeconds(0.25), new CaptureCamDriver(overlayData).Process); var captureCamDriverEvery4Seconds = new SampleFilter(TimeSpan.FromSeconds(4), new LogCamDriver().Process); TraceDebug.WriteLine("Cameras:"); TraceDebug.WriteLine(TrackCameras.ToString()); ApplyFirstLapCameraDirection(samples, replayControl); samples = samples .VerifyReplayFrames() .WithCorrectedPercentages() .WithCorrectedDistances() .WithFastestLaps() .WithFinishingStatus() .WithPitStopCounts() .TakeUntil(3.Seconds()).Of(d => d.Telemetry.LeaderHasFinished && d.Telemetry.RaceCars.All(c => c.HasSeenCheckeredFlag || c.HasRetired || c.TrackSurface != TrackLocation.OnTrack)) .TakeUntil(3.Seconds()).AfterReplayPaused(); if (shortTestOnly) { samples = samples.AtSpeed(Settings.Default.TimingFactorForShortTest); Settings.AppliedTimingFactor = 1.0 / Settings.Default.TimingFactorForShortTest; } videoCapture.Activate(workingFolder); var startTime = DateTime.Now; overlayData.CapturedVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); foreach (var data in samples) { var relativeTime = DateTime.Now - startTime; replayControl.Process(data); sessionDataCapture.Process(data); captureLeaderBoardEveryHalfSecond.Process(data, relativeTime); captureCamDriverEveryQuaterSecond.Process(data, relativeTime); recordPitStop.Process(data, relativeTime); fastestLaps.Process(data, relativeTime); removalEdits.Process(data, relativeTime); captureCamDriverEvery4Seconds.Process(data, relativeTime); } var files = videoCapture.Deactivate(); removalEdits.Stop(); var overlayFile = SaveOverlayData(overlayData, files); //terminate iRacing after video capture completed try { //ToBe added: Option to select/deselect termination of iRacing after capturing video in new settings Dialog Process[] iRacingProc = Process.GetProcessesByName("iRacingSim64DX11"); iRacingProc[0].Kill(); } catch { throw new Exception("Could not terminate iRacing Simulator".F(workingFolder)); } iRacing.Replay.SetSpeed(0); AltTabBackToApp(); if (files.Count == 0) { throw new Exception("Unable to find video files in '{0}' - possible wrong working folder".F(workingFolder)); } _WithOverlayFile(overlayFile); onComplete(overlayFile); }
private static bool FilterEquals(SampleFilter filter, string name, string op, string value) { return(filter.Name.Equals(name) && filter.Op.Equals(op) && filter.Value.Equals(value)); }
public SampleCertificationFilter() { Sample = new SampleFilter(); }
public virtual Task <PaginateResult <Sample> > GetByFiltersPaging(SampleFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(this._rep.PagingAndDefineFields(filters, queryBase)); }
public IList <SampleDto> GetSampleFilter(SampleFilter filter) { return(GetEntities <SampleFilter, Sample, SampleDto>(filter)); }
public async Task <IActionResult> Get([FromQuery] SampleFilter filters) { return(await base.Get <SampleFilter>(filters, "Seed - Sample")); }
public IList <SampleDto> GetSampleFilter(SampleFilter filter) { return(Builder <SampleDto> .CreateListOfSize(5).Build()); }
/// <summary> /// Function to load a version 1.x Gorgon sprite. /// </summary> /// <param name="graphics">The graphics interface used to create states.</param> /// <param name="reader">Binary reader to use to read in the data.</param> /// <param name="overrideTexture">The texture to assign to the sprite instead of the texture associated with the name stored in the file.</param> /// <returns>The sprite from the stream data.</returns> private static GorgonSprite LoadSprite(GorgonGraphics graphics, GorgonChunkReader reader, GorgonTexture2DView overrideTexture) { var sprite = new GorgonSprite(); if (!reader.HasChunk(FileHeader)) { throw new GorgonException(GorgonResult.CannotRead, Resources.GOR2DIO_ERR_INVALID_HEADER); } reader.Begin(FileHeader); reader.Begin(SpriteDataChunk); sprite.Anchor = reader.Read <DX.Vector2>(); sprite.Size = reader.Read <DX.Size2F>(); sprite.Anchor = new DX.Vector2(sprite.Anchor.X / sprite.Size.Width, sprite.Anchor.Y / sprite.Size.Height); sprite.HorizontalFlip = reader.ReadBoolean(); sprite.VerticalFlip = reader.ReadBoolean(); // Read vertex colors. sprite.CornerColors.UpperLeft = reader.Read <GorgonColor>(); sprite.CornerColors.UpperRight = reader.Read <GorgonColor>(); sprite.CornerColors.LowerLeft = reader.Read <GorgonColor>(); sprite.CornerColors.LowerRight = reader.Read <GorgonColor>(); // Write vertex offsets. sprite.CornerOffsets.UpperLeft = new DX.Vector3(reader.Read <DX.Vector2>(), 0); sprite.CornerOffsets.UpperRight = new DX.Vector3(reader.Read <DX.Vector2>(), 0); sprite.CornerOffsets.LowerLeft = new DX.Vector3(reader.Read <DX.Vector2>(), 0); sprite.CornerOffsets.LowerRight = new DX.Vector3(reader.Read <DX.Vector2>(), 0); reader.End(); // Read rendering information. reader.Begin(RenderDataChunk); // Culling mode is not per-sprite anymore. reader.SkipBytes(Unsafe.SizeOf <CullingMode>()); sprite.AlphaTest = reader.Read <GorgonRangeF>(); // Blending values are not per-sprite anymore. // Depth/stencil values are not per-sprite anymore. reader.SkipBytes(91); reader.End(); // Read texture information. reader.Begin(TextureDataChunk); GorgonColor borderColor = reader.Read <GorgonColor>(); TextureWrap hWrap = ConvertV2TextureWrapToTextureAddress(reader.Read <int>()); TextureWrap vWrap = ConvertV2TextureWrapToTextureAddress(reader.Read <int>()); SampleFilter filter = ConvertV2TextureFilterToFilter(reader.Read <TextureFilter>()); string textureName = reader.ReadString(); GorgonTexture2DView textureView; // Bind the texture (if we have one bound to this sprite) if it's already loaded, otherwise defer it. if ((!string.IsNullOrEmpty(textureName)) && (overrideTexture == null)) { GorgonTexture2D texture = graphics.LocateResourcesByName <GorgonTexture2D>(textureName).FirstOrDefault(); // If we used the editor build to sprite, the path to the texture is stored in the name instead of just the name. // So let's try and strip out the path information and extension and try again. if (texture == null) { textureName = Path.GetFileNameWithoutExtension(textureName); texture = graphics.LocateResourcesByName <GorgonTexture2D>(textureName).FirstOrDefault(); } textureView = texture?.GetShaderResourceView(); } else { textureView = overrideTexture; } sprite.TextureRegion = reader.ReadRectangleF(); if (textureView != null) { // V2 used black transparent by default, so convert it to our default so we can keep from creating unnecessary states. if (borderColor == GorgonColor.BlackTransparent) { borderColor = GorgonColor.White; } sprite.Texture = textureView; sprite.TextureSampler = CreateSamplerState(graphics, filter, borderColor, hWrap, vWrap); } reader.End(); reader.End(); return(sprite); }
/// <summary> /// Function to convert Gorgon 2.x texture filtering to 3.x texture filtering values. /// </summary> /// <param name="filter">Texture filtering value to convert.</param> /// <returns>Texture filtering value.</returns> private static SampleFilter ConvertV2TextureFilterToFilter(TextureFilter filter) { SampleFilter result = SampleFilter.MinMagMipPoint; switch (filter) { case TextureFilter.Anisotropic: result = SampleFilter.Anisotropic; break; case TextureFilter.CompareAnisotropic: result = SampleFilter.ComparisonAnisotropic; break; } // Sort out filter stateType. // Check comparison stateType. if ((filter & TextureFilter.Comparison) == TextureFilter.Comparison) { if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.ComparisonMinMagMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.ComparisonMinMagMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.ComparisonMinMagLinearMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.ComparisonMinLinearMagMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.ComparisonMinLinearMagPointMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.ComparisonMinPointMagMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.ComparisonMinMagPointMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.ComparisonMinPointMagLinearMipPoint; } } else { if ((filter == TextureFilter.None) || (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear))) { result = SampleFilter.MinMagMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.MinMagMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.MinMagLinearMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.MinLinearMagMipPoint; } if (((filter & TextureFilter.MinLinear) == TextureFilter.MinLinear) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.MinLinearMagPointMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.MinPointMagMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagPoint) == TextureFilter.MagPoint) && ((filter & TextureFilter.MipLinear) == TextureFilter.MipLinear)) { result = SampleFilter.MinMagPointMipLinear; } if (((filter & TextureFilter.MinPoint) == TextureFilter.MinPoint) && ((filter & TextureFilter.MagLinear) == TextureFilter.MagLinear) && ((filter & TextureFilter.MipPoint) == TextureFilter.MipPoint)) { result = SampleFilter.MinPointMagLinearMipPoint; } } return(result); }
public virtual async Task <Sample> GetOne(SampleFilter filters) { return(await this._rep.GetById(filters)); }
public async Task <IActionResult> Get([FromQuery] SampleFilter filters) { var result = new HttpResult <dynamic>(this._logger); try { if (filters.FilterBehavior == FilterBehavior.GetDataItem) { if (this._user.GetClaims().GetTools().VerifyClaimsCanReadDataItem("Sample")) { var searchResult = await this._rep.GetDataItem(filters); return(result.ReturnCustomResponse(searchResult, filters)); } else { return(new ObjectResult(null) { StatusCode = (int)HttpStatusCode.Forbidden }); } } else if (this._user.GetClaims().GetTools().VerifyClaimsCanReadCustom("Sample")) { if (filters.FilterBehavior == FilterBehavior.GetDataCustom) { var searchResult = await this._rep.GetDataCustom(filters); return(result.ReturnCustomResponse(searchResult, filters)); } if (filters.FilterBehavior == FilterBehavior.GetDataListCustom) { var filterKey = filters.CompositeKey(this._user); if (filters.ByCache) { if (this._cache.ExistsKey(filterKey)) { return(result.ReturnCustomResponse(this._cache.Get <IEnumerable <object> >(filterKey), filters)); } } var searchResult = await this._rep.GetDataListCustom(filters); this.AddCache(filters, filterKey, searchResult, "Sample"); return(result.ReturnCustomResponse(searchResult, filters)); } if (filters.FilterBehavior == FilterBehavior.GetDataListCustomPaging) { var filterKey = filters.CompositeKey(this._user); if (filters.ByCache) { if (this._cache.ExistsKey(filterKey)) { return(result.ReturnCustomResponse(this._cache.Get <IEnumerable <object> >(filterKey), filters)); } } var paginatedResult = await this._rep.GetDataListCustomPaging(filters); this.AddCache(filters, filterKey, paginatedResult.ResultPaginatedData, "Sample"); return(result.ReturnCustomResponse(paginatedResult.ToSearchResult <dynamic>(), filters)); } if (filters.FilterBehavior == FilterBehavior.Export) { var searchResult = await this._rep.GetDataListCustom(filters); var export = new ExportExcelCustom <dynamic>(filters); var file = export.ExportFile(this.Response, searchResult, "Sample", this._env.RootPath); return(File(file, export.ContentTypeExcel(), export.GetFileName())); } } else { return(new ObjectResult(null) { StatusCode = (int)HttpStatusCode.Forbidden }); } throw new InvalidOperationException("invalid FilterBehavior"); } catch (Exception ex) { var responseEx = result.ReturnCustomException(ex, "Seed - Sample", filters); return(responseEx); } }
public virtual async Task <IEnumerable <Sample> > GetByFilters(SampleFilter filters) { var queryBase = this._rep.GetBySimplefilters(filters); return(await this._rep.ToListAsync(queryBase)); }
/// <summary> /// Function to set the type of filtering to apply to the texture. /// </summary> /// <param name="filter">The filter to apply.</param> /// <returns>The fluent builder interface.</returns> public GorgonSamplerStateBuilder Filter(SampleFilter filter) { WorkingState.Filter = filter; return(this); }
public static IQueryable <Sample> OrderByDomain(this IQueryable <Sample> queryBase, SampleFilter filters) { return(queryBase.OrderBy(_ => _.SampleId)); }
internal void _CaptureRaceTest(Action <string> onComplete, IEnumerable <DataSample> samples) { //identify wheather highlights video only is selected and OBS pause/resume can be used (to be implemented) if (bRecordUsingPauseResume) { //Retrieve list of raceEvents selected depending on the duration of the highlight video var totalRaceEvents = RaceEventExtension.GetInterestingRaceEvents(overlayData.RaceEvents.ToList()); ApplyFirstLapCameraDirection(samples, replayControl); //Record the selected race events into a highlight video raceVideo.Activate(workingFolder); //Active video-capturing and send start command to recording software. OverlayData.CamDriver curCamDriver = overlayData.CamDrivers.First(); //start thread to control / switch cameras while recording ReplayControl.cameraControl.ReplayCameraControlTask(overlayData); //ReplayControl.cameraControl.CameraOnDriver(short.Parse(curCamDriver.CurrentDriver.CarNumber), (short)curCamDriver.camGroupNumber); //cycle through all raceEvents selected for the highlight video and record them (REMARK: Camera switching not implemented yet) foreach (var raceEvent in totalRaceEvents) { TraceInfo.WriteLine("ADV_RECORDING: Type: {0} | Durations-Span: {1} | ".F(raceEvent.GetType(), raceEvent.Duration)); //jump to selected RaceEvent in iRacing Replay int framePositionInRace = raceStartFrameNumber + (int)Math.Round(raceEvent.StartTime * 60.0); iRacing.Replay.MoveToFrame(raceStartFrameNumber + (int)Math.Round(raceEvent.StartTime * 60.0)); iRacing.Replay.SetSpeed((int)replaySpeeds.normal); //start iRacing Replay at selected position raceVideo.Resume(); //resume recording TraceDebug.WriteLine("Recording Race-Event. Frame-Position: {0} | Duration: {1} ms".F(framePositionInRace, 1000 * raceEvent.Duration)); Thread.Sleep((int)(1000 * raceEvent.Duration)); //pause thread until scene is fully recorded. raceVideo.Pause(); //pause recording software before jumping to new position in iRacing Replay } TraceDebug.WriteLine("Video Capture of Race-Events completed"); raceVideo.Stop(); } else //Code to be removed after being able to implment working solution where analysis phase and replay-capture phase are distinct processes. //use local variables for original code instead of global variables introduced to support full analysis in analysis-phase { var overlayData = new OverlayData(); var removalEdits = new RemovalEdits(overlayData.RaceEvents); var commentaryMessages = new CommentaryMessages(overlayData); var recordPitStop = new RecordPitStop(commentaryMessages); var fastestLaps = new RecordFastestLaps(overlayData); var replayControl = new ReplayControl(samples.First().SessionData, incidents, removalEdits, TrackCameras); var sessionDataCapture = new SessionDataCapture(overlayData); var captureLeaderBoardEveryHalfSecond = new SampleFilter(TimeSpan.FromSeconds(0.5), new CaptureLeaderBoard(overlayData, commentaryMessages, removalEdits).Process); var captureCamDriverEveryQuaterSecond = new SampleFilter(TimeSpan.FromSeconds(0.25), new CaptureCamDriver(overlayData).Process); var captureCamDriverEvery4Seconds = new SampleFilter(TimeSpan.FromSeconds(4), new LogCamDriver().Process); TraceDebug.WriteLine("Cameras:"); TraceDebug.WriteLine(TrackCameras.ToString()); var videoCapture = new VideoCapture(); ApplyFirstLapCameraDirection(samples, replayControl); samples = samples .VerifyReplayFrames() .WithCorrectedPercentages() .WithCorrectedDistances() .WithFastestLaps() .WithFinishingStatus() .WithPitStopCounts() .TakeUntil(3.Seconds()).Of(d => d.Telemetry.LeaderHasFinished && d.Telemetry.RaceCars.All(c => c.HasSeenCheckeredFlag || c.HasRetired || c.TrackSurface != TrackLocation.OnTrack)) .TakeUntil(3.Seconds()).AfterReplayPaused(); if (shortTestOnly) { samples = samples.AtSpeed(Settings.Default.TimingFactorForShortTest); Settings.AppliedTimingFactor = 1.0 / Settings.Default.TimingFactorForShortTest; } videoCapture.Activate(workingFolder); //Start video capturing FileName will be given by recording software. var startTime = DateTime.Now; overlayData.CapturedVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(); foreach (var data in samples) { var relativeTime = DateTime.Now - startTime; TraceDebug.WriteLine("Recording at time: {0}", relativeTime); replayControl.Process(data); sessionDataCapture.Process(data); captureLeaderBoardEveryHalfSecond.Process(data, relativeTime); captureCamDriverEveryQuaterSecond.Process(data, relativeTime); recordPitStop.Process(data, relativeTime); fastestLaps.Process(data, relativeTime); removalEdits.Process(data, relativeTime); captureCamDriverEvery4Seconds.Process(data, relativeTime); } var files = videoCapture.Deactivate(); //Stop video capturing - returns list with "guessed" filename. Filenmae being different from replay-script due to different time stamp. //investigate whether renaming of video file is necessary. removalEdits.Stop(); var overlayFile = SaveOverlayData(overlayData, files); iRacing.Replay.SetSpeed(0); AltTabBackToApp(); if (files.Count == 0) { throw new Exception("Unable to find video files in '{0}' - possible wrong working folder".F(workingFolder)); } _WithOverlayFile(overlayFile); onComplete(overlayFile); } //terminate iRacing after video capture completed to free up CPU resources if (bCloseiRacingAfterRecording) { try { //To be added: Option to select/deselect termination of iRacing after capturing video in new settings Dialog Process[] iRacingProc = Process.GetProcessesByName("iRacingSim64DX11"); iRacingProc[0].Kill(); } catch { throw new Exception("Could not terminate iRacing Simulator".F(workingFolder)); } } }