30 lines
1.0 KiB
C#
30 lines
1.0 KiB
C#
using System.Drawing;
|
|
|
|
namespace Pilz.S3DFileParser
|
|
{
|
|
internal static class Extensions
|
|
{
|
|
public static object GetPropertyValue(this object @base, string propertyName)
|
|
{
|
|
return @base?.GetType().GetProperty(propertyName, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static)?.GetValue(@base);
|
|
}
|
|
|
|
public static bool IsTheSameAs(this Bitmap @base, Bitmap image)
|
|
{
|
|
if (@base.Size != image.Size)
|
|
return false;
|
|
for (int y = 0, loopTo = @base.Height - 1; y <= loopTo; y++)
|
|
{
|
|
for (int x = 0, loopTo1 = @base.Width - 1; x <= loopTo1; x++)
|
|
{
|
|
var p1 = @base.GetPixel(x, y);
|
|
var p2 = image.GetPixel(x, y);
|
|
if (p1 != p2)
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
} |