/// <summary> /// Export the files of the survey to the directory and /// returns the total of bytes exported /// </summary> public int ExportAnswerFilesToDirectory(int surveyId, string path, FileExportMode exportMode) { int num; int num2 = 0; Hashtable savedFiles = new Hashtable(); foreach (FileData.FilesRow row in new Answers().GetValidatedFileAnswers(surveyId, 1, 10, out num).Files) { string str = path; if (exportMode == FileExportMode.VoterFileGroup) { if (!Directory.Exists(path + row.VoterId)) { Directory.CreateDirectory(path + row.VoterId); } str = path + row.VoterId + '/'; } else if (exportMode == FileExportMode.GuidFileGroup) { if (!Directory.Exists(path + row.GroupGuid)) { Directory.CreateDirectory(path + row.GroupGuid); } str = path + row.GroupGuid + '/'; } byte[] answerFileData = new Answers().GetAnswerFileData(row.FileId, row.GroupGuid); this.SaveFileToDisk(str, row.FileName, answerFileData, savedFiles); num2 += answerFileData.Length; } return(num2); }
/// <summary> /// Export the files of the survey to the directory and /// returns the total of bytes exported /// </summary> public int ExportAnswerFilesToDirectory(int surveyId, string path, FileExportMode exportMode) { int num; int num2 = 0; Hashtable savedFiles = new Hashtable(); foreach (FileData.FilesRow row in new Answers().GetValidatedFileAnswers(surveyId, 1, 10, out num).Files) { string str = path; if (exportMode == FileExportMode.VoterFileGroup) { if (!Directory.Exists(path + row.VoterId)) { Directory.CreateDirectory(path + row.VoterId); } str = path + row.VoterId + '/'; } else if (exportMode == FileExportMode.GuidFileGroup) { if (!Directory.Exists(path + row.GroupGuid)) { Directory.CreateDirectory(path + row.GroupGuid); } str = path + row.GroupGuid + '/'; } byte[] answerFileData = new Answers().GetAnswerFileData(row.FileId, row.GroupGuid); this.SaveFileToDisk(str, row.FileName, answerFileData, savedFiles); num2 += answerFileData.Length; } return num2; }