// Gen 1:1 Æð³õÉñ´´ÔìÌìµØ¡£ public void LoadIntoMemory() { string book, word = String.Empty; int chapter, verse = 0; using (StreamReader r = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("BibleProject.BibleFlatFiles.Chinese.SimplifiedChinese.txt"))) { string CurrentLine = String.Empty; while ((CurrentLine = r.ReadLine()) != null) { book = TextConverters.GetSimplifiedChineseBookNameFromId(TextConverters.GetBookIdFromAbbreviation(CurrentLine.Split('|')[0])); chapter = Convert.ToInt32(CurrentLine.Split(' ')[0].Split('|')[1]); verse = Convert.ToInt32(CurrentLine.Split(' ')[0].Split('|')[2]); try { word = CurrentLine.Split(' ')[1]; } // There's no line there because the verse has been removed to make sense in this Language. // The removed verse is still intact; it's only combined with the previous verse. catch (IndexOutOfRangeException) { word = " "; } MemoryStorage.ChineseSimplified.Add(new BibleCollection(book, chapter, verse, word)); } MemoryStorage.FullDataCollection.Add(new FullCollection(MemoryStorage.ChineseSimplified)); } }
public void LoadIntoMemory() { string book, word = String.Empty; int chapter, verse = 0; using (StreamReader r = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("BibleProject.BibleFlatFiles.English.kjvdat.txt"))) { string CurrentLine = String.Empty; while ((CurrentLine = r.ReadLine()) != null) { book = CurrentLine.Split('|')[0]; chapter = Convert.ToInt32(CurrentLine.Split('|')[1]); verse = Convert.ToInt32(CurrentLine.Split('|')[2]); word = CurrentLine.Split('|')[3].Split('~')[0]; MemoryStorage.EnglishKjv.Add(new BibleCollection(TextConverters.GetEnglishBookNameFromAbbreviation(book), chapter, verse, word)); } MemoryStorage.FullDataCollection.Add(new FullCollection(MemoryStorage.EnglishKjv)); } }
public void LoadIntoMemory() { string[] EmbeddedTraditionalChineseFiles = TextConverters.GetAllEmbeddedResourcesByFolder("BibleProject.BibleFlatFiles.Chinese.TraditonalFiles"); string book; int id; foreach (string file in EmbeddedTraditionalChineseFiles) { string testId = Path.GetExtension(file).Replace(".", ""); id = (Convert.ToInt32(testId) - 1); book = TextConverters.GetFullBookNameFromId(id); cfc.Add(new ChineseFileCollection(id, book, file)); } // list.OrderBy() is not working. Let's write our own natural order sorting algorithm, especially since every suggestion online appears to be incorrect... glare. May be a PEBKAC issue, but whatever. List <ChineseFileCollection> cf = new List <ChineseFileCollection>(); int current = 0; for (int i = 0; i < cfc.Count; i++) { foreach (var c in cfc) { if (i == c.BookId) { cf.Add(new ChineseFileCollection(c.BookId, c.BookName, c.FileName)); } } current++; } // The string for our new file. StringBuilder NewFlatFileString = new StringBuilder(); cf.Count(); foreach (var c in cf) { using (StreamReader r = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream(c.FileName), Encoding.GetEncoding("Big5"))) { string CurrentLine = String.Empty; // Get the Current line and convert it to UTF8 while ((CurrentLine = r.ReadLine()) != null) { String Book = TextConverters.GetTraditionalChineseBookNameFromId(c.BookId); int Chapter = Convert.ToInt32(CurrentLine.Split(':')[0]); int Verse = Convert.ToInt32(CurrentLine.Split(':')[1].Split(' ')[0]); String Word = TextConverters.GetUTF8StringFromBig5String(CurrentLine.Split(' ')[1]); MemoryStorage.ChineseTraditional.Add(new BibleCollection(Book, Chapter, Verse, Word)); } } } MemoryStorage.FullDataCollection.Add(new FullCollection(MemoryStorage.ChineseTraditional)); }