コード例 #1
0
        internal void SaveArticlesNonEnglishData(Dictionary <string, ArticleFile> _dictionary)
        {
            PDFFolder temp = new PDFFolder(this.location, this.title);

            foreach (var item in Enum.GetValues(typeof(Languages)))
            {
                if (_dictionary.ContainsKey(item.ToString()))
                {
                    string header   = item.ToString().Substring(0, 2);
                    string fileName = "index." + header + ".json";
                    if (DiskIO.IsFileExist(ContentLocation, fileName))
                    {
                        temp = DiskIO.DeserializePDFFolderFromFile(ContentLocation, fileName);
                        temp.SetLocationTitle(this.location, this.title);
                        if (temp.HasArticleWithID(_dictionary[item.ToString()].id))
                        {
                            temp.RemoveArticleWithID(_dictionary[item.ToString()].id);
                        }
                        temp.library.Add(_dictionary[item.ToString()]);
                        temp.SaveArticleLibrary(fileName);
                    }
                    else
                    {
                        temp.library = new List <ArticleFile>();
                        temp.library.Add(_dictionary[item.ToString()]);
                        temp.SaveArticleLibrary(fileName);
                    }
                }
            }
        }
コード例 #2
0
        internal void RemoveArticleNonEnglishData(int _id)
        {
            PDFFolder temp = new PDFFolder(this.location, this.title);

            foreach (var item in Enum.GetValues(typeof(Languages)))
            {
                string header   = item.ToString().Substring(0, 2);
                string fileName = "index." + header + ".json";
                if (DiskIO.IsFileExist(ContentLocation, fileName))
                {
                    temp = DiskIO.DeserializePDFFolderFromFile(ContentLocation, fileName);
                    temp.SetLocationTitle(this.location, this.title);
                    if (temp.HasArticleWithID(_id))
                    {
                        temp.RemoveArticleWithID(_id);
                    }
                    DiskIO.SaveAsJSONFile(temp, this.ContentLocation, fileName);
                }
            }
        }