static void OnError(int nativeId, string error) { WebGLConnection conn = null; if (!Connections.TryGetValue(nativeId, out conn)) { HTTPManager.Logger.Error("WebGLConnection - OnError", "No WebGL connection found for nativeId: " + nativeId.ToString() + " Error: " + error); return; } conn.OnError(error); }
static void OnAborted(int nativeId) { WebGLConnection conn = null; if (!Connections.TryGetValue(nativeId, out conn)) { HTTPManager.Logger.Error("WebGLConnection - OnAborted", "No WebGL connection found for nativeId: " + nativeId.ToString()); return; } conn.OnAborted(); }
static void OnUploadProgress(int nativeId, int uploaded, int total) { WebGLConnection conn = null; if (!Connections.TryGetValue(nativeId, out conn)) { HTTPManager.Logger.Error("WebGLConnection - OnUploadProgress", "No WebGL connection found for nativeId: " + nativeId.ToString()); return; } HTTPManager.Logger.Information(nativeId + " OnUploadProgress", uploaded.ToString() + " / " + total.ToString(), conn.Context); conn.OnUploadProgress(uploaded, total); }
static void OnBufferCallback(int nativeId, IntPtr pBuffer, int length) { WebGLConnection conn = null; if (!Connections.TryGetValue(nativeId, out conn)) { HTTPManager.Logger.Error("WebGLConnection - OnBufferCallback", "No WebGL connection found for nativeId: " + nativeId.ToString()); return; } byte[] buffer = BufferPool.Get(length, true); // Copy data from the 'unmanaged' memory to managed memory. Buffer will be reclaimed by the GC. Marshal.Copy(pBuffer, buffer, 0, length); conn.OnBuffer(new BufferSegment(buffer, 0, length)); }
static void OnResponse(int nativeId, int httpStatus, IntPtr pBuffer, int length, int err) { WebGLConnection conn = null; if (!Connections.TryGetValue(nativeId, out conn)) { HTTPManager.Logger.Error("WebGLConnection - OnResponse", "No WebGL connection found for nativeId: " + nativeId.ToString()); return; } HTTPManager.Logger.Information("WebGLConnection - OnResponse", string.Format("{0} {1} {2} {3}", nativeId, httpStatus, length, err), conn.Context); byte[] buffer = BufferPool.Get(length, true); // Copy data from the 'unmanaged' memory to managed memory. Buffer will be reclaimed by the GC. Marshal.Copy(pBuffer, buffer, 0, length); conn.OnResponse(httpStatus, buffer, length); BufferPool.Release(buffer); }