mirror of
https://github.com/reactos/reactos.git
synced 2024-12-29 10:35:28 +00:00
- remove now unneeded files
svn path=/trunk/; revision=33589
This commit is contained in:
parent
4442c49eca
commit
0ac3f1989d
10 changed files with 0 additions and 754 deletions
|
@ -1,333 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Text.RegularExpressions;
|
||||
using HtmlHelp;
|
||||
using HtmlHelp.ChmDecoding;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("api", Help = "!api <apiname>")]
|
||||
public class ApiCommand : Command
|
||||
{
|
||||
private const bool IsVerbose = false;
|
||||
|
||||
private HtmlHelpSystem chm;
|
||||
private string chmPath;
|
||||
private string mainChm;
|
||||
|
||||
public ApiCommand()
|
||||
{
|
||||
Run();
|
||||
}
|
||||
|
||||
private void WriteIfVerbose(MessageContext context,
|
||||
string message)
|
||||
{
|
||||
if (IsVerbose)
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
message);
|
||||
}
|
||||
|
||||
private void Run()
|
||||
{
|
||||
string CHMFilename = Path.Combine(chmPath, mainChm);
|
||||
chm = new HtmlHelpSystem();
|
||||
chm.OpenFile(CHMFilename, null);
|
||||
|
||||
Console.WriteLine(String.Format("Loaded main CHM: {0}",
|
||||
Path.GetFileName(CHMFilename)));
|
||||
foreach (string filename in Directory.GetFiles(chmPath))
|
||||
{
|
||||
if (!Path.GetExtension(filename).ToLower().Equals(".chm"))
|
||||
continue;
|
||||
if (Path.GetFileName(filename).ToLower().Equals(mainChm))
|
||||
continue;
|
||||
|
||||
Console.WriteLine(String.Format("Loading CHM: {0}",
|
||||
Path.GetFileName(filename)));
|
||||
try
|
||||
{
|
||||
chm.MergeFile(filename);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(String.Format("Could not load CHM: {0}. Exception {1}",
|
||||
Path.GetFileName(filename),
|
||||
ex));
|
||||
}
|
||||
}
|
||||
Console.WriteLine(String.Format("Loaded {0} CHMs",
|
||||
chm.FileList.Length));
|
||||
}
|
||||
|
||||
public override void Handle(MessageContext context)
|
||||
{
|
||||
if (parameters.Trim().Equals(String.Empty))
|
||||
DisplayNoKeyword(context);
|
||||
else
|
||||
Search(context,
|
||||
parameters);
|
||||
}
|
||||
|
||||
private bool SearchIndex(MessageContext context,
|
||||
string keyword)
|
||||
{
|
||||
if (chm.HasIndex)
|
||||
{
|
||||
IndexItem item = chm.Index.SearchIndex(keyword,
|
||||
IndexType.KeywordLinks);
|
||||
if (item != null && item.Topics.Count > 0)
|
||||
{
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Keyword {0} found in index",
|
||||
item.KeyWord));
|
||||
IndexTopic indexTopic = item.Topics[0] as IndexTopic;
|
||||
return DisplayResult(context,
|
||||
keyword,
|
||||
indexTopic);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Keyword {0} not found in index",
|
||||
keyword));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private void SearchFullText(MessageContext context,
|
||||
string keyword)
|
||||
{
|
||||
string sort = "Rating ASC";
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Searching fulltext database for {0}",
|
||||
keyword));
|
||||
|
||||
bool partialMatches = false;
|
||||
bool titlesOnly = true;
|
||||
int maxResults = 100;
|
||||
DataTable results = chm.PerformSearch(keyword,
|
||||
maxResults,
|
||||
partialMatches,
|
||||
titlesOnly);
|
||||
WriteIfVerbose(context,
|
||||
String.Format("results.Rows.Count = {0}",
|
||||
results != null ?
|
||||
results.Rows.Count.ToString() : "(none)"));
|
||||
if (results != null && results.Rows.Count > 0)
|
||||
{
|
||||
results.DefaultView.Sort = sort;
|
||||
if (!DisplayResult(context,
|
||||
keyword,
|
||||
results))
|
||||
{
|
||||
DisplayNoResult(context,
|
||||
keyword);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayNoResult(context,
|
||||
keyword);
|
||||
}
|
||||
}
|
||||
|
||||
private void Search(MessageContext context,
|
||||
string keyword)
|
||||
{
|
||||
if (!SearchIndex(context,
|
||||
keyword))
|
||||
SearchFullText(context,
|
||||
keyword);
|
||||
}
|
||||
|
||||
private bool DisplayResult(MessageContext context,
|
||||
string keyword,
|
||||
IndexTopic indexTopic)
|
||||
{
|
||||
keyword = keyword.Trim().ToLower();
|
||||
string url = indexTopic.URL;
|
||||
WriteIfVerbose(context,
|
||||
String.Format("URL from index search {0}",
|
||||
url));
|
||||
string prototype = ExtractPrototype(context,
|
||||
url);
|
||||
if (prototype == null || prototype.Trim().Equals(String.Empty))
|
||||
return false;
|
||||
string formattedPrototype = FormatPrototype(prototype);
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
formattedPrototype);
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool DisplayResult(MessageContext context,
|
||||
string keyword,
|
||||
DataTable results)
|
||||
{
|
||||
keyword = keyword.Trim().ToLower();
|
||||
for (int i = 0; i < results.DefaultView.Count; i++)
|
||||
{
|
||||
DataRowView row = results.DefaultView[i];
|
||||
string title = row["Title"].ToString();
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Examining {0}", title));
|
||||
if (title.Trim().ToLower().Equals(keyword))
|
||||
{
|
||||
string location = row["Location"].ToString();
|
||||
string rating = row["Rating"].ToString();
|
||||
string url = row["Url"].ToString();
|
||||
string prototype = ExtractPrototype(context,
|
||||
url);
|
||||
if (prototype == null || prototype.Trim().Equals(String.Empty))
|
||||
continue;
|
||||
string formattedPrototype = FormatPrototype(prototype);
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
formattedPrototype);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void DisplayNoResult(MessageContext context,
|
||||
string keyword)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
String.Format("I don't know about keyword {0}",
|
||||
keyword));
|
||||
}
|
||||
|
||||
private void DisplayNoKeyword(MessageContext context)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(context,
|
||||
"Please give me a keyword.");
|
||||
}
|
||||
|
||||
private string ReplaceComments(string s)
|
||||
{
|
||||
return Regex.Replace(s, "//(.+)\r\n", "");
|
||||
}
|
||||
|
||||
private string ReplaceLineEndings(string s)
|
||||
{
|
||||
return Regex.Replace(s, "(\r\n)+", " ");
|
||||
}
|
||||
|
||||
private string ReplaceSpaces(string s)
|
||||
{
|
||||
return Regex.Replace(s, @" +", " ");
|
||||
}
|
||||
|
||||
private string ReplaceSpacesBeforeLeftParenthesis(string s)
|
||||
{
|
||||
return Regex.Replace(s, @"\( ", @"(");
|
||||
}
|
||||
|
||||
private string ReplaceSpacesBeforeRightParenthesis(string s)
|
||||
{
|
||||
return Regex.Replace(s, @" \)", @")");
|
||||
}
|
||||
|
||||
private string ReplaceSemicolon(string s)
|
||||
{
|
||||
return Regex.Replace(s, @";", @"");
|
||||
}
|
||||
|
||||
private string FormatPrototype(string prototype)
|
||||
{
|
||||
string s = ReplaceComments(prototype);
|
||||
s = ReplaceLineEndings(s);
|
||||
s = ReplaceSpaces(s);
|
||||
s = ReplaceSpacesBeforeLeftParenthesis(s);
|
||||
s = ReplaceSpacesBeforeRightParenthesis(s);
|
||||
s = ReplaceSemicolon(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
private string ExtractPrototype(MessageContext context,
|
||||
string url)
|
||||
{
|
||||
string page = GetPage(context,
|
||||
url);
|
||||
Match match = Regex.Match(page,
|
||||
"<PRE class=\"?syntax\"?>(.+)</PRE>",
|
||||
RegexOptions.Multiline |
|
||||
RegexOptions.Singleline);
|
||||
if (match.Groups.Count > 1)
|
||||
{
|
||||
string prototype = match.Groups[1].ToString();
|
||||
return StripHtml(StripAfterSlashPre(prototype));
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
private string StripAfterSlashPre(string html)
|
||||
{
|
||||
int index = html.IndexOf("</PRE>");
|
||||
if (index != -1)
|
||||
{
|
||||
return html.Substring(0, index);
|
||||
}
|
||||
else
|
||||
return html;
|
||||
}
|
||||
|
||||
private string StripHtml(string html)
|
||||
{
|
||||
return Regex.Replace(html, @"<(.|\n)*?>", String.Empty);
|
||||
}
|
||||
|
||||
private string GetPage(MessageContext context,
|
||||
string url)
|
||||
{
|
||||
string CHMFileName = "";
|
||||
string topicName = "";
|
||||
string anchor = "";
|
||||
CHMStream.CHMStream baseStream;
|
||||
if (!chm.BaseStream.GetCHMParts(url, ref CHMFileName, ref topicName, ref anchor))
|
||||
{
|
||||
baseStream = chm.BaseStream;
|
||||
CHMFileName = baseStream.CHMFileName;
|
||||
topicName = url;
|
||||
anchor = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
baseStream = GetBaseStreamFromCHMFileName(context,
|
||||
CHMFileName);
|
||||
}
|
||||
|
||||
if ((topicName == "") || (CHMFileName == "") || (baseStream == null))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return baseStream.ExtractTextFile(topicName);
|
||||
}
|
||||
|
||||
private CHMStream.CHMStream GetBaseStreamFromCHMFileName(MessageContext context,
|
||||
string CHMFileName)
|
||||
{
|
||||
foreach (CHMFile file in chm.FileList)
|
||||
{
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Compare: {0} <> {1}",
|
||||
file.ChmFilePath,
|
||||
CHMFileName));
|
||||
if (file.ChmFilePath.ToLower().Equals(CHMFileName.ToLower()))
|
||||
{
|
||||
return file.BaseStream;
|
||||
}
|
||||
}
|
||||
WriteIfVerbose(context,
|
||||
String.Format("Could not find loaded CHM file in list: {0}",
|
||||
CHMFileName));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
public abstract class BugCommand : Command
|
||||
{
|
||||
private string m_BugID = null;
|
||||
|
||||
public BugCommand()
|
||||
{
|
||||
}
|
||||
|
||||
[CommandParameter("id", "The bug ID")]
|
||||
public string BugID
|
||||
{
|
||||
get { return m_BugID; }
|
||||
set { m_BugID = value; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (BugID == null)
|
||||
{
|
||||
Say("Please provide a valid bug number.");
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Say(BugUrl, Int32.Parse(BugID));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Say("{0} is not a valid bug number.", BugID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract string BugUrl { get; }
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("hresult", Help = "!hresult <value>")]
|
||||
public class HResultCommand : XmlLookupCommand
|
||||
{
|
||||
public HResultCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public override string XmlFile
|
||||
{
|
||||
get { return Settings.Default.HResultXml; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (Text.Equals(String.Empty))
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
"Please provide a valid HRESULT value.");
|
||||
return;
|
||||
}
|
||||
|
||||
NumberParser np = new NumberParser();
|
||||
long hresult = np.Parse(Text);
|
||||
if (np.Error)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is not a valid HRESULT value.",
|
||||
Text));
|
||||
return;
|
||||
}
|
||||
|
||||
string description = GetHresultDescription(hresult);
|
||||
if (description != null)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is {1}.",
|
||||
Text,
|
||||
description));
|
||||
}
|
||||
else
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("I don't know about HRESULT {0}.",
|
||||
Text));
|
||||
}
|
||||
}
|
||||
|
||||
public string GetHresultDescription(long hresult)
|
||||
{
|
||||
XmlElement root = base.m_XmlDocument.DocumentElement;
|
||||
XmlNode node = root.SelectSingleNode(String.Format("Hresult[@value='{0}']",
|
||||
hresult.ToString("X8")));
|
||||
if (node != null)
|
||||
{
|
||||
XmlAttribute text = node.Attributes["text"];
|
||||
if (text == null)
|
||||
throw new Exception("Node has no text attribute.");
|
||||
return text.Value;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("ntstatus", Help = "!ntstatus <value>")]
|
||||
public class NtStatusCommand : XmlLookupCommand
|
||||
{
|
||||
public NtStatusCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public override string XmlFile
|
||||
{
|
||||
get { return Settings.Default.NtStatusXml; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (Text.Equals(String.Empty))
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
"Please provide a valid NTSTATUS value.");
|
||||
return;
|
||||
}
|
||||
|
||||
NumberParser np = new NumberParser();
|
||||
long ntstatus = np.Parse(Text);
|
||||
if (np.Error)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is not a valid NTSTATUS value.",
|
||||
Text));
|
||||
return;
|
||||
}
|
||||
|
||||
string description = GetNtstatusDescription(ntstatus);
|
||||
if (description != null)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is {1}.",
|
||||
Text,
|
||||
description));
|
||||
}
|
||||
else
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("I don't know about NTSTATUS {0}.",
|
||||
Text));
|
||||
}
|
||||
}
|
||||
|
||||
public string GetNtstatusDescription(long ntstatus)
|
||||
{
|
||||
XmlElement root = base.m_XmlDocument.DocumentElement;
|
||||
XmlNode node = root.SelectSingleNode(String.Format("Ntstatus[@value='{0}']",
|
||||
ntstatus.ToString("X8")));
|
||||
if (node != null)
|
||||
{
|
||||
XmlAttribute text = node.Attributes["text"];
|
||||
if (text == null)
|
||||
throw new Exception("Node has no text attribute.");
|
||||
return text.Value;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("rosbug", Help = "!rosbug <number>")]
|
||||
class ReactOSBugUrl : BugCommand
|
||||
{
|
||||
public ReactOSBugUrl()
|
||||
{
|
||||
}
|
||||
|
||||
protected override string BugUrl
|
||||
{
|
||||
get { return "http://www.reactos.org/bugzilla/show_bug.cgi?id={0}"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("sambabug", Help = "!sambabug <number>")]
|
||||
class SambaBugUrl : BugCommand
|
||||
{
|
||||
public SambaBugUrl()
|
||||
{
|
||||
}
|
||||
|
||||
protected override string BugUrl
|
||||
{
|
||||
get { return "https://bugzilla.samba.org/show_bug.cgi?id={0}"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("svn", Help = "!svn")]
|
||||
public class SvnCommand : Command
|
||||
{
|
||||
private string m_SvnRoot;
|
||||
|
||||
public SvnCommand()
|
||||
{
|
||||
m_SvnRoot = Settings.Default.SVNRoot;
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
Say("svn co {0}", m_SvnRoot);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("winebug", Help = "!winebug <number>")]
|
||||
class WineBugUrl : BugCommand
|
||||
{
|
||||
public WineBugUrl()
|
||||
{
|
||||
}
|
||||
|
||||
protected override string BugUrl
|
||||
{
|
||||
get { return "http://bugs.winehq.org/show_bug.cgi?id={0}"; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("winerror", Help = "!winerror <value>")]
|
||||
public class WinErrorCommand : XmlLookupCommand
|
||||
{
|
||||
public WinErrorCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public override string XmlFile
|
||||
{
|
||||
get { return Settings.Default.WinErrorXml; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (Text.Equals(String.Empty))
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
"Please provide a valid System Error Code value.");
|
||||
return;
|
||||
}
|
||||
|
||||
NumberParser np = new NumberParser();
|
||||
long winerror = np.Parse(Text);
|
||||
if (np.Error)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is not a valid System Error Code value.",
|
||||
Text));
|
||||
return;
|
||||
}
|
||||
|
||||
string description = GetWinerrorDescription(winerror);
|
||||
if (description != null)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is {1}.",
|
||||
Text,
|
||||
description));
|
||||
}
|
||||
else
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("I don't know about System Error Code {0}.",
|
||||
Text));
|
||||
}
|
||||
}
|
||||
|
||||
public string GetWinerrorDescription(long winerror)
|
||||
{
|
||||
XmlElement root = base.m_XmlDocument.DocumentElement;
|
||||
XmlNode node = root.SelectSingleNode(String.Format("Winerror[@value='{0}']",
|
||||
Text));
|
||||
if (node != null)
|
||||
{
|
||||
XmlAttribute text = node.Attributes["text"];
|
||||
if (text == null)
|
||||
throw new Exception("Node has no text attribute.");
|
||||
return text.Value;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
using System;
|
||||
using System.Xml;
|
||||
|
||||
namespace TechBot.Library
|
||||
{
|
||||
[Command("wm" , Help = "!wm <value> or !wm <name>")]
|
||||
public class WMCommand : XmlCommand
|
||||
{
|
||||
private string m_WMText = null;
|
||||
|
||||
public WMCommand()
|
||||
{
|
||||
}
|
||||
|
||||
public override string XmlFile
|
||||
{
|
||||
get { return Settings.Default.WMXml; }
|
||||
}
|
||||
|
||||
[CommandParameter("wm", "The windows message to check")]
|
||||
public string WMText
|
||||
{
|
||||
get { return m_WMText; }
|
||||
set { m_WMText = value; }
|
||||
}
|
||||
|
||||
public override void ExecuteCommand()
|
||||
{
|
||||
if (WMText.Equals(String.Empty))
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
"Please provide a valid window message value or name.");
|
||||
return;
|
||||
}
|
||||
|
||||
NumberParser np = new NumberParser();
|
||||
long wm = np.Parse(WMText);
|
||||
string output;
|
||||
if (np.Error)
|
||||
{
|
||||
// Assume "!wm <name>" form.
|
||||
output = GetWmNumber(WMText);
|
||||
}
|
||||
else
|
||||
{
|
||||
output = GetWmDescription(wm);
|
||||
}
|
||||
|
||||
if (output != null)
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("{0} is {1}.",
|
||||
WMText,
|
||||
output));
|
||||
}
|
||||
else
|
||||
{
|
||||
TechBot.ServiceOutput.WriteLine(Context,
|
||||
String.Format("I don't know about window message {0}.",
|
||||
WMText));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetWmDescription(long wm)
|
||||
{
|
||||
XmlElement root = base.m_XmlDocument.DocumentElement;
|
||||
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@value='{0}']",
|
||||
wm));
|
||||
if (node != null)
|
||||
{
|
||||
XmlAttribute text = node.Attributes["text"];
|
||||
if (text == null)
|
||||
throw new Exception("Node has no text attribute.");
|
||||
return text.Value;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
private string GetWmNumber(string wmName)
|
||||
{
|
||||
XmlElement root = base.m_XmlDocument.DocumentElement;
|
||||
XmlNode node = root.SelectSingleNode(String.Format("WindowMessage[@text='{0}']",
|
||||
wmName));
|
||||
if (node != null)
|
||||
{
|
||||
XmlAttribute value = node.Attributes["value"];
|
||||
if (value == null)
|
||||
throw new Exception("Node has no value attribute.");
|
||||
return value.Value;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue