Beispiel #1
0
        private string CompileNotDocumented(Document document, string strippedSlug, string fullPath, ClientType currentLanguage)
        {
            var builder = new StringBuilder();

            builder.Append("<ul>");

            foreach (var language in SupportedLanguages.Where(x => x != currentLanguage))
            {
                var path = Path.Combine(fullPath, strippedSlug + "." + language + ".markdown");
                if (File.Exists(path))
                {
                    var url =
                        (Output.RootUrl.EndsWith("/") ? string.Empty : "/")
                        + document.VirtualTrail
                        .Replace(currentLanguage.ToString(), language.ToString().ToLower())
                        .Replace("\\", "/")
                        + "/" + strippedSlug;

                    builder.AppendFormat("<li><a href='{0}'>{1}</a></li>", new Uri(Output.RootUrl + url).AbsoluteUri, language.GetDescription());
                }
            }
            builder.Append("</ul>");

            var pathToNotDocumented = Path.Combine(destinationFullPath, "not-documented.markdown");

            document.Content = DocumentationParser.Parse(this, null, document, pathToNotDocumented, document.Trail);
            document.Content = string.Format(document.Content, currentLanguage.GetDescription(), builder);
            document.Slug    = strippedSlug;

            Output.SaveDocItem(document);

            return(document.Content);
        }
Beispiel #2
0
        public UserAgentInfo(string userAgent)
        {
            if (string.IsNullOrWhiteSpace(userAgent))
            {
                ClientType       = ClientType.OTHERS;
                ClientTypeString = ClientType.GetDescription();
                return;
            }

            Parser     uaParser   = Parser.GetDefault();
            ClientInfo clientInfo = uaParser.Parse(userAgent);

            ClientInfo = clientInfo;
            switch (clientInfo.UA.Family.ToLower())
            {
            case Constants.UserAgent.ELECTRON_FAMILY:
            {
                ClientType = ClientType.DESKTOP_APP;
                break;
            }

            case Constants.UserAgent.OTHER_FAMILY:
            {
                ClientType = ClientType.OTHERS;
                break;
            }

            default:
            {
                ClientType = ClientType.WEB_APP;
                break;
            }
            }
            ClientTypeString = ClientType.GetDescription();
        }