本文整理汇总了C#中IWriter.BeginBlock方法的典型用法代码示例。如果您正苦于以下问题:C# IWriter.BeginBlock方法的具体用法?C# IWriter.BeginBlock怎么用?C# IWriter.BeginBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWriter
的用法示例。
在下文中一共展示了IWriter.BeginBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseFile
public void ParseFile(string p_inputFileName, IWriter p_writer)
{
XmlDocument a_doc = new XmlDocument();
a_doc.Load(p_inputFileName);
XmlNamespaceManager nsmgr = new XmlNamespaceManager(a_doc.NameTable);
nsmgr.AddNamespace(ms_defaultNamespace, a_doc.DocumentElement.NamespaceURI);
XmlNodeList trackList = a_doc.GetElementsByTagName("trk");
if (trackList.Count > 0)
{
foreach (XmlNode track in trackList)
{
string trackName;
if (track.SelectNodes(GetFullName(ms_gpx_name), nsmgr).Count != 0)
trackName = track.SelectNodes(GetFullName(ms_gpx_name), nsmgr).Item(0).InnerText;
else
trackName = Guid.NewGuid().ToString();
p_writer.BeginBlock(trackName);
//parse points
XmlNodeList logList = track.SelectNodes(GetFullName("trkseg"), nsmgr);
foreach (XmlNode log in logList)
{
foreach (XmlNode point in log.ChildNodes)
{
decimal lat = Decimal.Parse(point.Attributes.GetNamedItem(ms_gpx_lat).Value, Utils.ms_formatProviderEn);
decimal lng = Decimal.Parse(point.Attributes.GetNamedItem(ms_gpx_lon).Value, Utils.ms_formatProviderEn);
XmlNode elevationtNode = point.SelectSingleNode(GetFullName(ms_gpx_ele), nsmgr);
int elevation = elevationtNode != null ? Decimal.ToInt32(Decimal.Parse(elevationtNode.InnerText, Utils.ms_formatProviderEn)) : 0;
XmlNode dateTimeNode = point.SelectSingleNode(GetFullName("time"), nsmgr);
DateTime time = dateTimeNode != null ? DateTime.Parse(dateTimeNode.InnerText, Utils.ms_formatProviderEn) : DateTime.MinValue;
p_writer.AddTrackPoint(time.ToUniversalTime(), lat, lng, elevation);
}
}
//parse waypoints
ProcessWaypoints(a_doc.GetElementsByTagName(ms_gpx_wpt), p_writer);
}
}
else
{
//parse waypoints
XmlNodeList markList = a_doc.GetElementsByTagName(ms_gpx_wpt);
if (markList.Count > 0)
{
p_writer.BeginBlock(Guid.NewGuid().ToString());
ProcessWaypoints(markList, p_writer);
}
}
}
示例2: ParseFile
public void ParseFile(string p_inputFileName, IWriter p_writer)
{
p_writer.BeginBlock("firstAndOne");
System.IO.StreamReader a_stream = System.IO.File.OpenText(p_inputFileName);
String line;
while ((line = a_stream.ReadLine()) != null)
{
if (line != String.Empty)
{
decimal lat, lng;
int alt;
DateTime time;
if (!ParseLineOzi(line, out lat, out lng, out alt, out time))
continue;
else
p_writer.AddTrackPoint(time, lat, lng, alt);
}
}
}