RA2MapEditTool.Data/ConfigParser.cs

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;

// 参考资料
// [1] https://blog.csdn.net/weixin_52796198/article/details/115347797
// [2] https://blog.csdn.net/baidu_26678247/article/details/78254876

namespace RA2MapEditTool
{
    /// <summary>
    /// 配置解析器
    /// </summary>
    public class ConfigParser : IDisposable
    {
        #region 字段
        private bool disposed;
        // TODO 缓冲区空间可能需要调整
        private const int BUFFER_SIZE = 0x8000;
        private string filePath;
        #endregion

        #region 属性
        /// <summary>
        /// 文件路径
        /// </summary>
        public string FilePath
        {
            get => this.filePath;
            set
            {
                if (File.Exists(value) || string.IsNullOrEmpty(this.FilePath))
                {
                    this.filePath = value;
                }
                else
                {
                    throw new FileNotFoundException();
                }
            }
        }

        /// <summary>
        /// 文件编码
        /// </summary>
        public Encoding Encoding { get; set; }
        #endregion

        #region 方法
        #region 调用kernel32
        /// <summary>
        /// 获取所有节点名称
        /// </summary>
        /// <param name="returnBuffer">缓冲区指针</param>
        /// <param name="size">缓冲区大小</param>
        /// <param name="filePath">文件名</param>
        /// <returns>复制到缓冲区的字符数</returns>
        [DllImport("kernel32")]
后面还有 240 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。