Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ReadString() [2/2]

string System.Xml.XmlDictionaryReader.ReadString ( int maxStringContentLength)
inlineprotectedinherited

Definition at line 836 of file XmlDictionaryReader.cs.

837 {
838 if (ReadState != ReadState.Interactive)
839 {
840 return string.Empty;
841 }
842 if (NodeType != XmlNodeType.Element)
843 {
845 }
846 if (NodeType == XmlNodeType.Element)
847 {
848 if (IsEmptyElement)
849 {
850 return string.Empty;
851 }
852 if (!Read())
853 {
855 }
856 if (NodeType == XmlNodeType.EndElement)
857 {
858 return string.Empty;
859 }
860 }
862 string text = string.Empty;
863 while (IsTextNode(NodeType))
864 {
865 string value = Value;
866 if (text.Length == 0)
867 {
868 text = value;
869 }
870 else
871 {
872 if (stringBuilder == null)
873 {
875 }
876 if (stringBuilder.Length > maxStringContentLength - value.Length)
877 {
878 XmlExceptionHelper.ThrowMaxStringContentLengthExceeded(this, maxStringContentLength);
879 }
880 stringBuilder.Append(value);
881 }
882 if (!Read())
883 {
885 }
886 }
887 if (stringBuilder != null)
888 {
889 text = stringBuilder.ToString();
890 }
891 if (text.Length > maxStringContentLength)
892 {
893 XmlExceptionHelper.ThrowMaxStringContentLengthExceeded(this, maxStringContentLength);
894 }
895 return text;
896 }
static string XmlInvalidOperation
Definition SR.cs:434
Definition SR.cs:7
bool IsTextNode(XmlNodeType nodeType)
XmlNodeType NodeType
Definition XmlReader.cs:62

References System.Xml.Dictionary, System.Xml.XmlReader.IsEmptyElement, System.Xml.XmlDictionaryReader.IsTextNode(), System.Xml.XmlReader.MoveToElement(), System.Xml.XmlReader.NodeType, System.Xml.XmlReader.Read(), System.text, System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(), System.Xml.XmlExceptionHelper.ThrowMaxStringContentLengthExceeded(), System.value, System.Xml.XmlReader.Value, and System.SR.XmlInvalidOperation.