コード例 #1
0
        public void AddConfigSection(ConfigSection configSection)
        {
            if (FindConfigSection(configSection) != null)
                throw new ArgumentException("Can not add a section that already exists: " + configSection.SectionName);

            ConfigSections.Add(configSection);
        }
コード例 #2
0
        public bool Equals(ConfigSection other)
        {
            StringComparison sc;
            if (SubSectionCaseSensitive)
                sc = StringComparison.Ordinal;
            else
                sc = StringComparison.OrdinalIgnoreCase;

            return string.Equals(SectionName, other.SectionName, StringComparison.OrdinalIgnoreCase) &&
                string.Equals(SubSection, other.SubSection, sc);
        }
コード例 #3
0
ファイル: ConfigFile.cs プロジェクト: dblock/gitextensions
        private ConfigSection FindOrCreateConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name);

            foreach (var configSection in _sections)
            {
                if (configSection.SectionName == configSectionToFind.SectionName &&
                    configSection.SubSection == configSectionToFind.SubSection)
                    return configSection;
            }
            _sections.Add(configSectionToFind);
            return configSectionToFind;
        }
コード例 #4
0
ファイル: ConfigFile.cs プロジェクト: dblock/gitextensions
        private ConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name);

            foreach (var configSection in _sections)
            {
                if (configSection.SectionName == configSectionToFind.SectionName &&
                    configSection.SubSection == configSectionToFind.SubSection)
                    return configSection;
            }
            return null;
        }
コード例 #5
0
ファイル: ConfigFile.cs プロジェクト: bergerjac/gitextensions
        public ConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name, true);

            return ConfigSections.FirstOrDefault(configSectionToFind.Equals);
        }
コード例 #6
0
ファイル: ConfigFile.cs プロジェクト: feinstaub/gitextensions
 private void NewSection()
 {
     _section = new ConfigSection(token.ToString(), false);
     _configFile.ConfigSections.Add(_section);
     token.Clear();
 }
コード例 #7
0
        public ConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name, true);

            return(ConfigSections.FirstOrDefault(configSectionToFind.Equals));
        }
コード例 #8
0
ファイル: ConfigFile.cs プロジェクト: slaut/gitextensions
        private ConfigSection FindOrCreateConfigSection(string name)
        {
            var result = FindConfigSection(name);
            if (result == null)
            {
                result = new ConfigSection(name, true);
                _sections.Add(result);
            }

            return result;
        }
コード例 #9
0
ファイル: ConfigFile.cs プロジェクト: Carbenium/gitextensions
 private ConfigSection FindConfigSection(ConfigSection configSectionToFind)
 {
     foreach (var configSection in ConfigSections)
     {
         if (configSectionToFind.Equals(configSection))
             return configSection;
     }
     return null;
 }
コード例 #10
0
ファイル: ConfigFile.cs プロジェクト: Carbenium/gitextensions
        public ConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name, true);

            return FindConfigSection(configSectionToFind);
        }
コード例 #11
0
 private void NewSection()
 {
     _section = new ConfigSection(token.ToString(), false);
     _configFile.ConfigSections.Add(_section);
     token.Clear();
 }
コード例 #12
0
ファイル: ConfigFile.cs プロジェクト: paviad/gitextensions
 public string GetPathValue(string setting)
 {
     return(ConfigSection.UnescapeString(GetStringValue(setting)));
 }
コード例 #13
0
ファイル: ConfigFile.cs プロジェクト: paviad/gitextensions
 public void AddPathValue(string setting, string value)
 {
     AddStringValue(setting, ConfigSection.EscapeString(value));
 }
コード例 #14
0
ファイル: ConfigFile.cs プロジェクト: paviad/gitextensions
 public void SetPathValue(string setting, string value)
 {
     SetStringValue(setting, ConfigSection.EscapeString(value));
 }
コード例 #15
0
ファイル: FormUpdates.cs プロジェクト: noamkfir/gitextensions
        public static ReleaseVersion FromSection(ConfigSection section)
        {
            Version ver;
            try
            {
                ver = new Version(section.SubSection);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e);
                return null;
            }

            return new ReleaseVersion()
            {
                Version = ver,
                ReleaseType = section.GetValue("ReleaseType"),
                DownloadPage = section.GetValue("DownloadPage")
            };
        }
コード例 #16
0
 public void SetPathValue(string setting, string value)
 {
     SetStringValue(setting, ConfigSection.FixPath(value));
 }
コード例 #17
0
ファイル: ConfigFile.cs プロジェクト: slaut/gitextensions
        private ConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name, true);

            foreach (var configSection in _sections)
            {
                if (configSectionToFind.Equals(configSection))
                    return configSection;
            }
            return null;
        }
コード例 #18
0
        public IConfigSection FindConfigSection(string name)
        {
            var configSectionToFind = new ConfigSection(name, true);

            return(FindConfigSection(configSectionToFind));
        }
コード例 #19
0
ファイル: ConfigFile.cs プロジェクト: slaut/gitextensions
        private void FindSections(IEnumerable<string> fileLines)
        {
            ConfigSection configSection = null;

            foreach (var line in fileLines)
            {
                var m = RegParseIsSection.Match(line);
                if (m.Success) //this line is a section
                {
                    var name = m.Groups["SectionName"].Value;

                    configSection = new ConfigSection(name, false);
                    _sections.Add(configSection);
                }
                else
                {
                    m = RegParseIsKey.Match(line);
                    if (m.Success) //this line is a key
                    {
                        var key = m.Groups["Key"].Value;
                        var value = m.Groups["Value"].Value;

                        if (configSection == null)
                            throw new Exception(
                                string.Format("Key {0} in configfile {1} is not in a section.", key, _fileName));

                        configSection.AddValue(key, value);
                    }
                }
            }
        }
コード例 #20
0
 public static void SetValueAsBool(this ConfigSection section, string name, bool value)
 {
     section.SetValue(name, value.ToString());
 }