ME3Explorer.KFreonTPFTools3.ExtractAndBuildLog C# (CSharp) Method

ExtractAndBuildLog() private method

private ExtractAndBuildLog ( string extractPath, List tmptexes ) : void
extractPath string
tmptexes List
return void
        private void ExtractAndBuildLog(string extractPath, List<TPFTexInfo> tmptexes)
        {
            // Heff: delete earlier temp contents, create temp folder:
            if (Directory.Exists(extractPath))
                Directory.Delete(extractPath, true);

            Directory.CreateDirectory(extractPath);

            using (FileStream fs = new FileStream(extractPath + "\\MEResults.log", FileMode.Create))
            {
                var hashes = new List<uint>();
                var texes = new List<TPFTexInfo>();
                foreach (TPFTexInfo tex in tmptexes)
                {
                    // KFreon: Ignore textures with no hash
                    if (tex.Hash == 0)
                        continue;

                    // Heff: ignore duplicates so that texmod's generator doesn't include them several times.
                    if (hashes.Contains(tex.Hash))
                        continue;

                    hashes.Add(tex.Hash);
                    texes.Add(tex);
                    // KFreon: Write hashes to log
                    string hash = KFreonLib.Textures.Methods.FormatTexmodHashAsString(tex.Hash);
                    string name = tex.TexName;
                    if (string.IsNullOrEmpty(name))
                        name = tex.FileName;
                    string append = "_" + hash + Path.GetExtension(tex.FileName);
                    if (name.Contains(hash))
                        append = "";
                    fs.WriteString(hash + "|" + name + append + Environment.NewLine);
                }
                fs.WriteString("\0");
                Extractor(extractPath, null, t => texes.Contains(t));
            }
        }
KFreonTPFTools3