private void NewRes_Click(object sender, EventArgs e) { var selectedType = (ComboChunkType)ResTypeCombo.SelectedItem; var chunk = (IffChunk)Activator.CreateInstance(selectedType.ChunkType, new object[] { }); var type = chunk.GetType(); if ((type == typeof(SPR2) || type == typeof(SPR) || type == typeof(DGRP)) && ActiveIff is GameObjectResource && ((GameObjectResource)ActiveIff).Sprites != null) { chunk.ChunkParent = ((GameObjectResource)ActiveIff).Sprites; } else { chunk.ChunkParent = ActiveIff.MainIff; } chunk.ChunkProcessed = true; var dialog = new IffNameDialog(chunk, true); dialog.ShowDialog(); /*chunk.ChunkLabel = "New Chunk"; * chunk.ChunkID = GetFreeID(); * chunk.ChunkProcessed = true; * ActiveIff.MainIff.AddChunk(chunk);*/ RefreshResList(); }
private void RenameDGRP_Click(object sender, EventArgs e) { if (ActiveDGRP == null) { return; } var dialog = new IffNameDialog(ActiveDGRP, false); dialog.ShowDialog(); UpdateDGRPList(false); }
private void RenameRes_Click(object sender, EventArgs e) { if (ResList.SelectedItem == null) { return; } var selectedType = (ComboChunkType)ResTypeCombo.SelectedItem; MethodInfo method = typeof(GameIffResource).GetMethod("Get"); MethodInfo generic = method.MakeGenericMethod(selectedType.ChunkType); var chunk = (IffChunk)generic.Invoke(ActiveIff, new object[] { ((ObjectResourceEntry)ResList.SelectedItem).ID }); var dialog = new IffNameDialog(chunk, false); dialog.ShowDialog(); RefreshResList(); }
private void PasteRes_Click(object sender,EventArgs e) { //try to paste this into the iff file. DataObject retrievedData = null; IffChunk chunk = null; StaExecute(() => { retrievedData = Clipboard.GetDataObject() as DataObject; if (retrievedData == null || !retrievedData.GetDataPresent("rawbinary")) { return; } MemoryStream memStream = retrievedData.GetData("rawbinary") as MemoryStream; if (memStream == null) { return; } memStream.Seek(0,SeekOrigin.Begin); try { using (var io = IoBuffer.FromStream(memStream,ByteOrder.BIG_ENDIAN)) chunk = ActiveIff.MainIff.AddChunk(memStream,io,false); } catch (Exception) { } }); if (chunk != null) { chunk.ChunkParent = ActiveIff.MainIff; var dialog = new IffNameDialog(chunk,true); dialog.ShowDialog(); } RefreshResList(); }
private void RenameRes_Click(object sender, EventArgs e) { if (ResList.SelectedItem == null) return; var selectedType = (ComboChunkType)ResTypeCombo.SelectedItem; MethodInfo method = typeof(GameIffResource).GetMethod("Get"); MethodInfo generic = method.MakeGenericMethod(selectedType.ChunkType); var chunk = (IffChunk)generic.Invoke(ActiveIff, new object[] { ((ObjectResourceEntry)ResList.SelectedItem).ID }); var dialog = new IffNameDialog(chunk, false); dialog.ShowDialog(); RefreshResList(); }
private void NewRes_Click(object sender, EventArgs e) { var selectedType = (ComboChunkType)ResTypeCombo.SelectedItem; var chunk = (IffChunk)Activator.CreateInstance(selectedType.ChunkType, new object[] { }); var type = chunk.GetType(); if ((type == typeof(SPR2) || type == typeof(SPR) || type == typeof(DGRP)) && ActiveIff is GameObjectResource && ((GameObjectResource)ActiveIff).Sprites != null) chunk.ChunkParent = ((GameObjectResource)ActiveIff).Sprites; else chunk.ChunkParent = ActiveIff.MainIff; chunk.ChunkProcessed = true; var dialog = new IffNameDialog(chunk, true); dialog.ShowDialog(); /*chunk.ChunkLabel = "New Chunk"; chunk.ChunkID = GetFreeID(); chunk.ChunkProcessed = true; ActiveIff.MainIff.AddChunk(chunk);*/ RefreshResList(); }