Пример #1
0
        internal static string GetBinarySettingValueName(SettingMeta meta, byte[] binaryValue)
        {
            var settingValue = meta.BinaryValues?
                               .FirstOrDefault(x => x.Value.Equals(binaryValue));

            return(settingValue == null?GetBinaryString(binaryValue) : settingValue.ValueName);
        }
Пример #2
0
        internal static string GetDwordSettingValueName(SettingMeta meta, uint dwordValue)
        {
            var settingValue = meta.DwordValues
                               .FirstOrDefault(x => x.Value.Equals(dwordValue));

            return(settingValue == null?GetDwordString(dwordValue) : settingValue.ValueName);
        }
Пример #3
0
        internal static string GetStringSettingValueName(SettingMeta meta, string stringValue)
        {
            var settingValue = meta.StringValues
                               .FirstOrDefault(x => x.Value.Equals(stringValue));

            return(settingValue == null ? stringValue : settingValue.ValueName);
        }
        private SettingMeta PostProcessMeta(uint settingId, SettingMeta settingMeta, SettingViewMode viewMode)
        {
            var newMeta = new SettingMeta()
            {
                DefaultDwordValue  = settingMeta.DefaultDwordValue,
                DefaultStringValue = settingMeta.DefaultStringValue,
                SettingName        = settingMeta.SettingName,
                SettingType        = settingMeta.SettingType,
                GroupName          = settingMeta.GroupName,
            };

            if (string.IsNullOrEmpty(newMeta.SettingName))
            {
                newMeta.SettingName = string.Format("0x{0:X8}", settingId);
            }

            var allowedSourcesForViewMode = GetAllowedSettingValueMetaSourcesForViewMode(viewMode);

            if (settingMeta.DwordValues != null)
            {
                newMeta.DwordValues = settingMeta.DwordValues
                                      .Where(x => allowedSourcesForViewMode.Contains(x.ValueSource)).ToList();
            }

            if (settingMeta.StringValues != null)
            {
                newMeta.StringValues = settingMeta.StringValues
                                       .Where(x => allowedSourcesForViewMode.Contains(x.ValueSource)).ToList();
            }

            return(newMeta);
        }
Пример #5
0
        internal static string ParseStringSettingValue(SettingMeta meta, string text)
        {
            var valueByName = meta.StringValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));

            if (valueByName != null)
            {
                return(valueByName.Value);
            }

            return(text);
        }
Пример #6
0
        internal static uint ParseDwordSettingValue(SettingMeta meta, string text)
        {
            var valueByName = meta.DwordValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));

            if (valueByName != null)
            {
                return(valueByName.Value);
            }

            return(ParseDwordByInputSafe(text));
        }
Пример #7
0
        internal static byte[] ParseBinarySettingValue(SettingMeta meta, string text)
        {
            var valueByName = meta.BinaryValues.FirstOrDefault(x => x.ValueName != null && x.ValueName.Equals(text));

            if (valueByName != null)
            {
                return(valueByName.Value);
            }

            return(ParseBinaryByInputSafe(text));
        }
Пример #8
0
        private SettingMeta CreateSettingMeta(uint settingId)
        {
            var settingType = GetSettingValueType(settingId);
            var settingName = GetSettingName(settingId);
            var groupName   = GetGroupName(settingId);

            if (groupName == null)
            {
                groupName = GetLegacyGroupName(settingId, settingName);
            }



            var result = new SettingMeta()
            {
                SettingType = settingType,
                SettingName = settingName,
                GroupName   = groupName,

                IsApiExposed = GetIsApiExposed(settingId),

                DefaultDwordValue =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
                    ? GetDwordDefaultValue(settingId) : 0,

                DefaultStringValue =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
                    ? GetStringDefaultValue(settingId) : null,

                DefaultBinaryValue =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE
                    ? GetBinaryDefaultValue(settingId) : null,

                DwordValues =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_DWORD_TYPE
                    ? GetDwordValues(settingId) : null,

                StringValues =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_WSTRING_TYPE
                    ? GetStringValues(settingId) : null,

                BinaryValues =
                    settingType == NVDRS_SETTING_TYPE.NVDRS_BINARY_TYPE
                    ? GetBinaryValues(settingId) : null,
            };

            return(result);
        }