Exemplo n.º 1
0
        public GameBuffer ReadFile(string filename)
        {
            var path_filename = System.IO.Path.Combine(external_path, filename);

            universalApp.LogInfo(string.Format("UFS->ReadFile:{0}", path_filename));

            GameBuffer buffer = null;

            if (universalApp.GetCache().Exists(path_filename))
            {
                File file = universalApp.GetCache().GetFile(path_filename, true);
                universalApp.LogInfo(string.Format("UFS->ReadFile()->file_size:{0}", file.GetSize()));
                int        f_size = (int)file.GetSize();
                UCharArray uch    = new UCharArray(f_size);
                buffer = new GameBuffer(f_size);

                file.ReadBinary(uch);
                file.Close();
                buffer.bytes = uch.ToArray();

                universalApp.LogInfo(string.Format("UFS->ReadFile()->buffer_length:{0}", buffer.bytes.Length));
            }
            else
            {
                universalApp.LogError(string.Format("filename does not exists:{0}", universalApp));
            }
            return(buffer);
        }