Exemple #1
0
        private string ExtractToSymbols(IPackage package, IPackageFile symbolFile)
        {
            var path = symbolsPathResolver.GetSymbolsPath(package, symbolFile);

            EnsureDirectory(path);

            using (var file = File.Open(path, FileMode.OpenOrCreate))
                symbolFile.GetStream().CopyTo(file);

            return(path);
        }
Exemple #2
0
        public void MapSources(IPackage package, string symbolFile, IEnumerable <string> referencedSources, Func <string, string> transform)
        {
            var version   = package.Version;
            var packageId = package.Id;

            string indexFile = Path.ChangeExtension(symbolFile, ".index");

            try
            {
                using (var writer = File.CreateText(indexFile))
                {
                    writer.WriteLine("SRCSRV: ini ------------------------------------------------");
                    writer.WriteLine("VERSION=2");
                    writer.WriteLine("INDEXVERSION=2");
                    writer.WriteLine("VERCTRL=NuGet");
                    writer.WriteLine("DATETIME={0}", DateTime.UtcNow);
                    writer.WriteLine("SRCSRV: variables ------------------------------------------");
                    writer.WriteLine("SRCSRVVERCTRL=http");
                    writer.WriteLine("NUGET={0}", SourceBaseUri);
                    writer.WriteLine("HTTP_EXTRACT_TARGET=%NUGET%/%var4%/%var2%/%var5%");
                    writer.WriteLine("SRCSRVTRG=%HTTP_EXTRACT_TARGET%");
                    writer.WriteLine("SRCSRVCMD=");
                    writer.WriteLine("SRCSRV: source files ---------------------------------------");
                    foreach (var source in referencedSources)
                    {
                        writer.WriteLine("{0}*{1}*_*{2}*{3}", source, version, packageId, transform(source));
                    }
                    writer.WriteLine("SRCSRV: end ------------------------------------------------");
                }

                ExecuteToolNoValue("pdbstr", string.Format(" -w -p:\"{0}\" -i:\"{1}\" -s:srcsrv", symbolFile, indexFile));
                ExecuteToolNoValue("symstore", string.Format(" add /compress /f \"{0}\" /s \"{1}\" /t {2} /v {3}", symbolFile, symbolsPathResolver.GetSymbolsPath(), packageId, version));
            }
            finally
            {
                File.Delete(indexFile);
            }
        }