private DataLoadRequest CreateRequestLoadTable(string name, IDataTable table, bool downloadOnly = false, Action <byte[]> processBinary = null) { if (downloadOnly || forceLoadCSV) { processBinary = null; } DataLoadRequest dataLoadRequest = CreateRequest(name, manifest.GetTableHash(name), DATA_TABLE_DIRECTORY, downloadOnly); dataLoadRequest.processCompressedTextData = delegate(byte[] bytes) { if (table != null) { if (bytes.Length < 256) { throw new ApplicationException("seek error"); } string text = DecompressToString(bytes); if (!string.IsNullOrEmpty(text)) { table.CreateTable(text); } else if (text == null) { throw new ApplicationException(); } } }; if (processBinary != null) { dataLoadRequest.SetupLoadBinary(manifest, processBinary); } return(dataLoadRequest); }
public void SetupLoadBinary(DataTableManifest manifest, Action <byte[]> processBinary) { enableLoadBinary = true; processCompressedBinaryData = processBinary; hashBinary = manifest.GetTableHash(GetName()); if (hashBinary == null) { enableLoadBinary = false; } }