ME3Explorer.KFreonTPFTools3.LoadTrees C# (CSharp) Method

LoadTrees() private method

Loads Tree.
private LoadTrees ( ) : bool
return bool
        private bool LoadTrees()
        {
            // KFreon: Try to setup tree
            Task<TreeDB> current = null;
            for (int i = 1; i < 4; i++)
            {
                // KFreon: Start task for tree we want
                var y = i;
                Task<TreeDB> temptask = Task.Run(() =>
                {
                    TreeDB temptree = null;
                    string tempcooked = MEExDirecs.GetDifferentPathCooked(y);
                    string tempbio = MEExDirecs.GetDifferentPathBIOGame(y);
                    bool res = Texplorer2.SetupTree(ref temptree, tempcooked, y, null, tempbio);
                    bool temp = false;
                    if (res)
                    {
                        int status2;
                        temp = temptree.ReadFromFile(ExecFolder + "me" + y + "tree.bin", Path.GetDirectoryName(tempbio), ExecFolder + "ThumbnailCaches\\ME" + y + "ThumbnailCache\\", out status2);
                    }

                    ChangeIndicatorColours(y, temp, true);
                    DebugOutput.PrintLn(temp ? "ME" + y + " tree found." : "ME" + y + " tree not found.");
                    return temp ? temptree : null;
                });


                if (i == WhichGame)
                    current = temptask;
            }

            //KFreon: Wait for tree we want to finish loading.
            while (!current.IsCompleted)
            {
                System.Threading.Thread.Sleep(50);
                Application.DoEvents();
            }

            Tree = current.Result;
            return Tree != null;
        }
KFreonTPFTools3