/// <summary> /// Reads a collection of client settings from a file. /// </summary> /// <param name="filePath">Path to config file.</param> /// <param name="filterIndex">Dialog file type filter index (1 based).</param> public IEnumerable <ClientSettings> Read(string filePath, int filterIndex) { if (filePath == null) { throw new ArgumentNullException("filePath"); } Debug.Assert(filterIndex <= _settingsPlugins.Count()); var serializer = _settingsPlugins[filterIndex - 1].Interface; List <ClientSettings> settings = serializer.Deserialize(filePath); if (settings.Count != 0) { // update the settings plugin index only if something was loaded FilterIndex = filterIndex; FileName = filePath; } return(settings.AsReadOnly()); }