Some very minimal code optimization.
parent
d7661343bb
commit
8c57d7befb
|
@ -184,8 +184,9 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
// long-compatible file reading
|
||||
for (long i = 0; i < fileSize; i += int.MaxValue)
|
||||
{
|
||||
var tempContent = sr.ReadBytes((int) Math.Min(int.MaxValue, fileSize));
|
||||
tempContent.CopyTo(fileContent, i);
|
||||
sr
|
||||
.ReadBytes((int) Math.Min(int.MaxValue, fileSize))
|
||||
.CopyTo(fileContent, i);
|
||||
}
|
||||
|
||||
// CRC check for this file
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
/// </summary>
|
||||
public virtual long Size
|
||||
{
|
||||
get { return _size.HasValue ? _size.Value : (_size = GetContents().Length).Value; }
|
||||
get { lock(this) return _size.HasValue ? _size.Value : (_size = GetContents().Length).Value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -20,7 +20,7 @@ namespace GarrysMod.AddonCreator.Addon
|
|||
/// </summary>
|
||||
public virtual int Crc32Hash
|
||||
{
|
||||
get { return _hash.HasValue ? _hash.Value : (_hash = Crc32.Compute(GetContents())).Value; }
|
||||
get { lock (this) return _hash.HasValue ? _hash.Value : (_hash = Crc32.Compute(GetContents())).Value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue