hello,
in fact the typecast errors disappeared with this version.
i've posted the previous message while i was changing
the fs.Read .... line.
Code:
private void m_Open_Click(object sender, System.EventArgs e)
{
if ( openFileDialog.ShowDialog() == DialogResult.OK )
{
FileStream fs = new FileStream (openFileDialog.FileName, FileMode.Open);
if (fs.CanRead)
{
fileMem = new byte[fs.Length];
fs.Read(fileMem, (int)0, (int)fs.Length);
BinIdent.IdentifyBinary (fileMem);
if (BinIdent.typeID > 0)
{
// call heavy class
}
else
{
//
}
fs.Close ();
}
else
{
MessageBox.Show ("The choosen file couln't be loaded!!!", "MaDis Error ...",MessageBoxButtons.OK , MessageBoxIcon.Error);
}
}
else
{
}
}
the BinIndent class looks like this.
Code:
using System;
namespace madis
{
/// <summary>
/// Zusammenfassende Beschreibung für Class
/// </summary>
public class BinIdent
{
public BinIdent()
{
}
public static int typeID = (int)BinaryType.RAW;
public static int IdentifyBinary(byte[] memptr)
{
#region 64BIT ID Test
ulong _64bitID = 0;
for (int i=0; i<8; i++)
{
_64bitID <<= 8;
_64bitID |=memptr[i];
}
switch (_64bitID)
{
// Atari Jaguar ROM File (128 KB)
case 0xE00008:
typeID = (int)BinaryType.JAGUAR_BOOTROM;
break;
case 0xF61A8C5FF028D5C2:
typeID = (int)BinaryType.JAGUAR_CDBOOTROM;
break;
default:
typeID = 0;
break;
}
#endregion
if (typeID != (int)BinaryType.RAW)
return typeID;
return typeID;
}
}
}
i'm wondering that the numbers in C# are big-endian however.
Thanks