本文整理汇总了C#中System.Xml.XmlTextReader.ReadContentAsDouble方法的典型用法代码示例。如果您正苦于以下问题:C# XmlTextReader.ReadContentAsDouble方法的具体用法?C# XmlTextReader.ReadContentAsDouble怎么用?C# XmlTextReader.ReadContentAsDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了XmlTextReader.ReadContentAsDouble方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportFiles
private void ImportFiles(FileInfo f)
{
IndexList = new List<int>();
GPXList = new List<GPXDatenSpeicher>();
XmlTextReader xr = new XmlTextReader(f.FullName);
#region Reader
while (xr.Read())
{
if (Zustand == GPX_Zustände.START)
{
if (xr.NodeType == XmlNodeType.Element && xr.Name == "gpx")
{
Zustand = GPX_Zustände.GPX;
}// ende if (xr.NodeType == XmlNodeType.Element && xr.Name == "gpx")
}//ende if (Zustand == GPX_Zustände.START)
else if (Zustand == GPX_Zustände.GPX)
{
if (xr.NodeType == XmlNodeType.Element && xr.Name == "trk")
{
Zustand = GPX_Zustände.GPX_TRK;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "wpt")
{
if (xr.HasAttributes)
{
while (xr.MoveToNextAttribute())
{
if (xr.Name == "lat") akt_lat = xr.ReadContentAsDouble();
if (xr.Name == "lon") akt_lon = xr.ReadContentAsDouble();
}
}
Zustand = GPX_Zustände.GPX_WPT;
}// ende if (xr.NodeType == XmlNodeType.Element && xr.Name == "wpt")
} // ende else if (Zustand == GPX_Zustände.GPX)
else if (Zustand == GPX_Zustände.GPX_TRK)
{
if (xr.NodeType == XmlNodeType.Element && xr.Name == "name")
{
Zustand = GPX_Zustände.GPX_TRK_NAME;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "trkseg")
{
Zustand = GPX_Zustände.GPX_TRK_TRKSEG;
}
if (xr.NodeType == XmlNodeType.EndElement && xr.Name == "trk")
{
Zustand = GPX_Zustände.GPX;
}
}// ende else if (Zustand == GPX_Zustände.GPX_TRK)
else if (Zustand == GPX_Zustände.GPX_WPT)
{
if (xr.NodeType == XmlNodeType.Element && xr.Name == "ele")
{
Zustand = GPX_Zustände.GPX_WPT_ELE;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "name")
{
Zustand = GPX_Zustände.GPX_WPT_NAME;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "cmt")
{
Zustand = GPX_Zustände.GPX_WPT_CMT;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "desc")
{
Zustand = GPX_Zustände.GPX_WPT_DESC;
}
if (xr.NodeType == XmlNodeType.Element && xr.Name == "sym")
{
Zustand = GPX_Zustände.GPX_WPT_SYM;
}
if (xr.NodeType == XmlNodeType.EndElement && xr.Name == "wpt")
{
SQL = "SELECT count(*) FROM tbl_Wegpunkt WHERE Längengrad like '" + akt_lon + "' AND Breitengrad like '" + akt_lat + "' AND Ele like '" + akt_ele + "' AND Name like '" + name + "' AND CMT like '" + cmt + "' AND DESC_Feld like '" + desc + "' AND sym like '" + sym + "'";
m.cmd = new OleDbCommand(SQL, m.con);
m.dr = m.cmd.ExecuteReader();
m.dr.Read();
if ((int)m.dr[0] == 0)
{
SQL = "INSERT INTO tbl_Wegpunkt (Längengrad,Breitengrad,Ele,Name,CMT,DESC_Feld,sym) VALUES ('" + akt_lon + "','" + akt_lat + "','" + akt_ele + "','" + name + "','" + cmt + "','" + desc + "','" + sym + "')";
}
m.cmd = new OleDbCommand(SQL, m.con);
m.cmd.ExecuteNonQuery();
Zustand = GPX_Zustände.GPX;
}
}
else if (Zustand == GPX_Zustände.GPX_WPT_ELE)
{
strBuf = xr.ReadContentAsString().Replace('.', ',');
akt_ele = double.Parse(strBuf);
if (xr.NodeType == XmlNodeType.EndElement && xr.Name == "ele")
{
Zustand = GPX_Zustände.GPX_WPT;
}
}
else if (Zustand == GPX_Zustände.GPX_WPT_NAME)
//.........这里部分代码省略.........
示例2: ReadXMLProgram
//.........这里部分代码省略.........
break;
//case Enumerators.ProgramSelect.CustomProgram:
// reader = new XmlTextReader(RootDiretory + "\\Programs\\ProgramRehabBilateral.xml");
// lblTitle.Text = "Program: Rehabilitation - Bilateral (9 Stages)";
// lblDescription.Text = "Program Time: 15 min";
// CurrentPowerIndex = GlobalVariables.RehabProgramPB;
// break;
default:
break;
}
while (reader.Read())
{
if (reader.ReadToFollowing("StageIndex"))
{
VO2MaxStage newVO2MaxStage = new VO2MaxStage();
reader.Read();
newVO2MaxStage.StageIndex = reader.ReadContentAsInt();
reader.ReadToFollowing("StageNumber");
reader.Read();
newVO2MaxStage.StageNumber = reader.ReadContentAsInt();
reader.ReadToFollowing("StageName");
reader.Read();
newVO2MaxStage.StageName = reader.ReadContentAsString();
reader.ReadToFollowing("StageDuration");
reader.Read();
newVO2MaxStage.StageTimeRemaining = new TimeSpan(0, reader.ReadContentAsInt(), 0);
reader.ReadToFollowing("Sets");
reader.Read();
while (reader.Read())
{
if (reader.Name == "Set")
{
VO2MaxSet newVO2MaxSet = new VO2MaxSet();
reader.ReadToFollowing("SetIndex");
reader.Read();
newVO2MaxSet.SetIndex = reader.ReadContentAsInt();
reader.ReadToFollowing("Number");
reader.Read();
newVO2MaxSet.SetNumber = reader.ReadContentAsInt();
reader.ReadToFollowing("Duration");
reader.Read();
double SetTime = reader.ReadContentAsDouble();
if (SetTime < 1)
{
SetTime = SetTime * 60;
newVO2MaxSet.TimeRemaining = new TimeSpan(0, 0, Convert.ToInt32(SetTime));
}
else
{
newVO2MaxSet.TimeRemaining = new TimeSpan(0, Convert.ToInt32(SetTime), 0);
}
reader.ReadToFollowing("Direction");
reader.Read();
newVO2MaxSet.Direction = reader.ReadContentAsString();
reader.ReadToFollowing("DirectionFlag");
reader.Read();
int DirectionVariable = reader.ReadContentAsInt();
if (DirectionVariable == 1)
newVO2MaxSet.SelectedDirection = Enumerators.Direction.Forward;
else if (DirectionVariable == -1)
newVO2MaxSet.SelectedDirection = Enumerators.Direction.Backward;
reader.ReadToFollowing("Contraction");
reader.Read();
newVO2MaxSet.Contraction = reader.ReadContentAsString();
reader.ReadToFollowing("Legs");
reader.Read();
newVO2MaxSet.Legs = reader.ReadContentAsString();
reader.ReadToFollowing("Position");
reader.Read();
newVO2MaxSet.Position = reader.ReadContentAsString();
reader.ReadToFollowing("RestDuration");
reader.Read();
newVO2MaxSet.RestTimeRemaining = new TimeSpan(0, reader.ReadContentAsInt(), 0);
reader.ReadToFollowing("Instructions");
reader.Read();
newVO2MaxSet.Instructions = reader.ReadContentAsString();
newVO2MaxStage.VO2MaxSetCollection.Add(newVO2MaxSet);
reader.Read(); //Read White Space
reader.Read(); //Read Set
reader.Read(); //Read White Space
}
else
{
break;
}
}
CurrentVO2MaxProgram.VO2MaxStageCollection.Add(newVO2MaxStage);
}
}
CurrentVO2MaxProgram.ProgramTime = new TimeSpan(0, 0, 0);
foreach (VO2MaxStage stage in CurrentVO2MaxProgram.VO2MaxStageCollection)
{
CurrentVO2MaxProgram.ProgramTime = CurrentVO2MaxProgram.ProgramTime + stage.StageTimeRemaining;
}
}