You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-15 06:40:08 +00:00
com.unity.ide.visualstudio@2.0.5
## [2.0.5] - 2020-10-30 Integration: Disable legacy pdb symbol checking for Unity packages
This commit is contained in:
@@ -7,28 +7,29 @@ using System.IO;
|
||||
|
||||
namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
public sealed class Image : IDisposable {
|
||||
public sealed class Image : IDisposable
|
||||
{
|
||||
|
||||
long position;
|
||||
Stream stream;
|
||||
|
||||
Image (Stream stream)
|
||||
Image(Stream stream)
|
||||
{
|
||||
this.stream = stream;
|
||||
this.position = stream.Position;
|
||||
this.stream.Position = 0;
|
||||
}
|
||||
|
||||
bool Advance (int length)
|
||||
bool Advance(int length)
|
||||
{
|
||||
if (stream.Position + length >= stream.Length)
|
||||
return false;
|
||||
|
||||
stream.Seek (length, SeekOrigin.Current);
|
||||
stream.Seek(length, SeekOrigin.Current);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MoveTo (uint position)
|
||||
bool MoveTo(uint position)
|
||||
{
|
||||
if (position >= stream.Length)
|
||||
return false;
|
||||
@@ -37,65 +38,65 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return true;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose ()
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
stream.Position = position;
|
||||
}
|
||||
|
||||
ushort ReadUInt16 ()
|
||||
ushort ReadUInt16()
|
||||
{
|
||||
return (ushort) (stream.ReadByte ()
|
||||
| (stream.ReadByte () << 8));
|
||||
return (ushort)(stream.ReadByte()
|
||||
| (stream.ReadByte() << 8));
|
||||
}
|
||||
|
||||
uint ReadUInt32 ()
|
||||
uint ReadUInt32()
|
||||
{
|
||||
return (uint) (stream.ReadByte ()
|
||||
| (stream.ReadByte () << 8)
|
||||
| (stream.ReadByte () << 16)
|
||||
| (stream.ReadByte () << 24));
|
||||
return (uint)(stream.ReadByte()
|
||||
| (stream.ReadByte() << 8)
|
||||
| (stream.ReadByte() << 16)
|
||||
| (stream.ReadByte() << 24));
|
||||
}
|
||||
|
||||
bool IsManagedAssembly ()
|
||||
bool IsManagedAssembly()
|
||||
{
|
||||
if (stream.Length < 318)
|
||||
return false;
|
||||
if (ReadUInt16 () != 0x5a4d)
|
||||
if (ReadUInt16() != 0x5a4d)
|
||||
return false;
|
||||
if (!Advance (58))
|
||||
if (!Advance(58))
|
||||
return false;
|
||||
if (!MoveTo (ReadUInt32 ()))
|
||||
if (!MoveTo(ReadUInt32()))
|
||||
return false;
|
||||
if (ReadUInt32 () != 0x00004550)
|
||||
if (ReadUInt32() != 0x00004550)
|
||||
return false;
|
||||
if (!Advance (20))
|
||||
if (!Advance(20))
|
||||
return false;
|
||||
if (!Advance (ReadUInt16 () == 0x20b ? 222 : 206))
|
||||
if (!Advance(ReadUInt16() == 0x20b ? 222 : 206))
|
||||
return false;
|
||||
|
||||
return ReadUInt32 () != 0;
|
||||
return ReadUInt32() != 0;
|
||||
}
|
||||
|
||||
public static bool IsAssembly (string file)
|
||||
public static bool IsAssembly(string file)
|
||||
{
|
||||
if (file == null)
|
||||
throw new ArgumentNullException ("file");
|
||||
throw new ArgumentNullException("file");
|
||||
|
||||
using (var stream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
return IsAssembly (stream);
|
||||
using (var stream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.Read))
|
||||
return IsAssembly(stream);
|
||||
}
|
||||
|
||||
public static bool IsAssembly (Stream stream)
|
||||
public static bool IsAssembly(Stream stream)
|
||||
{
|
||||
if (stream == null)
|
||||
throw new ArgumentNullException (nameof(stream));
|
||||
throw new ArgumentNullException(nameof(stream));
|
||||
if (!stream.CanRead)
|
||||
throw new ArgumentException (nameof(stream));
|
||||
throw new ArgumentException(nameof(stream));
|
||||
if (!stream.CanSeek)
|
||||
throw new ArgumentException (nameof(stream));
|
||||
throw new ArgumentException(nameof(stream));
|
||||
|
||||
using (var image = new Image (stream))
|
||||
return image.IsManagedAssembly ();
|
||||
using (var image = new Image(stream))
|
||||
return image.IsManagedAssembly();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user