Microsoft.Alm.Authentication.VstsAdalTokenCache.AfterAccessNotification C# (CSharp) Method

AfterAccessNotification() private method

private AfterAccessNotification ( TokenCacheNotificationArgs args ) : void
args TokenCacheNotificationArgs
return void
        private void AfterAccessNotification(TokenCacheNotificationArgs args)
        {
            lock (@lock)
            {
                if (File.Exists(_cacheFilePath) && this.HasStateChanged)
                {
                    try
                    {
                        byte[] state = this.Serialize();

                        byte[] data = ProtectedData.Protect(state, null, DataProtectionScope.CurrentUser);

                        File.WriteAllBytes(_cacheFilePath, data);

                        this.HasStateChanged = false;
                    }
                    catch (Exception exception)
                    {
                        Git.Trace.WriteLine($"! {exception.Message}");
                    }
                }
            }
        }