好的,大家好,我的问题是现在正在考虑使用WPF编辑用c#编写的应用程序中存在的数据的最佳方法。
该应用程序是一个小型独立应用程序,使用XML来存储有关如何解释十六进制消息并以人类可读格式显示的规则。
当前我的应用程序运行良好,但是我手动制作了XML,我想在应用程序中编写一些内容,使外行用户可以制定自己的规则集并将其保存为XML。
现在确定可以保存到XML并处理数据了,但是我相信我可以做到,但是我为XML的最佳方法而烦恼。
为简洁起见,我只是提供了一般信息并提供了一些资料-我正在使用的类:
public class RuleSet
{
public string Name { get; set; }
public string LongName { get; set; }
public DateTime ReleaseDate { get; set; }
public string Base { get; set; }
public List<String> IncludedBulletins { get; set; }
public List<Byte> Bytes { get; set; }
public RuleSet(string name, string longName, string releaseDate, string @base)
{
ReleaseDate = parseDate(releaseDate);
Name = name;
LongName = longName;
Base = @base;
IncludedBulletins = new List<String>();
Bytes = new List<Byte>();
}
}
public class Byte
{
public int ID { get; private set; }
public ReadMode Mode { get; private set; }
public List<Rule> Rules { get; set; }
public enum ReadMode
{
ASSORTED,
MULTI,
SINGLE
};
public Byte()
{
Rules = new List<Rule>();
}
}
public class Rule
{
public bool Active { get; private set; }
public int BytePos { get; private set; }
public int NibblePos { get; private set; }
public int Bit { get; private set; }
public int EndBit { get; private set; }
public int Value { get; private set; }
public int EndValue { get; private set; }
public string Translation { get; private set; }
public bool AllLowerBits { get; private set; }
public Rule()
{
Active = false;
Translation = "RFU";
}
}
以下是我们解释的规则的一个示例:
对于背景信息,这是十六进制格式的设备之间的银行应用程序中传递的持卡人验证方法规则,其解释如此处所述。
我有一个目录,它是应用程序最初加载时存储在内存中的规则集的列表,它会加载所有XML并将其解析为上面的对象,然后可以在应用程序中与之交互以提供有意义的信息。
我一直在努力的是我能做出的最好的UI显示,我已经考虑过:
如果任何人有任何示例或列表中所需内容的教程链接,或者有更好的建议和示例,那将是很大的帮助,我在试图思考处理此数据的最佳方法时瘫痪了。