Beispiel #1
0
        internal OptionsDialog(Type optionsType, KMod.Mod modSpec)
        {
            dialog           = null;
            modImage         = null;
            this.modSpec     = modSpec ?? throw new ArgumentNullException("modSpec");
            this.optionsType = optionsType ?? throw new ArgumentNullException("optionsType");
            optionCategories = OptionsEntry.BuildOptions(optionsType);
            options          = null;
            // Determine config location
            infoAttr = POptions.GetModInfoAttribute(optionsType);
            typeAttr = POptions.GetConfigFileAttribute(optionsType);
            var src = modSpec.file_source;

            if (src == null)
            {
                path = null;
            }
            else
            {
                path = Path.Combine(src.GetRoot(), typeAttr?.ConfigFileName ?? POptions.
                                    CONFIG_FILE_NAME);
            }
            // Find mod home page
            string url   = infoAttr?.URL;
            var    label = modSpec.label;

            if (string.IsNullOrEmpty(url) && label.distribution_platform == KMod.Label.
                DistributionPlatform.Steam)
            {
                // Steam mods use their workshop ID as the label
                url = "https://steamcommunity.com/sharedfiles/filedetails/?id=" + label.id;
            }
            modURL = url;
        }
Beispiel #2
0
        internal OptionsDialog(Type optionsType, IOptionsHandler handler)
        {
            string root = handler.ConfigPath;

            dialog           = null;
            modImage         = null;
            this.handler     = handler ?? throw new ArgumentNullException("handler");
            this.optionsType = optionsType ?? throw new ArgumentNullException("optionsType");
            optionCategories = OptionsEntry.BuildOptions(optionsType);
            options          = null;
            // Determine config location
            infoAttr = POptions.GetModInfoAttribute(optionsType);
            typeAttr = POptions.GetConfigFileAttribute(optionsType);
            path     = (root == null) ? null : Path.Combine(root, typeAttr?.ConfigFileName ??
                                                            POptions.CONFIG_FILE_NAME);
        }
Beispiel #3
0
        internal OptionsDialog(Type optionsType)
        {
            OnClose          = null;
            dialog           = null;
            modImage         = null;
            this.optionsType = optionsType ?? throw new ArgumentNullException(nameof(
                                                                                  optionsType));
            optionCategories = OptionsEntry.BuildOptions(optionsType);
            options          = null;
            // Determine config location
            var infoAttr = optionsType.GetCustomAttribute <ModInfoAttribute>();

            if (infoAttr != null)
            {
                collapseCategories = infoAttr.ForceCollapseCategories;
            }
            else
            {
                collapseCategories = false;
            }
            configAttr  = optionsType.GetCustomAttribute <ConfigFileAttribute>();
            displayInfo = new ModDialogInfo(optionsType, infoAttr?.URL, infoAttr?.Image);
        }