public void InitializePackages(string[] packageNames, bool reload = true)
        {
            int length = packageNames.Length;
            List <TPPackage> packages = new List <TPPackage>(length);

            for (int i = 0; i < length; i++)
            {
                TPPackage package = new TPPackage(packageNames[i], () => { return(true); });
                packages.Add(package);
            }

            Packages       = packages.ToArray();
            packagesLength = length;

            if (reload)
            {
                ReloadPackages();
            }
        }
Beispiel #2
0
        private static void OverridePackages()
        {
            List <TPPackage> packagesList = new List <TPPackage>(Manager.Packages);
            int length = overridePackages.Length;

            for (int i = 0; i < length; i++)
            {
                TPPackage package = new TPPackage(overridePackages[i].Name, overridePackages[i].OnReload);
                int       index   = packagesList.FindIndex(x => x.FileName.Contains(overridePackages[i].Name));
                if (index >= 0)
                {
                    packagesList[index] = package;
                }
                else
                {
                    packagesList.Add(package);
                }
            }
            Manager.SetPackages(packagesList.ToArray());
        }