Пример #1
0
    /// <summary>
    /// 读取文件+可以输入默认值的,如果读不到的情况
    /// </summary>
    /// <typeparam name="读取的类型"></typeparam>
    /// <param name="读取的key"></param>
    /// <param name="读取的默认值"></param>
    /// <param name="读取的方式"></param>
    /// <returns></returns>

    public static T Reader <T>(string key, T defaultData, SaveImplementType type = SaveImplementType.ImplementByte)
    {
        SaveSetting setting = new SaveSetting(key, type);

        using (Read reader = Read.Create(setting)) {
            //if (!Exists(identifier)) {
            //    return default(T);
            //}
            return(reader.Reader(setting.filenameData.tag, defaultData));
        }
    }
Пример #2
0
    /// <summary>
    /// 读取文件+有自定义风格的
    /// </summary>
    /// <typeparam name="读取的类型"></typeparam>
    /// <param name="读取的key"></param>
    /// <param name="读取的自定义风格"></param>
    /// <returns></returns>

    public static T Reader <T>(string key, SaveSetting setting)
    {
        SaveSetting settingClone = setting.Clone();

        using (Read reader = Read.Create(settingClone)) {
            //if (!Exists(identifier)) {
            //    return default(T);
            //}
            return(reader.Reader <T>(setting.filenameData.tag));
        }
    }