diff --git a/src/addoncreator/Addon/AddonFile.cs b/src/addoncreator/Addon/AddonFile.cs index 8bf5736..25474d0 100644 --- a/src/addoncreator/Addon/AddonFile.cs +++ b/src/addoncreator/Addon/AddonFile.cs @@ -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 diff --git a/src/addoncreator/Addon/AddonFileInfo.cs b/src/addoncreator/Addon/AddonFileInfo.cs index 1354631..d14d26d 100644 --- a/src/addoncreator/Addon/AddonFileInfo.cs +++ b/src/addoncreator/Addon/AddonFileInfo.cs @@ -12,7 +12,7 @@ namespace GarrysMod.AddonCreator.Addon /// 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; } } /// @@ -20,7 +20,7 @@ namespace GarrysMod.AddonCreator.Addon /// 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; } } ///