/// <summary> /// Returns a value indicating whether the specified bit is enabled. /// </summary> /// <param name="value">Reference value.</param> /// <param name="bit">Bit to check.</param> /// <returns> /// <b>true</b> if specified <paramref name="bit" /> is enabled; otherwise, <b>false</b>. /// </returns> public static bool CheckBit(this long value, Bits bit) { SentinelHelper.IsEnumValid(bit); SentinelHelper.IsTrue((byte)bit > 63); return(value.CheckBit((byte)bit)); }
/// <summary> /// Returns the specified byte. /// </summary> /// <param name="value">Reference value.</param> /// <param name="onebyte">Byte to retrieve.</param> /// <returns></returns> public static byte GetByte(this int value, Bytes onebyte) { SentinelHelper.IsEnumValid(onebyte); SentinelHelper.IsTrue((byte)onebyte > (byte)Bytes.Byte03); return(value.GetByte((byte)onebyte)); }
/// <summary> /// Returns the current state of the specified bit. /// </summary> /// <param name="value">Reference value.</param> /// <param name="bit">Bit to check.</param> /// <returns> /// Returns <b>1</b> if specified bit is active; otherwise <b>0</b>. /// </returns> public static int GetBit(this int value, Bits bit) { SentinelHelper.IsEnumValid(bit); SentinelHelper.IsTrue((byte)bit > 31); return(value.GetBit((byte)bit)); }
/// <summary> /// Returns the specified byte. /// </summary> /// <param name="value">Reference value.</param> /// <param name="onebyte">Byte to retrieve.</param> /// <returns></returns> public static byte GetByte(this ushort value, Bytes onebyte) { SentinelHelper.IsEnumValid(onebyte); SentinelHelper.IsTrue((byte)onebyte > 1); return(value.GetByte((byte)onebyte)); }
/// <summary> /// Returns the current state of the specified bit. /// </summary> /// <param name="value">Reference value.</param> /// <param name="bit">Bit to retrieve.</param> /// <returns> /// Returns <b>1</b> if specified bit is active; otherwise <b>0</b>. /// </returns> public static byte GetBit(this ulong value, Bits bit) { SentinelHelper.IsEnumValid(bit); SentinelHelper.IsTrue((byte)bit > 63); return(value.GetBit((byte)bit)); }
/// <summary> /// Returns the information about specified resolution /// </summary> /// <param name="value">Chart resolution</param> /// <returns> /// A <see cref="ResolutionInformation"/> instance that contains the information about specified resolution. /// </returns> public static ResolutionInformation GetInformationFrom(KnownChartResolution value) { SentinelHelper.IsEnumValid(value); var type = value.GetType(); var field = type.GetField(value.ToString()); if (field == null) { return(null); } var attr = GetCustomAttribute(field, typeof(ScreenResolutionAttribute)) as ScreenResolutionAttribute; if (attr != null) { return(new ResolutionInformation { Size = attr.Size, Name = attr.Name, Width = attr.Width, Resolution = value, Height = attr.Height, AspectRatio = attr.AspectRatio, AspectRatioNormalized = attr.AspectRatioNormalized, AspectRatioValue = attr.AspectRatioValue }); } return(null); }
/// <summary> /// Returns index in the enum type. /// </summary> /// <param name="item">Target item.</param> /// <returns> /// Index in the enum type. /// </returns> public static int IndexOf(this KnownWidthLineStyle item) { SentinelHelper.IsEnumValid(item); var enumArray = (KnownWidthLineStyle[])Enum.GetValues(typeof(KnownWidthLineStyle)); return(Array.IndexOf(enumArray, item)); }
/// <summary> /// Determines whether the element with the specified key is in the collection. /// </summary> /// <param name="valueKey">One of the values of <see cref="SmbiosStructure" /> that represents the key of the object <see cref="DmiStructure" /> to search.</param> /// <returns> /// <b>true</b> if the object <see cref="DmiStructure" /> with the <paramref name="valueKey"/> is in the collection; otherwise, it is <b>false</b>. /// </returns> /// <exception cref="InvalidEnumArgumentException"></exception> public bool Contains(SmbiosStructure valueKey) { bool knownBlockValid = SentinelHelper.IsEnumValid(valueKey, true); if (!knownBlockValid) { throw new InvalidEnumArgumentException(nameof(valueKey), (int)valueKey, typeof(SmbiosStructure)); } DmiStructure block = Items.FirstOrDefault(item => item.Class == valueKey); return(Items.Contains(block)); }
/// <summary> /// Converter for <see cref="MiniChartEmptyValuesAs"/> enumeration type to <see cref="eDispBlanksAs" />. /// </summary> /// <param name="reference">How to draw an empty values.</param> /// <returns> /// A <see cref="eDispBlanksAs"/> value. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eDispBlanksAs ToEppeDisplayBlanksAs(this MiniChartEmptyValuesAs reference) { SentinelHelper.IsEnumValid(reference); switch (reference) { case MiniChartEmptyValuesAs.Connect: return(eDispBlanksAs.Span); case MiniChartEmptyValuesAs.Zero: return(eDispBlanksAs.Zero); default: return(eDispBlanksAs.Gap); } }
/// <summary> /// Converter for <see cref="MiniChartType" /> enumeration type to <see cref="eSparklineType"/>. /// </summary> /// <param name="type">Mini-chart type.</param> /// <returns> /// A <see cref="eSparklineType" /> value. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eSparklineType ToEppeSparklineType(this MiniChartType type) { SentinelHelper.IsEnumValid(type); switch (type) { case MiniChartType.Line: return(eSparklineType.Line); case MiniChartType.WinLoss: return(eSparklineType.Stacked); default: return(eSparklineType.Column); } }
/// <summary> /// Converter for <see cref="KnownHorizontalAlignment"/> enumeration type to string representation. /// </summary> /// <param name="alignment">Alignment from model.</param> /// <returns> /// Alignment as string. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static string ToEppLabelAlignmentString(this KnownHorizontalAlignment alignment) { SentinelHelper.IsEnumValid(alignment); switch (alignment) { case KnownHorizontalAlignment.Left: return("l"); case KnownHorizontalAlignment.Right: return("r"); default: return("ctr"); } }
/// <summary> /// Converter for <see cref="T:iTin.Export.Model.KnownWidthLineStyle"/> enumeration type to integer value. /// </summary> /// <param name="borderWeight">Width line style from model.</param> /// <returns> /// An integer value than represents border width. /// </returns> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static int ToEppBorderWidth(this KnownWidthLineStyle borderWeight) { SentinelHelper.IsEnumValid(borderWeight); switch (borderWeight) { case KnownWidthLineStyle.Medium: return(2); case KnownWidthLineStyle.Thick: return(4); default: return(1); } }
/// <summary> /// Returns the value of attribute of type <see cref="ScreenResolutionAttribute"/> for this enum value. /// If this attribute is not defined returns <b>null</b> (<b>Nothing</b> in Visual Basic) /// </summary> /// <param name="value">Target enum value.</param> /// <returns> /// A <see cref="ResolutionInformation"/> that contains the value of attribute. /// </returns> public static ResolutionInformation GetResolutionInformation(this KnownChartResolution value) { SentinelHelper.IsEnumValid(value); var type = value.GetType(); var field = type.GetField(value.ToString()); if (field == null) { return(null); } var attr = Attribute.GetCustomAttribute(field, typeof(ScreenResolutionAttribute)) as ScreenResolutionAttribute; return(attr != null ? ScreenResolutionAttribute.GetInformationFrom(value) : null); }
/// <summary> /// Returns a value indicating whether the specified bit is enabled. /// </summary> /// <param name="value">Reference value.</param> /// <param name="bit">Bit to check.</param> /// <returns> /// <b>true</b> if specified <paramref name="bit" /> is enabled; otherwise, <b>false</b>. /// </returns> public static bool CheckBit(this ushort value, Bits bit) { Logger.Instance.Debug(""); Logger.Instance.Debug(" Assembly: iTin.Core, Namespace: iTin.Core, Class: ByteArrayExtensions"); Logger.Instance.Debug(" Returns a value indicating whether the specified bit is enabled"); Logger.Instance.Debug($" > Signature: ({typeof(bool)}) CheckBit(this {typeof(ushort)}, {typeof(Bits)})"); Logger.Instance.Debug($" > value: {value}"); SentinelHelper.IsEnumValid(bit); SentinelHelper.IsTrue((byte)bit > 15); Logger.Instance.Debug($" > bit: {bit}"); bool result = value.CheckBit((byte)bit); Logger.Instance.Info($" > Output: {result}"); return(result); }
/// <summary> /// Returns the current state of the specified bit. /// </summary> /// <param name="value">Reference value.</param> /// <param name="bit">Bit to check.</param> /// <returns> /// Returns <b>1</b> if specified bit is active; otherwise <b>0</b>. /// </returns> public static byte GetBit(this ushort value, Bits bit) { Logger.Instance.Debug(""); Logger.Instance.Debug(" Assembly: iTin.Core, Namespace: iTin.Core, Class: ByteArrayExtensions"); Logger.Instance.Debug(" Returns the current state of the specified bit"); Logger.Instance.Debug($" > Signature: ({typeof(byte)}) GetBit(this {typeof(ushort)}, {typeof(Bits)})"); Logger.Instance.Debug($" > value: {value}"); SentinelHelper.IsEnumValid(bit); SentinelHelper.IsTrue((byte)bit > 15); Logger.Instance.Debug($" > bit: {bit}"); byte result = value.GetBit((byte)bit); Logger.Instance.Info($" > Output: {result}"); return(result); }
/// <summary> /// Converter for <see cref="TextOrientation"/> enumeration type to angle degree. /// </summary> /// <param name="orientation">Orientation style from model.</param> /// <returns> /// Orientation as angle in degrees. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static float ToAngle(this TextOrientation orientation) { SentinelHelper.IsEnumValid(orientation); switch (orientation) { case TextOrientation.Upward: return(270); case TextOrientation.Horizontal: return(0); case TextOrientation.Vertical: return(0); default: return(90); } }
/// <summary> /// Converter for <see cref="T:iTin.Export.Model.KnownLabelPosition" /> enumeration type to <see cref="T:OfficeOpenXml.Drawing.Chart.eTickLabelPosition" />. /// </summary> /// <param name="orientation">Position style from model.</param> /// <returns> /// A <see cref="T:OfficeOpenXml.Drawing.Chart.eTickLabelPosition" /> value. /// </returns> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eTickLabelPosition ToEppLabelPosition(this KnownLabelPosition orientation) { SentinelHelper.IsEnumValid(orientation); switch (orientation) { case KnownLabelPosition.None: return(eTickLabelPosition.None); case KnownLabelPosition.High: return(eTickLabelPosition.High); case KnownLabelPosition.NextToAxis: return(eTickLabelPosition.NextTo); default: return(eTickLabelPosition.Low); } }
/// <summary> /// Converter for <see cref="KnownAxisType"/> enumeration type to <see cref="KnownChartElement"/> enumeration. /// </summary> /// <param name="type">Axis type to converter.</param> /// <returns> /// A enumeration value than represents axis type. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static KnownChartElement ToKnownChartElement(this KnownAxisType type) { SentinelHelper.IsEnumValid(type); switch (type) { case KnownAxisType.PrimaryValueAxis: return(KnownChartElement.PrimaryValueAxisTitle); case KnownAxisType.SecondaryCategoryAxis: return(KnownChartElement.SecondaryCategoryAxisTitle); case KnownAxisType.SecondaryValueAxis: return(KnownChartElement.SecondaryValueAxisTitle); default: return(KnownChartElement.PrimaryCategoryAxisTitle); } }
/// <summary> /// Converter for <see cref="KnownHorizontalAlignment"/> enumeration type to <see cref="eTextAlignment"/>. /// </summary> /// <param name="alignment">Horizontal alignment.</param> /// <returns> /// A <see cref="eTextAlignment"/> value. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eTextAlignment ToEppTextHorizontalAlignment(this KnownHorizontalAlignment alignment) { SentinelHelper.IsEnumValid(alignment); switch (alignment) { case KnownHorizontalAlignment.Left: return(eTextAlignment.Left); case KnownHorizontalAlignment.Center: return(eTextAlignment.Center); case KnownHorizontalAlignment.Right: return(eTextAlignment.Right); default: return(eTextAlignment.Left); } }
/// <summary> /// Converter for <see cref="T:iTin.Export.Model.KnownTickMarkStyle"/> enumeration type to <see cref="T:OfficeOpenXml.Drawing.Chart.eAxisTickMark" />. /// </summary> /// <param name="style">Mark style from model.</param> /// <returns> /// A <see cref="T:OfficeOpenXml.Drawing.Chart.eAxisTickMark" /> value. /// </returns> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eAxisTickMark ToEppTickMark(this KnownTickMarkStyle style) { SentinelHelper.IsEnumValid(style); switch (style) { case KnownTickMarkStyle.None: return(eAxisTickMark.None); case KnownTickMarkStyle.Inside: return(eAxisTickMark.In); case KnownTickMarkStyle.Outside: return(eAxisTickMark.Out); default: return(eAxisTickMark.Cross); } }
/// <summary> /// Converter for <see cref="T:iTin.Export.Model.KnownLegendLocation"/> enumeration type to <see cref="T:OfficeOpenXml.Drawing.Chart.eLegendPosition"/>. /// </summary> /// <param name="location">Chart legend location</param> /// <returns> /// A <see cref="OfficeOpenXml.Drawing.Chart.eLegendPosition" /> value. /// </returns> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eLegendPosition ToEppLegendPosition(this KnownLegendLocation location) { SentinelHelper.IsEnumValid(location); switch (location) { case KnownLegendLocation.Top: return(eLegendPosition.Bottom); case KnownLegendLocation.Bottom: return(eLegendPosition.Bottom); case KnownLegendLocation.Left: return(eLegendPosition.Left); default: return(eLegendPosition.Right); } }
/// <summary> /// Gets the element with the specified key. /// </summary> /// <value> /// Object <see cref="DmiStructure" /> specified by its key. /// </value> /// <remarks> /// If the element does not exist, <b>null</b> is returned. /// </remarks> /// <exception cref="InvalidEnumArgumentException"></exception> public DmiStructure this[SmbiosStructure valueKey] { get { bool knownBlockValid = SentinelHelper.IsEnumValid(valueKey, true); if (!knownBlockValid) { throw new InvalidEnumArgumentException(nameof(valueKey), (int)valueKey, typeof(SmbiosStructure)); } int blockIndex = IndexOf(valueKey); if (blockIndex != -1) { return(this[blockIndex]); } return(null); } }
/// <summary> /// Adds major, minor or both grid lines to the specified axis. Not supported in <c>EPPlus</c> library. /// </summary> /// <param name="axis"><c>Xml</c> node than represent an axis definition.</param> /// <param name="model">A <see cref="GridLine"/> value from model.</param> /// <param name="documentHelper">Target xml document helper.</param> /// <exception cref="T:System.ArgumentNullException">If <paramref name="axis" /> is <c>null</c>.</exception> /// <exception cref="T:System.InvalidOperationException">If <paramref name="axis" /> is not an axis.</exception> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static void AddAxisGridLinesMode(this XmlNode axis, GridLine model, IXmlHelper documentHelper) { SentinelHelper.ArgumentNull(axis, nameof(axis)); SentinelHelper.IsEnumValid(model); SentinelHelper.IsFalse(axis.Name.Contains("catAx") || axis.Name.Contains("valAx") || axis.Name.Contains("dateAx"), "Imposible extraer tipo. el nodo no es de tipo eje"); var existMajorGridLinesNode = documentHelper.TryGetElementFrom(axis, "c:majorGridlines", out var majorGridLinesElement); if (existMajorGridLinesNode) { var parent = majorGridLinesElement.ParentNode; parent.RemoveChild(majorGridLinesElement); } var existMinorGridLinesNode = documentHelper.TryGetElementFrom(axis, "c:minorGridlines", out var minorGridLinesElement); if (existMinorGridLinesNode) { var parent = minorGridLinesElement.ParentNode; parent.RemoveChild(minorGridLinesElement); } switch (model) { case GridLine.None: break; case GridLine.Major: axis.AppendChild(majorGridLinesElement); break; case GridLine.Minor: axis.AppendChild(minorGridLinesElement); break; case GridLine.Both: axis.AppendChild(majorGridLinesElement); axis.AppendChild(minorGridLinesElement); break; } }
/// <summary> /// Converter for <see cref="KnownLineStyle"/> enumeration type to <see cref="eLineStyle"/>. /// </summary> /// <param name="style">Line style from model.</param> /// <returns> /// A <see cref="eLineStyle"/> value. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eLineStyle ToEppLineStyle(this KnownLineStyle style) { SentinelHelper.IsEnumValid(style); switch (style) { case KnownLineStyle.Dash: return(eLineStyle.Dash); case KnownLineStyle.DashDot: return(eLineStyle.DashDot); case KnownLineStyle.DashDotDot: return(eLineStyle.SystemDashDotDot); case KnownLineStyle.Dot: return(eLineStyle.Dot); default: return(eLineStyle.Solid); } }
/// <summary> /// Converter for <see cref="LabelOrientation"/> enumeration type to angle degree. /// </summary> /// <param name="orientation">Orientation style from model.</param> /// <returns> /// Orientation as angle in degrees. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static float ToAngle(this LabelOrientation orientation) { SentinelHelper.IsEnumValid(orientation); switch (orientation) { case LabelOrientation.Upward: return(-5400000); case LabelOrientation.Downward: return(5400000); case LabelOrientation.Vertical: return(0); case LabelOrientation.Horizontal: return(0); default: return(0); } }
/// <summary> /// Returns the index of the object with the key specified in the collection /// </summary> /// <param name="valueKey">One of the values of <see cref="SmbiosStructure" /> that represents the key of the object to be searched in the collection.</param> /// <returns> /// Zero-base index of the first appearance of the item in the collection, if found; otherwise, -1. /// </returns> /// <exception cref="InvalidEnumArgumentException"></exception> public int IndexOf(SmbiosStructure valueKey) { bool knownBlockValid = SentinelHelper.IsEnumValid(valueKey, true); if (!knownBlockValid) { throw new InvalidEnumArgumentException(nameof(valueKey), (int)valueKey, typeof(SmbiosStructure)); } DmiStructure block = null; foreach (var item in Items) { if (item.Class != valueKey) { continue; } block = item; break; } return(IndexOf(block)); }
/// <summary> /// Converter for <see cref="KnownDocumentSize"/> enumeration type to <see cref="ePaperSize"/>. /// </summary> /// <param name="paper">Paper size value from model.</param> /// <returns> /// A <see cref="ePaperSize" /> value. /// </returns> /// <exception cref="T:System.ComponentModel.InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static ePaperSize ToEppPaperSize(this KnownDocumentSize paper) { SentinelHelper.IsEnumValid(paper); var paperSize = ePaperSize.A4; switch (paper) { case KnownDocumentSize.A0: break; case KnownDocumentSize.A1: break; case KnownDocumentSize.A2: paperSize = ePaperSize.A2; break; case KnownDocumentSize.A3: paperSize = ePaperSize.A3; break; case KnownDocumentSize.A5: paperSize = ePaperSize.A5; break; case KnownDocumentSize.A6: break; case KnownDocumentSize.A7: break; case KnownDocumentSize.A8: break; case KnownDocumentSize.A9: break; case KnownDocumentSize.A10: break; case KnownDocumentSize.Executive: break; case KnownDocumentSize.HalfLetter: break; case KnownDocumentSize.Letter: paperSize = ePaperSize.Letter; break; case KnownDocumentSize.Note: paperSize = ePaperSize.Note; break; case KnownDocumentSize.PostCard: break; } return(paperSize); }
/// <summary> /// Returns a value than represents a known node. /// </summary> /// <param name="element">A <see cref="KnownChartElement"/> value.</param> /// <returns> /// <see cref="XmlNode"/> reference that contains <c>Xml</c> node. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public XmlNode FromKnownChartElement(KnownChartElement element) { SentinelHelper.IsEnumValid(element); XmlNode knownRootNode = null; switch (element) { case KnownChartElement.Self: knownRootNode = GetXmlNode(ChartSpaceRootNode); break; case KnownChartElement.Legend: knownRootNode = GetXmlNode(ChartLegendRootNode); break; case KnownChartElement.PlotArea: knownRootNode = GetXmlNode(ChartPlotAreaRootNode); break; case KnownChartElement.ChartTitle: knownRootNode = GetXmlNode(ChartTitleRootNode); break; case KnownChartElement.PrimaryCategoryAxis: knownRootNode = GetElementsByTagName("c:catAx").ToList()[0]; break; case KnownChartElement.PrimaryValueAxis: knownRootNode = GetElementsByTagName("c:valAx").ToList()[0]; break; case KnownChartElement.SecondaryCategoryAxis: var catAxisXmlList = GetElementsByTagName("c:catAx").ToList(); SentinelHelper.IsTrue(catAxisXmlList.Count <= 1, "Error the secondary axis does not exist"); knownRootNode = catAxisXmlList[1]; break; case KnownChartElement.SecondaryValueAxis: var valAxisXmlList = GetElementsByTagName("c:valAx").ToList(); SentinelHelper.IsTrue(valAxisXmlList.Count <= 1, "Error the secondary axis does not exist"); knownRootNode = valAxisXmlList[1]; break; case KnownChartElement.PrimaryCategoryAxisTitle: knownRootNode = GetXmlNode(GetElementsByTagName("c:catAx").ToList()[0], "c:title"); break; case KnownChartElement.PrimaryValueAxisTitle: knownRootNode = GetXmlNode(GetElementsByTagName("c:valAx").ToList()[0], "c:title"); break; case KnownChartElement.SecondaryCategoryAxisTitle: var catAxisXmlList1 = GetElementsByTagName("c:catAx").ToList(); SentinelHelper.IsTrue(catAxisXmlList1.Count <= 1, "Error the secondary axis does not exist"); knownRootNode = GetXmlNode(catAxisXmlList1[1], "c:title"); break; case KnownChartElement.SecondaryValueAxisTitle: var valAxisXmlList2 = GetElementsByTagName("c:valAx").ToList(); SentinelHelper.IsTrue(valAxisXmlList2.Count <= 1, "Error the secondary axis does not exist"); knownRootNode = GetXmlNode(valAxisXmlList2[1], "c:title"); break; } return(knownRootNode); }
/// <summary> /// Converter for <see cref="KnownDocumentOrientation"/> enumeration type to <see cref="eOrientation"/>. /// </summary> /// <param name="orientation">Orientation value from model.</param> /// <returns> /// A <see cref="eOrientation" /> value. /// </returns> /// <exception cref="InvalidEnumArgumentException">The value specified is outside the range of valid values.</exception> public static eOrientation ToEppOrientation(this KnownDocumentOrientation orientation) { SentinelHelper.IsEnumValid(orientation); return(orientation == KnownDocumentOrientation.Portrait ? eOrientation.Portrait : eOrientation.Landscape); }
/// <summary> /// Determines whether the specified key is a valid key of the <see cref="CeaSection"/> enumeration. /// </summary> /// <param name="value">Key to check</param> /// <returns> /// <b>true</b> if the value belongs to the enumeration <see cref="CeaSection"/>; otherwise, it is <b>false</b>. /// </returns> private static bool IsValidSection(CeaSection value) => SentinelHelper.IsEnumValid(value);