-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathArchiveReader.cs
582 lines (503 loc) · 29.2 KB
/
ArchiveReader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Ionic.Zip;
using System.Security.Cryptography;
using System.Reflection;
using System.IO.Compression;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace DeltaZip
{
public class ArchiveReader
{
public string ArchiveName;
ZipFile zipFile;
HashSource[] hashes;
MemoryStream strings;
List<File> files;
Info info;
Stats stats;
WorkerThread workerThread = new WorkerThread();
public class Stats
{
public string Title;
public string Status;
public float Progress;
public DateTime StartTime = DateTime.Now;
public DateTime? WriteStartTime = null;
public DateTime? EndTime;
public long TotalWritten;
public long Unmodified;
public long ReadFromArchiveCompressed;
public long ReadFromArchiveDecompressed;
public long ReadFromWorkingCopy;
public volatile bool Canceled;
}
public ArchiveReader(string filename, Stats stats)
{
this.ArchiveName = Path.GetFileName(filename);
this.stats = stats;
this.stats.Status = "Opening " + ArchiveName;
this.stats.EndTime = null;
zipFile = new ZipFile(filename);
info = (Info)new XmlSerializer(typeof(Info)).Deserialize(Util.ExtractMetaData(zipFile, Settings.MetaDataInfo));
if (info.ReaderVersion == null) info.ReaderVersion = info.Version;
if (info.ReaderVersion.Major > Settings.VersionMajor || (info.ReaderVersion.Major == Settings.VersionMajor && info.ReaderVersion.Minor > Settings.VersionMinor)) {
throw new Exception("The archive was created by newer version of the program: " + info.Version);
}
hashes = Util.ReadArray<HashSource>(Util.ExtractMetaData(zipFile, Settings.MetaDataHashes));
strings = Util.ReadStream(Util.ExtractMetaData(zipFile, Settings.MetaDataStrings));
files = (List<File>)Util.FileSerializer.Deserialize(new StreamReader(Util.ExtractMetaData(zipFile, Settings.MetaDataFiles), Encoding.UTF8));
}
public string GetString(int index)
{
strings.Position = index;
List<byte> nameBytes = new List<byte>();
int b;
while ((b = strings.ReadByte()) > 0) nameBytes.Add((byte)b);
return Encoding.UTF8.GetString(nameBytes.ToArray());
}
class MemoryStreamRef
{
public WaitHandle Ready;
public Hash Hash;
public MemoryStream MemStream;
public long Offset;
public int Length;
public ExtractedData CacheLine;
}
class ExtractedData
{
public List<int> Refs = new List<int>(1);
public MemoryStream Data;
public ManualResetEvent LoadDone;
public static TimeSpan TotalReadTime = TimeSpan.Zero;
public static double TotalReadSizeMB = 0.0;
public WaitHandle AsycDecompress(ZipEntry srcEntry)
{
if (Data == null) {
if (StreamPool.Capacity < srcEntry.UncompressedSize) StreamPool.Capacity = (int)srcEntry.UncompressedSize;
this.Data = StreamPool.Allocate();
// Extract
if (srcEntry.CompressionMethod == CompressionMethod.Deflate && srcEntry.Encryption == EncryptionAlgorithm.None) {
PropertyInfo dataPosProp = typeof(ZipEntry).GetProperty("FileDataPosition", BindingFlags.NonPublic | BindingFlags.Instance);
long dataPos = (long)dataPosProp.GetValue(srcEntry, new object[] { });
PropertyInfo streamProp = typeof(ZipEntry).GetProperty("ArchiveStream", BindingFlags.NonPublic | BindingFlags.Instance);
Stream stream = (Stream)streamProp.GetValue(srcEntry, new object[] { });
MemoryStream compressedData = StreamPool.Allocate();
compressedData.SetLength(srcEntry.CompressedSize);
stream.Seek(dataPos, SeekOrigin.Begin);
Stopwatch watch = new Stopwatch();
watch.Start();
stream.Read(compressedData.GetBuffer(), 0, (int)compressedData.Length);
watch.Stop();
TotalReadTime += watch.Elapsed;
TotalReadSizeMB += (double)compressedData.Length / 1024 / 1024;
DeflateStream decompressStream = new System.IO.Compression.DeflateStream(compressedData, CompressionMode.Decompress, true);
this.LoadDone = new ManualResetEvent(false);
Interlocked.Increment(ref activeDecompressionThreads);
ThreadPool.QueueUserWorkItem(delegate {
byte[] buffer = new byte[64 * 1024];
int readCount;
while ((readCount = decompressStream.Read(buffer, 0, buffer.Length)) != 0) {
this.Data.Write(buffer, 0, readCount);
}
decompressStream.Close();
StreamPool.Release(ref compressedData);
Interlocked.Decrement(ref activeDecompressionThreads);
this.LoadDone.Set();
});
} else {
srcEntry.Extract(this.Data);
this.LoadDone = new ManualResetEvent(true);
}
}
return this.LoadDone;
}
}
static int activeDecompressionThreads = 0;
public static bool Extract(string archiveFilename, string destination, Stats stats)
{
stats.Title = Path.GetFileName(archiveFilename);
ArchiveReader archive = new ArchiveReader(archiveFilename, stats);
bool writeEnabled = (destination != null);
Dictionary<string, ZipFile> openZips = new Dictionary<string, ZipFile>();
openZips[archive.ArchiveName.ToLowerInvariant()] = archive.zipFile;
FileStream openFile = null;
IAsyncResult openFileRead = null;
string openFilePathLC = null;
long totalSize = 0;
long totalSizeDone = 0;
// Setup cache
Dictionary<string, ExtractedData> dataCache = new Dictionary<string, ExtractedData>();
int time = 0;
foreach (File file in archive.files) {
totalSize += file.Size;
foreach (int hashIndex in file.HashIndices) {
if (stats.Canceled) return false;
string path = archive.GetString(archive.hashes[hashIndex].Path).ToLowerInvariant();
if (!dataCache.ContainsKey(path)) dataCache.Add(path, new ExtractedData());
dataCache[path].Refs.Add(time++);
}
}
string stateFile = writeEnabled ? Path.Combine(destination, Settings.StateFile) : null;
stats.Status = "Loading working copy state";
WorkingCopy workingCopy = writeEnabled ? WorkingCopy.Load(stateFile) : new WorkingCopy();
WorkingCopy newWorkingFiles = new WorkingCopy();
List<WorkingHash> oldWorkingHashes = new List<WorkingHash>();
if (writeEnabled) {
int oldCount = workingCopy.Count;
workingCopy = WorkingCopy.HashLocalFiles(destination, stats, workingCopy);
if (workingCopy.Count > oldCount) {
stats.Status = "Saving working copy state";
workingCopy.Save(stateFile);
}
}
foreach(WorkingFile wf in workingCopy.GetAll()) {
foreach(WorkingHash wh in wf.Hashes) {
wh.File = wf;
}
oldWorkingHashes.AddRange(wf.Hashes);
}
oldWorkingHashes.Sort();
if (stats.Canceled) return false;
string tmpPath = null;
if (writeEnabled) {
tmpPath = Path.Combine(destination, Settings.TmpDirectory);
Directory.CreateDirectory(tmpPath);
}
Dictionary<ExtractedData, bool> loaded = new Dictionary<ExtractedData, bool>();
float waitingForDecompression = 0.0f;
float mbUnloadedDueToMemoryPressure = 0.0f;
stats.Status = writeEnabled ? "Extracting" : "Verifying";
stats.WriteStartTime = DateTime.Now;
foreach (File file in archive.files) {
string tmpFileName = null;
FileStream outFile = null;
if (writeEnabled) {
// Quickpath - see if the file exists and has correct content
WorkingFile workingFile = workingCopy.Find(Path.Combine(destination, file.Name));
if (workingFile != null && workingFile.ExistsOnDisk() && !workingFile.IsModifiedOnDisk()) {
if (new Hash(workingFile.Hash).CompareTo(new Hash(file.Hash)) == 0) {
// The file is already there - no need to extract it
stats.Status = "Skipped " + file.Name;
workingFile.UserModified = false;
newWorkingFiles.Add(workingFile);
stats.Unmodified += file.Size;
totalSizeDone += file.Size;
continue;
}
}
int tmpFileNamePostfix = 0;
do {
tmpFileName = Path.Combine(tmpPath, file.Name + (tmpFileNamePostfix == 0 ? string.Empty : ("-" + tmpFileNamePostfix.ToString())));
tmpFileNamePostfix++;
} while (System.IO.File.Exists(tmpFileName));
Directory.CreateDirectory(Path.GetDirectoryName(tmpFileName));
outFile = new FileStream(tmpFileName, FileMode.CreateNew, FileAccess.Write);
// Avoid fragmentation
outFile.SetLength(file.Size);
outFile.Position = 0;
}
List<WorkingHash> workingHashes = new List<WorkingHash>();
try {
stats.Progress = 0;
stats.Status = (writeEnabled ? "Extracting " : "Verifying ") + file.Name;
SHA1CryptoServiceProvider sha1Provider = new SHA1CryptoServiceProvider();
Queue<MemoryStreamRef> writeQueue = new Queue<MemoryStreamRef>();
int p = 0;
for (int i = 0; i < file.HashIndices.Count; i++) {
if (stats.Canceled) {
stats.Status = "Canceled. No files were modified.";
return false;
}
// Prefetch
for (; p < file.HashIndices.Count; p++) {
if (writeQueue.Count > 0 && writeQueue.Peek().Ready.WaitOne(TimeSpan.Zero)) break; // Some data is ready - go process it
int prefetchSize = 0;
Dictionary<MemoryStream, bool> prefetchedStreams = new Dictionary<MemoryStream, bool>();
foreach(MemoryStreamRef memStreamRef in writeQueue) {
prefetchedStreams[memStreamRef.MemStream] = true;
}
foreach(MemoryStream prefetchedStream in prefetchedStreams.Keys) {
prefetchSize += (int)prefetchedStream.Length;
}
if (writeQueue.Count > 0 && prefetchSize > Settings.WritePrefetchSize) break; // We have prefetched enough data
HashSource hashSrc = archive.hashes[file.HashIndices[p]];
string path = archive.GetString(hashSrc.Path).ToLowerInvariant();
ExtractedData data = dataCache[path];
// See if we have the hash on disk. Try our best not to seek too much
WorkingHash onDiskHash = null;
long bestSeekDistance = long.MaxValue;
int idx = oldWorkingHashes.BinarySearch(new WorkingHash() { Hash = hashSrc.Hash });
if (idx >= 0) {
while (idx - 1 >= 0 && oldWorkingHashes[idx - 1].Hash.Equals(hashSrc.Hash)) idx--;
for (; idx < oldWorkingHashes.Count && oldWorkingHashes[idx].Hash.Equals(hashSrc.Hash); idx++) {
WorkingHash wh = oldWorkingHashes[idx];
long seekDistance;
if (openFile != null && openFilePathLC == wh.File.NameLowercase) {
seekDistance = Math.Abs(openFile.Position - wh.Offset);
} else {
seekDistance = long.MaxValue;
}
if (onDiskHash == null || seekDistance < bestSeekDistance) {
onDiskHash = wh;
bestSeekDistance = seekDistance;
}
}
}
if (onDiskHash != null && ((openFilePathLC == onDiskHash.File.NameLowercase) || (onDiskHash.File.ExistsOnDisk() && !onDiskHash.File.IsModifiedOnDisk()))) {
MemoryStream memStream = new MemoryStream(onDiskHash.Length);
memStream.SetLength(onDiskHash.Length);
// Finish the last read
if (openFileRead != null) {
openFile.EndRead(openFileRead);
openFileRead = null;
}
// Open other file
if (openFilePathLC != onDiskHash.File.NameLowercase) {
if (openFile != null) openFile.Close();
openFile = new FileStream(onDiskHash.File.NameLowercase, FileMode.Open, FileAccess.Read, FileShare.Read, Settings.FileStreamBufferSize, FileOptions.None);
openFilePathLC = onDiskHash.File.NameLowercase;
System.Diagnostics.Debug.Write(Path.GetFileName(onDiskHash.File.NameMixedcase));
}
System.Diagnostics.Debug.Write(onDiskHash.Offset == openFile.Position ? "." : "S");
if (openFile.Position != onDiskHash.Offset)
openFile.Position = onDiskHash.Offset;
openFileRead = openFile.BeginRead(memStream.GetBuffer(), 0, (int)memStream.Length, null, null);
writeQueue.Enqueue(new MemoryStreamRef() {
Ready = openFileRead.AsyncWaitHandle,
MemStream = memStream,
Offset = 0,
Length = (int)memStream.Length,
CacheLine = null,
Hash = hashSrc.Hash
});
stats.ReadFromWorkingCopy += hashSrc.Length;
} else {
// Locate and load the zipentry
ZipEntry pZipEntry;
path = path.Replace("\\", "/");
if (path.StartsWith("/")) {
pZipEntry = archive.zipFile[path.Substring(1)];
} else {
int slashIndex = path.IndexOf("/");
string zipPath = path.Substring(0, slashIndex);
string entryPath = path.Substring(slashIndex + 1);
if (!openZips.ContainsKey(zipPath)) openZips[zipPath] = new ZipFile(Path.Combine(Path.GetDirectoryName(archiveFilename), zipPath));
pZipEntry = openZips[zipPath][entryPath];
}
if (data.Data == null) {
stats.ReadFromArchiveDecompressed += pZipEntry.UncompressedSize;
stats.ReadFromArchiveCompressed += pZipEntry.CompressedSize;
data.AsycDecompress(pZipEntry);
}
loaded[data] = true;
writeQueue.Enqueue(new MemoryStreamRef() {
Ready = data.LoadDone,
MemStream = data.Data,
Offset = hashSrc.Offset,
Length = hashSrc.Length,
CacheLine = data,
Hash = hashSrc.Hash
});
}
}
MemoryStreamRef writeItem = writeQueue.Dequeue();
while (writeItem.Ready.WaitOne(TimeSpan.FromSeconds(0.01)) == false) {
waitingForDecompression += 0.01f;
}
// Write output
if (writeEnabled) {
workingHashes.Add(new WorkingHash() {
Hash = writeItem.Hash,
Offset = outFile.Position,
Length = writeItem.Length
});
outFile.Write(writeItem.MemStream.GetBuffer(), (int)writeItem.Offset, writeItem.Length);
}
// Verify SHA1
sha1Provider.TransformBlock(writeItem.MemStream.GetBuffer(), (int)writeItem.Offset, writeItem.Length, writeItem.MemStream.GetBuffer(), (int)writeItem.Offset);
stats.TotalWritten += writeItem.Length;
totalSizeDone += writeItem.Length;
stats.Title = string.Format("{0:F0}% {1}", 100 * (float)totalSizeDone / (float)totalSize , Path.GetFileName(archiveFilename));
stats.Progress = (float)i / (float)file.HashIndices.Count;
// Unload if it is not needed anymore
if (writeItem.CacheLine != null) {
writeItem.CacheLine.Refs.RemoveAt(0);
if (writeItem.CacheLine.Refs.Count == 0) {
StreamPool.Release(ref writeItem.CacheLine.Data);
writeItem.CacheLine.LoadDone = null;
loaded.Remove(writeItem.CacheLine);
}
}
// Unload some data if we are running out of memory
while (loaded.Count * Settings.MaxZipEntrySize > Settings.WriteCacheSize) {
ExtractedData maxRef = null;
foreach (ExtractedData ed in loaded.Keys) {
if (maxRef == null || ed.Refs[0] > maxRef.Refs[0]) maxRef = ed;
}
maxRef.LoadDone.WaitOne();
// Check that we are not evicting something from the write queue
bool inQueue = false;
foreach(MemoryStreamRef memRef in writeQueue) {
if (memRef.CacheLine == maxRef) inQueue = true;
}
if (inQueue) break;
mbUnloadedDueToMemoryPressure += (float)maxRef.Data.Length / 1024 / 1024;
StreamPool.Release(ref maxRef.Data);
maxRef.LoadDone = null;
loaded.Remove(maxRef);
}
}
stats.Progress = 0;
sha1Provider.TransformFinalBlock(new byte[0], 0, 0);
byte[] sha1 = sha1Provider.Hash;
if (new Hash(sha1).CompareTo(new Hash(file.Hash)) != 0) {
MessageBox.Show("The checksum of " + file.Name + " does not match original value. The file is corrupted.", "Critical error", MessageBoxButtons.OK, MessageBoxIcon.Error);
if (writeEnabled) {
stats.Status = "Extraction failed. Checksum mismatch.";
} else {
stats.Status = "Verification failed. Checksum mismatch.";
}
return false;
}
} finally {
if (outFile != null) outFile.Close();
}
if (writeEnabled) {
FileInfo fileInfo = new FileInfo(tmpFileName);
WorkingFile workingFile = new WorkingFile() {
NameMixedcase = Path.Combine(destination, file.Name),
Size = fileInfo.Length,
Created = fileInfo.CreationTime,
Modified = fileInfo.LastWriteTime,
Hash = file.Hash,
TempFileName = tmpFileName,
Hashes = workingHashes
};
newWorkingFiles.Add(workingFile);
}
}
stats.Progress = 0;
stats.Title = string.Format("100% {0}", Path.GetFileName(archiveFilename));
// Close sources
foreach (ZipFile zip in openZips.Values) {
zip.Dispose();
}
if (openFileRead != null) openFile.EndRead(openFileRead);
if (openFile != null) openFile.Close();
// Replace the old working copy with new one
if (writeEnabled) {
List<string> deleteFilesLC = new List<string>();
List<string> deleteFilesAskLC = new List<string>();
List<string> keepFilesLC = new List<string>();
stats.Status = "Preparing to move files";
// Delete all non-user-modified files
foreach (WorkingFile workingFile in workingCopy.GetAll()) {
if (!workingFile.UserModified && workingFile.ExistsOnDisk() && !workingFile.IsModifiedOnDisk()) {
WorkingFile newWF = newWorkingFiles.Find(workingFile.NameLowercase);
// Do not delete if it is was skipped 'fast-path' file
if (newWF != null && newWF.TempFileName == null) continue;
deleteFilesLC.Add(workingFile.NameLowercase);
}
}
// Find obstructions for new files
foreach (WorkingFile newWorkingFile in newWorkingFiles.GetAll()) {
if (newWorkingFile.TempFileName != null && newWorkingFile.ExistsOnDisk() && !deleteFilesLC.Contains(newWorkingFile.NameLowercase)) {
deleteFilesAskLC.Add(newWorkingFile.NameLowercase);
}
}
// Ask the user for permission to delete
StringBuilder sb = new StringBuilder();
sb.AppendLine("Do you want to override local changes in the following files?");
int numLines = 0;
foreach (string deleteFileAskLC in deleteFilesAskLC) {
sb.AppendLine(deleteFileAskLC);
numLines++;
if (numLines > 30) {
sb.AppendLine("...");
sb.AppendLine("(" + deleteFilesAskLC.Count + " files in total)");
break;
}
}
if (deleteFilesAskLC.Count > 0) {
DialogResult overrideAnswer = Settings.AlwaysOverwrite ? DialogResult.Yes : MessageBox.Show(sb.ToString(), "Override files", MessageBoxButtons.YesNoCancel);
if (overrideAnswer == DialogResult.Cancel) {
stats.Status = "Canceled. No files were modified.";
return false;
}
if (overrideAnswer == DialogResult.Yes) {
deleteFilesLC.AddRange(deleteFilesAskLC);
} else {
keepFilesLC = deleteFilesAskLC;
}
deleteFilesAskLC.Clear();
}
// Delete files
foreach (string deleteFileLC in deleteFilesLC) {
stats.Status = "Deleting " + Path.GetFileName(deleteFileLC);
while (true) {
try {
FileInfo fileInfo = new FileInfo(deleteFileLC);
if (fileInfo.IsReadOnly) {
fileInfo.IsReadOnly = false;
}
System.IO.File.Delete(deleteFileLC);
workingCopy.Remove(deleteFileLC);
break;
} catch (Exception e) {
DialogResult deleteAnswer = MessageBox.Show("Can not delete file " + deleteFileLC + Environment.NewLine + e.Message, "Error", MessageBoxButtons.AbortRetryIgnore);
if (deleteAnswer == DialogResult.Retry) continue;
if (deleteAnswer == DialogResult.Ignore) break;
if (deleteAnswer == DialogResult.Abort) {
stats.Status = "Canceled. Some files were deleted.";
return false;
}
}
}
}
// Move the new files
foreach (WorkingFile newWorkingFile in newWorkingFiles.GetAll()) {
if (!keepFilesLC.Contains(newWorkingFile.NameLowercase) && newWorkingFile.TempFileName != null) {
stats.Status = "Moving " + Path.GetFileName(newWorkingFile.NameMixedcase);
while (true) {
try {
Directory.CreateDirectory(Path.GetDirectoryName(newWorkingFile.NameMixedcase));
System.IO.File.Move(newWorkingFile.TempFileName, newWorkingFile.NameMixedcase);
workingCopy.Add(newWorkingFile);
break;
} catch (Exception e) {
DialogResult moveAnswer = MessageBox.Show("Error when moving " + newWorkingFile.TempFileName + Environment.NewLine + e.Message, "Error", MessageBoxButtons.AbortRetryIgnore);
if (moveAnswer == DialogResult.Retry) continue;
if (moveAnswer == DialogResult.Ignore) break;
if (moveAnswer == DialogResult.Abort) {
stats.Status = "Canceled. Some files were deleted or overridden.";
return false;
}
}
}
}
}
stats.Status = "Saving working copy state";
workingCopy.Save(stateFile);
stats.Status = "Deleting temporary directory";
try {
if (Directory.Exists(tmpPath)) Directory.Delete(tmpPath, true);
} catch {
}
}
stats.EndTime = DateTime.Now;
if (writeEnabled) {
stats.Status = "Extraction finished";
} else {
stats.Status = "Verification finished";
}
return true;
}
}
}