Ejemplo n.º 1
0
        public void write(Definition value)
        {
            Definition info = value;

            var item = new ListViewItem();

            writeSubItems(item, value);

            _items.Add(item);
        }
Ejemplo n.º 2
0
 public virtual void CompileMain(BinaryWriter f, List<Definition> infos, int RecNo)
 {
     var item = new Definition();
     item = infos[RecNo];
     List<String> TmpArr = MainForm.Instance.DatInfo.getFieldNames();
     for (int i = 0; i < TmpArr.Count; i++)
     {
         String FName = TmpArr[i];
         WriteFieldValue(f, item, FName);
     }
 }
Ejemplo n.º 3
0
        public override Definition ParseMain(BinaryReader f, int RecNo)
        {
            var ret = new Definition();

            if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Gracia_Final)
            {
                var info = new EtcitemgrpInfo_Gracia_Final();
                info.InitFieldValues();

                info = (EtcitemgrpInfo_Gracia_Final) base.ReadFieldValue(f, info, "tag", "UNK_0");
                info = (EtcitemgrpInfo_Gracia_Final) base.ReadFieldValue(f, info, "drop_mesh1", "UNK_1");
                info = (EtcitemgrpInfo_Gracia_Final) base.ReadFieldValue(f, info, "UNK_2");
                info = (EtcitemgrpInfo_Gracia_Final) base.ReadFieldValue(f, info, "UNK_3");
                info = (EtcitemgrpInfo_Gracia_Final) base.ReadFieldValue(f, info, "fort", "grade");

                ret = info;
            }
            else if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Kamael)
            {
                var info = new EtcitemgrpInfo_CT1();
                info.InitFieldValues();
                info = (EtcitemgrpInfo_CT1) base.ReadFieldValue(f, info, "tag", "UNK_1");
                if (RConfig.Instance.DatVersionAsEnum >= DatVersion.HellBound)
                    info = (EtcitemgrpInfo_CT1) base.ReadFieldValue(f, info, "UNK_2");
                if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Gracia_1__Gracia_2)
                    info = (EtcitemgrpInfo_CT1) base.ReadFieldValue(f, info, "UNK_3");
                info = (EtcitemgrpInfo_CT1) base.ReadFieldValue(f, info, "fort", "grade");
                ret = info;
            }
            else if (RConfig.Instance.DatVersionAsEnum >= DatVersion.C4)
            {
                var info = new EtcitemgrpInfo_C4();
                info = (EtcitemgrpInfo_C4) base.ReadFieldValue(f, info, "tag", "grade");
                ret = info;
            }
            else
            {
                var info = new EtcitemgrpInfo();
                info = (EtcitemgrpInfo) base.ReadFieldValue(f, info, "tag", "grade");
                ret = info;
            }
            return ret;
        }
Ejemplo n.º 4
0
        public override Definition ParseMain(BinaryReader f, int RecNo)
        {
            var info = new Definition();

            if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Gracia_Final)
            {
                var dat = new ZoneNameInfo_Gracia_Final();
                dat = (ZoneNameInfo_Gracia_Final) base.ReadFieldValue(f, dat, "nbr", "zone_name");
                dat = (ZoneNameInfo_Gracia_Final) base.ReadFieldValue(f, dat, "coords1", "UNK_2");
                info = dat;
            }
            else
            {
                var dat = new ZoneNameInfo();
                dat = (ZoneNameInfo) base.ReadFieldValue(f, dat, "nbr", "zone_name");
                if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Interlude)
                    dat = (ZoneNameInfo) base.ReadFieldValue(f, dat, "coords1", "map");
                info = dat;
            }
            return info;
        }
Ejemplo n.º 5
0
 public override Definition ParseMain(BinaryReader f, int RecNo)
 {
     var ret = new Definition();
     if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Gracia_Plus__Epilogue)
     {
         var info = new ChargrpInfo_Gracia_Plus();
         int count = 300;
         info.hair_tab = new UNICODE();
         for (int i = 0; i < count; i++)
         {
             info.hair_tab.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < count - 1)
                 info.hair_tab.Text += ",";
         }
         info = (ChargrpInfo_Gracia_Plus) base.ReadFieldValue(f, info, "face_mesh", "cnt_dmg");
         info.snd_att = new UNICODE();
         for (int i = 0; i < info.cnt_att.Value; i++)
         {
             info.snd_att.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_att.Value - 1)
                 info.snd_att.Text += ",";
         }
         info.snd_def = new UNICODE();
         for (int i = 0; i < info.cnt_def.Value; i++)
         {
             info.snd_def.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_def.Value - 1)
                 info.snd_def.Text += ",";
         }
         info.snd_dmg = new UNICODE();
         for (int i = 0; i < info.cnt_dmg.Value; i++)
         {
             info.snd_dmg.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_dmg.Value - 1)
                 info.snd_dmg.Text += ",";
         }
         info = (ChargrpInfo_Gracia_Plus) base.ReadFieldValue(f, info, "voice_snd_hand", "p2");
         ret = info;
     }
     else if (RConfig.Instance.DatVersionAsEnum >= DatVersion.Kamael)
     {
         var info = new ChargrpInfo_CT1();
         ret = info;
     }
     else
     {
         var info = new ChargrpInfo();
         info = (ChargrpInfo) base.ReadFieldValue(f, info, "face_icon", "cnt_ft");
         info.hair_mesh = new UNICODE();
         for (int i = 0; i < info.cnt_hm.Value; i++)
         {
             info.hair_mesh.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_hm.Value - 1)
                 info.hair_mesh.Text += ",";
         }
         info.hair_tex = new UNICODE();
         for (int i = 0; i < info.cnt_ht.Value; i++)
         {
             info.hair_tex.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_ht.Value - 1)
                 info.hair_tex.Text += ",";
         }
         info.face_mesh = new UNICODE();
         for (int i = 0; i < info.cnt_fm.Value; i++)
         {
             info.face_mesh.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_fm.Value - 1)
                 info.face_mesh.Text += ",";
         }
         info.face_tex = new UNICODE();
         for (int i = 0; i < info.cnt_ft.Value; i++)
         {
             info.face_tex.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_ft.Value - 1)
                 info.face_tex.Text += ",";
         }
         info = (ChargrpInfo) base.ReadFieldValue(f, info, "body_mesh1", "cnt_dmg");
         info.snd_att = new UNICODE();
         for (int i = 0; i < info.cnt_att.Value; i++)
         {
             info.snd_att.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_att.Value - 1)
                 info.snd_att.Text += ",";
         }
         info.snd_def = new UNICODE();
         for (int i = 0; i < info.cnt_def.Value; i++)
         {
             info.snd_def.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_def.Value - 1)
                 info.snd_def.Text += ",";
         }
         info.snd_dmg = new UNICODE();
         for (int i = 0; i < info.cnt_dmg.Value; i++)
         {
             info.snd_dmg.Text += DatTool.ReadStringSimple_UnicodeInt32Length(f);
             if (i < info.cnt_dmg.Value - 1)
                 info.snd_dmg.Text += ",";
         }
         info = (ChargrpInfo) base.ReadFieldValue(f, info, "voice_snd_hand", "voice_snd_fist");
         ret = info;
     }
     return ret;
 }
Ejemplo n.º 6
0
        public void writeSubItems(ListViewItem item, Definition value)
        {
            Definition info = value;

            bool first = true;

            item.SubItems.Clear();

            item.Text = info.ToString();
            item.Tag = info;

            Color color = Color.White;

            foreach (PropertyInfo prop in info.GetType().GetProperties())
            {
                if (first)
                {
                    first = false;
                    continue;
                }

                foreach (Attribute at in prop.GetCustomAttributes(true))
                {
                    if (at is ListColor)
                    {
                        var co = at as ListColor;
                        color = ConvertUtilities.HtmlColorToColor((String) prop.GetValue(value, null));
                    }
                }

                var sub = new ListViewItem.ListViewSubItem();
                sub.Text = prop.GetValue(value, null).ToString();
                item.SubItems.Add(sub);
            }

            item.ForeColor = color;
        }
Ejemplo n.º 7
0
        public void WriteFieldValue(BinaryWriter f, Definition item, String FName)
        {
            try
            {
                FieldInfo FType = MainForm.Instance.DatInfo.getDefinition().GetType().GetField(FName);
                Object obj = FType.GetValue(item);
                if (obj is IType)
                {
                    var type = (IType) obj;

                    type.write(f);
                }
                else
                {
                    throw new NotImplementedException("Format " + obj.GetType().Name + " is not implement IType");
                }
            }
            catch (Exception ex)
            {
                item.DumpFieldValues();
                ex = new ApplicationException(
                    String.Format("Error compiling string file (FieldName: {0} RecordOffset: 0x{1:X})",
                                  FName, f.BaseStream.Position), ex);
            }
        }
Ejemplo n.º 8
0
 public void WriteFieldValue(BinaryWriter f, Definition item, int FNumber)
 {
     String FName = MainForm.Instance.DatInfo.getFieldNames()[FNumber];
     WriteFieldValue(f, item, FName);
 }
Ejemplo n.º 9
0
 public void WriteFieldValue(BinaryWriter f, Definition info, String FromName, String ToName)
 {
     int startPos = 0, endPos = 0;
     List<String> TmpArr = MainForm.Instance.DatInfo.getFieldNames();
     for (int i = 0; i < TmpArr.Count; i++)
     {
         if (TmpArr[i] == FromName)
             startPos = i;
         if (TmpArr[i] == ToName)
             endPos = i;
     }
     for (int i = startPos; i <= endPos; i++)
         WriteFieldValue(f, info, i);
 }
Ejemplo n.º 10
0
 public Definition ReadFieldValue(BinaryReader f, Definition info, int FNumber)
 {
     String FName = MainForm.Instance.DatInfo.getFieldNames()[FNumber];
     return ReadFieldValue(f, info, FName);
 }
Ejemplo n.º 11
0
        public Definition ReadFieldValue(BinaryReader f, Definition info, String FName)
        {
            Definition TmpInfo = info;
            long curPos = f.BaseStream.Position;

            try
            {
                FieldInfo FType = MainForm.Instance.DatInfo.getDefinition().GetType().GetField(FName);

                Type field = FType.FieldType;

                if (FType.GetValue(info) == null)
                {
                    Object obj = field.InvokeMember(null, BindingFlags.CreateInstance, null, null, null);

                    if (obj is IType)
                    {
                        var type = (IType)obj;
                        FType.SetValue(info, type.read(f));
                    }
                    else
                    {
                        throw new NotImplementedException("Format " + obj.GetType().Name + " is not implement IType");
                    }
                }
                else
                {
                    FType.SetValue(info, ((IType)FType.GetValue(info)).read(f));
                }
            }
            catch (Exception ex)
            {
                TmpInfo.DumpFieldValues();
                ex = new ApplicationException(
                    String.Format("Error parsing string file (FieldName: {0} RecordOffset: 0x{1:X} DumpData: {2})",
                                  FName, f.BaseStream.Position, DatTool.Debug_DumpString(f, curPos, 8)), ex);
            }
            return info;
        }
Ejemplo n.º 12
0
        public void setColumnSize(Definition def, String columnName, int size)
        {
            String defName = def.GetType().Name;

            if (!_columnSize.ContainsKey(defName))
            {
                _columnSize[defName] = new Dictionary<string, int>();
            }

            if (_columnSize[defName].ContainsKey(columnName))
                _columnSize[defName].Remove(columnName);

            _columnSize[defName].Add(columnName, size);
        }
Ejemplo n.º 13
0
        public int getColumnSize(Definition def, String columnName)
        {
            String defName = def.GetType().Name;

            if (_columnSize.ContainsKey(defName))
            {
                if (_columnSize[defName].ContainsKey(columnName))
                {
                    return _columnSize[defName][columnName];
                }
            }

            return 60;
        }