ME3Explorer.KFreonTPFTools3.RepackWithTexplorer C# (CSharp) Method

RepackWithTexplorer() private method

private RepackWithTexplorer ( List texes ) : void
texes List
return void
        private async void RepackWithTexplorer(List<TPFTexInfo> texes)
        {
            if (!texes.Any(tex => tex.Hash != 0))
            {
                Overall.UpdateText("No valid textures to use.");
                return;
            }

            string path = "";
            using (SaveFileDialog sfd = new SaveFileDialog())
            {
                sfd.Title = "Select location to save TPF";
                sfd.Filter = "TPF|*.tpf";
                sfd.FileName = "";
                if (sfd.ShowDialog() == DialogResult.OK)
                    path = sfd.FileName;
                else
                    return;
            }

            string filesPath = Path.Combine(TemporaryPath, "TPF_REBUILD");

            // KFreon: Extract files to central location and build .log
            ExtractAndBuildLog(filesPath, texes);
            await Task.Run(() => backbone.GetCurrentJob().Wait());

            List<string> files = new List<string>(Directory.GetFiles(filesPath));

            // KFreon: Ensure log is the last file
            string log = null;
            for (int i = 0; i < files.Count; i++)
            {
                if (files[i].EndsWith(".log", StringComparison.OrdinalIgnoreCase))
                {
                    log = files[i];
                    files.RemoveAt(i);
                    break;
                }
            }
            files.Add(log);

            SaltTPF.ZipWriter.Repack(path, files);

            Overall.UpdateText(File.Exists(path) && files.Count > 1 ? "Build complete." : "Build failed.");
        }
KFreonTPFTools3