protected virtual void TraceOutput(bool isDirty) { if (!LogCondition) { return; } if (ConfigObject == null) { throw new ChoConfigurationConstructionException("configObject"); } try { ChoStringMsgBuilder msg = new ChoStringMsgBuilder(String.Format("{0} {1}", isDirty ? "*" : " ", ChoObject.ToString(ConfigObject, ChoFormattableObject.ExtendedFormatName))); if (ConfigSection != null && MetaDataInfo != null) { msg.AppendNewLine(); ChoStringMsgBuilder metaDataMsg = new ChoStringMsgBuilder(ChoObject.ToString(MetaDataInfo)); msg.Append(metaDataMsg.ToString()); } Log(msg.ToString()); } catch (Exception ex) { Trace.Write(ex); if (!Silent) { throw; } } }
private void QueueProcessingThreadCallback(object state) { IChoQueuedMsgServiceObject <T> msgQObject = null; while (true) { try { msgQObject = _queue.Dequeue() as IChoQueuedMsgServiceObject <T>; if (msgQObject == null) { continue; } if (msgQObject.IsQuitServiceMsg) { break; } QueueMessageHandler(msgQObject); } catch (ChoFatalApplicationException fex) { ChoEnvironment.Exit(-1, fex); } catch (Exception ex) { ChoApplication.WriteToEventLog(ex.ToString(), EventLogEntryType.Error); if (msgQObject != null) { ChoApplication.WriteToEventLog(ChoObject.ToString(msgQObject)); } //ChoProfile.DefaultContext.Append(ex); //if (!EventLog.SourceExists(ChoAssembly.GetEntryAssembly().GetName().Name)) // EventLog.CreateEventSource(ChoAssembly.GetEntryAssembly().GetName().Name, "Application"); //EventLog.WriteEntry(ChoAssembly.GetEntryAssembly().GetName().Name, ChoApplicationException.ToString(ex)); //throw; } } }
public override string ToString() { return(ChoObject.ToString(this)); }
// // Summary: // Writes the text representation of the specified object to the standard output // stream. // // Parameters: // value: // The value to write, or null. // // Exceptions: // System.IO.IOException: // An I/O error occurred. public void Write(object value) { Write(ChoObject.ToString(value)); }
public string ToStringL() { return(ChoObject.ToString(this)); }
public override string ToString() { return(Payload != null?ChoObject.ToString(Payload) : null); }
public new static string ToString() { return(ChoObject.ToString(_instance)); }
public static string ToString(object configObject) { if (configObject == null) { return(String.Empty); } string configObjectString = ChoObject.ToString(configObject); ChoConfigurationElementMapAttribute configurationElementMap = ChoType.GetAttribute(configObject.GetType(), typeof(ChoConfigurationElementMapAttribute)) as ChoConfigurationElementMapAttribute; if (configurationElementMap == null) { return(configObjectString); } else if (configObjectString == configObject.GetType().FullName) { ChoStringMsgBuilder msg = new ChoStringMsgBuilder(configurationElementMap.Description); MemberInfo[] memberInfos = ChoType.GetMembers(configObject.GetType(), typeof(ChoMemberInfoAttribute)); if (memberInfos == null || memberInfos.Length == 0) { msg.AppendLine(ChoStringMsgBuilder.Empty); } else { string errMsg; foreach (MemberInfo memberInfo in memberInfos) { errMsg = ChoType.GetAttributeNameParameterValue(configObject.GetType(), memberInfo.Name, typeof(ChoMemberInfoAttribute), "ErrMsg") as string; if (errMsg == null) { msg.AppendFormatLine("{0}: {1}", memberInfo.Name, ChoType.GetMemberValue(configObject, memberInfo.Name)); } else { msg.AppendFormatLine("{0}: {1} [ERROR: {2}]", memberInfo.Name, ChoType.GetMemberValue(configObject, memberInfo.Name), errMsg); } } } msg.AppendNewLine(); return(msg.ToString()); } else { StringBuilder msg = new StringBuilder(configObjectString); MemberInfo[] memberInfos = ChoType.GetMembers(configObject.GetType(), typeof(ChoMemberInfoAttribute)); List <string> errMsgs = new List <string>(); if (memberInfos != null && memberInfos.Length >= 0) { string errMsg; foreach (MemberInfo memberInfo in memberInfos) { errMsg = ChoType.GetAttributeNameParameterValue(configObject.GetType(), memberInfo.Name, typeof(ChoMemberInfoAttribute), "ErrMsg") as string; if (errMsg != null) { errMsgs.Add(String.Format("{0}: {1}", memberInfo.Name, errMsg)); } } } if (errMsgs.Count > 0) { ChoStringMsgBuilder errReport = new ChoStringMsgBuilder("Following errors produced while construction"); foreach (string errMsg in errMsgs) { errReport.AppendFormatLine(errMsg); } msg.AppendLine(errReport.ToString()); } return(msg.ToString()); } }