ME3Explorer.KFreonTPFTools3.RemoveFileDuplicates C# (CSharp) Method

RemoveFileDuplicates() private method

private RemoveFileDuplicates ( ) : void
return void
        private void RemoveFileDuplicates()
        {
            // KFreon: Rewrote this. Any coders, look back in the history to see the original abomination...

            List<TPFTexInfo> newTexes = new List<TPFTexInfo>();
            List<int> duplicateInds = new List<int>();
            for (int i = 0; i < LoadedTexes.Count; i++)
            {
                TPFTexInfo curr = LoadedTexes[i];
                if (curr.isDef || duplicateInds.Contains(i))
                    continue;

                for (int j = i; j < LoadedTexes.Count; j++) 
                {
                    TPFTexInfo checker = LoadedTexes[j];
                    if (checker.isDef || curr == checker)
                        continue;

                    if (curr.Hash == checker.Hash)
                    {
                        duplicateInds.Add(j); // KFreon: Add this index to list so when curr gets to this texture, it's skipped since it's already in another textures duplicate list.
                        if (!curr.FileDuplicates.Contains(checker))  // KFreon: Heff's check to ensure that no file duplicates are further duplicated when doing Analyse -> load -> analyse.
                            curr.FileDuplicates.Add(checker);
                    }
                }

                newTexes.Add(curr);
            }

            LoadedTexes.Clear();
            LoadedTexes.AddRange(newTexes);
        }
KFreonTPFTools3