convert VB to C#
This commit is contained in:
30
Pilz.Simple3DFileParser/Other/Extensions.cs
Normal file
30
Pilz.Simple3DFileParser/Other/Extensions.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user