public async Task <bool> ExecutePlugin(Window win, AssetWorkspace workspace, List <AssetContainer> selection) { AssetContainer cont = selection[0]; AssetTypeValueField texBaseField = TextureHelper.GetByteArrayTexture(workspace, cont).GetBaseField(); TextureFile texFile = TextureFile.ReadTextureFile(texBaseField); EditDialog dialog = new EditDialog(texFile.m_Name, texFile, texBaseField); bool saved = await dialog.ShowDialog <bool>(win); if (saved) { byte[] savedAsset = texBaseField.WriteToByteArray(); var replacer = new AssetsReplacerFromMemory( 0, cont.PathId, (int)cont.ClassId, cont.MonoId, savedAsset); workspace.AddReplacer(cont.FileInstance, replacer, new MemoryStream(savedAsset)); return(true); } return(false); }
public async Task <bool> ExecutePlugin(Window win, AssetWorkspace workspace, List <AssetExternal> selection) { AssetExternal tex = selection[0]; AssetTypeValueField texBaseField = tex.instance.GetBaseField(); TextureFile texFile = TextureFile.ReadTextureFile(texBaseField); EditDialog dialog = new EditDialog(texFile.m_Name, texFile, texBaseField); bool saved = await dialog.ShowDialog <bool>(win); if (saved) { byte[] savedAsset = texBaseField.WriteToByteArray(); var replacer = new AssetsReplacerFromMemory( 0, tex.info.index, (int)tex.info.curFileType, AssetHelper.GetScriptIndex(tex.file.file, tex.info), savedAsset); workspace.AddReplacer(tex.file, replacer, new MemoryStream(savedAsset)); return(true); } return(false); }