Пример #1
0
        private void mReplaceButton_Click(object sender, EventArgs e)
        {
            int index = mAssetListBox.SelectedIndex;

            if (index > -1)
            {
                Chunk  c        = mAssetListBox.Items[index] as Chunk;
                string fileName = null;

                try
                {
                    fileName = Munger.GetMungedFile("Choose file to replace " + c.Name + "." + c.Type);
                    if (fileName != null)
                    {
                        mStatusLabel.Text = "Replacing item...";
                        mUcfbFileHelper.ReplaceUcfbChunk(c, fileName, true);
                        mStatusLabel.Text = "Done Replacing.";
                        //PopulateListBox();
                        //mMainTextBox.Clear();
                        //if (index < mAssetListBox.Items.Count)
                        //    mAssetListBox.SelectedIndex = index;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error! Operation unsuccessful.");
                }
            }
        }
Пример #2
0
        private void AddGatheredStrings()
        {
            if (mStringsToAdd.Count > 0)
            {
                Chunk        cur       = null;
                List <Chunk> locChunks = new List <Chunk>();
                // rip through the whole thing first.
                while ((cur = mCoreUucfbFileHelper.RipChunk(false)) != null)
                {
                    if (cur.Type == "Locl")
                    {
                        locChunks.Add(cur);
                    }
                }

                Chunk c = null;
                // process from back to front so we don't mess up the chunk's knowledge of it's position
                for (int i = locChunks.Count - 1; i > -1; i--)
                {
                    c = locChunks[i];
                    if (mStringsToAdd.ContainsKey(c.Name))
                    {
                        LocHelper helper = new LocHelper(c.GetAssetData());
                        helper.AddNewStrings(mStringsToAdd[c.Name].ToString());
                        mCoreUucfbFileHelper.ReplaceUcfbChunk(c, helper.GetUcfbData(), true);
                    }
                }
            }
        }