/*
* Created by SharpDevelop.
* User: suloku
* Date: 03/05/2016
* Time: 20:54
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WC3_TOOL
{
///
/// Description of ECT.
///
public class ECT
{
public const int SIZE_ECT = 188;
// Global Settings
// Save Data Attributes
public byte[] Data;
public bool Edited;
public readonly bool Exportable;
public readonly byte[] BAK;
public string FileName, FilePath;
public ECT(byte[] data)
{
Data = (byte[])(data ?? new byte[SIZE_ECT]).Clone();
BAK = (byte[])Data.Clone();
Exportable = !Data.SequenceEqual(new byte[Data.Length]);
return;
}
public byte[] getData(int Offset, int Length)
{
return Data.Skip(Offset).Take(Length).ToArray();
}
public void setData(byte[] input, int Offset)
{
input.CopyTo(Data, Offset);
Edited = true;
}
public static UInt32 ect_checksum(int length, byte[] Data)
{
UInt32 Chk = 0;
int i;
length = length>>2;
Chk=0;
for(i=0; i',
':', 'Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#'
};
public string gba2text(byte[] input)
{
string texto;
texto = "";
foreach (byte value in input)
{
if (value == 0xFF)
break;
else{
string newtext = texto + SYMBOL[value].ToString();
texto = newtext;
}
}
return texto;
}
public byte[] text2gba(string input, int len)
{
byte[] gbatext = new byte[len];
byte i = 0;
int count = 0;
foreach (char value in input)
{
for(i=0;i<0xFF;i++)
{
if (value == SYMBOL[i])
{
if (i==0)
{
gbatext[count] = 0;
break;
}
else
{
gbatext[count] = i;
break;
}
}
}
//MessageBox.Show(gbatext[count].ToString("X"));
count++;
}
if (count < len)
gbatext[count] = 0xFF;
return gbatext;
}
}
}