ME3Explorer.KFreonTPFTools3.ReplaceButton_Click C# (CSharp) Method

ReplaceButton_Click() private method

private ReplaceButton_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private async void ReplaceButton_Click(object sender, EventArgs e)
        {
            TPFTexInfo tex;
            int index = GetSelectedTex(out tex);
            if (index < 0)
                return;

            string replacingPath = null;

            using (OpenFileDialog ofd = new OpenFileDialog())
            {

                ofd.Title = "Select image to replace with";
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    replacingPath = ofd.FileName;
                else
                    return;
            }
            Overall.UpdateText("Replacing texture...");
            OverallProg.ChangeProgressBar(0, 1);
            DebugOutput.PrintLn("Replacing data of texture: " + (isAnalysed ? tex.TexName : tex.FileName) + " with: " + replacingPath);

            await Task.Run(() =>
            {
                tex.FileName = Path.GetFileName(replacingPath);
                tex.FilePath = Path.GetDirectoryName(replacingPath);
                DebugOutput.PrintLn("Getting new details...");
                tex.Thumbnail = new MemoryStream();
                tex.EnumerateDetails();

                /*try
                {
                    DebugOutput.PrintLn("Updating to new thumbnail");
                     MainTreeViewImageList.Images[tex.ThumbInd] = new Bitmap(tex.Thumbnail);
                }
                catch
                {
                    myTreeNode node = MainTreeView.SelectedNode as myTreeNode;
                    node.ImageIndex = 2;
                }*/
                LoadedTexes[index] = tex;
            });
            OverallProg.ChangeProgressBar(1, 1);
            Overall.UpdateText("Texture replaced!");
            RedrawTreeView();
        }
KFreonTPFTools3