Erdem hocam teşekkürler.. söylediğin yoldan gideceğim ancak başka bir yapıya geçmeden şu şekilde şimdilik çalıştı .. ilerleyen bölümlerde iyileştirme yaparken o konuya tekrar döneceğim
import std.stdio;
import std.string;
import std.file;
import std.format;
struct FALCON4_ct {
short numEntities;
ushort id;
ushort collisionType;
float collisionRadius;
byte[8] classInfo;
uint updateRate;
uint updateTolerance;
float fineUpdateRange;
float fineUpdateForceRange;
float fineUpdateMultiplier;
uint damageSeed;
int hitpoints;
ushort majorRevisionNumber;
ushort minorRevisionNumber;
ushort createPriority;
byte managementDomain;
byte transferable;
byte private_;
byte tangible;
byte collidable;
byte global;
byte persistent;
ushort padding1_2;
byte padding3;
short[7] visType;
short vehicleDataIndex;
byte dataType;
ushort dataPtr;
short unknow1;
//byte unknow2;
}
void dosyadanOku() {
FALCON4_ct falcon4_ct;
File dosya = File ("FALCON4.ct", "rb" );
dosya.rawRead((&falcon4_ct.numEntities)[0..1]);
for(int i=0;i<3; i++) { // kaç tane kayıt varsa okadar dönecek şimdilik bu..... for(int i=0;i<falcon4_ct.numEntities; i++)
dosya.rawRead((&falcon4_ct.id)[0..1]);
dosya.rawRead((&falcon4_ct.collisionType)[0..1]);
dosya.rawRead((&falcon4_ct.collisionRadius)[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[0])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[1])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[2])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[3])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[4])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[5])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[6])[0..1]);
dosya.rawRead((&falcon4_ct.classInfo[7])[0..1]);
dosya.rawRead((&falcon4_ct.updateRate)[0..1]);
dosya.rawRead((&falcon4_ct.updateTolerance)[0..1]);
dosya.rawRead((&falcon4_ct.fineUpdateRange)[0..1]);
dosya.rawRead((&falcon4_ct.fineUpdateForceRange)[0..1]);
dosya.rawRead((&falcon4_ct.fineUpdateMultiplier)[0..1]);
dosya.rawRead((&falcon4_ct.damageSeed)[0..1]);
dosya.rawRead((&falcon4_ct.hitpoints)[0..1]);
dosya.rawRead((&falcon4_ct.majorRevisionNumber)[0..1]);
dosya.rawRead((&falcon4_ct.minorRevisionNumber)[0..1]);
dosya.rawRead((&falcon4_ct.createPriority)[0..1]);
dosya.rawRead((&falcon4_ct.managementDomain)[0..1]);
dosya.rawRead((&falcon4_ct.transferable)[0..1]);
dosya.rawRead((&falcon4_ct.private_)[0..1]);
dosya.rawRead((&falcon4_ct.tangible)[0..1]);
dosya.rawRead((&falcon4_ct.collidable)[0..1]);
dosya.rawRead((&falcon4_ct.global)[0..1]);
dosya.rawRead((&falcon4_ct.persistent)[0..1]);
dosya.rawRead((&falcon4_ct.padding1_2)[0..1]);
dosya.rawRead((&falcon4_ct.padding3)[0..1]);
dosya.rawRead((&falcon4_ct.visType[0])[0..1]);
dosya.rawRead((&falcon4_ct.visType[1])[0..1]);
dosya.rawRead((&falcon4_ct.visType[2])[0..1]);
dosya.rawRead((&falcon4_ct.visType[3])[0..1]);
dosya.rawRead((&falcon4_ct.visType[4])[0..1]);
dosya.rawRead((&falcon4_ct.visType[5])[0..1]);
dosya.rawRead((&falcon4_ct.visType[6])[0..1]);
dosya.rawRead((&falcon4_ct.vehicleDataIndex)[0..1]);
dosya.rawRead((&falcon4_ct.dataType)[0..1]);
dosya.rawRead((&falcon4_ct.dataPtr)[0..1]);
dosya.rawRead((&falcon4_ct.unknow1)[0..1]);
//dosya.rawRead((&falcon4_ct.unknow2)[0..1]);
writeln("Num Entities= ",falcon4_ct.numEntities);
writeln("Id= ",falcon4_ct.id);
writeln("Collision Type= ",falcon4_ct.collisionType);
writeln("collision Radius= ",falcon4_ct.collisionRadius);
writeln("Class Info [1]= ",falcon4_ct.classInfo[0]);
writeln("Class Info [2]= ",falcon4_ct.classInfo[1]);
writeln("Class Info [3]= ",falcon4_ct.classInfo[2]);
writeln("Class Info [4]= ",falcon4_ct.classInfo[3]);
writeln("Class Info [5]= ",falcon4_ct.classInfo[4]);
writeln("Class Info [6]= ",falcon4_ct.classInfo[5]);
writeln("Class Info [7]= ",falcon4_ct.classInfo[6]);
writeln("Update Rate= ",falcon4_ct.updateRate);
writeln("Update Tolerance= ",falcon4_ct.updateTolerance);
writeln("Fine Update Range= ",falcon4_ct.fineUpdateRange);
writeln("FineUpdateForce Range= ",falcon4_ct.fineUpdateForceRange);
writeln("Fine Update Multiplier= ",falcon4_ct.fineUpdateMultiplier);
writeln("Damage Seed= ",falcon4_ct.damageSeed);
writeln("Hitpoints= ",falcon4_ct.hitpoints);
writeln("Major Revision Number= ",falcon4_ct.majorRevisionNumber);
writeln("Minor Revision Number= ",falcon4_ct.minorRevisionNumber);
writeln("Create Priority= ",falcon4_ct.createPriority);
writeln("Management Domain= ",falcon4_ct.managementDomain);
writeln("Transferable= ",falcon4_ct.transferable);
writeln("Private= ",falcon4_ct.private_);
writeln("Tangible= ",falcon4_ct.tangible);
writeln("Collidable= ",falcon4_ct.collidable);
writeln("Global= ",falcon4_ct.global);
writeln("Persistent= ",falcon4_ct.persistent);
writeln("Padding1_2= ",falcon4_ct.padding1_2);
writeln("Padding3= ",falcon4_ct.padding3);
writeln("Vis Type[1]= ",falcon4_ct.visType[0]);
writeln("Vis Type[2]= ",falcon4_ct.visType[1]);
writeln("Vis Type[3]= ",falcon4_ct.visType[2]);
writeln("Vis Type[4]= ",falcon4_ct.visType[3]);
writeln("Vis Type[5]= ",falcon4_ct.visType[4]);
writeln("Vis Type[6]= ",falcon4_ct.visType[5]);
writeln("Vis Type[7]= ",falcon4_ct.visType[6]);
writeln("Vehicle Data Index= ",falcon4_ct.vehicleDataIndex);
writeln("Data Type= ",falcon4_ct.dataType);
writeln("Data Ptr _ RecordID= ",falcon4_ct.dataPtr);
writeln("Unknow 1= ",falcon4_ct.unknow1);
//writeln("Unknow 2= ",falcon4_ct.unknow2);
writeln();
writeln();
}
dosya.close();
}
şimdi bu şekilde yani program natamam şekilde bir yandanda GtkD ile uğraşmaya başladım şimdi oda şu şekilde.. ancak çıkışlarda string e dönüşümde sıkıntı yaşıyorum galiba :rolleyes:
import gtk.Main;
import gtk.MainWindow;
import gtk.ListStore;
import gtk.TreeView;
import gtk.TreeViewColumn;
import gtk.TreeIter;
import gtk.CellRendererText;
import gtk.Box;
import std.stdio;
import std.string;
import std.file;
import std.format;
struct FALCON4_ct {
short numEntities;
ushort id;
ushort collisionType;
float collisionRadius;
byte[8] classInfo;
uint updateRate;
uint updateTolerance;
float fineUpdateRange;
float fineUpdateForceRange;
float fineUpdateMultiplier;
uint damageSeed;
int hitpoints;
ushort majorRevisionNumber;
ushort minorRevisionNumber;
ushort createPriority;
byte managementDomain;
byte transferable;
byte private_;
byte tangible;
byte collidable;
byte global;
byte persistent;
ushort padding1_2;
byte padding3;
short[7] visType;
short vehicleDataIndex;
byte dataType;
ushort dataPtr;
short unknow1;
//byte unknow2;
}
class Pencere: MainWindow
{
Box anaKutu;
this()
{
super("Ağaç gösterimi örneği 1");
setSizeRequest(250, 200);
anaKutu = new Box(Orientation.VERTICAL, 0);
auto model = new VeriModeli();
//.............................
FALCON4_ct falcon4_ct;
File dosya = File ("FALCON4.ct", "rb" );
dosya.rawRead((&falcon4_ct.numEntities)[0..1]);
for(int i=0;i<1; i++) { // kaç tane kayıt varsa okadar dönecek şimdilik bu..... for(int i=0;i<falcon4_ct.numEntities; i++)
model.ekle("Id= ",cast(string)dosya.rawRead((&falcon4_ct.id)[0..1]));
model.ekle("Collision Type= ",cast(string)dosya.rawRead((&falcon4_ct.collisionType)[0..1]));
model.ekle("collision Radius= ",cast(string)dosya.rawRead((&falcon4_ct.collisionRadius)[0..1]));
model.ekle("Class Info [1]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[0])[0..1]));
model.ekle("Class Info [2]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[1])[0..1]));
model.ekle("Class Info [3]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[2])[0..1]));
model.ekle("Class Info [4]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[3])[0..1]));
model.ekle("Class Info [5]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[4])[0..1]));
model.ekle("Class Info [6]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[5])[0..1]));
model.ekle("Class Info [7]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[6])[0..1]));
model.ekle("Class Info [8]= ",cast(string)dosya.rawRead((&falcon4_ct.classInfo[7])[0..1]));
model.ekle("Update Rate= ",cast(string)dosya.rawRead((&falcon4_ct.updateRate)[0..1]));
model.ekle("Update Tolerance= ",cast(string)dosya.rawRead((&falcon4_ct.updateTolerance)[0..1]));
model.ekle("Fine Update Range= ",cast(string)dosya.rawRead((&falcon4_ct.fineUpdateRange)[0..1]));
model.ekle("FineUpdateForce Range= ",cast(string)dosya.rawRead((&falcon4_ct.fineUpdateForceRange)[0..1]));
model.ekle("Fine Update Multiplier= ",cast(string)dosya.rawRead((&falcon4_ct.fineUpdateMultiplier)[0..1]));
model.ekle("Damage Seed= ",cast(string)dosya.rawRead((&falcon4_ct.damageSeed)[0..1]));
model.ekle("Hitpoints= ",cast(string)dosya.rawRead((&falcon4_ct.hitpoints)[0..1]));
model.ekle("Major Revision Number= ",cast(string)dosya.rawRead((&falcon4_ct.majorRevisionNumber)[0..1]));
model.ekle("Minor Revision Number= ",cast(string)dosya.rawRead((&falcon4_ct.minorRevisionNumber)[0..1]));
model.ekle("Create Priority= ",cast(string)dosya.rawRead((&falcon4_ct.createPriority)[0..1]));
model.ekle("Management Domain= ",cast(string)dosya.rawRead((&falcon4_ct.managementDomain)[0..1]));
model.ekle("Transferable= ",cast(string)dosya.rawRead((&falcon4_ct.transferable)[0..1]));
model.ekle("Private= ",cast(string)dosya.rawRead((&falcon4_ct.private_)[0..1]));
model.ekle("Tangible= ",cast(string)dosya.rawRead((&falcon4_ct.tangible)[0..1]));
model.ekle("Collidable= ",cast(string)dosya.rawRead((&falcon4_ct.collidable)[0..1]));
model.ekle("Global= ",cast(string)dosya.rawRead((&falcon4_ct.global)[0..1]));
model.ekle("Persistent= ",cast(string)dosya.rawRead((&falcon4_ct.persistent)[0..1]));
model.ekle("Padding1_2= ",cast(string)dosya.rawRead((&falcon4_ct.padding1_2)[0..1]));
model.ekle("Padding3= ",cast(string)dosya.rawRead((&falcon4_ct.padding3)[0..1]));
model.ekle("Vis Type[1]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[0])[0..1]));
model.ekle("Vis Type[2]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[1])[0..1]));
model.ekle("Vis Type[3]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[2])[0..1]));
model.ekle("Vis Type[4]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[3])[0..1]));
model.ekle("Vis Type[5]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[4])[0..1]));
model.ekle("Vis Type[6]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[5])[0..1]));
model.ekle("Vis Type[7]= ",cast(string)dosya.rawRead((&falcon4_ct.visType[6])[0..1]));
model.ekle("Vehicle Data Index= ",cast(string)dosya.rawRead((&falcon4_ct.vehicleDataIndex)[0..1]));
model.ekle("Data Type= ",cast(string)dosya.rawRead((&falcon4_ct.dataType)[0..1]));
model.ekle("Data Ptr _ RecordID= ",cast(string)dosya.rawRead((&falcon4_ct.dataPtr)[0..1]));
model.ekle("Unknow 1= ",cast(string)dosya.rawRead((&falcon4_ct.unknow1)[0..1]));
}
dosya.close();
//..............................
auto görünüm = new GörünümModeli(model);
anaKutu.packStart(görünüm, true, true, 0);
add(anaKutu);
showAll();
}
}
class VeriModeli /* model */
{
ListStore model;
this()
{
model = new ListStore([GType.STRING, GType.STRING]);
}
void ekle(string isim, string başkent)
{
TreeIter erişici = model.createIter();
model.setValue(erişici, 0, isim);
model.setValue(erişici, 1, başkent);
}
}
class GörünümModeli: TreeView /* görünüm */
{
TreeViewColumn üyeSütunu;
TreeViewColumn değerSütünu;
this(VeriModeli veri)
{
üyeSütunu = new TreeViewColumn("Member", new CellRendererText(), "text", 0);
appendColumn(üyeSütunu);
değerSütünu = new TreeViewColumn("Value", new CellRendererText(), "text", 1);
appendColumn(değerSütünu);
setModel(veri.model);
}
}
void main(string[] değişkenler)
{
Main.init(değişkenler);
auto pencere = new Pencere();
Main.run();
}
--
[ Bu gönderi, http://ddili.org/forum'dan dönüştürülmüştür. ]