Пример #1
0
        internal static void LoadRecipes()
        {
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HunterPie.Resources/Data/CraftingData.xml"));

                XmlNodeList items = document.SelectNodes("//Crafting/Item");

                IEnumerable <Recipe> recipes = items.Cast <XmlNode>()
                                               .Select(node => XmlNodeToRecipe(node));

                foreach (Recipe recipe in recipes)
                {
                    AddNewRecipe(recipe.OutputId, recipe);
                }

                Debugger.Warn($"Loaded {recipes.Count()} different item crafting recipes!");

                document = null;
            }
            catch (Exception err)
            {
                Debugger.Error($"Failed to load crafting data.\n{err}");
            }
        }
Пример #2
0
        public void LoadPlugins()
        {
            Stopwatch benchmark = Stopwatch.StartNew();

            if (packages.Count > 0)
            {
                // Quick load
                foreach (PluginPackage package in packages)
                {
                    if (!package.settings.IsEnabled)
                    {
                        continue;
                    }

                    try
                    {
                        package.plugin.Initialize(ctx);
                    }
                    catch (Exception err)
                    {
                        Debugger.Error(err);
                    }
                }
            }
            benchmark.Stop();
            Debugger.Module($"Loaded {packages.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");
        }
Пример #3
0
        public static async Task <bool> DownloadFileAsync(string URL, string output, string relFilepath)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    byte[] data = await client.GetByteArrayAsync(new Uri(URL));

                    if (Path.GetDirectoryName(relFilepath).Length > 0)
                    {
                        string dirs = Path.GetDirectoryName(output);

                        if (!Directory.Exists(dirs))
                        {
                            Directory.CreateDirectory(dirs);
                        }
                    }
                    File.WriteAllBytes(output, data);
                    return(true);
                }
            }
            catch (Exception err)
            {
                Debugger.Error(err);
                return(false);
            }
        }
 public void createConfig(string uniqueID, string uri = Constants.FALLBACK_URI, string retry = Constants.FALLBACK_HOTKEY)
 {
     Debugger.Error("Config.json for DiscordHelper not found!");
     Debugger.Module("Creating Config.json.", Name);
     File.WriteAllText(
         configPath, "{\n\t\"uri\": \"" + uri + "\",\n\t\"id\": \"" + uniqueID + "\",\n\t\"retry\": \"" + retry + "\"\n}");
 }
Пример #5
0
        public void PreloadPlugins()
        {
            Stopwatch benchmark = Stopwatch.StartNew();

            Debugger.Module("Pre loading modules");
            string[] modules = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Modules"));
            foreach (string module in modules)
            {
                // Skip modules without Module.json
                if (!File.Exists(Path.Combine(module, "module.json")))
                {
                    continue;
                }

                try
                {
                    string            serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                    PluginInformation modInformation   = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);
                    PluginSettings    modSettings      = GetPluginSettings(module);

                    if (File.Exists(Path.Combine(module, modInformation.EntryPoint)))
                    {
                        Debugger.Module($"Compiling plugin: {modInformation.Name}");
                        if (CompilePlugin(module, modInformation))
                        {
                            Debugger.Module($"{modInformation.Name} compiled successfully.");
                        }
                        else
                        {
                            continue;
                        }
                    }
                    Stopwatch s = Stopwatch.StartNew();
                    foreach (string required in modInformation.Dependencies)
                    {
                        AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, required)));
                    }
                    Assembly           plugin  = AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, $"{modInformation.Name}.dll")));
                    IEnumerable <Type> entries = plugin.ExportedTypes.Where(exp => exp.GetMethod("Initialize") != null);
                    if (entries.Count() > 0)
                    {
                        dynamic mod = plugin.CreateInstance(entries.First().ToString());
                        packages.Add(new PluginPackage {
                            plugin = mod, information = modInformation, settings = modSettings, path = module
                        });
                    }
                } catch (Exception err)
                {
                    Debugger.Error(err);
                    continue;
                }
            }
            IsReady = true;
            benchmark.Stop();
            Debugger.Module($"Pre loaded {packages.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");
            if (QueueLoad)
            {
                LoadPlugins();
            }
        }
Пример #6
0
        /// <summary>
        /// Loads a specific plugin
        /// </summary>
        /// <param name="plugin">Plugin to be loaded</param>
        /// <returns>True if it was loaded successfully, false if not</returns>
        public static bool LoadPlugin(IPlugin plugin)
        {
            if (ctx == null)
            {
                return(false);
            }
            var name = packages.FirstOrDefault(p => p.plugin == plugin).information?.Name;

            try
            {
                plugin.Initialize(ctx);
                if (!string.IsNullOrEmpty(name))
                {
                    failedPlugins.Remove(name);
                }
            }
            catch (Exception ex)
            {
                Debugger.Error($"Error on initializing plugin {plugin.Name}: {ex}");
                if (!string.IsNullOrEmpty(name))
                {
                    failedPlugins.Add(name);
                }
                return(false);
            }

            return(true);
        }
Пример #7
0
        public bool CompilePlugin(string pluginPath, PluginInformation information)
        {
            var compiler = CSharpCompilation.Create($"{nameof(HunterPie)}{information.Name}", options: new CSharpCompilationOptions(OutputKind.DynamicallyLinkedLibrary)
                                                    .WithOptimizationLevel(OptimizationLevel.Release));

            var types = new[]
            {
                typeof(Hunterpie),               // HunterPie
                typeof(JObject),                 // Newtonsoft.Json.dll
                typeof(Object),                  // mscorlib.dll
                typeof(UIElement),               // PresentationCore.dll
                typeof(Window),                  // PresentationFramework.dll
                typeof(Uri),                     // System.dll
                typeof(Enumerable),              // System.Core.dll
                typeof(DataSet),                 // System.Data.dll
                typeof(DataTableExtensions),     // System.Data.DataSetExtensions.dll
                typeof(Bitmap),                  // System.Drawing.dll
                typeof(HttpClient),              // System.Net.Http.dll
                typeof(BigInteger),              // System.Numerics.dll
                typeof(Form),                    // System.Windows.Forms.dll
                typeof(XamlType),                // System.Xaml.dll
                typeof(XmlNode),                 // System.Xml.dll
                typeof(XNode),                   // System.Xml.Linq.dll
                typeof(Rect),                    // WindowsBase.dll
            };

            // Load all basic dependencies
            List <MetadataReference> references = types.Select(type => MetadataReference.CreateFromFile(type.Assembly.Location)).ToList <MetadataReference>();

            if (information.Dependencies != null)
            {
                foreach (string extDependency in information.Dependencies)
                {
                    references.Add(MetadataReference.CreateFromFile(Path.Combine(pluginPath, extDependency)));
                }
            }
            compiler = compiler.AddReferences(references);
            var code    = File.ReadAllText(Path.Combine(pluginPath, information.EntryPoint));
            var options = CSharpParseOptions.Default.WithLanguageVersion(
                LanguageVersion.CSharp7_3);
            var syntaxTree = SyntaxFactory.ParseSyntaxTree(SourceText.From(code, Encoding.UTF8), options, Path.Combine(pluginPath, information.EntryPoint));

            compiler = compiler.AddSyntaxTrees(syntaxTree);
            var result = compiler.Emit(Path.Combine(pluginPath, information.Name) + ".dll");

            if (result.Success)
            {
                return(true);
            }
            else
            {
                Debugger.Error($"Failed to compile plugin: {information.Name}");
                foreach (var exception in result.Diagnostics)
                {
                    Debugger.Error(exception);
                }
                return(false);
            }
        }
Пример #8
0
        public void LoadPlugins(Game ctx)
        {
            Stopwatch benchmark = Stopwatch.StartNew();

            if (plugins.Count > 0)
            {
                // Quick load
                foreach (IPlugin plugin in plugins)
                {
                    plugin.Initialize(ctx);
                }
            }
            else
            {
                string[] modules = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Modules"));
                foreach (string module in modules)
                {
                    try
                    {
                        string            serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                        PluginInformation modInformation   = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                        if (File.Exists(Path.Combine(module, modInformation.EntryPoint)))
                        {
                            Debugger.Module($"Compiling plugin: {modInformation.Name}");
                            if (CompilePlugin(module, modInformation))
                            {
                                Debugger.Module($"{modInformation.Name} compiled successfully.");
                            }
                            else
                            {
                                continue;
                            }
                        }

                        foreach (string required in modInformation.Dependencies)
                        {
                            AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, required)));
                        }
                        var plugin = AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, $"{modInformation.Name}.dll")));
                        IEnumerable <Type> entries = plugin.ExportedTypes.Where(exp => exp.GetMethod("Initialize") != null);
                        if (entries.Count() > 0)
                        {
                            dynamic mod = plugin.CreateInstance(entries.First().ToString());
                            mod.Initialize(ctx);
                            plugins.Add(mod);
                        }
                    } catch (Exception err)
                    {
                        Debugger.Error(err);
                        continue;
                    }
                }
            }
            benchmark.Stop();
            Debugger.Module($"Loaded {plugins.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");
        }
Пример #9
0
 /// <summary>
 /// Unloads a specific plugin
 /// </summary>
 /// <param name="plugin">The plugin to be unloaded</param>
 /// <returns>True if the plugin was unloaded successfully, false otherwise</returns>
 public static bool UnloadPlugin(IPlugin plugin)
 {
     if (ctx == null)
     {
         return(true);
     }
     try
     {
         plugin.Unload();
         return(true);
     } catch (Exception err)
     {
         Debugger.Error(err);
         return(false);
     }
 }
Пример #10
0
        static string BuildCustomPartsStructure(int WeaponType, GameStructs.CustomAugment[] CustomAugments, bool ShowError)
        {
            StringBuilder[] Structure = new StringBuilder[5];
            for (int cAugmentIndex = 0; cAugmentIndex < CustomAugments.Length; cAugmentIndex++)
            {
                GameStructs.CustomAugment cAugment = CustomAugments[cAugmentIndex];
                // Skip empty slots
                if (cAugment.ID == byte.MaxValue)
                {
                    continue;
                }
                string AugmentType = HoneyGearData.SelectSingleNode($"//Honey/Weapons/Custom").ChildNodes[WeaponType].SelectSingleNode($"Part[@Level='{cAugment.Level + 1}' and @ID='{cAugment.ID}']/@Type")?.Value;

                // If we dont find the augment id, then we try the wildcard ones, since there are some
                // missing IDs
                if (AugmentType == null)
                {
                    AugmentType = HoneyGearData.SelectSingleNode($"//Honey/Weapons/Custom").ChildNodes[WeaponType].SelectSingleNode($"Part[@Level='{cAugment.Level + 1}' and @ID='?']/@Type")?.Value;
                }

                // If the augment is still null, then it isn't supported yet. In this case we display an error
                // with the augment ID, so it's easier to map it.
                if (AugmentType == null && ShowError)
                {
                    Debugger.Error($"Unsupported custom augment (ID = {cAugment.ID}, Level = {cAugment.Level})");
                    continue;
                }

                // Initializes StringBuilder if it isn't initialized yet
                int.TryParse(AugmentType, out int parsed);
                if (Structure[parsed] == null)
                {
                    Structure[parsed] = new StringBuilder();
                }

                Structure[parsed].Append((cAugment.Level + 1).ToString());
            }

            StringBuilder JoinedResult = new StringBuilder();

            foreach (StringBuilder SubBuilder in Structure)
            {
                JoinedResult.Append(SubBuilder?.ToString() + ";");
            }
            JoinedResult.Remove(JoinedResult.Length - 1, 1);
            return(JoinedResult.ToString());
        }
Пример #11
0
        static string GetWeaponHoneyID(int WeaponType, int WeaponID)
        {
            XmlNodeList nl = HoneyGearData.SelectSingleNode($"//Honey/Weapons").ChildNodes;

            if (WeaponType > nl.Count)
            {
                return("0");
            }
            XmlNode WeaponNode = nl[WeaponType];
            string  wID        = WeaponNode.SelectSingleNode($"Weapon[@ID='{WeaponID}']/@HoneyID")?.Value ?? "0";

            if (wID == "0")
            {
                Debugger.Error($"Unsupported weapon ID: {WeaponID}");
            }
            return(wID);
        }
Пример #12
0
        internal static void LoadRecipes()
        {
            try
            {
                XmlDocument document = new XmlDocument();
                document.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "HunterPie.Resources/Data/CraftingData.xml"));

                XmlNodeList items = document.SelectNodes("//Crafting/Item");
                list = items.Cast <XmlNode>()
                       .Select(node => XmlNodeToRecipe(node))
                       .ToDictionary(m => m.OutputId);

                Debugger.Warn("Loaded crafting data!");

                document = null;
            } catch (Exception err)
            {
                Debugger.Error($"Failed to load crafting data.\n{err}");
            }
        }
Пример #13
0
        internal static async Task <string> ReadOnlineModuleJson(string URL)
        {
            string url = URL;

            if (!URL.EndsWith("module.json"))
            {
                url = $"{URL}/module.json";
            }
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    return(await client.GetStringAsync(new Uri(url)));
                }
            } catch (Exception err)
            {
                Debugger.Error(err);
                return(null);
            }
        }
Пример #14
0
        /// <summary>
        /// Unloads a specific plugin
        /// </summary>
        /// <param name="plugin">The plugin to be unloaded</param>
        /// <returns>True if the plugin was unloaded successfully, false otherwise</returns>
        public static bool UnloadPlugin(IPlugin plugin)
        {
            if (ctx == null)
            {
                return(true);
            }
            try
            {
                // This means this plugin is not loaded, so we skip it
                if (plugin.Context == null)
                {
                    return(true);
                }

                plugin.Unload();
                return(true);
            } catch (Exception err)
            {
                Debugger.Error(err);
                return(false);
            }
        }
Пример #15
0
        public async Task <bool> PreloadPlugins()
        {
            Stopwatch benchmark = Stopwatch.StartNew();

            Debugger.Module("Pre loading modules");
            foreach (string module in IterateModules())
            {
                try
                {
                    string            serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                    PluginInformation modInformation   = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                    try
                    {
                        await PreloadPlugin(module, modInformation);

                        failedPlugins.Remove(modInformation.Name);
                    }
                    catch
                    {
                        failedPlugins.Add(modInformation.Name);
                        throw;
                    }
                }
                catch (Exception err)
                {
                    Debugger.Error(err);
                }
            }

            benchmark.Stop();
            Debugger.Module($"Pre loaded {packages.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");

            if (!tsc.Task.IsCompleted)
            {
                tsc.SetResult(null);
            }
            return(true);
        }
Пример #16
0
        public async Task LoadPlugins()
        {
            await PreloadTask;

            Stopwatch benchmark = Stopwatch.StartNew();

            if (packages.Count > 0)
            {
                // Quick load
                foreach (PluginPackage package in packages.Where(p => p.settings.IsEnabled))
                {
                    try
                    {
                        package.plugin.Initialize(ctx);
                    }
                    catch (Exception err)
                    {
                        Debugger.Error(err);
                    }
                }
            }
            benchmark.Stop();
            Debugger.Module($"Loaded {packages.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");
        }
Пример #17
0
        public async Task <bool> PreloadPlugins()
        {
            Stopwatch benchmark = Stopwatch.StartNew();

            Debugger.Module("Pre loading modules");
            string[] modules = Directory.GetDirectories(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Modules"));
            foreach (string module in modules)
            {
                // Skip modules without Module.json
                if (!File.Exists(Path.Combine(module, "module.json")))
                {
                    continue;
                }

                try
                {
                    string            serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                    PluginInformation modInformation   = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                    if (modInformation.Update.MinimumVersion is null)
                    {
                        Debugger.Error($"{modInformation.Name.ToUpper()} MIGHT BE OUTDATED! CONSIDER UPDATING IT.");
                    }

                    if (PluginUpdate.PluginSupportsUpdate(modInformation))
                    {
                        switch (await PluginUpdate.UpdateAllFiles(modInformation, module))
                        {
                        case UpdateResult.Updated:
                            serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                            modInformation   = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                            Debugger.Module($"Updated plugin: {modInformation.Name} (ver {modInformation.Version})");
                            break;

                        case UpdateResult.Skipped:
                            break;

                        case UpdateResult.Failed:
                            Debugger.Error($"Failed to update plugin: {modInformation.Name}");
                            continue;

                        case UpdateResult.UpToDate:
                            Debugger.Module($"Plugin {modInformation.Name} is up-to-date (ver {modInformation.Version})");
                            break;
                        }
                    }

                    PluginSettings modSettings = GetPluginSettings(module);

                    if (!string.IsNullOrEmpty(modInformation.EntryPoint) && File.Exists(Path.Combine(module, modInformation.EntryPoint)))
                    {
                        Debugger.Module($"Compiling plugin: {modInformation.Name}");
                        if (CompilePlugin(module, modInformation))
                        {
                            Debugger.Module($"{modInformation.Name} compiled successfully.");
                        }
                        else
                        {
                            continue;
                        }
                    }
                    Stopwatch s = Stopwatch.StartNew();
                    foreach (string required in modInformation.Dependencies)
                    {
                        AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, required)));
                    }
                    Assembly           plugin  = AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, $"{modInformation.Name}.dll")));
                    IEnumerable <Type> entries = plugin.ExportedTypes.Where(exp => exp.GetMethod("Initialize") != null);
                    if (entries.Count() > 0)
                    {
                        dynamic mod = plugin.CreateInstance(entries.First().ToString());
                        packages.Add(new PluginPackage {
                            plugin = mod, information = modInformation, settings = modSettings, path = module
                        });
                    }
                }
                catch (Exception err)
                {
                    Debugger.Error(err);
                    continue;
                }
            }

            IsReady = true;
            benchmark.Stop();
            Debugger.Module($"Pre loaded {packages.Count} module(s) in {benchmark.ElapsedMilliseconds}ms");
            if (QueueLoad)
            {
                LoadPlugins();
            }
            return(true);
        }
Пример #18
0
        private async Task PreloadPlugin(string module, PluginInformation modInformation)
        {
            if (File.Exists(Path.Combine(module, ".remove")))
            {
                Directory.Delete(module, true);
                Debugger.Module($"Plugin {modInformation.Name} removed.");
                return;
            }

            if (modInformation.Update.MinimumVersion is null)
            {
                Debugger.Error($"{modInformation.Name.ToUpper()} MIGHT BE OUTDATED! CONSIDER UPDATING IT.");
            }

            if (PluginUpdate.PluginSupportsUpdate(modInformation))
            {
                switch (await PluginUpdate.UpdateAllFiles(modInformation, module))
                {
                case UpdateResult.Updated:
                    var serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                    modInformation = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                    Debugger.Module($"Updated plugin: {modInformation.Name} (ver {modInformation.Version})");
                    break;

                case UpdateResult.Skipped:
                    break;

                case UpdateResult.Failed:
                    Debugger.Error($"Failed to update plugin: {modInformation.Name}");
                    break;

                case UpdateResult.UpToDate:
                    Debugger.Module($"Plugin {modInformation.Name} is up-to-date (ver {modInformation.Version})");
                    break;
                }
            }

            PluginSettings modSettings = GetPluginSettings(module);

            if (!string.IsNullOrEmpty(modInformation.EntryPoint) &&
                File.Exists(Path.Combine(module, modInformation.EntryPoint)))
            {
                Debugger.Module($"Compiling plugin: {modInformation.Name}");
                if (CompilePlugin(module, modInformation))
                {
                    Debugger.Module($"{modInformation.Name} compiled successfully.");
                }
                else
                {
                    return;
                }
            }

            foreach (string required in modInformation.Dependencies)
            {
                AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, required)));
            }

            Assembly plugin =
                AppDomain.CurrentDomain.Load(
                    AssemblyName.GetAssemblyName(Path.Combine(module, $"{modInformation.Name}.dll")));
            IEnumerable <Type> entries = plugin.ExportedTypes.Where(exp => exp.GetMethod("Initialize") != null);

            if (entries.Any())
            {
                dynamic mod = plugin.CreateInstance(entries.First().ToString());
                packages.Add(new PluginPackage
                {
                    plugin = mod, information = modInformation, settings = modSettings, path = module
                });
            }
        }
Пример #19
0
        private async Task PreloadPlugin(string module, PluginInformation modInformation)
        {
            if (File.Exists(Path.Combine(module, ".remove")))
            {
                Directory.Delete(module, true);
                Debugger.Module($"Plugin {modInformation.Name} removed.");
                return;
            }

            if (modInformation.Update.MinimumVersion is null)
            {
                Debugger.Error($"{modInformation.Name.ToUpper()} MIGHT BE OUTDATED! CONSIDER UPDATING IT.");
            }

            if (PluginUpdate.PluginSupportsUpdate(modInformation))
            {
                switch (await PluginUpdate.UpdateAllFiles(modInformation, module))
                {
                case UpdateResult.Updated:
                    var serializedModule = File.ReadAllText(Path.Combine(module, "module.json"));
                    modInformation = JsonConvert.DeserializeObject <PluginInformation>(serializedModule);

                    Debugger.Module($"Updated plugin: {modInformation.Name} (ver {modInformation.Version})");
                    break;

                case UpdateResult.Skipped:
                    break;

                case UpdateResult.Failed:
                    Debugger.Error($"Failed to update plugin: {modInformation.Name}");
                    break;

                case UpdateResult.UpToDate:
                    Debugger.Module($"Plugin {modInformation.Name} is up-to-date (ver {modInformation.Version})");
                    break;
                }
            }

            PluginSettings modSettings = GetPluginSettings(module);

            if (!string.IsNullOrEmpty(modInformation.EntryPoint) &&
                File.Exists(Path.Combine(module, modInformation.EntryPoint)))
            {
                Debugger.Module($"Compiling plugin: {modInformation.Name}");
                if (CompilePlugin(module, modInformation))
                {
                    Debugger.Module($"{modInformation.Name} compiled successfully.");
                }
                else
                {
                    return;
                }
            }

            foreach (string required in modInformation.Dependencies)
            {
                AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(Path.Combine(module, required)));
            }

            var moduleAssembly = AppDomain.CurrentDomain.Load(
                AssemblyName.GetAssemblyName(Path.Combine(module, $"{modInformation.Name}.dll"))
                );
            var pluginType = moduleAssembly.ExportedTypes.FirstOrDefault(exp => exp.GetMethod("Initialize") != null);

            if (pluginType != null)
            {
                var plugin = (IPlugin)moduleAssembly.CreateInstance(pluginType.FullName);
                // making sure that name is matching modInformation, e.g. if plugin dev forgot to populate this value
                plugin.Name = modInformation.Name;

                var package = new PluginPackage
                {
                    plugin = plugin, information = modInformation, settings = modSettings, path = module
                };
                packages.Add(package);

                // if plugin is enabled, adding it's settings
                if (modSettings.IsEnabled)
                {
                    AddPackageSettings(package);
                }
            }
        }