/// <summary> /// Reads in Git's configuration files, parses them, and combines them into a single database. /// <para/> /// Returns the combined database of configuration data. /// </summary> /// <param name="directory">Optional working directory of a repository from which to read its Git local configuration.</param> /// <param name="loadLocal">Read, parse, and include Git local configuration values if `<see langword="true"/>`; otherwise do not.</param> /// <param name="loadSystem">Read, parse, and include Git system configuration values if `<see langword="true"/>`; otherwise do not.</param> public static Configuration ReadConfiuration(string directory, bool loadLocal, bool loadSystem) { if (string.IsNullOrWhiteSpace(directory)) { throw new ArgumentNullException("directory"); } if (!Directory.Exists(directory)) { throw new DirectoryNotFoundException(directory); } ConfigurationLevel types = ConfigurationLevel.All; if (!loadLocal) { types ^= ConfigurationLevel.Local; } if (!loadSystem) { types ^= ConfigurationLevel.System; } var config = new Configuration(); config.LoadGitConfiguration(directory, types); return(config); }