Example #1
0
        public static FileMapSystem CreateFromStreamAssetFile(string Dir)
        {
            var FileMap = new FileMapSystem(Dir);
            var bs      = UnityStreamingFileHelper.ReadStreamAssetFileAllBytes(Dir, FileMap.FileMapInfoFileName);

            if (bs == null || bs.Length == 0)
            {
                //Debug.LogError("本地读取到数据长度为0,Dir:"+Dir);
                return(null);
            }

            FileMap.InitFileMapInfo(bs);
            //Debug.LogError("初始化Map成功,len:"+bs.Length+"Dir:"+Dir);
            return(FileMap);
        }
Example #2
0
    public static byte[] ReadFileAllBytes(string dir, string fileName, int offset, int len, out eFileLoaderPosType pos)
    {
        var hasFile = IsFileExist(dir, fileName, out pos);

        if (hasFile)
        {
            if (pos == eFileLoaderPosType.PersistAsset)
            {
                return(UnityPersistFileHelper.ReadPersistAssetFileAllBytes(dir, fileName, offset, len));
            }
            if (pos == eFileLoaderPosType.StreamAsset)
            {
                return(UnityStreamingFileHelper.ReadStreamAssetFileAllBytes(dir, fileName, offset, len));
            }
        }
        return(null);
    }