本文整理汇总了C#中XmlReader.ReadElementContentAsInt方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.ReadElementContentAsInt方法的具体用法?C# XmlReader.ReadElementContentAsInt怎么用?C# XmlReader.ReadElementContentAsInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlReader
的用法示例。
在下文中一共展示了XmlReader.ReadElementContentAsInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseContextSetupReply
public void ParseContextSetupReply(XmlReader reader)
{
// verify node is "context_setup_reply
if (reader.Name == "context_setup_reply")
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "apiversion")
{
csr.apiversion = reader.ReadElementContentAsString();
//UnityEngine.Debug.Log("apiversion=" + csr.apiversion);
}
if (reader.NodeType == XmlNodeType.Element && reader.Name == "setup_request_status")
{
csr.setup_request_status = reader.ReadElementContentAsInt();
//UnityEngine.Debug.Log("setup_request_status=" + csr.setup_request_status);
}
if (reader.NodeType == XmlNodeType.Element && reader.Name == "context_uid")
{
csr.context_uid = reader.ReadElementContentAsString();
#if SHOW_INIT
QuickInfoMsg msg = new QuickInfoMsg();
msg.title = "NLU STATUS";
msg.text = "NLU Initialized : " + CmdTime + " seconds";
msg.timeout = 2.0f;
QuickInfoDialog.GetInstance().PutMessage(msg);
#endif
Initialized = true;
//UnityEngine.Debug.Log("context_uid=" + csr.context_uid);
}
}
}
}
示例2: ParseUtteranceReply
public void ParseUtteranceReply(XmlReader reader)
{
pur = new process_utterance_reply();
// verify node is "context_setup_reply
if (reader.Name == "process_utterance_reply")
{
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "utterance_request_status")
{
pur.utterance_request_status = reader.ReadElementContentAsInt();
#if DEBUG_REPLY
UnityEngine.Debug.Log("utterance status=" + pur.utterance_request_status);
#endif
// report error
if (pur.utterance_request_status < 0 && errorCallback != null)
{
//'utterance_request_status' indicates if utterance process is final or NLU server starts
// 0: OK. the 'match_record' list contains the simulation command(s) for the utterance
// 1: NLU server executes 'clarifying NLU sub-session' (see "SiTEL-SMS API Reqs & Specs" document)
//-1: cannot process utterance
//-2: MLU not ready for utterance processing
//-3: missing utterance text
string error="none";
switch (pur.utterance_request_status)
{
case -1:
error = "error -1: cannot process utterance";
break;
case -2:
error = "error -2: MLU not ready for utterance processing";
break;
case -3:
error = "error -3: missing utterance text";
break;
}
errorCallback(error);
}
}
if (reader.NodeType == XmlNodeType.Element && reader.Name == "match_records")
{
List<sim_command_param> parameters=null;
List<missing_sim_command_param> missing = null;
match_record record = null;
while (reader.Read())
{
#if DEBUG_REPLY
if (reader.NodeType == XmlNodeType.Element)
UnityEngine.Debug.Log("NODE_NAME=" + reader.Name + ", NODE_TYPE=" + reader.NodeType.ToString());
else if (reader.NodeType == XmlNodeType.EndElement)
UnityEngine.Debug.Log("NODE_END=" + reader.Name + ", NODE_TYPE=" + reader.NodeType.ToString());
else
UnityEngine.Debug.Log("NODE_TYPE=" + reader.NodeType.ToString());
#endif
// match START element
if (reader.NodeType == XmlNodeType.Element && reader.Name == "match")
{
if (reader.IsEmptyElement == false)
{
record = new match_record();
if ( reader.MoveToAttribute("index") == false )
UnityEngine.Debug.Log("CAN'T FIND INDEX!");
record.index = reader.ReadContentAsInt();
if ( reader.MoveToAttribute("sim_command") == false )
UnityEngine.Debug.Log("CAN'T FIND SIM_COMMAND!");
record.sim_command = reader.ReadContentAsString();
if ( reader.MoveToAttribute("score") == false )
UnityEngine.Debug.Log("CAN'T FIND SCORE!");
record.score = reader.ReadContentAsFloat();
if ( reader.MoveToAttribute("input") == false )
UnityEngine.Debug.Log("CAN'T FIND INPUT!");
record.input = reader.ReadContentAsString();
#if DEBUG_REPLY
UnityEngine.Debug.Log("START MATCH : sim_command=" + record.sim_command);
#endif
}
}
// match END element
if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "match")
{
if (reader.IsEmptyElement == false)
{
#if DEBUG_REPLY
UnityEngine.Debug.Log("END MATCH");
#endif
pur.match_records.Add(record);
// do callback here, we have a valid match!!
if (utteranceCallback != null)
utteranceCallback(record);
record.Debug();
}
}
// sim command parameters
//.........这里部分代码省略.........
示例3: LoadStatus
protected virtual void LoadStatus (XmlReader reader) {
reader.ReadToFollowing ("Status");
reader.ReadToDescendant ("HP");
HP = reader.ReadElementContentAsInt ();
}