/// <summary> /// Export users. Export the specified users with the properties you list in the **fields** parameter. /// </summary> /// <exception cref="Genesys.Internal.Provisioning.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="exportFileData">Export File Data</param> /// <returns>Task of ApiResponse (ExportFileResponse)</returns> public async System.Threading.Tasks.Task <ApiResponse <ExportFileResponse> > ExportFileAsyncWithHttpInfo(ExportFileData exportFileData) { // verify the required parameter 'exportFileData' is set if (exportFileData == null) { throw new ApiException(400, "Missing required parameter 'exportFileData' when calling ExportApi->ExportFile"); } var localVarPath = "/export-users"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json" }; String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (exportFileData != null && exportFileData.GetType() != typeof(byte[])) { localVarPostBody = Configuration.ApiClient.Serialize(exportFileData); // http body (model) parameter } else { localVarPostBody = exportFileData; // byte array } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("ExportFile", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <ExportFileResponse>(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), (ExportFileResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(ExportFileResponse)))); }
/// <summary> /// Export users. Export the specified users with the properties you list in the **fields** parameter. /// </summary> /// <exception cref="Genesys.Internal.Provisioning.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="exportFileData">Export File Data</param> /// <returns>ExportFileResponse</returns> public ExportFileResponse ExportFile(ExportFileData exportFileData) { ApiResponse <ExportFileResponse> localVarResponse = ExportFileWithHttpInfo(exportFileData); return(localVarResponse.Data); }
/// <summary> /// Export users. Export the specified users with the properties you list in the **fields** parameter. /// </summary> /// <exception cref="Genesys.Internal.Provisioning.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="exportFileData">Export File Data</param> /// <returns>Task of ExportFileResponse</returns> public async System.Threading.Tasks.Task <ExportFileResponse> ExportFileAsync(ExportFileData exportFileData) { ApiResponse <ExportFileResponse> localVarResponse = await ExportFileAsyncWithHttpInfo(exportFileData); return(localVarResponse.Data); }
private void Export() { this.FileFolders.Clear(); Stopwatch stopwatch = new Stopwatch(); int num = 0; if (FileID.Count > 0) { stopwatch.Start(); progBar.Maximum = FileID.Count; using (RPM_DataFile rPMDataFile = new RPM_DataFile()) { foreach (Guid fileID in FileID) { progFile.Value = 0; DataFile dataFile = rPMDataFile.GetDataFile(fileID); string folderPath = FolderPath; ExportForm exportForm = this; int folderCount = exportForm.FolderCount; int num1 = folderCount; exportForm.FolderCount = folderCount + 1; FolderName = Path.Combine(folderPath, string.Format("FILE_{0}", num1)); if (!Directory.Exists(FolderName)) { Directory.CreateDirectory(FolderName); Network.SetAcl(FolderName); } FileFolders.Add(FolderName); ListItem listItem1 = new ListItem(); vProgressBar _vProgressBar = progBar; ExportForm exportForm1 = this; int fileCount = exportForm1.FileCount; int num2 = fileCount; exportForm1.FileCount = fileCount + 1; _vProgressBar.Value = num2; progBar.Invalidate(); Application.DoEvents(); picThumbnail.Image = Utilities.ByteArrayToImage(dataFile.Thumbnail); picThumbnail.Invalidate(); Application.DoEvents(); WriteFileInfo(dataFile); CopyFile(dataFile); listItem1.Text = string.Format("Export: {0}", string.Concat(dataFile.OriginalFileName, dataFile.FileExtension)); HashAlgorithm sHA1 = HashAlgorithms.SHA1; switch (dataFile.HashAlgorithm) { case HASH_ALGORITHM.MD5: { sHA1 = HashAlgorithms.MD5; break; } case HASH_ALGORITHM.SHA1: { sHA1 = HashAlgorithms.SHA1; break; } case HASH_ALGORITHM.SHA256: { sHA1 = HashAlgorithms.SHA256; break; } case HASH_ALGORITHM.SHA384: { sHA1 = HashAlgorithms.SHA384; break; } case HASH_ALGORITHM.SHA512: { sHA1 = HashAlgorithms.SHA512; break; } case HASH_ALGORITHM.RIPEMD160: { sHA1 = HashAlgorithms.RIPEMD160; break; } } string hashFromFile = Hash.GetHashFromFile(TargetFileName, sHA1); BeginInvoke(new MethodInvoker(() => { lblExportFileName.Text = string.Concat(dataFile.OriginalFileName, dataFile.FileExtension); lblExportHash.Text = Convert.ToString(hashFromFile); })); if (!hashFromFile.Equals(dataFile.FileHashCode)) { num++; listItem1.Description = string.Format(LangCtrl.GetString("txt_FileHashFail", "File validate Failed {0} x {1}"), dataFile.FileHashCode, hashFromFile); listItem1.ImageIndex = 2; vListBox.Items.Insert(listItem1, 0); } else { listItem1.ImageIndex = 1; listItem1.Description = string.Format(LangCtrl.GetString("txt_HashVerified", "File Hash code Verified: {0}"), hashFromFile); } vListBox.Items.Insert(listItem1, 0); CopyMemos(dataFile); CopyThumbnails(dataFile); Global.Log("EXPORT", string.Format(LangCtrl.GetString("txt_DiscExport", "Export: {0}{1} - {2}"), dataFile.StoredFileName, dataFile.FileExtension, dataFile.ShortDesc)); Application.DoEvents(); int num3 = 0; try { using (RPM_Snapshot rPMSnapshot = new RPM_Snapshot()) { List <Snapshot> snapshots = rPMSnapshot.GetSnapshots(fileID); if (snapshots.Count > 0) { foreach (Snapshot snapshot in snapshots) { string str1 = Path.Combine(snapshot.UNCName, snapshot.UNCPath); SourceFileName = Network.FormatPath(Path.Combine(str1, snapshot.StoredFileName)); string str2 = string.Concat("Snapshot_", num3, snapshot.FileExtension); TargetFileName = Path.Combine(FolderName, str2); if (!File.Exists(SourceFileName)) { continue; } File.Copy(SourceFileName, TargetFileName, true); num3++; } } } } catch { } } if (EFD.IsZipFile) { BeginInvoke(new MethodInvoker(() => { ListItem listItem = new ListItem() { ImageIndex = 5, Text = LangCtrl.GetString("txt_SecuringFiles", "Securing Selected Files...Please wait...") }; vListBox.Items.Insert(listItem, 0); })); if (EFD.ZipName.Contains(".")) { EFD.ZipName = this.EFD.ZipName.Substring(0, this.EFD.ZipName.IndexOf('.')); } //TODO : ref ExportFileData eFD = EFD; eFD.ZipName = string.Concat(eFD.ZipName, ".zip"); if (Zip.ZipFolders(this.FileFolders, Path.Combine(this.FolderPath, this.EFD.ZipName), this.EFD.ZipPwd)) { Global.Log("EXPORT_ZIP", string.Format(LangCtrl.GetString("txt_ExportSecure", "Export secure file {0}"), Path.Combine(this.FolderPath, this.EFD.ZipName))); foreach (string fileFolder in this.FileFolders) { Directory.Delete(fileFolder, true); } } } stopwatch.Stop(); base.BeginInvoke(new MethodInvoker(() => { this.picThumbnail.Image = null; this.lblExportFileName.Text = string.Empty; this.lblExportHash.Text = string.Empty; TimeSpan timeSpan = TimeSpan.FromMilliseconds((double)stopwatch.ElapsedMilliseconds); string str = string.Format("{0:D2}:{1:D2}:{2:D2}.{3:D2}", new object[] { timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds }); ListItem listItem = new ListItem(); if (this.EFD.IsZipFile) { listItem.ImageIndex = 5; listItem.Text = string.Format(LangCtrl.GetString("txt_SecureFileCreated", "Secure File Created > {0}"), this.EFD.ZipName); this.vListBox.Items.Insert(listItem, 0); } listItem = new ListItem(); if (!this.IsDVD) { listItem.ImageIndex = 3; listItem.Text = string.Format(LangCtrl.GetString("txt_ExportCompleted", "Export Completed > {0} Files in {1}"), this.FileID.Count, str); Global.Log("EXPORT-COMPLETE", listItem.Text); } else { listItem.ImageIndex = 4; listItem.Text = string.Format(LangCtrl.GetString("txt_DiscPrep", "Disc Prep Completed > {0} Files in {1}"), this.FileID.Count, str); } listItem.Description = string.Format(LangCtrl.GetString("txt_ExportFileErrors", "File Errors: {0}"), num); this.vListBox.Items.Insert(listItem, 0); base.BeginInvoke(new MethodInvoker(() => { this.lblExportFileName.Text = string.Empty; this.lblExportHash.Text = string.Empty; })); })); } } base.BeginInvoke(new MethodInvoker(() => { try { if (!this.IsDVD) { this.picThumbnail.SizeMode = PictureBoxSizeMode.CenterImage; this.picThumbnail.Image = Properties.Resources.export; this.lbl_FileName.Text = LangCtrl.GetString("txt_FileExportCompleted", "File Export Completed..."); this.lbl_HashCode.Text = string.Empty; } else { this.picThumbnail.SizeMode = PictureBoxSizeMode.CenterImage; this.picThumbnail.Image = Properties.Resources.burndisc; this.lbl_FileName.Text = LangCtrl.GetString("txt_RecToDisc", "Record Files to Disc..."); this.lbl_HashCode.Text = string.Empty; (new ExportCD() { RootFolder = this.TEMP_FOLDER }).ShowDialog(this); DirectoryInfo directoryInfo = new DirectoryInfo(this.TEMP_FOLDER); FileInfo[] files = directoryInfo.GetFiles(); for (int i = 0; i < (int)files.Length; i++) { files[i].Delete(); } DirectoryInfo[] directories = directoryInfo.GetDirectories(); for (int j = 0; j < (int)directories.Length; j++) { directories[j].Delete(true); } Directory.Delete(this.TEMP_FOLDER); this.BurnCompleteCallback(); } } catch { } })); }