Esempio n. 1
0
    // 只是读取配置文件,不修改
    public T DecodeOnly <T>()
    {
        string        path = Path.Combine(Application.persistentDataPath, _fileName);
        StreamimgSave ss   = new StreamimgSave(_fileName);

        return(ss.LoadbyJson <T>());
    }
Esempio n. 2
0
    public T Decode <T>()
    {
        string         path = Path.Combine(Application.persistentDataPath, _fileName);
        PersistentSave ps   = new PersistentSave(_fileName);

        if (!File.Exists(path))
        {
            StreamimgSave ss   = new StreamimgSave(_fileName);
            T             data = ss.LoadbyJson <T>();
            // 未处理配置文件不存在的情况
            ps.SaveByBin <T>(data);
        }

        return(ps.LoadByBin <T>());
    }