/// <summary> /// Convert a given parameter to driver id(s) /// </summary> /// <exception cref="CodeParserException">Driver ID could not be parsed</exception> private void ConvertDriverIds(CodeParameter parameter) { if (!parameter.IsExpression) { List <DriverId> drivers = new List <DriverId>(); string[] parameters = parameter.StringValue.Split(':'); foreach (string value in parameters) { try { DriverId id = new DriverId(value); drivers.Add(id); } catch (ArgumentException e) { throw new CodeParserException(e.Message + $" from {parameter.Letter} parameter", this); } } if (drivers.Count == 1) { parameter.ParsedValue = drivers[0]; } else { parameter.ParsedValue = drivers.ToArray(); } parameter.IsDriverId = true; } }
public Driver(DriverId id, string firstName, string lastName, string description, UserGroupId userGroupId, DriverGroup group) { Id = id; FirstName = firstName; LastName = lastName; Description = description; UserGroupId = userGroupId; Group = group; }
public PhysicalDeviceDriverPropertiesKHR ( StructureType sType = StructureType.PhysicalDeviceDriverProperties, void *pNext = default, DriverId driverID = default, ConformanceVersion conformanceVersion = default ) { SType = sType; PNext = pNext; DriverID = driverID; ConformanceVersion = conformanceVersion; }
public void ParseM915() { DuetAPI.Commands.Code code = new DuetAPI.Commands.Code("M915 P2:0.3:1.4 S22"); Assert.AreEqual(CodeType.MCode, code.Type); Assert.AreEqual(915, code.MajorNumber); Assert.IsNull(code.MinorNumber); Assert.AreEqual(CodeFlags.None, code.Flags); Assert.AreEqual(2, code.Parameters.Count); Assert.AreEqual('P', code.Parameters[0].Letter); DriverId[] driverIds = new DriverId[] { new DriverId(2), new DriverId(3), new DriverId(1, 4) }; Assert.AreEqual(driverIds, (DriverId[])code.Parameters[0]); Assert.AreEqual('S', code.Parameters[1].Letter); Assert.AreEqual(22, (int)code.Parameters[1]); }
/// <summary> /// Creates a new CodeParameter instance and parses value to a native data type if applicable /// </summary> /// <param name="letter">Letter of the code parameter</param> /// <param name="value">String representation of the value</param> /// <param name="isString">Whether this is a string. This is set to true if the parameter was inside quotation marks</param> /// <param name="isDriverId">Whether this is a driver ID</param> /// <remarks>This constructor does not parsed long (aka int64) values because RRF cannot handle them</remarks> public CodeParameter(char letter, string value, bool isString, bool isDriverId) { Letter = letter; StringValue = value; if (isString) { // Value is definitely a string because it is encapsulated in quotation marks ParsedValue = value; } else if (isDriverId) { // Value is a (list of) driver identifier(s) List <DriverId> driverIds = new List <DriverId>(); foreach (string item in value.Split(':')) { DriverId driverId = new DriverId(item); driverIds.Add(driverId); } if (driverIds.Count == 1) { ParsedValue = driverIds[0]; } else { ParsedValue = driverIds.ToArray(); } } else { // It is not encapsulated... value = value.Trim(); if (string.IsNullOrEmpty(value)) { // Empty parameters are repesented as integers with the value 0 (e.g. G92 XY => G92 X0 Y0) ParsedValue = 0; } else if (value.StartsWith('{') && value.EndsWith('}')) { // It is an expression IsExpression = true; ParsedValue = value; } else if (value.Contains(':')) { // It is an array (or a string) string[] subArgs = value.Split(':'); try { if (value.Contains('.')) { // If there is a dot anywhere, attempt to parse it as a float array ParsedValue = subArgs.Select(subArg => float.Parse(subArg, NumberStyles.Any, CultureInfo.InvariantCulture)).ToArray(); } else { try { // If there is no dot, it could be an integer array ParsedValue = subArgs.Select(int.Parse).ToArray(); } catch { // If that failed, attempt to parse everything as a uint array ParsedValue = subArgs.Select(uint.Parse).ToArray(); } } } catch { // It must be a string (fallback) ParsedValue = value; } } else if (int.TryParse(value, out int asInt)) { // It is a valid integer ParsedValue = asInt; } else if (uint.TryParse(value, out uint asUInt)) { // It is a valid unsigned integer ParsedValue = asUInt; } else if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out float asFloat)) { // It is a valid float ParsedValue = asFloat; } else { // It is a string ParsedValue = value; } } }
/// <summary> /// Read a <see cref="Request.EvaluationResult"/> request /// </summary> /// <param name="from">Origin</param> /// <param name="expression">Expression</param> /// <param name="result">Evaluation result</param> /// <returns>Number of bytes read</returns> public static int ReadEvaluationResult(ReadOnlySpan <byte> from, out string expression, out object result) { EvaluationResultHeader header = MemoryMarshal.Cast <byte, EvaluationResultHeader>(from)[0]; int bytesRead = Marshal.SizeOf(header); // Read expression ReadOnlySpan <byte> unicodeExpression = from.Slice(bytesRead, header.ExpressionLength); expression = Encoding.UTF8.GetString(unicodeExpression); bytesRead += header.ExpressionLength; // Read value switch (header.Type) { case DataType.Int: result = header.IntValue; break; case DataType.UInt: result = header.UIntValue; break; case DataType.Float: result = header.FloatValue; break; case DataType.IntArray: int[] intArray = new int[header.IntValue]; for (int i = 0; i < header.IntValue; i++) { intArray[i] = MemoryMarshal.Read <int>(from.Slice(bytesRead)); bytesRead += Marshal.SizeOf <int>(); } result = intArray; break; case DataType.UIntArray: uint[] uintArray = new uint[header.IntValue]; for (int i = 0; i < header.IntValue; i++) { uintArray[i] = MemoryMarshal.Read <uint>(from.Slice(bytesRead)); bytesRead += Marshal.SizeOf <uint>(); } result = uintArray; break; case DataType.FloatArray: float[] floatArray = new float[header.IntValue]; for (int i = 0; i < header.IntValue; i++) { floatArray[i] = MemoryMarshal.Read <float>(from.Slice(bytesRead)); bytesRead += Marshal.SizeOf <float>(); } result = floatArray; break; case DataType.String: result = Encoding.UTF8.GetString(from.Slice(bytesRead, header.IntValue)); bytesRead += header.IntValue; break; case DataType.DriverId: result = new DriverId(header.UIntValue); break; case DataType.DriverIdArray: DriverId[] driverIdArray = new DriverId[header.IntValue]; for (int i = 0; i < header.IntValue; i++) { driverIdArray[i] = new DriverId(MemoryMarshal.Read <uint>(from.Slice(bytesRead))); bytesRead += Marshal.SizeOf <uint>(); } result = driverIdArray; break; case DataType.Bool: result = Convert.ToBoolean(header.IntValue); break; case DataType.BoolArray: bool[] boolArray = new bool[header.IntValue]; for (int i = 0; i < header.IntValue; i++) { boolArray[i] = Convert.ToBoolean(MemoryMarshal.Read <byte>(from.Slice(bytesRead))); bytesRead += Marshal.SizeOf <byte>(); } result = boolArray; break; case DataType.Expression: string errorMessage = Encoding.UTF8.GetString(from.Slice(bytesRead, header.IntValue)); result = new CodeParserException(errorMessage); break; default: result = null; break; } return(AddPadding(bytesRead)); }
public async Task <DriverReadModel> GetDriverById(DriverId id, CancellationToken token) { var result = await _queryProcessor.ProcessAsync(new ReadModelByIdQuery <DriverReadModel>(id), token); return(result); }
public PhysicalDeviceVulkan12Properties ( StructureType sType = StructureType.PhysicalDeviceVulkan12Properties, void *pNext = default, DriverId driverID = default, ConformanceVersion conformanceVersion = default, ShaderFloatControlsIndependence denormBehaviorIndependence = default, ShaderFloatControlsIndependence roundingModeIndependence = default, Bool32 shaderSignedZeroInfNanPreserveFloat16 = default, Bool32 shaderSignedZeroInfNanPreserveFloat32 = default, Bool32 shaderSignedZeroInfNanPreserveFloat64 = default, Bool32 shaderDenormPreserveFloat16 = default, Bool32 shaderDenormPreserveFloat32 = default, Bool32 shaderDenormPreserveFloat64 = default, Bool32 shaderDenormFlushToZeroFloat16 = default, Bool32 shaderDenormFlushToZeroFloat32 = default, Bool32 shaderDenormFlushToZeroFloat64 = default, Bool32 shaderRoundingModeRtefloat16 = default, Bool32 shaderRoundingModeRtefloat32 = default, Bool32 shaderRoundingModeRtefloat64 = default, Bool32 shaderRoundingModeRtzfloat16 = default, Bool32 shaderRoundingModeRtzfloat32 = default, Bool32 shaderRoundingModeRtzfloat64 = default, uint maxUpdateAfterBindDescriptorsInAllPools = default, Bool32 shaderUniformBufferArrayNonUniformIndexingNative = default, Bool32 shaderSampledImageArrayNonUniformIndexingNative = default, Bool32 shaderStorageBufferArrayNonUniformIndexingNative = default, Bool32 shaderStorageImageArrayNonUniformIndexingNative = default, Bool32 shaderInputAttachmentArrayNonUniformIndexingNative = default, Bool32 robustBufferAccessUpdateAfterBind = default, Bool32 quadDivergentImplicitLod = default, uint maxPerStageDescriptorUpdateAfterBindSamplers = default, uint maxPerStageDescriptorUpdateAfterBindUniformBuffers = default, uint maxPerStageDescriptorUpdateAfterBindStorageBuffers = default, uint maxPerStageDescriptorUpdateAfterBindSampledImages = default, uint maxPerStageDescriptorUpdateAfterBindStorageImages = default, uint maxPerStageDescriptorUpdateAfterBindInputAttachments = default, uint maxPerStageUpdateAfterBindResources = default, uint maxDescriptorSetUpdateAfterBindSamplers = default, uint maxDescriptorSetUpdateAfterBindUniformBuffers = default, uint maxDescriptorSetUpdateAfterBindUniformBuffersDynamic = default, uint maxDescriptorSetUpdateAfterBindStorageBuffers = default, uint maxDescriptorSetUpdateAfterBindStorageBuffersDynamic = default, uint maxDescriptorSetUpdateAfterBindSampledImages = default, uint maxDescriptorSetUpdateAfterBindStorageImages = default, uint maxDescriptorSetUpdateAfterBindInputAttachments = default, ResolveModeFlags supportedDepthResolveModes = default, ResolveModeFlags supportedStencilResolveModes = default, Bool32 independentResolveNone = default, Bool32 independentResolve = default, Bool32 filterMinmaxSingleComponentFormats = default, Bool32 filterMinmaxImageComponentMapping = default, ulong maxTimelineSemaphoreValueDifference = default, SampleCountFlags framebufferIntegerColorSampleCounts = default ) { SType = sType; PNext = pNext; DriverID = driverID; ConformanceVersion = conformanceVersion; DenormBehaviorIndependence = denormBehaviorIndependence; RoundingModeIndependence = roundingModeIndependence; ShaderSignedZeroInfNanPreserveFloat16 = shaderSignedZeroInfNanPreserveFloat16; ShaderSignedZeroInfNanPreserveFloat32 = shaderSignedZeroInfNanPreserveFloat32; ShaderSignedZeroInfNanPreserveFloat64 = shaderSignedZeroInfNanPreserveFloat64; ShaderDenormPreserveFloat16 = shaderDenormPreserveFloat16; ShaderDenormPreserveFloat32 = shaderDenormPreserveFloat32; ShaderDenormPreserveFloat64 = shaderDenormPreserveFloat64; ShaderDenormFlushToZeroFloat16 = shaderDenormFlushToZeroFloat16; ShaderDenormFlushToZeroFloat32 = shaderDenormFlushToZeroFloat32; ShaderDenormFlushToZeroFloat64 = shaderDenormFlushToZeroFloat64; ShaderRoundingModeRtefloat16 = shaderRoundingModeRtefloat16; ShaderRoundingModeRtefloat32 = shaderRoundingModeRtefloat32; ShaderRoundingModeRtefloat64 = shaderRoundingModeRtefloat64; ShaderRoundingModeRtzfloat16 = shaderRoundingModeRtzfloat16; ShaderRoundingModeRtzfloat32 = shaderRoundingModeRtzfloat32; ShaderRoundingModeRtzfloat64 = shaderRoundingModeRtzfloat64; MaxUpdateAfterBindDescriptorsInAllPools = maxUpdateAfterBindDescriptorsInAllPools; ShaderUniformBufferArrayNonUniformIndexingNative = shaderUniformBufferArrayNonUniformIndexingNative; ShaderSampledImageArrayNonUniformIndexingNative = shaderSampledImageArrayNonUniformIndexingNative; ShaderStorageBufferArrayNonUniformIndexingNative = shaderStorageBufferArrayNonUniformIndexingNative; ShaderStorageImageArrayNonUniformIndexingNative = shaderStorageImageArrayNonUniformIndexingNative; ShaderInputAttachmentArrayNonUniformIndexingNative = shaderInputAttachmentArrayNonUniformIndexingNative; RobustBufferAccessUpdateAfterBind = robustBufferAccessUpdateAfterBind; QuadDivergentImplicitLod = quadDivergentImplicitLod; MaxPerStageDescriptorUpdateAfterBindSamplers = maxPerStageDescriptorUpdateAfterBindSamplers; MaxPerStageDescriptorUpdateAfterBindUniformBuffers = maxPerStageDescriptorUpdateAfterBindUniformBuffers; MaxPerStageDescriptorUpdateAfterBindStorageBuffers = maxPerStageDescriptorUpdateAfterBindStorageBuffers; MaxPerStageDescriptorUpdateAfterBindSampledImages = maxPerStageDescriptorUpdateAfterBindSampledImages; MaxPerStageDescriptorUpdateAfterBindStorageImages = maxPerStageDescriptorUpdateAfterBindStorageImages; MaxPerStageDescriptorUpdateAfterBindInputAttachments = maxPerStageDescriptorUpdateAfterBindInputAttachments; MaxPerStageUpdateAfterBindResources = maxPerStageUpdateAfterBindResources; MaxDescriptorSetUpdateAfterBindSamplers = maxDescriptorSetUpdateAfterBindSamplers; MaxDescriptorSetUpdateAfterBindUniformBuffers = maxDescriptorSetUpdateAfterBindUniformBuffers; MaxDescriptorSetUpdateAfterBindUniformBuffersDynamic = maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; MaxDescriptorSetUpdateAfterBindStorageBuffers = maxDescriptorSetUpdateAfterBindStorageBuffers; MaxDescriptorSetUpdateAfterBindStorageBuffersDynamic = maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; MaxDescriptorSetUpdateAfterBindSampledImages = maxDescriptorSetUpdateAfterBindSampledImages; MaxDescriptorSetUpdateAfterBindStorageImages = maxDescriptorSetUpdateAfterBindStorageImages; MaxDescriptorSetUpdateAfterBindInputAttachments = maxDescriptorSetUpdateAfterBindInputAttachments; SupportedDepthResolveModes = supportedDepthResolveModes; SupportedStencilResolveModes = supportedStencilResolveModes; IndependentResolveNone = independentResolveNone; IndependentResolve = independentResolve; FilterMinmaxSingleComponentFormats = filterMinmaxSingleComponentFormats; FilterMinmaxImageComponentMapping = filterMinmaxImageComponentMapping; MaxTimelineSemaphoreValueDifference = maxTimelineSemaphoreValueDifference; FramebufferIntegerColorSampleCounts = framebufferIntegerColorSampleCounts; }
private void AuthorizationDenied() { string currentTime = string.Format("{0:dd/MM/yyyy hh:mm:ss}", DateTime.Now); if (AppVars.objPolicyConfiguration.MapType.ToInt() == 1) { if (AppVars.objPolicyConfiguration.IsListenAll.ToBool()) { // For Google Map Use Socket To Send/Receive Data General.SendMessageToPDA("request pda=" + DriverId + "=" + DriverNo + "=logout auth status>>no>>" + DriverId + ">>" + currentTime + "=10", DriverId.ToString()); } else { // For Map Point Use GCM to Send Data // General.SendGCMMessage("auth status=no=" + this.DriverId, this.ObjBooking.Fleet_Driver.DeviceId); } } else { if (AppVars.objPolicyConfiguration.IsListenAll.ToBool()) { // For Google Map Use Socket To Send/Receive Data General.SendMessageToPDA("request pda=" + DriverId + "=" + DriverNo + "=logout auth status>>no>>" + DriverId + ">>" + currentTime + "=10", DriverId.ToString()); } else { // For Map Point Use GCM to Send Data // General.SendGCMMessage("auth status=no=" + this.DriverId, this.ObjBooking.Fleet_Driver.DeviceId); } } }