Skip to content

Commit

Permalink
ctaggart#35 downloadFile not working :(
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Taggart authored and Chet Husk committed Nov 25, 2014
1 parent d979765 commit 117c90f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 19 deletions.
41 changes: 28 additions & 13 deletions ConsoleTest/Program.fs
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
open System
//open System.Collections.Generic
open System.IO
//open System.Text
open SourceLink
//open SourceLink.PdbModify
//open SourceLink.SrcSrv
open SourceLink.SymbolStore
open System.Reflection

let pdbSourceLink = @"..\..\..\packages\SourceLink.Fake\tools\SourceLink.pdb"

let printPdbDocuments() =
use s = File.OpenRead pdbSourceLink

let sc = SymbolCache @"C:\tmp\cache"
let r = sc.ReadPdb(s, pdbSourceLink)

for d in r.Documents do
printfn "\npdb original source file path: %s" d.URL
printfn "it had an md5 checksum of: %s" (d.GetCheckSum() |> Hex.encode)
let url = r.GetDownloadUrl d.URL
printfn "has download url if source indexed: %s" url
let downloadedFile = sc.DownloadFile url
printfn "downloaded the file to the cache %s" downloadedFile
printfn "downloaded file has md5 of: %s" (Crypto.hashMD5 downloadedFile |> Hex.encode)

let printMethods() =
let dll = Assembly.LoadFrom @"..\..\..\packages\SourceLink.SymbolStore\lib\net45\SourceLink.SymbolStore.dll"
for dt in dll.DefinedTypes do
printfn "\n%s" dt.FullName
for m in dt.GetMembers() do
printfn " %d %s" m.MetadataToken m.Name

let getNugetExeShas() =
let f = @"C:\Projects\SourceLink\.nuget\NuGet.exe"
printfn "calculated: %s" (GitRepo.ComputeChecksum f)
use r = new GitRepo(@"C:\Projects\SourceLink")
printfn "in repo: %s" (r.Checksum f)

// print methods and their files and line numbers
let printMethodsFileLines() =
Expand All @@ -28,8 +45,8 @@ let printMethodsFileLines() =

printfn "%d method in %s" token fn
printfn " %d sequence points" m.SequencePointCount
for p in m.SequencePoints do
printfn "%d, %d" p.Line p.Column
// for p in m.SequencePoints do
// printfn "%d, %d" p.Line p.Column
()


Expand All @@ -41,8 +58,6 @@ let printMethodsFileLines() =

[<EntryPoint>]
let main argv =
// getNugetExeShas()
// let mdd = Cor.CorMetaDataDispenser() :> Cor.IMetaDataDispenser
// printfn "mdd: %A" mdd
printPdbDocuments()
printMethodsFileLines()
0
12 changes: 6 additions & 6 deletions SymbolStore/SequencePoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ namespace SourceLink.SymbolStore
{
public class SequencePoint
{
public int Offset { get; }
public SymDocument Document { get; }
public int Line { get; }
public int Column { get; }
public int EndLine { get; }
public int EndColumn { get; }
public int Offset { get; private set; }
public SymDocument Document { get; private set; }
public int Line { get; private set; }
public int Column { get; private set; }
public int EndLine { get; private set; }
public int EndColumn { get; private set; }

public SequencePoint(int offset, SymDocument document, int line, int column, int endLine, int endColumn)
{
Expand Down

0 comments on commit 117c90f

Please sign in to comment.