Пример #1
0
        public List <TokenIncubatorUpdateModel> GetTokenIncubatorUpdates(string tokenId, string cultureStr)
        {
            var folderPath = Path.Combine(tokenFolderAbsolutePath, tokenId, "updates");

            if (!Directory.Exists(folderPath))
            {
                return(null);
            }

            var availableFiles = GlobalizationFileFinder.GetCultureFiles(folderPath, cultureStr, ".json").ToList();
            var mainFile       = availableFiles.FirstOrDefault(x => x.EndsWith(".json"));

            if (!string.IsNullOrWhiteSpace(mainFile))
            {
                var updateList = JsonConvert.DeserializeObject <List <TokenIncubatorUpdateModel> >(System.IO.File.ReadAllText(mainFile));
                if (updateList != null)
                {
                    foreach (var u in updateList)
                    {
                        var contentPath = Path.Combine(folderPath, u.Content);
                        if (!string.IsNullOrWhiteSpace(u.Content) && File.Exists(contentPath))
                        {
                            u.Content = System.IO.File.ReadAllText(contentPath);
                        }
                    }
                }
                return(updateList);
            }
            return(null);
        }
Пример #2
0
        public string GetTokenIncubationDetail(string tokenId, string cultureStr)
        {
            var folderPath = Path.Combine(tokenFolderAbsolutePath, tokenId, "incubator");

            if (!Directory.Exists(folderPath))
            {
                return(null);
            }

            var availablePath = GlobalizationFileFinder.GetCultureFiles(folderPath, cultureStr, ".md").Where(x => Path.GetFileNameWithoutExtension(x).StartsWith("detail.")).FirstOrDefault();

            if (availablePath != null)
            {
                return(File.ReadAllText(availablePath));
            }
            return(null);
        }
Пример #3
0
        public IEnumerable <string> GetTokenIncubationBannereRelativePaths(string tokenId, string cultureStr)
        {
            var sliderFolderPath = Path.Combine(tokenFolderAbsolutePath, tokenId, "slides");

            if (!Directory.Exists(sliderFolderPath))
            {
                yield return(null);
            }

            var availablePaths = GlobalizationFileFinder.GetCultureFiles(sliderFolderPath, cultureStr, ".png").ToList();

            foreach (var path in availablePaths)
            {
                Uri    absolutePath = new Uri(path);
                Uri    folderPath   = new Uri(tokenFolderAbsolutePath + "/");
                string relativePath = folderPath.MakeRelativeUri(absolutePath).ToString();
                yield return(relativePath);
            }
            ;
        }
Пример #4
0
        public string GetWhitePaper(string tokenId, string cultureStr)
        {
            var sliderFolderPath = Path.Combine(tokenFolderAbsolutePath, tokenId, "whitepaper");

            if (!Directory.Exists(sliderFolderPath))
            {
                return(null);
            }

            var availablePaths = GlobalizationFileFinder.GetCultureFiles(sliderFolderPath, cultureStr, ".pdf").ToList();

            if (availablePaths.Count >= 1)
            {
                var    path         = availablePaths.FirstOrDefault();
                Uri    absolutePath = new Uri(path);
                Uri    folderPath   = new Uri(tokenFolderAbsolutePath + "/");
                string relativePath = folderPath.MakeRelativeUri(absolutePath).ToString();
                return(relativePath);
            }
            ;
            return(null);
        }
Пример #5
0
 private IEnumerable <string> EnumerateNewsFiles()
 {
     return(GlobalizationFileFinder.GetCultureFiles(_path, _lang));
 }