Exemplo n.º 1
0
        private async Task DownloadFile(FileStream downloadStream, Stream compareStream, bool ms, bool mi, KeyTypeFlags flags)
        {
            SymbolStoreFile file = new SymbolStoreFile(downloadStream, downloadStream.Name);

            SymbolStores.SymbolStore store = null;
            if (ms)
            {
                Uri.TryCreate("http://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri);
                store = new HttpSymbolStore(_tracer, store, uri);
            }
            if (mi)
            {
                Uri.TryCreate("http://symweb.corp.microsoft.com/", UriKind.Absolute, out Uri uri);
                store = new SymwebHttpSymbolStore(_tracer, store, uri);
            }
            var generator = new FileKeyGenerator(_tracer, file);

            IEnumerable <SymbolStoreKey> keys = generator.GetKeys(flags);

            Assert.True(keys.Count() > 0);

            foreach (SymbolStoreKey key in keys)
            {
                if (key.FullPathName.Contains(".ni.pdb"))
                {
                    continue;
                }
                using (SymbolStoreFile symbolFile = await store.GetFile(key, CancellationToken.None))
                {
                    if (symbolFile != null)
                    {
                        Assert.True(downloadStream != symbolFile.Stream);
                        Assert.True(compareStream != symbolFile.Stream);

                        compareStream.Seek(0, SeekOrigin.Begin);
                        CompareStreams(compareStream, symbolFile.Stream);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private async Task DownloadFile(string path, bool ms, bool mi, string cache)
        {
            using (Stream stream = TestUtilities.OpenCompressedFile(path))
            {
                SymbolStoreFile          file  = new SymbolStoreFile(stream, path);
                SymbolStores.SymbolStore store = null;
                if (ms)
                {
                    Uri.TryCreate("http://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri);
                    store = new HttpSymbolStore(_tracer, store, uri);
                }
                if (mi)
                {
                    Uri.TryCreate("http://symweb.corp.microsoft.com/", UriKind.Absolute, out Uri uri);
                    store = new SymwebHttpSymbolStore(_tracer, store, uri);
                }
                if (cache != null)
                {
                    store = new CacheSymbolStore(_tracer, store, cache);
                }
                KeyTypeFlags flags     = KeyTypeFlags.IdentityKey;
                var          generator = new FileKeyGenerator(_tracer, file);

                IEnumerable <SymbolStoreKey> keys = generator.GetKeys(flags);
                foreach (SymbolStoreKey key in keys)
                {
                    using (SymbolStoreFile symbolFile = await store.GetFile(key, CancellationToken.None))
                    {
                        if (symbolFile != null)
                        {
                            CompareStreams(file.Stream, symbolFile.Stream);
                        }
                    }
                }
            }
        }