sodoff/src/Controllers/Common/ItemStoreController.cs
2023-06-27 22:15:06 +02:00

38 lines
1.1 KiB
C#

using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using sodoff.Model;
using sodoff.Util;
namespace sodoff.Controllers.Common;
public class ItemStoreController : Controller {
private readonly DBContext ctx;
public ItemStoreController(DBContext ctx) {
this.ctx = ctx;
}
[HttpPost]
//[Produces("application/xml")]
[Route("ItemStoreWebService.asmx/GetStore")]
public IActionResult GetStore() {
// TODO, this may be implemented enough, but may not be
var assembly = Assembly.GetExecutingAssembly();
string resourceName = assembly.GetManifestResourceNames().Single(str => str.EndsWith("store.xml"));
using (Stream stream = assembly.GetManifestResourceStream(resourceName))
using (StreamReader reader = new StreamReader(stream)) {
string result = reader.ReadToEnd();
return Ok(result);
}
}
[HttpPost]
//[Produces("application/xml")]
[Route("ItemStoreWebService.asmx/GetRankAttributeData")]
public IActionResult GetRankAttributeData() {
// TODO
return Ok(XmlUtil.ReadResourceXmlString("rankattrib"));
}
}