mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-07-19 07:15:10 +00:00
Fix locking exception
This commit is contained in:
@@ -137,13 +137,17 @@ namespace BurnOutSharp.Builder
|
||||
int charWidth = nullTerminator.Length;
|
||||
|
||||
List<char> keyChars = new List<char>();
|
||||
while (offset < content.Length && BitConverter.ToUInt16(content, offset) != 0x0000)
|
||||
while (offset < content.Length)
|
||||
{
|
||||
keyChars.Add(encoding.GetChars(content, offset, charWidth)[0]); offset += charWidth;
|
||||
}
|
||||
offset += 2;
|
||||
char c = encoding.GetChars(content, offset, charWidth)[0];
|
||||
keyChars.Add(c);
|
||||
offset += charWidth;
|
||||
|
||||
return new string(keyChars.ToArray());
|
||||
if (c == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return new string(keyChars.ToArray()).TrimEnd('\0');
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -583,21 +583,18 @@ namespace BurnOutSharp.Wrappers
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_sourceDataLock)
|
||||
{
|
||||
// Use the cached data if possible
|
||||
if (_debugData != null && _debugData.Count != 0)
|
||||
return _debugData;
|
||||
|
||||
// If we have no resource table, just return
|
||||
if (DebugTable?.DebugDirectoryTable == null
|
||||
|| DebugTable.DebugDirectoryTable.Length == 0)
|
||||
return null;
|
||||
|
||||
// Otherwise, build and return the cached dictionary
|
||||
ParseDebugTable();
|
||||
// Use the cached data if possible
|
||||
if (_debugData != null && _debugData.Count != 0)
|
||||
return _debugData;
|
||||
}
|
||||
|
||||
// If we have no resource table, just return
|
||||
if (DebugTable?.DebugDirectoryTable == null
|
||||
|| DebugTable.DebugDirectoryTable.Length == 0)
|
||||
return null;
|
||||
|
||||
// Otherwise, build and return the cached dictionary
|
||||
ParseDebugTable();
|
||||
return _debugData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2815,16 +2812,19 @@ namespace BurnOutSharp.Wrappers
|
||||
if (DebugData == null)
|
||||
return Enumerable.Empty<object>();
|
||||
|
||||
return DebugData.Select(r => r.Value)
|
||||
var nb10Found = DebugData.Select(r => r.Value)
|
||||
.Select(r => r as Models.PortableExecutable.NB10ProgramDatabase)
|
||||
.Where(n => n != null)
|
||||
.Where(n => n.PdbFileName.Contains("path"))
|
||||
.Select(n => (object)n)
|
||||
.Concat(DebugData.Select(r => r.Value)
|
||||
.Select(r => r as Models.PortableExecutable.RSDSProgramDatabase)
|
||||
.Where(r => r != null)
|
||||
.Where(r => r.PathAndFileName.Contains("path"))
|
||||
.Select(r => (object)r));
|
||||
.Where(n => n.PdbFileName.Contains(path))
|
||||
.Select(n => (object)n);
|
||||
|
||||
var rsdsFound = DebugData.Select(r => r.Value)
|
||||
.Select(r => r as Models.PortableExecutable.RSDSProgramDatabase)
|
||||
.Where(r => r != null)
|
||||
.Where(r => r.PathAndFileName.Contains(path))
|
||||
.Select(r => (object)r);
|
||||
|
||||
return nb10Found.Concat(rsdsFound);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -126,17 +126,24 @@ namespace BurnOutSharp.Tools
|
||||
/// </summary>
|
||||
public static string ReadString(this byte[] content, ref int offset, Encoding encoding)
|
||||
{
|
||||
if (offset >= content.Length)
|
||||
return null;
|
||||
|
||||
byte[] nullTerminator = encoding.GetBytes(new char[] { '\0' });
|
||||
int charWidth = nullTerminator.Length;
|
||||
|
||||
List<char> keyChars = new List<char>();
|
||||
while (BitConverter.ToUInt16(content, offset) != 0x0000)
|
||||
while (offset < content.Length)
|
||||
{
|
||||
keyChars.Add(encoding.GetChars(content, offset, charWidth)[0]); offset += charWidth;
|
||||
}
|
||||
offset += 2;
|
||||
char c = encoding.GetChars(content, offset, charWidth)[0];
|
||||
keyChars.Add(c);
|
||||
offset += charWidth;
|
||||
|
||||
return new string(keyChars.ToArray());
|
||||
if (c == '\0')
|
||||
break;
|
||||
}
|
||||
|
||||
return new string(keyChars.ToArray()).TrimEnd('\0');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user