ToFile() public method

Obtain credentials to a file. If the filename is not supplied then the path used when reading in the credentials will be used, or the default path of Constants.Data_DIR\credentials.json will be used
public ToFile ( string filename = null ) : void
filename string
return void
 /// <summary>
 /// Log out of the companion API and remove local credentials
 /// </summary>
 public void Logout()
 {
     // Remove everything other than the local email address
     Credentials = CompanionAppCredentials.FromFile();
     Credentials.machineToken = null;
     Credentials.machineId    = null;
     Credentials.appId        = null;
     Credentials.password     = null;
     Credentials.ToFile();
     CurrentState = State.NEEDS_LOGIN;
 }
        // Obtain a response, ensuring that we obtain the response's cookies
        private HttpWebResponse GetResponse(HttpWebRequest request)
        {
            Logging.Debug("Entered");
            Logging.Debug("Requesting " + request.RequestUri);

            HttpWebResponse response;

            try
            {
                response = (HttpWebResponse)request.GetResponse();
            }
            catch (WebException wex)
            {
                Logging.Warn("Failed to obtain response, error code " + wex.Status);
                return(null);
            }
            Logging.Debug("Response is " + JsonConvert.SerializeObject(response));
            UpdateCredentials(response);
            Credentials.ToFile();

            Logging.Debug("Leaving");
            return(response);
        }