Esempio n. 1
0
        public PythonAppConfigSection([NotNull] PythonAppConfigParams configParams, KeyValuePair <string, IniFileSection> pair, [CanBeNull] IniFileSection values)
            : base(pair.Value
                   .Where(x => !x.Key.StartsWith("__HINT"))
                   .Select(x => PythonAppConfigValue.Create(configParams, x,
                                                            pair.Value.Commentaries?.GetValueOrDefault(x.Key)?.Split('\n')[0],
                                                            values?.GetValueOrDefault(x.Key), values != null)).NonNull())
        {
            Key        = pair.Key;
            HintTop    = PrepareHint(pair.Value.GetNonEmpty("__HINT_TOP"));
            HintBottom = PrepareHint(pair.Value.GetNonEmpty("__HINT_BOTTOM"));

            var commentary = pair.Value.Commentary?.Split('\n')[0].Trim();

            if (commentary == @"hidden")
            {
                DisplayName = @"hidden";
            }
            else
            {
                var name = commentary ?? PythonAppConfig.ConvertKeyToName(pair.Key);

                var match = SectionName.Match(name);
                if (match.Success && match.Groups[2].Success && match.Groups[2].Length > 50)
                {
                    name    = PythonAppConfig.CapitalizeFirst(match.Groups[1].Value).Trim();
                    ToolTip = PythonAppConfig.CapitalizeFirst(match.Groups[2].Value).Trim();
                }

                DisplayName = PythonAppConfig.CapitalizeFirst(name);
            }
        }
Esempio n. 2
0
        public PythonAppConfigSection(KeyValuePair <string, IniFileSection> pair, [CanBeNull] IniFileSection values)
            : base(pair.Value.Select(x => PythonAppConfigValue.Create(x,
                                                                      pair.Value.Commentaries?.GetValueOrDefault(x.Key), values?.GetValueOrDefault(x.Key), values != null)))
        {
            Key = pair.Key;

            var commentary = pair.Value.Commentary;

            DisplayName = commentary?.Trim() ?? PythonAppConfig.ConvertKeyToName(pair.Key);
        }