/// <summary>
        /// Converts this object to the text on disk
        /// </summary>
        /// <returns></returns>
        public string ToCMMText()
        {
            var metaOutLines = new List <string>();

            // Write out MetaCMM Classic
            metaOutLines.Add(ModName);
            metaOutLines.Add(Version);
            metaOutLines.Add(InstalledBy);
            metaOutLines.Add(Guid.NewGuid().ToString()); // This is not used in Mod Manager 6

            // Write MetaCMM Extended
            if (IncompatibleDLC.Any())
            {
                metaOutLines.Add($@"{MetaCMM.PrefixIncompatibleDLC}{string.Join(';', IncompatibleDLC)}");
            }

            if (OptionsSelectedAtInstallTime.Any())
            {
                // I hope this covers all cases. Mods targeting moddesc 6 or lower don't need friendlyname or description, but virtually all of them did
                // as MM4/5 autonaming was ugly
                metaOutLines.Add($@"{MetaCMM.PrefixOptionsSelectedOnInstall}{string.Join(';', OptionsSelectedAtInstallTime)}");
            }

            return(string.Join('\n', metaOutLines));
        }
Example #2
0
        public void WriteMetaCMM(string path)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(ModName);
            sb.AppendLine(Version);
            sb.AppendLine(InstalledBy ?? App.BuildNumber.ToString());
            sb.AppendLine(InstallerInstanceGUID);

            // MetaCMM Extended
            if (OptionsSelectedAtInstallTime.Any())
            {
                sb.AppendLine($@"{PrefixOptionsSelectedOnInstall}{string.Join(';', OptionsSelectedAtInstallTime)}");
            }
            if (IncompatibleDLC.Any())
            {
                sb.AppendLine($@"{PrefixIncompatibleDLC}{string.Join(';', IncompatibleDLC)}");
            }

            File.WriteAllText(path, sb.ToString());
        }