BEGroup.Utility.IniFile.GetValue C# (CSharp) Method

GetValue() public method

Gets the value with the specified section and the specified key.
public GetValue ( string section, string key ) : string
section string Section name
key string Key name
return string
        public string GetValue(string section, string key)
        {
            if (!ContainsKey(section, key)) return null;
            return _content[section][key];
        }

Usage Example

Beispiel #1
0
            /// <summary>
            /// Loads all custom vehicles
            /// </summary>
            public static void LoadCustomVehicles()
            {
                CustomVehicles = new List<CustomVehicle>();
                if (!File.Exists(CONFIG_FILE_CUSTOM_VEHICLES)) return;

                IniFile ini = new IniFile(CONFIG_FILE_CUSTOM_VEHICLES);
                int count = 0; if (!int.TryParse(ini.GetValue(CONFIG_CV, CONFIG_CV_COUNT), out count)) count = 0;
                if (count <= 0) return;

                CustomVehicles.Capacity = count;

                for (int i = 0; i < count; i++)
                {
                    string data = ini.GetValue(CONFIG_CV, Utils.FormatML(CONFIG_CV_ITEM, i + 1));
                    CustomVehicle cv = CustomVehicle.Deserialize(data);
                    if (cv != null)
                    {
                        CustomVehicles.Add(cv);
                    }
                }

                CustomVehicles.Sort();
            }
All Usage Examples Of BEGroup.Utility.IniFile::GetValue