修复转义符号引起的bug
This commit is contained in:
parent
3dcbe4a0eb
commit
7826b3a3f4
@ -4,56 +4,65 @@ using System.IO;
|
||||
|
||||
namespace IDTF.Net
|
||||
{
|
||||
// References:
|
||||
// http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/export/_IdtfExporter.java?revision=HEAD&view=markup
|
||||
// http://www2.iaas.msu.ru/tmp/u3d/
|
||||
// References:
|
||||
// http://jmol.svn.sourceforge.net/viewvc/jmol/trunk/Jmol/src/org/jmol/export/_IdtfExporter.java?revision=HEAD&view=markup
|
||||
// http://www2.iaas.msu.ru/tmp/u3d/
|
||||
|
||||
public abstract class Node
|
||||
{
|
||||
public Node()
|
||||
{
|
||||
this.MetaData = new MetaData();
|
||||
}
|
||||
public abstract class Node
|
||||
{
|
||||
public Node()
|
||||
{
|
||||
this.MetaData = new MetaData();
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
set
|
||||
{
|
||||
name = value.Replace("\"","\\\"");
|
||||
}
|
||||
}
|
||||
|
||||
public NodeType Type { get; protected set; }
|
||||
public NodeType Type { get; protected set; }
|
||||
|
||||
private List<Parent> _parents;
|
||||
public List<Parent> Parents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_parents == null) { _parents = new List<Parent>(); }
|
||||
return _parents;
|
||||
}
|
||||
private List<Parent> _parents;
|
||||
private string name;
|
||||
|
||||
set
|
||||
{
|
||||
_parents = value;
|
||||
}
|
||||
}
|
||||
public List<Parent> Parents
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_parents == null) { _parents = new List<Parent>(); }
|
||||
return _parents;
|
||||
}
|
||||
|
||||
public MetaData MetaData { get; private set; }
|
||||
set
|
||||
{
|
||||
_parents = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected void WriteCommonOutputWithoutMetaData(StreamWriter toStream)
|
||||
{
|
||||
toStream.WriteLine(String.Format("\tNODE_NAME \"{0}\"", this.Name));
|
||||
if (_parents != null)
|
||||
{
|
||||
ListExtensions.ExportParentListToStream(_parents, toStream);
|
||||
}
|
||||
}
|
||||
public MetaData MetaData { get; private set; }
|
||||
|
||||
protected void WriteMetaData(StreamWriter toStream)
|
||||
{
|
||||
this.MetaData.WriteOutput(toStream);
|
||||
}
|
||||
protected void WriteCommonOutputWithoutMetaData(StreamWriter toStream)
|
||||
{
|
||||
toStream.WriteLine(String.Format("\tNODE_NAME \"{0}\"", this.Name));
|
||||
if (_parents != null)
|
||||
{
|
||||
ListExtensions.ExportParentListToStream(_parents, toStream);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
protected void WriteMetaData(StreamWriter toStream)
|
||||
{
|
||||
this.MetaData.WriteOutput(toStream);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Group : Node
|
||||
public class Group : Node
|
||||
{
|
||||
public Group() : base()
|
||||
{
|
||||
|
@ -24,7 +24,16 @@ namespace IDTF.Net
|
||||
|
||||
public abstract class Resource
|
||||
{
|
||||
public string Name { get; set; }
|
||||
private string name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => name;
|
||||
set
|
||||
{
|
||||
name = value.Replace("\"", "\\\"");
|
||||
}
|
||||
}
|
||||
public abstract ResourceListType ResourceType { get; }
|
||||
public abstract void Export(StreamWriter toStream);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user