Task TrackerPost(string queryString, MJDict body) { return(http.PostAsync(config["trackerBaseUrl"] + "/api" + queryString, new StringContent(MiniJson.ToString(body), Encoding.UTF8, "application/json") ).ContinueWith(c => { if (c.Exception != null) { AddMessage("Warning: Exception occurred while attempting to communicate with the tracker: " + c.Exception.ToString()); } }, TaskContinuationOptions.OnlyOnFaulted)); }
void LoadConfig() { string configFile = "appsettings.json"; try { config = MiniJson.Parse(File.ReadAllText(configFile)) as MJDict; } catch (FileNotFoundException) { config = new MJDict(); } }
// -- Maestro: Added 2nd parameter initConfig to set config from OCT/OST. public void Run(string[] args, Dictionary <string, object> initConfig = null) { foreach (var arg in args) { if (arg == "-v") { debug = true; } } // -- Maestro: See if we should use supplied config (OST/OCT) or load from disk (standalone). if (initConfig == null) { LoadConfig(); } else { config = initConfig; } Init(); MainLoop(); }