public void SaveProfile() { if (_setReference != null) { _setReference.FindSetting("Path").Set(_path); _setReference.FindSetting("Executable").Set(_executable); _setReference.FindSet("Startup Sequence").Remove(); _setReference.AddSet("Startup Sequence"); foreach (string sequencename in _startupSequence.Keys) { _setReference.FindSet("Startup Sequence").AddSetting(sequencename, _startupSequence[sequencename]); } } else { _parentSet.AddSet(_profileName); _setReference = _parentSet.FindSet(_profileName); _setReference.AddSetting("Path", _path); _setReference.AddSetting("Executable", _executable); _setReference.AddSet("Startup Sequence"); foreach (string sequencename in _startupSequence.Keys) { _setReference.FindSet("Startup Sequence").AddSetting(sequencename, _startupSequence[sequencename]); } } }