Пример #1
0
		internal void WriteXml(XmlHelper writer)
		{
			if (mKind == ConverterKind.None && mTypeName == string.Empty) return;
			
			writer.mWriter.WriteStartElement("Converter");
			
			writer.WriteAttribute("Kind", Kind.ToString(), "None");
			writer.WriteAttribute("TypeName", mTypeName.ToString(), string.Empty);

			writer.WriteAttribute("Arg1", Arg1, string.Empty);
			writer.WriteAttribute("Arg2", Arg2, string.Empty);
			writer.WriteAttribute("Arg3", Arg3, string.Empty);
			
			writer.mWriter.WriteEndElement();

		}
 internal abstract void WriteHeaderAttributes(XmlHelper writer);
 internal abstract void WriteExtraElements(XmlHelper writer);
        internal void SaveToXml(XmlHelper writer)
        {
            writer.mWriter.WriteStartElement("Field");
            writer.mWriter.WriteStartAttribute("Name", "");
            writer.mWriter.WriteString(mFieldName);
            writer.mWriter.WriteEndAttribute();
            writer.mWriter.WriteStartAttribute("Type", "");
            writer.mWriter.WriteString(mFieldType);
            writer.mWriter.WriteEndAttribute();
            WriteHeaderAttributes(writer);

            Converter.WriteXml(writer);

            writer.WriteElement("Visibility", this.Visibility.ToString(), "Public");
            writer.WriteElement("FieldIgnored", this.FieldIgnored);
            writer.WriteElement("FieldOptional", this.FieldOptional);
            writer.WriteElement("FieldInNewLine", this.FieldInNewLine);
            writer.WriteElement("TrimChars", this.TrimChars, " \t");
            writer.WriteElement("TrimMode", this.TrimMode.ToString(), "None");

            if (FieldNullValue != null)
            {
                writer.mWriter.WriteStartElement("FieldNullValue");
                writer.mWriter.WriteStartAttribute("Type", "");
                writer.mWriter.WriteString(ClassBuilder.TypeToString(mFieldNullValue.GetType()));
                writer.mWriter.WriteEndAttribute();

                writer.mWriter.WriteString(mFieldNullValue.ToString());

                writer.mWriter.WriteEndElement();
            }

            WriteExtraElements(writer);
            writer.mWriter.WriteEndElement();
        }
 internal override void WriteHeaderElement(XmlHelper writer)
 {
     writer.mWriter.WriteStartElement("FixedLengthClass");
     writer.mWriter.WriteStartAttribute("FixedMode", "");
     writer.mWriter.WriteString(mFixedMode.ToString());
     writer.mWriter.WriteEndAttribute();
 }
 internal override void WriteExtraElements(XmlHelper writer)
 {
 }
Пример #7
0
 internal override void WriteHeaderElement(XmlHelper writer)
 {
     writer.mWriter.WriteStartElement("DelimitedClass");
     writer.mWriter.WriteStartAttribute("Delimiter", "");
     writer.mWriter.WriteString(this.Delimiter);
     writer.mWriter.WriteEndAttribute();
 }
		internal override void WriteExtraElements(XmlHelper writer)
		{
			writer.WriteElement("FieldQuoted", this.FieldQuoted);
			writer.WriteElement("QuoteChar", this.QuoteChar.ToString(), "\"");
			writer.WriteElement("QuoteMode", this.QuoteMode.ToString(), "OptionalForRead");
			writer.WriteElement("QuoteMultiline", this.QuoteMultiline.ToString(), "AllowForRead");
		}
		internal override void WriteHeaderAttributes(XmlHelper writer)
		{
		}
 internal override void WriteExtraElements(XmlHelper writer)
 {
     writer.WriteElement("AlignMode", this.AlignMode.ToString(), "Left");
     writer.WriteElement("AlignChar", this.AlignChar.ToString(), " ");
 }
 internal override void WriteHeaderAttributes(XmlHelper writer)
 {
     writer.mWriter.WriteStartAttribute("Length", "");
     writer.mWriter.WriteString(mFieldLength.ToString());
     writer.mWriter.WriteEndAttribute();
 }
Пример #12
0
		internal abstract void WriteHeaderElement(XmlHelper writer);
Пример #13
0
		/// <summary>
		/// Creates a custom serialization of the current ClassBuilder
		/// </summary>
		/// <param name="filename">A file name to write to.</param>
		public void SaveToXml(string filename)
		{
			XmlHelper writer = new XmlHelper();
			
			writer.BeginWriteFile(filename);
			
			WriteHeaderElement(writer);
			
			writer.WriteElement("ClassName", ClassName);
			writer.WriteElement("Namespace", this.Namespace, string.Empty);

            writer.WriteElement("SealedClass", this.SealedClass);
            writer.WriteElement("Visibility", this.Visibility.ToString(), "Public");

            writer.WriteElement("IgnoreEmptyLines", this.IgnoreEmptyLines);
            writer.WriteElement("IgnoreFirstLines", this.IgnoreFirstLines.ToString(), "0");
            writer.WriteElement("IgnoreLastLines", this.IgnoreLastLines.ToString(), "0");

            writer.WriteElement("CommentMarker", this.IgnoreCommentedLines.CommentMarker, string.Empty);
            writer.WriteElement("CommentInAnyPlace", this.IgnoreCommentedLines.InAnyPlace.ToString().ToLower(), true.ToString().ToLower());

            writer.WriteElement("RecordCondition", this.RecordCondition.Condition.ToString(), "None");
            writer.WriteElement("RecordConditionSelector", this.RecordCondition.Selector, string.Empty);

			WriteExtraElements(writer);

			writer.mWriter.WriteStartElement("Fields");
			
			for(int i = 0; i < mFields.Count; i++)
				((FieldBuilder) mFields[i]).SaveToXml(writer);
			
			writer.mWriter.WriteEndElement();
			
			writer.mWriter.WriteEndElement();
			writer.EndWrite();
		}