/// <summary> /// Parse a remote block from an existing configuration file. /// <para/> /// This constructor succeeds even if the requested remote is not defined /// within the supplied configuration file. If that occurs then there will be /// no URIs and no ref specifications known to the new instance. /// </summary> /// <param name="rc"> /// the existing configuration to get the remote settings from. /// The configuration must already be loaded into memory. /// </param> /// <param name="remoteName">subsection key indicating the name of this remote.</param> public RemoteConfig(Config rc, string remoteName) { if (rc == null) { throw new ArgumentNullException("rc"); } Name = remoteName; oldName = Name; string[] vlst = rc.getStringList(Section, Name, KeyUrl); URIs = new List <URIish>(vlst.Length); foreach (string s in vlst) { URIs.Add(new URIish(s)); } vlst = rc.getStringList(Section, Name, KeyPushurl); PushURIs = new List <URIish>(vlst.Length); foreach (string s in vlst) { PushURIs.Add(new URIish(s)); } vlst = rc.getStringList(Section, Name, KeyFetch); Fetch = new List <RefSpec>(vlst.Length); foreach (string s in vlst) { Fetch.Add(new RefSpec(s)); } vlst = rc.getStringList(Section, Name, KeyPush); Push = new List <RefSpec>(vlst.Length); foreach (string s in vlst) { Push.Add(new RefSpec(s)); } string val = rc.getString(Section, Name, KeyUploadpack) ?? DEFAULT_UPLOAD_PACK; UploadPack = val; val = rc.getString(Section, Name, KeyReceivepack) ?? DEFAULT_RECEIVE_PACK; ReceivePack = val; val = rc.getString(Section, Name, KeyTagopt); TagOpt = TagOpt.fromOption(val); Mirror = rc.getBoolean(Section, Name, KeyMirror, DefaultMirror); Timeout = rc.getInt(Section, Name, KeyTimeout, 0); }