fix endorsing for real

This commit is contained in:
Timothy Baldridge 2019-08-26 18:19:23 -06:00
parent d33c1a358d
commit 9c87af84d6
4 changed files with 12 additions and 5 deletions

View File

@ -440,7 +440,8 @@ namespace Wabbajack
{
GameName = general.gameName,
FileID = general.fileID,
ModID = general.modID
ModID = general.modID,
Version = general.version ?? "0.0.0.0"
};
Status($"Getting Nexus info for {found.Name}");
try

View File

@ -174,6 +174,7 @@ namespace Wabbajack
public string GameName;
public string ModID;
public string FileID;
public string Version;
}
public class GoogleDriveMod : Archive

View File

@ -79,6 +79,7 @@ namespace Wabbajack
public void Install()
{
Directory.CreateDirectory(Outputfolder);
Directory.CreateDirectory(DownloadFolder);
@ -120,14 +121,14 @@ namespace Wabbajack
private void AskToEndorse()
{
var mods = ModList.Directives
var mods = ModList.Archives
.OfType<NexusMod>()
.GroupBy(f => (f.GameName, f.ModID))
.Select(mod => mod.First())
.ToArray();
var result = MessageBox.Show(
$"Installation has completed, but you have installed ${mods.Length} from the Nexus, would you like to" +
$"Installation has completed, but you have installed {mods.Length} from the Nexus, would you like to" +
" endorse these mods to show support to the authors? It will only take a few moments.", "Endorse Mods?",
MessageBoxButton.YesNo, MessageBoxImage.Question);
@ -144,7 +145,11 @@ namespace Wabbajack
mods[b] = tmp;
}
mods.PMap(mod => NexusAPI.EndorseMod(mod, NexusAPIKey));
mods.PMap(mod =>
{
var er = NexusAPI.EndorseMod(mod, NexusAPIKey);
Utils.Log($"Endorsed {mod.GameName} - {mod.ModID} - Result: {er.message}");
});
Info("Done! You may now exit the application!");
}

View File

@ -168,7 +168,7 @@ namespace Wabbajack
var url = $"https://api.nexusmods.com/v1/games/{ConvertGameName(mod.GameName)}/mods/{mod.ModID}/endorse.json";
var client = BaseNexusClient(apikey);
var content = new FormUrlEncodedContent(new Dictionary<string, string>() {{"value", "\"\""}});
var content = new FormUrlEncodedContent(new Dictionary<string, string>() {{"version", mod.Version}});
using (var s = client.PostStreamSync(url, content))
{