static string ReadMassiveRemoteZipFileButJavaCodeOnly(string url) { HighTimeoutWebclient wc = new HighTimeoutWebclient(); wc.Encoding = UTF8; byte[] received = null; try { received = wc.DownloadData(url); } catch (Exception ex) { Logger.Output(LogType.ERROR, "Failed to read MassiveRemoteZip: " + ex.ToString() + " for " + url); return ""; } wc.Dispose(); MemoryStream ms = new MemoryStream(received); Logger.Output(LogType.DEBUG, "Received " + received.Length + " bytes to parse from <" + url + ">..."); ZipStorer zs = ZipStorer.Open(ms, FileAccess.Read); StringBuilder toret = new StringBuilder(); foreach (ZipStorer.ZipFileEntry zfe in zs.ReadCentralDir()) { if (zfe.FilenameInZip.Contains(".java")) { MemoryStream mes = new MemoryStream(); zs.ExtractFile(zfe, mes); byte[] bytes = mes.ToArray(); mes.Close(); toret.Append("/<FILE:" + zfe.FilenameInZip + "\n"); toret.Append(UTF8.GetString(bytes)); } } ms.Close(); return toret.ToString(); }
static string ReadMassiveRemoteZipFileButJavaCodeOnly(string url) { HighTimeoutWebclient wc = new HighTimeoutWebclient(); wc.Encoding = UTF8; byte[] received = null; try { received = wc.DownloadData(url); } catch (Exception ex) { Logger.Output(LogType.ERROR, "Failed to read MassiveRemoteZip: " + ex.ToString() + " for " + url); return(""); } wc.Dispose(); MemoryStream ms = new MemoryStream(received); Logger.Output(LogType.DEBUG, "Received " + received.Length + " bytes to parse from <" + url + ">..."); ZipStorer zs = ZipStorer.Open(ms, FileAccess.Read); StringBuilder toret = new StringBuilder(); foreach (ZipStorer.ZipFileEntry zfe in zs.ReadCentralDir()) { if (zfe.FilenameInZip.Contains(".java")) { MemoryStream mes = new MemoryStream(); zs.ExtractFile(zfe, mes); byte[] bytes = mes.ToArray(); mes.Close(); toret.Append("/<FILE:" + zfe.FilenameInZip + "\n"); toret.Append(UTF8.GetString(bytes)); } } ms.Close(); return(toret.ToString()); }