Ejemplo n.º 1
0
        public void PerformTreeComparison()
        {
            int count = -1;

            // KFreon: Get number of textures waiting to be processed
            lock (Sync)
                count = TreeTempTexes.Count;

            // KFreon: Add each element with duplicate checking
            while (count > 0)
            {
                // KFreon: Get elements from list as added previously
                List <object> item;
                lock (Sync)
                    item = TreeTempTexes[0];

                TreeTexInfo tex      = (TreeTexInfo)item[0];
                string      PackName = (string)item[1];
                string      filename = (string)item[2];

                // KFreon: Add to list if not a duplicate
                TreeTexInfo temp = null;
                if ((temp = Contains(tex, PackName, filename)) != null)
                {
                    temp.Update(tex, pathBIOGame);

                    if (GameVersion == 2 && !temp.ValidFirstPCC && tex.ValidFirstPCC)
                    {
                        // KFreon: Get index of new first file in 'old' list
                        int index = temp.Files.IndexOf(tex.Files[0]);

                        // KFreon: Move pcc
                        var element = temp.Files.Pop(index);
                        temp.Files.Insert(0, element);

                        // KFreon: Move expid
                        var exp = temp.ExpIDs.Pop(index);
                        temp.ExpIDs.Insert(0, exp);

                        // KFreon: Update originals lists
                        temp.OriginalExpIDs = new List <int>(temp.ExpIDs);
                        temp.OriginalFiles  = new List <string>(temp.Files);

                        temp.ValidFirstPCC = true;
                    }
                }
                else
                {
                    BlindAddTex(tex);
                }

                // KFreon: Remove item from temp list
                lock (Sync)
                {
                    TreeTempTexes.RemoveAt(0);
                    count = TreeTempTexes.Count;
                }
            }
        }