AppConfig.cs
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System.IO;
using System.Xml.Serialization;
namespace KeyGo
{
/// <summary>
/// 应用配置帮助类
/// </summary>
public class AppConfig
{
/// <summary>
/// Gets or sets a value indicating whether [power boot].
/// </summary>
/// <value>
/// <c>true</c> if [power boot]; otherwise, <c>false</c>.
/// </value>
public bool PowerBoot { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether [close to hide].
/// </summary>
/// <value>
/// <c>true</c> if [close to hide]; otherwise, <c>false</c>.
/// </value>
public bool CloseToHide { get; set; } = true;
/// <summary>
/// Loads the XML.
/// </summary>
/// <param name="filePath">The file path.</param>
/// <returns></returns>
public static AppConfig LoadXml(string filePath)
{
AppConfig data = null;
if (File.Exists(filePath))
{
XmlSerializer formatter = new XmlSerializer(typeof(AppConfig));
using (var stream = File.OpenRead(filePath))
{
if (stream.Length > 0)
{
data = formatter.Deserialize(stream) as AppConfig;
}
}
}
return data;
}
/// <summary>
/// Saves the XML.
/// </summary>
/// <param name="filePath">The file path.</param>
public void SaveXml(string filePath)
{
if (!File.Exists(filePath))
Directory.CreateDirectory(Path.GetDirectoryName(filePath));
XmlSerializer formatter = new XmlSerializer(typeof(AppConfig));
using (var stream = File.Create(filePath))
{
后面还有 5 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
