private static string Format(IDictionary<ObjectId, string> missingCommits) { StringBuilder r = new StringBuilder(); r.Append(JGitText.Get().missingPrerequisiteCommits); foreach (KeyValuePair<ObjectId, string> e in missingCommits.EntrySet()) { r.Append("\n "); r.Append(e.Key.Name); if (e.Value != null) { r.Append(" ").Append(e.Value); } } return r.ToString(); }
public static object Eval(string source, IDictionary<string, Scriptable> bindings) { Context cx = ContextFactory.GetGlobal().EnterContext(); try { Scriptable scope = cx.InitStandardObjects(); if (bindings != null) { foreach (KeyValuePair<string, Scriptable> entry in bindings.EntrySet()) { Scriptable @object = entry.Value; @object.SetParentScope(scope); scope.Put(entry.Key, scope, @object); } } return cx.EvaluateString(scope, source, "source", 1, null); } finally { Context.Exit(); } }
public void ReplaceDatabase(string databaseName, InputStream databaseStream, IDictionary <string, InputStream> attachmentStreams) { ReplaceDatabase(databaseName, databaseStream, attachmentStreams == null ? null : attachmentStreams.EntrySet().GetEnumerator()); }
/// <exception cref="System.IO.IOException"></exception> private HttpURLConnection Open(string method, string bucket, string key, IDictionary <string, string> args) { StringBuilder urlstr = new StringBuilder(); urlstr.Append("http://"); urlstr.Append(bucket); urlstr.Append('.'); urlstr.Append(DOMAIN); urlstr.Append('/'); if (key.Length > 0) { HttpSupport.Encode(urlstr, key); } if (!args.IsEmpty()) { Iterator<KeyValuePair<string, string>> i; urlstr.Append('?'); i = args.EntrySet().Iterator(); while (i.HasNext()) { KeyValuePair<string, string> e = i.Next(); urlstr.Append(e.Key); urlstr.Append('='); HttpSupport.Encode(urlstr, e.Value); if (i.HasNext()) { urlstr.Append('&'); } } } Uri url = new Uri(urlstr.ToString()); Proxy proxy = HttpSupport.ProxyFor(proxySelector, url); HttpURLConnection c; c = (HttpURLConnection)url.OpenConnection(proxy); c.SetRequestMethod(method); c.SetRequestProperty("User-Agent", "jgit/1.0"); c.SetRequestProperty("Date", HttpNow()); return c; }
public Header(IDictionary<string, IList<string>> map) : this() { // initialize fields foreach (KeyValuePair<string, IList<string>> next in map.EntrySet()) { string key = next.Key; IList<string> value = next.Value; List<string> linkedList = new List<string>(); foreach (string element in value) { linkedList.AddItem(element); props.AddItem(key); props.AddItem(element); } keyTable.Put(key, linkedList); } }
private string ReplaceUri(string uri, IDictionary<string, string> replacements) { if (replacements.IsEmpty()) { return uri; } KeyValuePair<string, string>? match = null; foreach (KeyValuePair<string, string> replacement in replacements.EntrySet()) { // Ignore current entry if not longer than previous match if (match != null && match.Value.Key.Length > replacement.Key.Length) { continue; } if (!uri.StartsWith(replacement.Key)) { continue; } match = replacement; } if (match != null) { return match.Value.Value + Sharpen.Runtime.Substring(uri, match.Value.Key.Length); } else { return uri; } }