- Home /
How can I read this code in Unity?
I'm trying to read a cache that contains files I've got the file converter and everything but I'm not trying to read the cache in Unity, there is a folder in Unity which it reaches and it verifies to me that it can find it and throws me an error.
The code that I'm running:
using UnityEngine;
using System;
using System.IO;
using System.Collections;
using System.Runtime.InteropServices;
using CacheIO;
using CacheIO.IO;
class CacheLoader : MonoBehaviour
{
void Start()
{
Cache cache = new Cache("../cache/");
readItem(cache, 4151);
}
private static void readItem(Cache cache, int id)
{
ItemDefinition item = new ItemDefinition(id);
item.Load(cache);
print(id + ": " + item.name + " (" + item.itemId + ")");
}
}
The error that is being thrown by Unity:
DllNotFoundException: MonoPosixHelper System.IO.Compression.DeflateStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen, Boolean gzip) (wrapper remoting-invoke-with-check) System.IO.Compression.DeflateStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode,bool,bool) System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode, Boolean leaveOpen) System.IO.Compression.GZipStream..ctor (System.IO.Stream compressedStream, CompressionMode mode) (wrapper remoting-invoke-with-check) System.IO.Compression.GZipStream:.ctor (System.IO.Stream,System.IO.Compression.CompressionMode) CacheIO.Util.GZip.GZipDecompressor.Decompress (System.Byte[] output, System.IO.Stream stream) CacheIO.Archive.decompress (System.Byte[] data) CacheIO.Archive..ctor (Int32 id, System.Byte[] data, System.Int32[] keys) CacheIO.Index..ctor (CacheIO.IndexFile index, CacheIO.IndexFile index255) CacheIO.Cache..ctor (System.String folder, Boolean newProtocol) CacheIO.Cache..ctor (System.String folder) CacheLoader.Start () (at Assets/CacheLoader.cs:14)
Also, if there is a different way I should run the code tell me how because I can't seem to find a good way to find the cache folder unless I'm using the start method? Can someone explain me the best way to do so? CacheIO is taken from a DLL which I have the source code of. If you require more code/information please let me know.:)