/** * Create a Bink connection by socket * * @param socket Socket * @param socketBufferSize Socket BufferSize * @param resourcePath File Resource Path * @param fileMark File name mark to clear * @param executor Executor to notify callback * @param listener ReceiveListener * @return BlinkConn * @throws Exception */ public static BlinkConn newConnection(Socket socket, int socketBufferSize, String resourcePath, String fileMark, Executor executor, BlinkListener listener) { String path = Path.Combine(resourcePath, DEFAULT_RESOURCE_DIR); DiskResource resource = new DiskResource(path, fileMark); BlinkParser parser = new BlinkParser(resource); SocketAdapter socketAdapter = new SocketAdapter(socket, socketBufferSize, parser); ExecutorDelivery delivery = new ExecutorDelivery(executor, listener); return(new BlinkConn(socketAdapter, delivery, socketAdapter, delivery, resource)); }
/// <summary> /// Create a Bink connection by socket /// </summary> /// <param name="socket">Socket</param> /// <param name="socketBufferSize">Socket BufferSize</param> /// <param name="resourcePath">File Resource Path</param> /// <param name="fileMark">File name mark to clear and create</param> /// <param name="progressPrecision">Send and Receive notify progress precision</param> /// <param name="receiveListener">ReceiveListener</param> /// <param name="blinkListener">BlinkListener</param> /// <returns>BlinkConn</returns> public static BlinkConn NewConnection( Socket socket, int socketBufferSize, String resourcePath, String fileMark, float progressPrecision, ReceiveListener receiveListener, BlinkListener blinkListener) { String path = Path.Combine(resourcePath, DEFAULT_RESOURCE_DIR); DiskResource resource = new DiskResource(path, fileMark); BlinkParserImpl parser = new BlinkParserImpl(resource); AsyncSocketAdapter socketAdapter = new AsyncSocketAdapter(socket, socketBufferSize); DelegateDelivery delivery = new DelegateDelivery(blinkListener, receiveListener); return(new BlinkConn(socketAdapter, socketAdapter, delivery, delivery, delivery, resource, parser, progressPrecision)); }