private static Assembly LoadAdalAssembly()
        {
            List <Assembly> list;

            lock (ASAzureUtility.GetAppDomainLock("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_ADAL_LOADING_LOCK"))
            {
                list = (List <Assembly>)AppDomain.CurrentDomain.GetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_LOADED_ADAL_ASSEMBLIES");
                if (list != null)
                {
                    list.ForEach(delegate(Assembly assembly)
                    {
                        AdalRuntimeLibrary.AdalAssembliesDictionary.Add(assembly.FullName, assembly);
                    });
                }
                else
                {
                    list = new List <Assembly>();
                    string[] adalAssemblyNames = AdalRuntimeLibrary.AdalAssemblyNames;
                    for (int i = 0; i < adalAssemblyNames.Length; i++)
                    {
                        string   name      = adalAssemblyNames[i];
                        Assembly assembly2 = AdalRuntimeLibrary.LoadAssemblyFromLocalResource(name);
                        list.Add(assembly2);
                        AdalRuntimeLibrary.AdalAssembliesDictionary.Add(assembly2.FullName, assembly2);
                    }
                    AppDomain.CurrentDomain.SetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_LOADED_ADAL_ASSEMBLIES", list);
                }
            }
            return(list.First <Assembly>());
        }
 internal static void Invalidate()
 {
     lock (ASAzureUtility.GetAppDomainLock("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE_USAGE_LOCK"))
     {
         Dictionary <string, Uri> dictionary = (Dictionary <string, Uri>)AppDomain.CurrentDomain.GetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE");
         if (dictionary != null)
         {
             dictionary.Clear();
         }
     }
 }
            internal static Uri GetCluster(Uri dataSourceUri, string asAzureServerName)
            {
                Uri result;

                lock (ASAzureUtility.GetAppDomainLock("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE_USAGE_LOCK"))
                {
                    string key = ASAzureUtility.ClustersCache.getKey(dataSourceUri, asAzureServerName);
                    Dictionary <string, Uri> dictionary = (Dictionary <string, Uri>)AppDomain.CurrentDomain.GetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE");
                    result = ((dictionary != null) ? (dictionary.ContainsKey(key) ? dictionary[key] : null) : null);
                }
                return(result);
            }
 internal static void AddCluster(Uri dataSourceUri, string asAzureServerName, Uri clusterUri)
 {
     lock (ASAzureUtility.GetAppDomainLock("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE_USAGE_LOCK"))
     {
         string key = ASAzureUtility.ClustersCache.getKey(dataSourceUri, asAzureServerName);
         if (AppDomain.CurrentDomain.GetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE") == null)
         {
             AppDomain.CurrentDomain.SetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE", new Dictionary <string, Uri>());
         }
         ((Dictionary <string, Uri>)AppDomain.CurrentDomain.GetData("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_DATA_SOURCE_CLUSTER_URIS_CACHE"))[key] = clusterUri;
     }
 }
            internal CacheLocalStorage(object cache, string dataSource)
            {
                this.cache = cache;
                if (!Directory.Exists(AdalRuntimeLibrary.AdalCacheDirectory))
                {
                    Directory.CreateDirectory(AdalRuntimeLibrary.AdalCacheDirectory);
                }
                string mD5Hash = AdalRuntimeLibrary.CacheLocalStorage.GetMD5Hash(dataSource);

                this.cacheFilePath = string.Format("{0}\\{1}_{2}.dat", AdalRuntimeLibrary.AdalCacheDirectory, "managed_asazure", mD5Hash);
                this.cacheFileLock = ASAzureUtility.GetAppDomainLock("MICROSOFT_ANALYSISSERVICES_XMLA_LIBS_ADAL_CACHE_" + mD5Hash);
                this.dataSource    = dataSource;
                Delegate value  = Delegate.CreateDelegate(this.adal.TokenCacheNotificationT, this, AdalRuntimeLibrary.CacheLocalStorage.GetMethodInfo(new Action <object>(this.BeforeAccessNotification)));
                Delegate value2 = Delegate.CreateDelegate(this.adal.TokenCacheNotificationT, this, AdalRuntimeLibrary.CacheLocalStorage.GetMethodInfo(new Action <object>(this.AfterAccessNotification)));
                Delegate value3 = Delegate.CreateDelegate(this.adal.TokenCacheNotificationT, this, AdalRuntimeLibrary.CacheLocalStorage.GetMethodInfo(new Action <object>(this.BeforeWriteNotification)));

                this.adal.BeforeAccessP.SetValue(cache, value, null);
                this.adal.AfterAccessP.SetValue(cache, value2, null);
                this.adal.BeforeWriteP.SetValue(cache, value3, null);
            }