private void SetNewTokenAndSaveToFile(string newToken) { _tvdbInfo.Token = newToken; _tvdbInfo.TokenRetrievedDate = DateTime.Now; _tvdbInfo.SaveToFile(_tvdbInfoFilePath); Log.Information($"New token expires on {_tvdbInfo.GetExpiration().ToString("MM/dd/yyyy hh:mm tt")}"); Log.Information($"Saved authentication info to {_tvdbInfoFilePath}"); }
static void ReadTVDBInfo() { string filePath = GetTVDBInfoFilePath(); TVDBInfo tvdbInfo = TVDBInfo.ReadFromFile(filePath); tvdbInfo.TokenRetrievedDate = DateTime.Now.AddDays(-1); Console.WriteLine($"apiKey from TVDBInfo: {tvdbInfo.ApiKey}. DateTime: {tvdbInfo.TokenRetrievedDate}"); tvdbInfo.SaveToFile(filePath); }
static void SetNewTokenAndSaveToFile(ref TVDBInfo tvdbInfo, string token, string filePath) { tvdbInfo.Token = token; tvdbInfo.TokenRetrievedDate = DateTime.Now; tvdbInfo.SaveToFile(filePath); }