TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ PublishMod()

static void Terraria.Social.Steam.WorkshopHelper.PublishMod ( LocalMod mod,
string iconPath )
inlinestaticpackage

Definition at line 1158 of file WorkshopHelper.cs.

1159 {
1160 //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
1161 TmodFile modFile = mod.modFile;
1163 if (bp.buildVersion != modFile.TModLoaderVersion)
1164 {
1165 throw new WebException(Language.GetTextValue("tModLoader.OutdatedModCantPublishError"));
1166 }
1167 string changeLogFile = Path.Combine(ModCompile.ModSourcePath, modFile.Name, "changelog.txt");
1168 string changeLog = ((!File.Exists(changeLogFile)) ? "" : File.ReadAllText(changeLogFile));
1169 string workshopDescFile = Path.Combine(ModCompile.ModSourcePath, modFile.Name, "description_workshop.txt");
1170 string workshopDesc = ((!File.Exists(workshopDescFile)) ? bp.description : File.ReadAllText(workshopDescFile));
1171 NameValueCollection values = new NameValueCollection
1172 {
1173 { "displayname", bp.displayName },
1174 {
1175 "displaynameclean",
1176 string.Join("", from x in ChatManager.ParseMessage(bp.displayName, Color.White)
1177 where x.GetType() == typeof(TextSnippet)
1178 select x.Text)
1179 },
1180 { "name", modFile.Name },
1181 {
1182 "version",
1183 $"{bp.version}"
1184 },
1185 { "author", bp.author },
1186 { "homepage", bp.homepage },
1187 { "description", workshopDesc },
1188 { "iconpath", iconPath },
1189 {
1190 "sourcesfolder",
1191 Path.Combine(ModCompile.ModSourcePath, modFile.Name)
1192 },
1193 {
1194 "modloaderversion",
1195 $"{modFile.TModLoaderVersion}"
1196 },
1197 {
1198 "modreferences",
1199 string.Join(", ", bp.modReferences.Select((BuildProperties.ModReference x) => x.mod))
1200 },
1201 {
1202 "modside",
1203 bp.side.ToFriendlyString()
1204 },
1205 { "changelog", changeLog }
1206 };
1207 if (string.IsNullOrWhiteSpace(values["author"]))
1208 {
1209 throw new WebException("You need to specify an author in build.txt");
1210 }
1211 if (string.IsNullOrWhiteSpace(values["version"]))
1212 {
1213 throw new WebException("You need to specify a version in build.txt");
1214 }
1215 if (!Main.dedServ)
1216 {
1217 Main.MenuUI.SetState(new WorkshopPublishInfoStateForMods(Interface.modSources, modFile, values));
1218 return;
1219 }
1220 SocialAPI.LoadSteam();
1222 {
1223 Publicity = WorkshopItemPublicSettingId.Public,
1224 UsedTags = Array.Empty<WorkshopTagOption>(),
1225 PreviewImagePath = iconPath
1226 };
1227 SteamedWraps.SteamClient = true;
1228 SocialAPI.Workshop.PublishMod(modFile, values, publishSetttings);
1229 }
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
readonly TmodFile modFile
Definition LocalMod.cs:7
readonly BuildProperties properties
Definition LocalMod.cs:9
static readonly string ModSourcePath
Definition ModCompile.cs:61
static UIModSources modSources
Definition Interface.cs:63
static List< TextSnippet > ParseMessage(string text, Color baseColor)

References Terraria.Main.dedServ, Terraria.Localization.Language.GetTextValue(), Terraria.Social.SocialAPI.LoadSteam(), Terraria.Main.MenuUI, Terraria.ModLoader.Core.LocalMod.modFile, Terraria.ModLoader.Core.ModCompile.ModSourcePath, Terraria.ModLoader.UI.Interface.modSources, Terraria.ModLoader.Core.TmodFile.Name, Terraria.UI.Chat.ChatManager.ParseMessage(), Terraria.ModLoader.Core.LocalMod.properties, Terraria.ModLoader.Core.TmodFile.TModLoaderVersion, and Terraria.Social.SocialAPI.Workshop.

Referenced by Terraria.ModLoader.UI.UIModSourceItem.PublishMod(), and Terraria.ModLoader.UI.UIModSourceItem.PublishModCommandLine().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: