You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.4 KiB
C#

1 month ago
using System.ComponentModel;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace GeoSigma.SigmaDrawerStyle
{
/// <summary>
/// 文件导入,其它信息
/// </summary>
public class OtherInfoProperty : IPropertyFileImport
{
private IRectangularCSGridPropertyChange iChange;
/// <summary>
/// Initializes a new instance of the <see cref="OtherInfoProperty"/> class.
/// </summary>
public OtherInfoProperty()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="OtherInfoProperty"/> class.
/// </summary>
/// <param name="iChange">iChange</param>
public OtherInfoProperty(IRectangularCSGridPropertyChange iChange)
{
}
[Browsable(false)]
public string ColumnLength
{
get;
set;
}
[Category("\t其他"), DisplayName("\t\t\t\t\t层位")]
public string Horizon
{
get;
set;
}
[Category("\t其他"), DisplayName("\t\t\t\t\t\t类型")]
public PointInfos PointType
{
get;
set;
}
public enum PointInfos
{
,
,
}
/// <summary>
/// 输出Xml数据
/// </summary>
/// <returns>string</returns>
public string SerialXml()
{
string strData = string.Empty;
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.IndentChars = " ";
settings.NewLineChars = "\r\n";
settings.Encoding = Encoding.Default;
// 去除xml声明
settings.OmitXmlDeclaration = true;
System.IO.MemoryStream mem = new MemoryStream();
using (XmlWriter writer = XmlWriter.Create(mem, settings))
{
//去除默认命名空间xmlns:xsd和xmlns:xsi
XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add(string.Empty, string.Empty);
XmlSerializer formatter = new XmlSerializer(this.GetType());
formatter.Serialize(writer, this, ns);
}
return Encoding.Default.GetString(mem.ToArray());
}
}
}