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