public FormEntityView() { InitializeComponent(); entityData = new GameEntityData[256]; statData = new BaseStatData[256]; for (int i = 0; i < 256; ++i) { statData[i] = new BaseStatData(); } comboBoxObj.DataSource = GetEntityNames(); comboBoxSpr.DataSource = GetSpriteNames(); if (!Settings.Default.rootpath.Equals(String.Empty)) { LoadFromFile(Settings.Default.rootpath + "entities.rzdb"); } }
private void LoadFromFile(string fname) { try { textBoxFile.Text = fname; RZDBReader br = new RZDBReader(File.OpenRead(fname)); entityCount = br.ReadSize(); for (int i = 0; i < entityCount; ++i) { entityData[i] = new GameEntityData(br); } statTableSize = br.ReadSize(); for (int i = 0; i < statTableSize; ++i) { statData[i] = new BaseStatData(br); } br.Close(); comboBoxObj.SelectedIndex = 0; } catch (Exception) { MessageBox.Show("Invalid file."); } }