예제 #1
0
        internal static bool TryGet(
            string link, out HelpLink.LinkType type, out string content)
        {
            type    = HelpLink.LinkType.Link;
            content = string.Empty;

            int separatorIdx = link.IndexOf(':');

            if (separatorIdx == -1)
            {
                return(false);
            }

            string key = link.Substring(0, separatorIdx);

            try
            {
                type = (HelpLink.LinkType)Enum.Parse(
                    typeof(HelpLink.LinkType), key, true);
            }
            catch (Exception ex)
            {
                mLog.ErrorFormat("Unable to get help link data: '{0}': {1}",
                                 key, ex.Message);
                mLog.DebugFormat("StackTrace: {0}", ex.StackTrace);

                return(false);
            }

            content = link.Substring(separatorIdx + 1);

            return(true);
        }
예제 #2
0
            internal static string AsString(HelpLink.LinkType linkType, string linkContent)
            {
                string linkTypeString = string.Empty;

                switch (linkType)
                {
                case HelpLink.LinkType.Action:
                    linkTypeString = ACTION;
                    break;

                case HelpLink.LinkType.Help:
                    linkTypeString = HELP;
                    break;

                case HelpLink.LinkType.Link:
                    linkTypeString = LINK;
                    break;
                }

                return(string.Concat(linkTypeString, SEPARATOR, linkContent));
            }