Exemplo n.º 1
0
 private void button4_Click(object sender, EventArgs e)
 {
     if (lbFiles.SelectedIndex != -1)
     {
         FatRecord rec = selectedLodFile[lbFiles.SelectedItem.ToString()];
         if (rec.Extension == "TXT" || rec.Extension == "ZBK")
         {
             rtbMain.Text = Encoding.Default.GetString(rec.GetRawData());
         }
         else if (rec.Extension == "PCX")
         {
             bmp = rec.GetBitmap();
             Invalidate();
         }
         else if (rec.Extension == "DEF")
         {
             def = rec.GetDefFile();
             bmp = def.GetSprite(0, 0);
             lbDecomposed.Items.Clear();
             for (int i = 0; i < def.BlockCount; i++)
             {
                 lbDecomposed.Items.AddRange(def.headers[i].Names);
             }
         }
     }
 }
        public static void LoadFromMaster(Heroes3Master master)
        {
            FatRecord un32, un44;


            un32    = master.ResolveWith(BackupManager.GetBackupFileName(Speciality.IMG_FNAME_SMALL)) ?? master.ResolveWith(Speciality.IMG_FNAME_SMALL);
            un44    = master.ResolveWith(BackupManager.GetBackupFileName(Speciality.IMG_FNAME)) ?? master.ResolveWith(Speciality.IMG_FNAME);
            h_specs = master.ResolveWith(BackupManager.GetBackupFileName(HeroesManager.H_SPECS)) ?? master.ResolveWith(HeroesManager.H_SPECS);

            spec_rows = Encoding.Default.GetString(h_specs.GetRawData()).Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);

            LoadOriginalSpecs(Properties.Resources.allspecs, 0);
            LoadDefsUncompressed(un32.GetRawData(), un44.GetRawData());
        }