Exemple #1
0
 private float convertTypeToArea(MyObjects obj)
 {
     if (obj == MyObjects.House)
     {
         return(25f);
     }
     else if (obj == MyObjects.Trees)
     {
         return(25f);
     }
     return(1f);
 }
Exemple #2
0
 private GameObject getMyPrefab(MyObjects obj)
 {
     if (obj == MyObjects.House)
     {
         return(houses[rand.Next(0, houses.Length)]);
     }
     else if (obj == MyObjects.Trees)
     {
         return(trees[rand.Next(0, trees.Length)]);
     }
     return(null);
 }
         public static void Main(string[] args)
         {
             var products = new MyObjects()
             {
                 new MyObject() {Id = 1, Name = "Dell"},
                 new MyObject() {Id = 2, Name = "Sony"},
                 new MyObject() {Id = 3, Name = "HP"}
             };
 
             var serializeObject = SerializeObject<MyObjects>(products);
             Console.WriteLine(serializeObject);
             Console.ReadLine();
         }
        string SentenceToText(GreekDictionary dictionary, MyObjects.Verse verse, MyObjects.Book book, MyObjects.Chapter chapter)
        {
            var sb = new StringBuilder();

            foreach (var w in verse.Words)
            {
                if (w.Greek != "<br />")
                {
                    sb.Append(w.Prefix);
                    sb.Append(w.Greek);
                    sb.Append(w.Suffix);
                    sb.Append(" ");
                }
            }

            return sb.ToString();
        }
        public void GenerateFiles(MyObjects.Book book, string baseFileName, GreekDictionary dictionary)
        {
            foreach (var chapter in book.Chapters)
            {
                var sb = new StringBuilder();
                var txt = new StringBuilder();

                sb.AppendLine("<div class=\"flex-container\">");
                foreach (var sentence in chapter.Verses)
                {
                    sb.Append(VerseToHtml(sentence, dictionary, book, chapter));
                    txt.Append(VerseToText(sentence, dictionary, book, chapter));
                }

                sb.AppendLine("</div>");

                File.WriteAllText(baseFileName + "." + chapter.Id + ".html", sb.ToString());

                File.WriteAllText(baseFileName + "." + chapter.Id + ".txt", txt.ToString());
            }
        }
        string SentenceToHtml(GreekDictionary dictionary, MyObjects.Verse verse, MyObjects.Book book, MyObjects.Chapter chapter)
        {
            var sb = new StringBuilder();

            foreach (var w in verse.Words)
            {
                if (w.Greek == "<br />")
                {
                    sb.AppendLine("</div>");
                    sb.AppendLine("<br />");
                    sb.AppendLine("<div class=\"flex-container\">");
                }
                else if (w.StrongNumber > 0)
                {
                    sb.Append("<span ng-click='selectWord(" + w.StrongNumber + ", $event)'" + " strongnumber=\"" + w.StrongNumber + "\">");
                    sb.Append(w.Prefix);
                    sb.Append(w.Greek);
                    sb.Append(w.Suffix);
                    sb.Append("</span>");
                }
                else
                {
                    sb.Append("<span>");
                    sb.Append(w.Greek);
                    sb.Append("</span>");
                }

                var word = dictionary.FindWord(w.StrongNumber);
                if (word != null)
                {
                    word.AddUsage(w.Greek, book.BookNameEnglish, chapter.Id.ToString(), verse.Id, verse.ToString());
                    dictionary.AddLookup(w.Greek, word);
                }
            }

            return sb.ToString();
        }
        public void GenerateVerses(MyObjects.Book book, string outputDir, string baseFileName, KJV.KJVBible kjv, Web.WebBible web)
        {
            if (!Directory.Exists(outputDir))
                Directory.CreateDirectory(outputDir);

            foreach(var chapter in book.Chapters)
            {
                var sb = new StringBuilder();

                sb.AppendLine("<div ng-switch on=\"verseNumber\">");

                foreach(var verse in chapter.Verses)
                {
                    sb.AppendLine("<div ng-switch-when=\"" + verse.Id + "\" >");

                    sb.AppendLine("<div>Greek</div>");
                    sb.AppendLine("<div>");
                    var text = string.Empty;

                    foreach(var w in verse.Words)
                    {
                        text = text += "<span>" + w.Greek + "</span> ";
                    }

                    sb.AppendLine(text);
                    sb.AppendLine("</div>");

                    // Web Verse
                    if (web != null && web.Books.ContainsKey(book.Id))
                    {
                        var webBook = web.Books[book.Id];
                        if (webBook != null && webBook.Chapters.ContainsKey(chapter.Id))
                        {
                            var webChapter = webBook.Chapters[chapter.Id];
                            if (webChapter != null && webChapter.Verses.ContainsKey(verse.Id))
                            {
                                var webVerse = webChapter.Verses[verse.Id];
                                if (webVerse != null)
                                {
                                    sb.AppendLine("<br />");
                                    sb.AppendLine("<div>World English Bible</div>");
                                    sb.AppendLine("<div>");
                                    sb.AppendLine(webVerse.Text);
                                    sb.AppendLine("</div>");
                                }
                            }
                        }
                    }

                    // King James Verse
                    if (kjv != null && kjv.Books.ContainsKey(book.Id))
                    {
                        var kjvBook = kjv.Books[book.Id];
                        if (kjvBook != null && kjvBook.Chapters.ContainsKey(chapter.Id))
                        {
                            var kjvChapter = kjvBook.Chapters[chapter.Id];
                            if (kjvChapter != null && kjvChapter.Verses.ContainsKey(verse.Id))
                            {
                                var kjvVerse = kjvChapter.Verses[verse.Id];
                                if (kjvVerse != null)
                                {
                                    sb.AppendLine("<br />");
                                    sb.AppendLine("<div>King James Version</div>");
                                    sb.AppendLine("<div>");
                                    sb.AppendLine(kjvVerse.Text);
                                    sb.AppendLine("</div>");
                                }
                            }
                        }
                    }

                    sb.AppendLine("</div>");
                }

                sb.AppendLine("<div ng-switch-default>");
                sb.AppendLine("No verse found");
                sb.AppendLine("</div>");

                sb.AppendLine("</div>");

                sb.AppendLine("<br />");

                File.WriteAllText(Path.Combine(outputDir, baseFileName + "." + chapter.Id + ".html"), sb.ToString());
            }
        }
        string VerseToHtml(MyObjects.Verse verse, GreekDictionary dictionary, MyObjects.Book book, MyObjects.Chapter chapter)
        {
            var sb = new StringBuilder();

            //sb.Append("<div class=\"flex-item\">");
            sb.Append("<span ng-click='selectVerse(" + verse.Id + ", $event)'>");
            sb.Append("[" + verse.Id.ToString() + "]");
            //sb.Append("</div>");
            sb.Append("</span>");

            sb.Append(SentenceToHtml(dictionary, verse, book, chapter));

            return sb.ToString();
        }
 string VerseToText(MyObjects.Verse verse, GreekDictionary dictionary, MyObjects.Book book, MyObjects.Chapter chapter)
 {
     var sb = new StringBuilder();
     sb.AppendLine("[" + verse.Id.ToString() + "]" + SentenceToText(dictionary, verse, book, chapter));
     return sb.ToString();
 }