//public static void WriteHexDumpFromFile(string filename)
//{
// try
// {
// File file = new File(filename);
// RandomAccessFile stream = new RandomAccessFile(file, "r");
// sbyte[] bytes = new sbyte[stream.length()];
// stream.read(bytes);
// stream.close();
// System.Console.WriteLine("dump of [" + file + "]");
// Console.WriteHexDump(bytes);
// }
// catch (Exception exc)
// {
// Console.WriteThrowable(exc);
// }
//}
/// <summary>
/// writes bytes to file
/// </summary>
/// <param name="cdata"></param>
/// <param name="p"></param>
public static void WriteBytes(sbyte[] cdata, string filename, bool utf8)
{
try
{
File f = new File(filename);
if (f.exists())
f.delete();
RandomAccessFile stream = new RandomAccessFile(filename, "rw");
if (utf8)
{
stream.writeByte(0xEF);
stream.writeByte(0xBB);
stream.writeByte(0xBF);
}
stream.write(cdata);
stream.close();
}
catch
{
}
}