Ejemplo n.º 1
0
 public virtual void dump(ref string strInfo)
 {
     strInfo = strInfo + base.GetType().Name + "={";
     foreach (FieldInfo info in base.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance))
     {
         if (!info.FieldType.IsGenericType && (info.MemberType == MemberTypes.Field))
         {
             if (info.FieldType.BaseType == typeof(TloXmlItem))
             {
                 TloXmlItem item = info.GetValue(this) as TloXmlItem;
                 if (item != null)
                 {
                     item.dump(ref strInfo);
                 }
             }
             else if ((info.Name == "strUrl") || (info.Name == "strThumb"))
             {
                 string str = info.GetValue(this) as string;
                 if (string.IsNullOrEmpty(str))
                 {
                     strInfo = strInfo + info.Name + "= ";
                 }
                 else
                 {
                     string str2 = strInfo;
                     strInfo = str2 + info.Name + "=" + str.Substring(0, 7) + " ";
                 }
             }
             else
             {
                 object obj2 = strInfo;
                 strInfo = string.Concat(new object[] { obj2, info.Name, "=", info.GetValue(this), " " });
             }
         }
     }
     strInfo = strInfo + "}";
 }
Ejemplo n.º 2
0
 public bool Parse(byte[] bytesXmlData)
 {
     if (bytesXmlData != null)
     {
         try
         {
             XDocument document = loadXml(bytesXmlData);
             if (document == null)
             {
                 return(false);
             }
             if (document.Root == null)
             {
                 return(false);
             }
             if (document.Root.Name != "TimelineObject")
             {
                 Log.e("TimeLineObject", "error object name=" + document.Root.Name);
                 return(false);
             }
             foreach (XElement element in document.Root.Elements())
             {
                 if (!empty(element))
                 {
                     if (element.Name == "id")
                     {
                         this.nID = (ulong)element;
                     }
                     else if (element.Name == "username")
                     {
                         this.strUsername = (string)element;
                     }
                     else if (element.Name == "createTime")
                     {
                         this.nCreateTime = (uint)element;
                     }
                     else if (element.Name == "private")
                     {
                         this.nPrivate = (int)element;
                     }
                     else if (element.Name == "contentDesc")
                     {
                         this.strContentDesc = (string)element;
                     }
                     else if (element.Name == "ContentObject")
                     {
                         this.content = new ContentObject(element);
                     }
                     else if (element.Name == "location")
                     {
                         this.lbs = new TloLocation(element);
                     }
                     else if (element.Name == "appInfo")
                     {
                         if (!TloXmlItem.IsEmpty(element))
                         {
                             this.appInfo = new TloAppInfo(element);
                         }
                     }
                     else if (element.Name == "publicUserName")
                     {
                         this.strPublicUserName = (string)element;
                     }
                     else
                     {
                         bool flag1 = element.Name == "sourceUserName";
                     }
                 }
             }
             return(true);
         }
         catch (Exception exception)
         {
             Log.e("TimeLineObject", "xml parse error=" + exception);
         }
     }
     return(false);
 }