protected static bool GetResourceContents(string path, IntPtr dst) { try { var cachePath = PathToResourceAsFile(path); var asset = File.ReadAllBytes(cachePath); using (var srcStr = new StdString(asset)) { srcStr.Swap(new StdString(dst, false)); } return(true); } catch (Exception e) { Debug.LogError($"Failed to read file `{path}`: ${e.ToString()}"); return(false); } }
public void Swap(StdString str) { UnsafeNativeMethods.std_string__swap__Rstr(mpPtr, str.mpPtr); GC.KeepAlive(this); }