Example #1
0
        public static DocSets GetDocSets(string culture, string docPath)
        {
            DocSets result          = null;
            int     firstSlashIndex = docPath.IndexOf("/");

            if (firstSlashIndex < 0)
            {
                return(null);
            }
            string productCategory    = docPath.Substring(0, firstSlashIndex);
            string docPathTrimProduct = docPath.Substring(firstSlashIndex + 1);

            result = GetCachedDocSets(culture, productCategory);
            if (result == null)
            {
                string docSetFilePath = productCategory + "/DocSets.xml";
                string docSetContent  = BlobManager.ReadContent(blobConnectString, docBlobContainer, culture, docSetFilePath);

                if (docSetContent != null)
                {
                    result = XmlReader.GetOject <DocSets>(docSetContent);
                    if (result != null)
                    {
                        CacheDocSets(culture, productCategory, result);
                    }
                }
            }
            return(result);
        }
Example #2
0
        public static Toc GetToc(string culture, string docPath)
        {
            Toc result          = null;
            int firstSlashIndex = docPath.IndexOf("/");

            if (firstSlashIndex < 0)
            {
                return(null);
            }
            string productCategory    = docPath.Substring(0, firstSlashIndex);
            string docPathTrimProduct = docPath.Substring(firstSlashIndex + 1);

            firstSlashIndex = docPathTrimProduct.IndexOf("/");
            if (firstSlashIndex < 0)
            {
                return(null);
            }
            string docSetCategory = docPathTrimProduct.Substring(0, firstSlashIndex);

            result = GetCachedToc(culture, productCategory, docSetCategory);
            if (result == null)
            {
                string tocFilePath = productCategory + "/" + docSetCategory + "/toc.xml";
                string tocContent  = BlobManager.ReadContent(blobConnectString, docBlobContainer, culture, tocFilePath);
                if (tocContent != null)
                {
                    result = XmlReader.GetOject <Toc>(tocContent);
                    if (result != null)
                    {
                        result.RootPath  = docSetCategory;
                        result.UrlPrefix = "/" + culture + result.UrlPrefix + productCategory + "/" + docSetCategory + "/";
                        CacheToc(culture, productCategory, docSetCategory, result);
                        BuildTheTocChildMap(result);
                    }
                }
            }
            return(result);
        }
Example #3
0
 public static string GetDocContent(string culture, string docPath)
 {
     return(BlobManager.ReadContent(blobConnectString, docBlobContainer, culture, docPath + ".htm"));
 }