Framework changed to WPF

Only the basic window frame is implemented.
Adjusted the structure of resource files.
This commit is contained in:
2022-09-29 21:56:43 +08:00
parent 346a68ddb4
commit a055dc5299
128 changed files with 48325 additions and 63581 deletions

View File

@@ -0,0 +1,16 @@
namespace GrasscutterTools.Models
{
public class GameItem
{
public int Id { get; set; }
public string Name { get; set; }
public string Category { get; set; }
public override string ToString()
{
return $"{Id} : {Name}";
}
}
}

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections.ObjectModel;
namespace GrasscutterTools.Models
{
public class GameItems : Collection<GameItem>
{
public GameItems(string sources)
{
var lines = sources.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
var category = string.Empty;
foreach (var line in lines)
{
if (line.StartsWith("//"))
{
category = line.Substring(2).Trim().Replace('_', ' ').ToLowerInvariant();
category = char.ToUpperInvariant(category[0]) + category.Substring(1);
}
else
{
var sp = line.IndexOf(':');
if (sp >= 0)
{
Items.Add(new GameItem
{
Id = int.Parse(line.Substring(0, sp).Trim()),
Name = line.Substring(sp + 1).Trim(),
Category = category
});
}
}
}
}
}
}