示例#1
0
        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();
        }
示例#2
0
        private void RenameDGRP_Click(object sender, EventArgs e)
        {
            if (ActiveDGRP == null)
            {
                return;
            }
            var dialog = new IffNameDialog(ActiveDGRP, false);

            dialog.ShowDialog();
            UpdateDGRPList(false);
        }
示例#3
0
        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();
        }
示例#4
0
        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();
        }
示例#5
0
        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();
        }
示例#6
0
        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();
        }