protected string SerializeProperties(string globalLang, string globalBaseUri, bool globalAddImageQuery) { globalLang = (globalLang != null) ? globalLang : String.Empty; globalBaseUri = String.IsNullOrWhiteSpace(globalBaseUri) ? null : globalBaseUri; StringBuilder builder = new StringBuilder(String.Empty); for (int i = 0; i < m_Images.Length; i++) { if (!String.IsNullOrEmpty(m_Images[i].Src)) { string escapedSrc = Util.HttpEncode(m_Images[i].Src); if (!String.IsNullOrWhiteSpace(m_Images[i].Alt)) { string escapedAlt = Util.HttpEncode(m_Images[i].Alt); if (m_Images[i].AddImageQueryNullable == null || m_Images[i].AddImageQueryNullable == globalAddImageQuery) { builder.AppendFormat("<image id='{0}' src='{1}' alt='{2}'/>", i + 1, escapedSrc, escapedAlt); } else { builder.AppendFormat("<image addImageQuery='{0}' id='{1}' src='{2}' alt='{3}'/>", m_Images[i].AddImageQuery.ToString().ToLowerInvariant(), i + 1, escapedSrc, escapedAlt); } } else { if (m_Images[i].AddImageQueryNullable == null || m_Images[i].AddImageQueryNullable == globalAddImageQuery) { builder.AppendFormat("<image id='{0}' src='{1}'/>", i + 1, escapedSrc); } else { builder.AppendFormat("<image addImageQuery='{0}' id='{1}' src='{2}'/>", m_Images[i].AddImageQuery.ToString().ToLowerInvariant(), i + 1, escapedSrc); } } } } for (int i = 0; i < m_TextFields.Length; i++) { if (!String.IsNullOrWhiteSpace(m_TextFields[i].Text)) { string escapedValue = Util.HttpEncode(m_TextFields[i].Text); if (!String.IsNullOrWhiteSpace(m_TextFields[i].Lang) && !m_TextFields[i].Lang.Equals(globalLang)) { string escapedLang = Util.HttpEncode(m_TextFields[i].Lang); builder.AppendFormat("<text id='{0}' lang='{1}'>{2}</text>", i + 1, escapedLang, escapedValue); } else { builder.AppendFormat("<text id='{0}'>{1}</text>", i + 1, escapedValue); } } } return(builder.ToString()); }
protected string SerializeProperties(string globalLang, string globalBaseUri, bool globalAddImageQuery) { globalLang = (globalLang != null) ? globalLang : string.Empty; globalBaseUri = string.IsNullOrWhiteSpace(globalBaseUri) ? null : globalBaseUri; StringBuilder builder = new StringBuilder(string.Empty); for (int i = 0; i < this.m_Images.Length; i++) { string str; string str2; if (!string.IsNullOrEmpty(this.m_Images[i].Src)) { str = Util.HttpEncode(this.m_Images[i].Src); if (string.IsNullOrWhiteSpace(this.m_Images[i].Alt)) { goto Label_0143; } str2 = Util.HttpEncode(this.m_Images[i].Alt); if (this.m_Images[i].AddImageQueryNullable.HasValue) { bool?addImageQueryNullable = this.m_Images[i].AddImageQueryNullable; bool flag = globalAddImageQuery; if (!((addImageQueryNullable.GetValueOrDefault() == flag) && addImageQueryNullable.HasValue)) { goto Label_00F3; } } builder.AppendFormat("<image id='{0}' src='{1}' alt='{2}'/>", (object[])new object[] { ((int)(i + 1)), str, str2 }); } continue; Label_00F3 :; builder.AppendFormat("<image addImageQuery='{0}' id='{1}' src='{2}' alt='{3}'/>", (object[])new object[] { this.m_Images[i].AddImageQuery.ToString().ToLowerInvariant(), ((int)(i + 1)), str, str2 }); continue; Label_0143: if (this.m_Images[i].AddImageQueryNullable.HasValue) { bool?nullable4 = this.m_Images[i].AddImageQueryNullable; bool flag3 = globalAddImageQuery; if (!((nullable4.GetValueOrDefault() == flag3) && nullable4.HasValue)) { goto Label_01AD; } } builder.AppendFormat("<image id='{0}' src='{1}'/>", (object[])new object[] { ((int)(i + 1)), str }); continue; Label_01AD :; builder.AppendFormat("<image addImageQuery='{0}' id='{1}' src='{2}'/>", (object[])new object[] { this.m_Images[i].AddImageQuery.ToString().ToLowerInvariant(), ((int)(i + 1)), str }); } for (int j = 0; j < this.m_TextFields.Length; j++) { if (!string.IsNullOrWhiteSpace(this.m_TextFields[j].Text)) { string str3 = Util.HttpEncode(this.m_TextFields[j].Text); if (!string.IsNullOrWhiteSpace(this.m_TextFields[j].Lang) && !this.m_TextFields[j].Lang.Equals(globalLang)) { string str4 = Util.HttpEncode(this.m_TextFields[j].Lang); builder.AppendFormat("<text id='{0}' lang='{1}'>{2}</text>", (object[])new object[] { ((int)(j + 1)), str4, str3 }); } else { builder.AppendFormat("<text id='{0}'>{1}</text>", (object[])new object[] { ((int)(j + 1)), str3 }); } } } return(builder.ToString()); }