mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-23 09:49:02 +00:00
parent
c0ef2f107e
commit
5566a7d7f2
2 changed files with 15 additions and 3 deletions
|
@ -1,8 +1,10 @@
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using ProjectLighthouse.Helpers;
|
||||||
using ProjectLighthouse.Serialization;
|
using ProjectLighthouse.Serialization;
|
||||||
using ProjectLighthouse.Types;
|
using ProjectLighthouse.Types;
|
||||||
|
|
||||||
|
@ -25,9 +27,12 @@ namespace ProjectLighthouse.Controllers {
|
||||||
Slot slot = await this.GetSlotFromBody();
|
Slot slot = await this.GetSlotFromBody();
|
||||||
if(slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
|
if(slot == null) return this.BadRequest(); // if the level cant be parsed then it obviously cant be uploaded
|
||||||
|
|
||||||
string resource = LbpSerializer.StringElement("resource", slot.Resources);
|
string resources = slot.Resources
|
||||||
|
.Where(hash => !FileHelper.ResourceExists(hash))
|
||||||
|
.Aggregate("", (current, hash) =>
|
||||||
|
current + LbpSerializer.StringElement("resource", hash));
|
||||||
|
|
||||||
return this.Ok(LbpSerializer.TaggedStringElement("slot", resource, "type", "user"));
|
return this.Ok(LbpSerializer.TaggedStringElement("slot", resources, "type", "user"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.Linq;
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using ProjectLighthouse.Serialization;
|
using ProjectLighthouse.Serialization;
|
||||||
|
|
||||||
|
@ -83,6 +84,12 @@ namespace ProjectLighthouse.Types {
|
||||||
[XmlElement("moveRequired")]
|
[XmlElement("moveRequired")]
|
||||||
public bool MoveRequired { get; set; }
|
public bool MoveRequired { get; set; }
|
||||||
|
|
||||||
|
public string SerializeResources() {
|
||||||
|
return this.Resources
|
||||||
|
.Aggregate("", (current, resource) =>
|
||||||
|
current + LbpSerializer.StringElement("resource", resource));
|
||||||
|
}
|
||||||
|
|
||||||
public string Serialize() {
|
public string Serialize() {
|
||||||
string slotData = LbpSerializer.StringElement("name", Name) +
|
string slotData = LbpSerializer.StringElement("name", Name) +
|
||||||
LbpSerializer.StringElement("id", SlotId) +
|
LbpSerializer.StringElement("id", SlotId) +
|
||||||
|
@ -91,7 +98,7 @@ namespace ProjectLighthouse.Types {
|
||||||
LbpSerializer.StringElement("description", Description) +
|
LbpSerializer.StringElement("description", Description) +
|
||||||
LbpSerializer.StringElement("icon", IconHash) +
|
LbpSerializer.StringElement("icon", IconHash) +
|
||||||
LbpSerializer.StringElement("rootLevel", RootLevel) +
|
LbpSerializer.StringElement("rootLevel", RootLevel) +
|
||||||
LbpSerializer.StringElement("resource", this.Resources) +
|
this.SerializeResources() +
|
||||||
LbpSerializer.StringElement("location", Location.Serialize()) +
|
LbpSerializer.StringElement("location", Location.Serialize()) +
|
||||||
LbpSerializer.StringElement("initiallyLocked", InitiallyLocked) +
|
LbpSerializer.StringElement("initiallyLocked", InitiallyLocked) +
|
||||||
LbpSerializer.StringElement("isSubLevel", SubLevel) +
|
LbpSerializer.StringElement("isSubLevel", SubLevel) +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue