static public void DeleteCredentials(string cmdrname) { CompanionCredentials c = CompanionCredentials.FromFile(cmdrname); if (c != null) { c.Clear(); c.ToFile(); } }
static public bool SetDisabled(string cmdrname, bool disabled) { CompanionCredentials c = CompanionCredentials.FromFile(cmdrname); if (c != null && c.IsComplete) // only worth it if complete { c.disablelogin = disabled; c.ToFile(); // and write back return(true); } else { return(false); } }
// Obtain a response, ensuring that we obtain the response's cookies private HttpWebResponse GetResponse(HttpWebRequest request) { BaseUtils.HttpCom.WriteLog("Companion Requesting ", request.RequestUri.ToNullSafeString()); //Trace.WriteLine("Requesting " + request.RequestUri); HttpWebResponse response; try { response = (HttpWebResponse)request.GetResponse(); } catch (WebException wex) { Trace.WriteLine("Failed to obtain response, error code " + wex.Status); return(null); } BaseUtils.HttpCom.WriteLog("Companion Response ", JsonConvert.SerializeObject(response)); //Trace.WriteLine("Response is " + JsonConvert.SerializeObject(response)); UpdateCredentials(response); Credentials.ToFile(); return(response); }