示例#1
0
        public new static string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Available Properties");

            foreach (var propertyReplacer in ChoPropertyManagerSettings.Me.PropertyReplacers)
            {
                ChoStringMsgBuilder msg1 = new ChoStringMsgBuilder("{0} Property Replacer".FormatString(propertyReplacer.Name));

                bool found = false;
                if (propertyReplacer.AvailablePropeties != null)
                {
                    found = false;
                    foreach (KeyValuePair <string, string> keyValue in propertyReplacer.AvailablePropeties)
                    {
                        found = true;
                        msg1.AppendFormatLine("{0} - {1}".FormatString(keyValue.Key, keyValue.Value));
                    }
                }

                if (!found)
                {
                    msg1.AppendFormatLine("No properties found. / Failed to enumerate properties.");
                }

                msg.AppendFormatLine(msg1.ToString());
            }

            return(msg.ToString());
        }
示例#2
0
        public string Format(object value, bool indentMsg)
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder();

            if (((IDictionary)value).Count == 0)
            {
                msg.Append(ChoString.EmptyString);
            }
            else
            {
                msg.AppendLine();
                if (indentMsg)
                {
                    msg.AppendLine("[");
                    foreach (object token in ((IDictionary)value).Keys)
                    {
                        msg.AppendFormatLine(String.Format("{0} - {1}", ChoObject.ToString(token), ChoObject.ToString(((IDictionary)value)[token])));
                    }
                    msg.Append("]");
                }
                else
                {
                    foreach (object token in ((Hashtable)value).Keys)
                    {
                        msg.AppendLine(token.ToString());
                    }
                }
            }

            return(msg.ToString());
        }
        public string Format(object value, bool indentMsg)
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder();

            if (((Hashtable)value).Count == 0)
            {
                msg.Append(ChoString.EmptyString);
            }
            else
            {
                msg.AppendLine();
                if (indentMsg)
                {
                    msg.AppendLine("[");
                    foreach (object token in ((Hashtable)value).Values)
                    {
                        msg.AppendFormatLine(ChoObject.ToString(token));
                    }
                    msg.Append("]");
                }
                else
                {
                    foreach (object token in ((Hashtable)value).Values)
                    {
                        msg.AppendLine(ChoObject.ToString(token));
                    }
                }
            }

            return(msg.ToString());
        }
        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;
                }
            }
        }
示例#5
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("ApplicationId: {0}", ApplicationName);
            msg.AppendFormatLine("EventLogSourceName: {0}", EventLogSourceName);
            msg.AppendFormatLine("TurnOnConsoleOutput: {0}", TurnOnConsoleOutput);
            msg.AppendFormatLine("ApplicationConfigFilePath: {0}", ApplicationConfigFilePath);

            msg.AppendFormatLine(String.Empty);

            msg.AppendFormatLine("ApplicationNameWithoutExtension: {0}", ApplicationNameWithoutExtension);
            msg.AppendFormatLine("ApplicationLogDirectory: {0}", ApplicationLogDirectory);
            msg.AppendFormatLine("HostName: {0}", HostName);

            msg.AppendFormatLine(String.Empty);

            if (ApplicationBehaviourSettings != null)
            {
                msg.AppendFormatLine(ApplicationBehaviourSettings.ToString());
            }

            if (TrayApplicationBehaviourSettings != null)
            {
                msg.AppendFormatLine(TrayApplicationBehaviourSettings.ToString());
            }

            if (LogSettings != null)
            {
                msg.AppendFormatLine(LogSettings.ToString());
            }

            return(msg.ToString());
        }
        public string Format(object value, bool indentMsg)
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder();

            if (((Array)value).Length == 0)
            {
                msg.AppendLine(ChoString.EmptyString);
            }
            else
            {
                if (indentMsg)
                {
                    msg.AppendLine("[");
                    foreach (object token in (Array)value)
                    {
                        msg.AppendFormatLine(ChoObject.ToString(token));
                    }
                    msg.AppendLine("]");
                }
                else
                {
                    foreach (object token in (Array)value)
                    {
                        msg.AppendLine(ChoObject.ToString(token));
                    }
                }
            }

            return(msg.ToString());
        }
示例#7
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("APM Settings");

            msg.AppendFormatLine("MaxNoOfRetry: {0}", MaxNoOfRetry);
            msg.AppendFormatLine("SleepBetweenRetry: {0}", SleepBetweenRetry);

            return(msg.ToString());
        }
示例#8
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Console Settings");

            msg.AppendFormatLine("ForegroundColor: {0}", ForegroundColor);
            msg.AppendFormatLine("BackgroundColor: {0}", BackgroundColor);
            msg.AppendFormatLine("ConsoleMode: {0}", ConsoleMode);

            return(msg.ToString());
        }
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("ConfigurationMetaDataFilePath: {0}", OverridenConfigurationMetaDataFilePath);
            msg.AppendFormatLine("PCMetaDataFilePath: {0}", OverridenPCMetaDataFilePath);
            msg.AppendFormatLine("ETLMetaDataFilePath: {0}", OverridenETLMetaDataFilePath);

            return(msg.ToString());
        }
示例#10
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("Account: {0}", Account);
            msg.AppendFormatLine("UserName: {0}", UserName);
            msg.AppendFormatLine("HelpText: {0}", HelpText);

            return(msg.ToString());
        }
示例#11
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("INI Settings");

            msg.AppendFormatLine("NameValueDelimiter: {0}", NameValueSeparator);
            msg.AppendFormatLine("CommantChars: {0}", CommentChars);
            msg.AppendFormatLine("IgnoreValueWhiteSpaces: {0}", IgnoreValueWhiteSpaces);

            return(msg.ToString());
        }
示例#12
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Tray Application Font Settings");

            msg.AppendFormatLine("FontName: {0}", FontName);
            msg.AppendFormatLine("FontSize: {0}", FontSize);
            msg.AppendFormatLine("FontColor: {0}", FontColor);

            return(msg.ToString());
        }
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("Reset: {0}", ResetFailedCounterAfter);
            msg.AppendFormatLine("RebootMsg: {0}", RebootMessage.GetValue());
            msg.AppendFormatLine("Command: {0}", Command.GetValue());
            msg.AppendFormatLine("Actions: {0}", Actions.GetValue());

            return(msg.ToString());
        }
示例#14
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Log Settings");

            msg.AppendFormatLine("TraceLevel: {0}", TraceLevel);
            msg.AppendFormatLine("LogFolder: {0}", LogFolder);
            msg.AppendFormatLine("LogFileName: {0}", LogFileName);
            msg.AppendFormatLine("LogTimeStampFormat: {0}", LogTimeStampFormat);

            return(msg.ToString());
        }
示例#15
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("CommandLine Parser Settings");

            msg.AppendFormatLine("SwitchChars: {0}", new ChoArrayToStringFormatter().Format(SwitchChars, true));
            msg.AppendFormatLine("valueSeperators: {0}", new ChoArrayToStringFormatter().Format(ValueSeperators, true));
            msg.AppendFormatLine("UsageSwitches: {0}", new ChoArrayToStringFormatter().Format(UsageSwitches, true));
            msg.AppendFormatLine("FileArgSwitches: {0}", new ChoArrayToStringFormatter().Format(FileArgSwitches, true));
            msg.AppendFormatLine("IgnoreCase: {0}", IgnoreCase);

            return(msg.ToString());
        }
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("DelayedAutoStart: {0}", DelayedAutoStart);
            msg.AppendFormatLine("Description: {0}", Description);
            msg.AppendFormatLine("DisplayName: {0}", DisplayName);
            msg.AppendFormatLine("ServiceName: {0}", ServiceName);
            msg.AppendFormatLine("ServiceStartMode: {0}", ServiceStartMode);

            return(msg.ToString());
        }
示例#17
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Tray Application Context Menu Settings");

            msg.AppendFormatLine("DisplayAlwaysOnTopMenuItem: {0}", DisplayAlwaysOnTopMenuItem);
            msg.AppendFormatLine("DisplayRunAtSystemsStartupMenuItem: {0}", DisplayRunAtSystemsStartupMenuItem);
            msg.AppendFormatLine("DisplayShowInTaskbarMenuItem: {0}", DisplayShowInTaskbarMenuItem);
            msg.AppendFormatLine("DisplayAboutMenuItem: {0}", DisplayAboutMenuItem);
            msg.AppendFormatLine("DisplayHelpMenuItem: {0}", DisplayHelpMenuItem);
            msg.AppendFormatLine("DisplayExitMenuItem: {0}", DisplayExitMenuItem);

            return(msg.ToString());
        }
示例#18
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder(GetType().Name);

            msg.AppendFormatLine("ErrorCode: {0}".FormatString(ErrorCode));
            msg.AppendFormatLine("ErrorMsg: {0}".FormatString(ErrorMsg));
            msg.AppendFormatLine("Exception: ");
            if (Exception != null)
            {
                msg.AppendFormatLine(Exception.ToString().Indent());
            }

            return(msg.ToString());
        }
示例#19
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Application Behaviour Settings");

            msg.AppendFormatLine("HideWindow: {0}", HideWindow);
            msg.AppendFormatLine("BringWindowToTop: {0}", BringWindowToTop);
            msg.AppendFormatLine("AlwaysOnTop: {0}", AlwaysOnTop);
            msg.AppendFormatLine("RunAtStartup: {0}", RunAtStartup);
            msg.AppendFormatLine("RunOnceAtStartup: {0}", RunOnceAtStartup);
            msg.AppendFormatLine("SingleInstanceApp: {0}", SingleInstanceApp);
            msg.AppendFormatLine("ActivateFirstInstance: {0}", ActivateFirstInstance);

            return(msg.ToString());
        }
示例#20
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Tray Application Behaviour Settings");

            msg.AppendFormatLine("TurnOn: {0}", TurnOn);
            msg.AppendFormatLine("HideMainWindowAtStartup: {0}", HideMainWindowAtStartup);
            msg.AppendFormatLine("HideTrayIconWhenMainWindowShown: {0}", HideTrayIconWhenMainWindowShown);
            msg.AppendFormatLine("TooltipText: {0}", TooltipText);
            msg.AppendFormatLine("BalloonTipText: {0}", BalloonTipText);
            msg.AppendFormatLine("TrayAppTurnOnMode: {0}", TrayAppTurnOnMode);
            msg.AppendFormatLine("ShowInTaskbar: {0}", ShowInTaskbar);
            msg.AppendFormatLine("TrayIcon: {0}", TrayIcon);

            return(msg.ToString());
        }
示例#21
0
        internal static void Initialize()
        {
            //ChoStreamProfile.Clean(ChoReservedDirectoryName.Others, ChoType.GetLogFileName(typeof(ChoTypesManager)));

            StringBuilder topMsg = new StringBuilder();

            ChoStringMsgBuilder parseMethodsMsg  = new ChoStringMsgBuilder("Below are the loaded parse methods");
            ChoStringMsgBuilder formatMethodsMsg = new ChoStringMsgBuilder("Below are the loaded format methods");
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Below are the loaded type objects");

            foreach (Type type in ChoType.GetTypes(typeof(ChoStringObjectFormattableAttribute)))
            {
                if (ChoTypesManagerSettings.IsExcludedType(type))
                {
                    continue;
                }

                ChoTypeObjectParseInfo  typeObjectParseInfo  = new ChoTypeObjectParseInfo();
                ChoTypeObjectFormatInfo typeObjectFormatInfo = new ChoTypeObjectFormatInfo();
                try
                {
                    //typeObjectFormatInfo.TypeObject = typeObjectParseInfo.TypeObject = ChoObject.CreateInstance(type);
                    msg.AppendFormatLine(type.FullName);
                }
                catch (ChoFatalApplicationException)
                {
                    throw;
                }
                catch (Exception ex)
                {
                    msg.AppendFormatLine("{0}: [{1}]", type.FullName, ex.Message);
                }

                LoadObjectParser(parseMethodsMsg, type, typeObjectParseInfo);
                LoadObjectFormatter(formatMethodsMsg, type, typeObjectFormatInfo);
            }

            _typeObjectsParseInfoArr  = TypeObjectsParseInfo.Values.ToArray();
            _typeObjectsFormatInfoArr = TypeObjectsFormatInfo.Values.ToArray();

            //_typeObjectsParseInfo.Clear();
            //_typeObjectsFormatInfo.Clear();

            topMsg.Append(parseMethodsMsg.ToString() + Environment.NewLine + Environment.NewLine);
            topMsg.Append(formatMethodsMsg.ToString() + Environment.NewLine + Environment.NewLine);
            topMsg.Append(msg.ToString() + Environment.NewLine + Environment.NewLine);
            _helpText = topMsg.ToString();
        }
示例#22
0
        private bool IsExists(ArrayList list, object element)
        {
            foreach (object item in list)
            {
                if (item.Equals(element))
                {
                    ChoStringMsgBuilder msg = new ChoStringMsgBuilder("Duplicate entry found");
                    msg.AppendFormatLine(ChoObject.ToString(element));

                    ChoTrace.Debug(msg.ToString());
                    return(true);
                }
            }

            return(false);
        }
示例#23
0
        public new string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} ChoThreadPool Settings", Name);

            msg.AppendNewLine();
            msg.AppendLine("MaxWorkerThreads: {0}", _maxWorkerThreads);
            msg.AppendLine("MinWorkerThreads: {0}", _minWorkerThreads);
            msg.AppendLine("IdleTimeout: {0}", _idleTimeout);
            msg.AppendLine("DisposeOfStateObjects: {0}", _disposeOfStateObjects);
            msg.AppendLine("UseCallerContext: {0}", _useCallerContext);
            msg.AppendLine("PostExecuteWorkItemCallback: {0}", _postExecuteWorkItemCallback);
            msg.AppendLine("CallToPostExecute: {0}", _callToPostExecute);
            msg.AppendLine("BlockIfPoolBusy: {0}", _blockIfPoolBusy);
            msg.AppendNewLine();

            return(msg.ToString());
        }
示例#24
0
        public static new string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", typeof(ChoApplication).Name);

            msg.AppendFormatLine("AppEnvironment: {0}", AppEnvironment);
            msg.AppendFormatLine("ApplicationMode: {0}", ApplicationMode);
            msg.AppendFormatLine("AppDomainName: {0}", AppDomainName);
            msg.AppendFormatLine("ProcessId: {0}", ProcessId);
            msg.AppendFormatLine("ProcessFilePath: {0}", ProcessFilePath);
            msg.AppendFormatLine("UnmanagedCodePermissionAvailable: {0}", UnmanagedCodePermissionAvailable);
            msg.AppendFormatLine("EntryAssemblyLocation: {0}", EntryAssemblyLocation);
            msg.AppendFormatLine("EntryAssemblyFileName: {0}", EntryAssemblyFileName);
            msg.AppendFormatLine("ApplicationBaseDirectory: {0}", ApplicationBaseDirectory);
            msg.AppendFormatLine("ApplicationConfigDirectory: {0}", ApplicationConfigDirectory);
            msg.AppendFormatLine("ApplicationLogDirectory: {0}", ApplicationLogDirectory);

            return(msg.ToString());
        }
示例#25
0
        private static void GetErrorMsgs(object target, ChoStringMsgBuilder msg)
        {
            MemberInfo[]  memberInfos = ChoType.GetMembers(target.GetType()); //, typeof(ChoMemberInfoAttribute));
            List <string> errMsgs     = new List <string>();
            string        errMsg;

            if (memberInfos != null && memberInfos.Length >= 0)
            {
                foreach (MemberInfo memberInfo in memberInfos)
                {
                    errMsg = ChoConfigurationObjectErrorManagerService.GetObjectMemberError(target, memberInfo.Name);
                    if (errMsg != null)
                    {
                        errMsgs.Add(String.Format("{0}: {1}", memberInfo.Name, errMsg));
                    }
                }
            }

            if (errMsgs.Count > 0)
            {
                msg.AppendLine();
                ChoStringMsgBuilder errReport = new ChoStringMsgBuilder("Following errors occurred while construction");

                foreach (string errMsg1 in errMsgs)
                {
                    errReport.AppendFormatLine(errMsg1);
                }

                msg.AppendLine(errReport.ToString().Indent(1));
            }
            else
            {
                errMsg = ChoConfigurationObjectErrorManagerService.GetObjectError(target);

                if (!errMsg.IsNullOrEmpty())
                {
                    msg.AppendLine();
                    ChoStringMsgBuilder errReport = new ChoStringMsgBuilder("Following errors occurred while construction");
                    errReport.AppendFormatLine(errMsg);

                    msg.AppendLine(errReport.ToString().Indent(1));
                }
            }
        }
示例#26
0
        public string GetHelpText()
        {
            StringBuilder msg = new StringBuilder("List of available properties" + Environment.NewLine);

            msg.AppendLine();
            msg.AppendLine("@this - Context info will be replaced.");
            msg.AppendLine();

            foreach (IChoPropertyReplacer propertyReplacer in PropertyReplacers)
            {
                if (propertyReplacer.AvailablePropeties == null)
                {
                    continue;
                }

                ChoStringMsgBuilder msg1 = new ChoStringMsgBuilder(propertyReplacer.Name);

                foreach (KeyValuePair <string, string> keyValue in propertyReplacer.AvailablePropeties)
                {
                    msg1.AppendFormatLine("{0} - {1}", keyValue.Key, keyValue.Value);
                }

                msg.AppendLine(msg1.ToString());
            }

            ChoStringMsgBuilder msg2 = new ChoStringMsgBuilder("Application Propeties");

            foreach (Dictionary <string, string> dict in ChoApplication.GetPropertyHelpTexts())
            {
                if (dict == null)
                {
                    continue;
                }

                foreach (KeyValuePair <string, string> keyValue in dict)
                {
                    msg2.AppendFormatLine("{0} - {1}", keyValue.Key, keyValue.Value);
                }
            }
            msg.AppendLine(msg2.ToString());

            return(msg.ToString());
        }
示例#27
0
        public string Format(object value)
        {
            if (!CanFormat(value.GetType()))
            {
                return(value.ToString());
            }
            else
            {
                ChoStringMsgBuilder msg = new ChoStringMsgBuilder();
                msg.AppendLine();
                msg.AppendLine("[");
                foreach (string token in value as string[])
                {
                    msg.AppendFormatLine(token);
                }
                msg.AppendLine("]");

                return(msg.ToString());
            }
        }
示例#28
0
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("AppEnvironment: {0}", AppEnvironment);
            msg.AppendFormatLine("SharedEnvironmentConfigFilePath: {0}", SharedEnvironmentConfigFilePath);
            msg.AppendFormatLine("AppDomainName: {0}", AppDomainName);
            msg.AppendFormatLine("ProcessId: {0}", ProcessId);
            msg.AppendFormatLine("ProcessFilePath: {0}", ProcessFilePath);
            msg.AppendFormatLine("UnmanagedCodePermissionAvailable: {0}", UnmanagedCodePermissionAvailable);
            msg.AppendFormatLine("ApplicationName: {0}", ApplicationName);
            msg.AppendFormatLine("ApplicationNameWithoutExtension: {0}", ApplicationNameWithoutExtension);
            msg.AppendFormatLine("EntryAssemblyLocation: {0}", EntryAssemblyLocation);
            msg.AppendFormatLine("EntryAssemblyFileName: {0}", EntryAssemblyFileName);
            msg.AppendFormatLine("ApplicationConfigFilePath: {0}", ApplicationConfigFilePath);
            msg.AppendFormatLine("ApplicationBaseDirectory: {0}", ApplicationBaseDirectory);
            msg.AppendFormatLine("ApplicationLogDirectory: {0}", ApplicationLogDirectory);
            msg.AppendFormatLine("HostName: {0}", HostName);

            return(msg.ToString());
        }
        public string Format(object value, bool indentMsg)
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder();

            msg.AppendLine();
            if (indentMsg)
            {
                msg.AppendLine("[");
                foreach (string token in value as string[])
                {
                    msg.AppendFormatLine(token);
                }
                msg.AppendLine("]");
            }
            else
            {
                foreach (string token in value as string[])
                {
                    msg.AppendLine(token);
                }
            }
            return(msg.ToString());
        }
        public override string ToString()
        {
            ChoStringMsgBuilder msg = new ChoStringMsgBuilder("{0} Settings", GetType().Name);

            msg.AppendFormatLine("Description: {0}", Description);
            msg.AppendFormatLine("ServiceName: {0}", ServiceName);
            msg.AppendFormatLine("ServiceStartMode: {0}", ServiceStartMode);
            msg.AppendFormatLine("Depends: {0}", Depends);
            msg.AppendFormatLine("Account: {0}", Account);
            msg.AppendFormatLine("UserName: {0}", UserName);
            msg.AppendFormatLine("Timeout: {0}", Timeout);

            msg.AppendFormatLine("CanHandlePowerEvent: {0}", CanHandlePowerEvent);
            msg.AppendFormatLine("CanHandleSessionChangeEvent: {0}", CanHandleSessionChangeEvent);
            msg.AppendFormatLine("CanPauseAndContinue: {0}", CanPauseAndContinue);
            msg.AppendFormatLine("CanShutdown: {0}", CanShutdown);
            msg.AppendFormatLine("CanStop: {0}", CanStop);
            msg.AppendFormatLine("AutoLog: {0}", AutoLog);
            msg.AppendFormatLine("ExitCode: {0}", ExitCode);

            msg.AppendFormatLine(RecoverySettings.ToString().Indent());

            return(msg.ToString());
        }