コード例 #1
0
        ////

        private static bool DetectGithub(Mod mod)
        {
            if (ModFeaturesHelpers.GetGithubUserNameProp(mod) == null)
            {
                return(false);
            }
            if (ModFeaturesHelpers.GetGitubProjectNameProp(mod) == null)
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Gets a mod's github project (source code) name, if defined.
        /// </summary>
        /// <param name="mod"></param>
        /// <returns></returns>
        public static string GetGithubProjectName(Mod mod)
        {
            var self = ModHelpersMod.Instance.ModFeaturesHelpers;

            if (!self.GithubMods.ContainsKey(mod.Name))
            {
                return(null);
            }

            PropertyInfo gitProjProp = ModFeaturesHelpers.GetGitubProjectNameProp(mod);

            return((string)gitProjProp.GetValue(null));
        }
コード例 #3
0
        ////////////////

        internal void OnPostModsLoad()
        {
            this.GithubMods = new Dictionary <string, Mod>();
            this.ConfigMods = new Dictionary <string, Mod>();
            this.ConfigDefaultsResetMods = new Dictionary <string, Mod>();

            foreach (Mod mod in ModLoader.Mods)
            {
                if (ModFeaturesHelpers.DetectGithub(mod))
                {
                    this.GithubMods[mod.Name] = mod;
                }
            }
        }