Ejemplo n.º 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);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        internal static PDFFolder SerializeFromJSON(string _pdfLocation, string _pdfFolderName, string _fileName)
        {
            PDFFolder retVal = new PDFFolder(_pdfLocation, _pdfFolderName);

            if (DiskIO.IsFileExist(_pdfLocation + "\\" + _pdfFolderName, _fileName))
            {
                retVal = DiskIO.DeserializePDFFolderFromFile(_pdfLocation + "\\" + _pdfFolderName, _fileName);
            }
            retVal.SetLocationTitle(_pdfLocation, _pdfFolderName);
            return(retVal);
        }
Ejemplo n.º 3
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);
                }
            }
        }
Ejemplo n.º 4
0
        internal Dictionary <string, ArticleFile> ReadNonEnglishDataLibrary(int _id)
        {
            Dictionary <string, ArticleFile> retVal = new Dictionary <string, ArticleFile>();
            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))
                    {
                        retVal.Add(item.ToString(), temp.FindArticleWithID(_id));
                    }
                }
            }
            return(retVal);
        }