private void importBLKToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog openFile = new OpenFileDialog() { Filter = "All supported files|*.bin;*.bdt|BIN files|*.bin|BDT files|*.bdt" }; if (openFile.ShowDialog() == DialogResult.OK) { if (Path.GetExtension(openFile.FileName).ToLower() == ".bdt") { visibilityFunctions.ChunkList.AddRange(VisibilityFunctions.LoadShadowVisibilityFile(new FileStream(openFile.FileName, FileMode.Open))); } else if (Path.GetExtension(openFile.FileName).ToLower() == ".bin") { visibilityFunctions.ChunkList.AddRange(VisibilityFunctions.LoadHeroesVisibilityFile(openFile.FileName)); } numericCurrentChunk.Minimum = 1; numericCurrentChunk.Maximum = visibilityFunctions.ChunkList.Count(); numericCurrentChunk.Value = visibilityFunctions.ChunkList.Count(); if (numericCurrentChunk.Maximum != 0) { numericCurrentChunk.Value = 1; } labelChunkAmount.Text = "Amount: " + visibilityFunctions.ChunkList.Count(); } }
public void initVisibilityEditor(bool isShadow, string fileName) { if (File.Exists(fileName)) { if (isShadow) { visibilityFunctions.OpenVisibilityFile = null; byte[] bytes = File.ReadAllBytes(fileName); visibilityFunctions.ChunkList = VisibilityFunctions.LoadShadowVisibilityFile(Archive.FromONEFile(ref bytes)); labelLoadedBLK.Text = ""; } else { visibilityFunctions.OpenVisibilityFile = fileName; visibilityFunctions.ChunkList = VisibilityFunctions.LoadHeroesVisibilityFile(visibilityFunctions.OpenVisibilityFile); labelLoadedBLK.Text = "Loaded " + fileName; } numericCurrentChunk.Minimum = 1; numericCurrentChunk.Maximum = visibilityFunctions.ChunkList.Count(); numericCurrentChunk.Value = visibilityFunctions.ChunkList.Count(); if (numericCurrentChunk.Maximum != 0) { numericCurrentChunk.Value = 1; } labelChunkAmount.Text = "Amount: " + visibilityFunctions.ChunkList.Count(); } }