Skip to content

Commit

Permalink
fix: wrong demo date
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Aug 21, 2024
1 parent 698fdf7 commit e419d23
Showing 1 changed file with 37 additions and 33 deletions.
70 changes: 37 additions & 33 deletions internal/demo/demo.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,23 @@ func GetDemoFromPath(demoPath string) (*Demo, error) {
demoType = constants.DemoTypePOV
}

m := new(msgs2.CDataGCCStrike15V2_MatchInfo)
err = proto.Unmarshal(matchInfoBytes, m)
if err != nil {
fmt.Printf("failed to unmarshal MatchInfo message: %v", err)
} else {
netMessageDecryptionPublicKey = getNetMessageDecryptionKeyFromPubKey(m.Watchablematchinfo.GetClDecryptdataKeyPub())
date = getDateFromMatchTime(m.GetMatchtime())
rounds := m.GetRoundstatsall()
if len(rounds) > 0 {
lastRound := rounds[len(rounds)-1]
shareCode = encodeMatchShareCode(MatchInformation{
MatchId: m.GetMatchid(),
ReservationId: lastRound.GetReservationid(),
TvPort: m.GetWatchablematchinfo().GetTvPort(),
})
if len(matchInfoBytes) > 0 {
m := new(msgs2.CDataGCCStrike15V2_MatchInfo)
err = proto.Unmarshal(matchInfoBytes, m)
if err != nil {
fmt.Printf("failed to unmarshal MatchInfo message: %v", err)
} else {
netMessageDecryptionPublicKey = getNetMessageDecryptionKeyFromPubKey(m.Watchablematchinfo.GetClDecryptdataKeyPub())
date = getDateFromMatchTime(m.GetMatchtime())
rounds := m.GetRoundstatsall()
if len(rounds) > 0 {
lastRound := rounds[len(rounds)-1]
shareCode = encodeMatchShareCode(MatchInformation{
MatchId: m.GetMatchid(),
ReservationId: lastRound.GetReservationid(),
TvPort: m.GetWatchablematchinfo().GetTvPort(),
})
}
}
}
} else {
Expand Down Expand Up @@ -200,24 +202,26 @@ func GetDemoFromPath(demoPath string) (*Demo, error) {
)
checksum = strconv.FormatUint(crc64.Checksum([]byte(data), crc64.MakeTable(crc64.ECMA)), 16)

m := new(msg.CDataGCCStrike15V2_MatchInfo)
err = proto.Unmarshal(matchInfoBytes, m)
if err != nil {
fmt.Printf("failed to unmarshal MatchInfo message: %v", err)
} else {
netMessageDecryptionPublicKey = getNetMessageDecryptionKeyFromPubKey(m.Watchablematchinfo.GetClDecryptdataKeyPub())
date = getDateFromMatchTime(m.GetMatchtime())
lastRound := m.GetRoundstatsLegacy()
rounds := m.GetRoundstatsall()
if lastRound == nil && len(rounds) > 0 {
lastRound = rounds[len(rounds)-1]
}
if lastRound != nil {
shareCode = encodeMatchShareCode(MatchInformation{
MatchId: m.GetMatchid(),
ReservationId: lastRound.GetReservationid(),
TvPort: m.GetWatchablematchinfo().GetTvPort(),
})
if len(matchInfoBytes) > 0 {
m := new(msg.CDataGCCStrike15V2_MatchInfo)
err = proto.Unmarshal(matchInfoBytes, m)
if err != nil {
fmt.Printf("failed to unmarshal MatchInfo message: %v", err)
} else {
netMessageDecryptionPublicKey = getNetMessageDecryptionKeyFromPubKey(m.Watchablematchinfo.GetClDecryptdataKeyPub())
date = getDateFromMatchTime(m.GetMatchtime())
lastRound := m.GetRoundstatsLegacy()
rounds := m.GetRoundstatsall()
if lastRound == nil && len(rounds) > 0 {
lastRound = rounds[len(rounds)-1]
}
if lastRound != nil {
shareCode = encodeMatchShareCode(MatchInformation{
MatchId: m.GetMatchid(),
ReservationId: lastRound.GetReservationid(),
TvPort: m.GetWatchablematchinfo().GetTvPort(),
})
}
}
}
}
Expand Down

0 comments on commit e419d23

Please sign in to comment.