public OneTimeJobResult <T> ExecuteJobAndGetResult <T>( int engineId, JobDescription jobDescription, CredentialBase jobCredential, JobResultDataFormatType resultDataFormat, string jobType) where T : class, new() { return(this.ExecuteJobAndGetResult <T>(this.engineDal.GetEngine(engineId).get_ServerName(), jobDescription, jobCredential, resultDataFormat, jobType)); }
public OneTimeJobResult <T> ExecuteJobAndGetResult <T>( string engineName, JobDescription jobDescription, CredentialBase jobCredential, JobResultDataFormatType resultDataFormat, string jobType) where T : class, new() { this.RouteJobToEngine(jobDescription, engineName); using (OneTimeJobRawResult timeJobRawResult = this.oneTimeJobManager.ExecuteJob(jobDescription, jobCredential)) { string error = timeJobRawResult.Error; if (!timeJobRawResult.Success) { OneTimeJobService.log.WarnFormat(jobType + " credential test failed: " + timeJobRawResult.Error, Array.Empty <object>()); string messageFromException = this.GetLocalizedErrorMessageFromException(timeJobRawResult.ExceptionFromJob); return(new OneTimeJobResult <T>() { Success = false, Message = string.IsNullOrEmpty(messageFromException) ? error : messageFromException }); } try { T obj; if (resultDataFormat == JobResultDataFormatType.Xml) { using (XmlTextReader xmlTextReader = new XmlTextReader(timeJobRawResult.JobResultStream)) { xmlTextReader.Namespaces = false; obj = (T) new XmlSerializer(typeof(T)).Deserialize((XmlReader)xmlTextReader); } } else { obj = SerializationHelper.Deserialize <T>(timeJobRawResult.JobResultStream); } return(new OneTimeJobResult <T>() { Success = true, Value = obj }); } catch (Exception ex) { OneTimeJobService.log.Error((object)string.Format("Failed to deserialize {0} credential test job result: {1}", (object)jobType, (object)ex)); return(new OneTimeJobResult <T>() { Success = false, Message = this.GetLocalizedErrorMessageFromException(timeJobRawResult.ExceptionFromJob) }); } } }
// Token: 0x060005C0 RID: 1472 RVA: 0x00022798 File Offset: 0x00020998 public OneTimeJobResult <T> ExecuteJobAndGetResult <T>(string engineName, JobDescription jobDescription, CredentialBase jobCredential, JobResultDataFormatType resultDataFormat, string jobType) where T : class, new() { this.RouteJobToEngine(jobDescription, engineName); OneTimeJobResult <T> result; using (OneTimeJobRawResult oneTimeJobRawResult = this.oneTimeJobManager.ExecuteJob(jobDescription, jobCredential)) { string error = oneTimeJobRawResult.Error; if (!oneTimeJobRawResult.Success) { OneTimeJobService.log.WarnFormat(jobType + " credential test failed: " + oneTimeJobRawResult.Error, Array.Empty <object>()); string localizedErrorMessageFromException = this.GetLocalizedErrorMessageFromException(oneTimeJobRawResult.ExceptionFromJob); result = new OneTimeJobResult <T> { Success = false, Message = (string.IsNullOrEmpty(localizedErrorMessageFromException) ? error : localizedErrorMessageFromException) }; } else { try { T value; if (resultDataFormat == JobResultDataFormatType.Xml) { using (XmlTextReader xmlTextReader = new XmlTextReader(oneTimeJobRawResult.JobResultStream)) { xmlTextReader.Namespaces = false; value = (T)((object)new XmlSerializer(typeof(T)).Deserialize(xmlTextReader)); goto IL_CF; } } value = SerializationHelper.Deserialize <T>(oneTimeJobRawResult.JobResultStream); IL_CF: result = new OneTimeJobResult <T> { Success = true, Value = value }; } catch (Exception arg) { OneTimeJobService.log.Error(string.Format("Failed to deserialize {0} credential test job result: {1}", jobType, arg)); result = new OneTimeJobResult <T> { Success = false, Message = this.GetLocalizedErrorMessageFromException(oneTimeJobRawResult.ExceptionFromJob) }; } } } return(result); }