private void ImportAllTextures(string inputDirecotry, string extensionFilter) { var files = Directory.GetFiles(inputDirecotry); foreach (var tex in CurBlock.Textures) { TextureLoadedInfos info = (TextureLoadedInfos)tex.Tag; string legalizedName = LegalizeFilePath(info.Name); string f = files.FirstOrDefault(n => (Path.GetFileNameWithoutExtension(n) ?? "") == (legalizedName ?? "")); if (!string.IsNullOrEmpty(f) && !info.IsReadOnly) { ImportTexture(f, tex); } TextureReplaced?.Invoke(this, new TextureReplacedEventArgs(CurBlock, CurTexture)); } }
private void ButtonItem_ImpTex_Click(object sender, EventArgs e) { if (CurTextureInfo.IsReadOnly) { MessageBoxEx.Show(this, "This texture is read-only. Probably it was loaded from a compressed MIO0-Bank.", "Import Texture", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { var ofd = new OpenFileDialog() { Filter = FileDialogFilters.FilterPictureFormats_All + "|" + FileDialogFilters.FilterPictureFormats_Single }; if (ofd.ShowDialog(this) == DialogResult.OK) { ImportTexture(ofd.FileName, CurTexture); TextureReplaced?.Invoke(this, new TextureReplacedEventArgs(CurBlock, CurTexture)); } } }