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