Hello what changes need to be used for the opening of the RDB
source code
db_summonrandomskill.rdb
source code
db_summonrandomskill.rdb
using System;
using System.ComponentModel;
using System.IO;
using System.Text;
using Gtk;
namespace test
{
class MainClass
{
BindingList<db_questlink> db_questlinkinfo = new BindingList<db_questlink>();
public string date_modified { get; set; }
public Int32 row_count { get; set; }
public static void Main (string[] args)
{
Application.Init ();
MainWindow win = new MainWindow ();
win.Show ();
Application.Run ();
}
//Replace this with OpenFileDialog (This is just for demonstration)
static string prog_dir = Directory.GetCurrentDirectory(); //This will load files from programs current directory
static string file_dir = Path.Combine(prog_dir, "db_questlink.rdb");
public void read_rdb()
{ //F
using(BinaryReader br = new BinaryReader(File.OpenRead(file_dir)))
{
//First as usual read the rdb header
Byte[] in_date = br.ReadBytes(8);
date_modified = BytesToString (in_date);
row_count = br.ReadInt32();
//Now we begin reading the actual info
db_questlink questlink = new db_questlink();
//While the Reader is Reading
while (br.PeekChar () != -1)
{
questlink.read_rdb(br);
//If response is agreeable add his info to the bindinglist
db_questlinkinfo.Add(questlink);
}
}
}
public static string BytesToString(byte[] b)
{
int num = 0;
string str = "";
for (int i = 0; i < (int)b.Length && b[i] > 0; i++)
{
num++;
}
byte[] numArray = new byte[num];
for (int i = 0; i < num && b[i] > 0; i++) {
numArray [i] = b [i];
}
str = Encoding.GetEncoding ("ASCII").GetString (numArray);
return str;
}
}
}
[/i]
using System;
using System.IO;
namespace test
{
public class db_questlink
{
public Int32 quest_id { get; set; }
public Int32 npc_id { get; set; }
public Byte flag_start { get; set; }
public Byte flag_progress { get; set; }
public Byte flag_end { get; set; }
public void read_rdb(BinaryReader br)
{
this.quest_id = br.ReadInt32();
this.npc_id = br.ReadInt32();
this.flag_start = br.ReadByte();
this.flag_progress = br.ReadByte();
this.flag_end = br.ReadByte();
}
}
}