|
1 | | -using Newtonsoft.Json; |
| 1 | +using Newtonsoft.Json; |
2 | 2 | using Newtonsoft.Json.Linq; |
3 | 3 | using NLog; |
4 | 4 | using System; |
5 | 5 | using System.Collections.Generic; |
6 | 6 | using System.Linq; |
7 | 7 | using System.Net; |
8 | | -using System.Net.Http; |
| 8 | +using System.Net.Http; |
9 | 9 | using System.Text; |
10 | 10 | using System.Threading; |
11 | 11 | using System.Threading.Tasks; |
@@ -34,12 +34,12 @@ public Uploader() |
34 | 34 | /// <summary> |
35 | 35 | /// Upload replay |
36 | 36 | /// </summary> |
37 | | - /// <param name="file"></param> |
| 37 | + /// <param name="file">The file to upload</param> |
38 | 38 | public async Task Upload(ReplayFile file) |
39 | 39 | { |
40 | | - var checkDuplicate = file.UploadStatus != UploadStatus.ReadyForUpload; |
| 40 | + var doDuplicateCheck = file.UploadStatus != UploadStatus.ReadyForUpload; |
41 | 41 | file.UploadStatus = UploadStatus.Uploading; |
42 | | - if (file.Fingerprint != null && !checkDuplicate || await CheckDuplicate(file.Fingerprint)) { |
| 42 | + if (file.Fingerprint != null && doDuplicateCheck && await CheckDuplicate(file.Fingerprint)) { |
43 | 43 | _log.Debug($"File {file} marked as duplicate"); |
44 | 44 | file.UploadStatus = UploadStatus.Duplicate; |
45 | 45 | } else { |
@@ -134,12 +134,12 @@ private async Task<string[]> CheckDuplicate(IEnumerable<string> fingerprints) |
134 | 134 | /// </summary> |
135 | 135 | public async Task CheckDuplicate(IEnumerable<ReplayFile> replays) |
136 | 136 | { |
137 | | - foreach(var replay in replays) { |
138 | | - replay.UploadStatus = UploadStatus.CheckingDuplicates; |
| 137 | + foreach(var replay in replays) { |
| 138 | + replay.UploadStatus = UploadStatus.CheckingDuplicates; |
139 | 139 | } |
140 | 140 | var exists = new HashSet<string>(await CheckDuplicate(replays.Select(x => x.Fingerprint))); |
141 | | - foreach(var replay in replays) { |
142 | | - replay.UploadStatus = exists.Contains(replay.Fingerprint) ? UploadStatus.Duplicate : UploadStatus.ReadyForUpload; |
| 141 | + foreach(var replay in replays) { |
| 142 | + replay.UploadStatus = exists.Contains(replay.Fingerprint) ? UploadStatus.Duplicate : UploadStatus.ReadyForUpload; |
143 | 143 | } |
144 | 144 | } |
145 | 145 |
|
|
0 commit comments