Exemplo n.º 1
0
        public byte[] DownloadLogFile(string directoryName, string fileName)
        {
            assertConnected();
            try
            {
                // make sure that only a terminal folder name and a not-fully-qualified filename are passed to the server
                fileName = fileName.Replace("\\", "/");
                fileName = fileName.Substring(fileName.LastIndexOf("/") + 1);

                directoryName = directoryName.Replace("\\", "/");
                directoryName = directoryName.Substring(directoryName.LastIndexOf("/") + 1);

                // prepare for download
                string downloadFileClaimToken = wsClient.QueueLogFileDownload(accessToken(), directoryName, fileName);
                if (downloadFileClaimToken == null)
                {
                    return(null);
                }

                // download all parts
                return(downloadFileIncrementally(downloadFileClaimToken));
            }
            catch (Exception ex)
            {
                throw TranslateException(ex);
            }
        }