[blam] Atom: Use the same logic in Update() as in the constructor to get content



commit 96af178c22719a6456161412667db5e134dbc3e4
Author: Carlos Martín Nieto <carlos cmartin tk>
Date:   Fri Sep 10 15:48:11 2010 +0100

    Atom: Use the same logic in Update() as in the constructor to get content

 src/Item.cs |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/src/Item.cs b/src/Item.cs
index ecd81a7..784da5e 100644
--- a/src/Item.cs
+++ b/src/Item.cs
@@ -155,29 +155,27 @@ namespace Imendio.Blam {
 			}
 
 			string entryText = "";
-			if (entry.Content == null || entry.Content.Length == 0) {
+            if (entry.Content == null || entry.Content.Length == 0) {
+                Console.Error.WriteLine("no content, title= {0}", this.Title);
                 if(entry.Summary.Text == null){
-                    entryText = "<p>There was no summary/content found for this entry. This is" +
+                    Console.Error.WriteLine("summary text null");
+                    this.Text = "<p>There was no summary/content found for this entry. This is" + 
                         " most likely a bug.</p>";
                 } else {
-                    entryText = entry.Summary.Text.Trim();
+                    this.Text = entry.Summary.Text.Trim();
                 }
-			} else {
-                AtomText text = entry.ContentByType("text/html");
-                if(text != null){
-                    entryText = text.Text;
-                } else {
-                    text = entry.ContentByType("application/xhtml+xml");
-                    if(text != null){
-                        entryText = text.Text;
+            } else {
+                foreach (AtomText content in entry.Content) {
+                    if (content.Type == "text/html" ||
+                        content.Type == "html" ||
+                        content.Type == "application/xhtml+xml") {
+                        if(!this.Text.Equals(content.Text.Trim())){
+                            this.Text = content.Text.Trim();
+                        }
+                        break;
                     }
                 }
-			}
-
-			if (this.Text.Equals(entryText) == false) {
-				this.Text = entryText;
-				return true;
-			}
+            }
 
 			return false;
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]