ReadIni() public méthode

public ReadIni ( Nini.Ini.IniReader r ) : void
r Nini.Ini.IniReader
Résultat void
Exemple #1
0
        /// <summary>
        /// Load control bindings from an arbitrary stream.
        /// If there are already bindings, the new ones will be added.
        /// New bindings overwrite old bindings.
        /// </summary>
        /// <param name="file">The source of the INI data</param>
        public void LoadConfiguration(Stream file)
        {
            using (IniReader r = new IniReader(file))
            {
                while (true)
                {
                    if (r.Type != IniType.Section)
                    {
                        if (!r.MoveToNextSection())
                        {
                            break;
                        }
                    }
                    String[] parts = r.Name.Split(' ');
                    if (parts[0] == "KeyBindings")
                    {
                        if (parts.Length > 1)
                        {
                            ControlState cs = rootcstate.GetChild(parts[1], true);
                            cs.ReadIni(r);
                        }
                        else
                        {
                            rootcstate.ReadIni(r);
                        }
                    }

                    /*else if (parts[0] == "MouseButtons")
                     * {
                     * }*/
                    else if (parts[0] == "WindowEvents")
                    {
                        while (r.Read())
                        {
                            if (r.Type == IniType.Section)
                            {
                                break;
                            }

                            if (r.Type == IniType.Key)
                            {
                                winEvents[r.Name] = r.Value;
                            }
                        }
                    }
                    else
                    {
                        r.MoveToNextSection();
                    }
                }
            }
        }