diff options
Diffstat (limited to '')
| -rw-r--r-- | backend/parser/parser.go | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/backend/parser/parser.go b/backend/parser/parser.go index 19cd677..e39616c 100644 --- a/backend/parser/parser.go +++ b/backend/parser/parser.go | |||
| @@ -2,8 +2,8 @@ package parser | |||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "errors" | 4 | "errors" |
| 5 | "io" | ||
| 5 | "math" | 6 | "math" |
| 6 | "os" | ||
| 7 | "regexp" | 7 | "regexp" |
| 8 | "strconv" | 8 | "strconv" |
| 9 | "strings" | 9 | "strings" |
| @@ -22,13 +22,9 @@ type Result struct { | |||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | // Don't try to understand it, feel it. | 24 | // Don't try to understand it, feel it. |
| 25 | func ProcessDemo(filePath string) (Result, error) { | 25 | func ProcessDemo(demoFile io.Reader) (Result, error) { |
| 26 | var result Result | 26 | var result Result |
| 27 | file, err := os.Open(filePath) | 27 | reader := bitreader.NewReader(demoFile, true) |
| 28 | if err != nil { | ||
| 29 | return Result{}, err | ||
| 30 | } | ||
| 31 | reader := bitreader.NewReader(file, true) | ||
| 32 | demoFileStamp := reader.TryReadString() | 28 | demoFileStamp := reader.TryReadString() |
| 33 | demoProtocol := reader.TryReadSInt32() | 29 | demoProtocol := reader.TryReadSInt32() |
| 34 | networkProtocol := reader.TryReadSInt32() | 30 | networkProtocol := reader.TryReadSInt32() |