Exemple #1
0
        internal ModReport(PluginInfo p, HashSet <AssemblyName> haveAssemblies, HarmonyModSupportException unsupportedLibs = null, bool enumerated = true)
        {
            plugin       = p;
            isEnumerated = enumerated;

            SameAssemblyName sameName = new SameAssemblyName();

            if (p.assemblyCount != 0)
            {
                p.GetAssemblies()
                .Do((assembly) =>
                {
                    var refs = assembly.GetReferencedAssemblies();
                    foreach (var assemblyName in refs)
                    {
                        switch (assemblyName.Name)
                        {
                        case "0Harmony":
                            needsHarmony  = assemblyName.Version;
                            m_usesHarmony = true;
                            break;

                        case "CitiesHarmony.API":
                            needsHarmonyAPI = assemblyName.Version;
                            m_usesHarmony   = true;
                            break;

                        case "CitiesHarmony.Harmony":
                            needsNewHarmony = assemblyName.Version;
                            m_usesHarmony   = true;
                            break;
                        }

                        if (!haveAssemblies.Contains(assemblyName))
                        {
                            m_missingAssemblies.Add(assemblyName);
                        }

                        if (unsupportedLibs != null)
                        {
                            unsupportedLibs.unsupportedAssemblies.ForEach((u) =>
                            {
                                if (sameName.Equals(u.assembly.GetName(), assemblyName))
                                {
                                    ReportProblem(ModReport.ProblemType.ExceptionThrown, unsupportedLibs, u.Message);
                                }
                            });
                        }
                    }
                });
            }
        }
Exemple #2
0
        internal void ReportUnsupportedHarmony(HarmonyModSupportException e)
        {
            SameAssemblyName sameName = new SameAssemblyName();

            Array.ForEach(plugin.userModInstance.GetType().Assembly.GetReferencedAssemblies(),
                          (refa) =>
            {
                e.unsupportedAssemblies.ForEach((u) =>
                {
                    if (sameName.Equals(u.assembly.GetName(), refa))
                    {
                        ReportProblem(ModReport.ProblemType.ExceptionThrown, e, u.Message);
                    }
                });
            });
        }