本文整理汇总了C#中System.Xml.XmlTextReader.ReadToFollowing方法的典型用法代码示例。如果您正苦于以下问题:C# System.Xml.XmlTextReader.ReadToFollowing方法的具体用法?C# System.Xml.XmlTextReader.ReadToFollowing怎么用?C# System.Xml.XmlTextReader.ReadToFollowing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlTextReader
的用法示例。
在下文中一共展示了System.Xml.XmlTextReader.ReadToFollowing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: initialize
public static void initialize(Main pMain)
{
m_pMain = pMain;
m_pWebClient = new CGWebClient();
m_pWebClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(m_pWebClient_DownloadFileCompleted);
m_pWebClient.DownloadProgressChanged += new System.Net.DownloadProgressChangedEventHandler(m_pWebClient_DownloadProgressChanged);
if (!System.IO.File.Exists(@"pak\Files\tile.p000"))
m_pWebClient.DownloadFile(WEBSITE + "launcher/new_patch.xml", "patch.xml");
else if (!System.IO.File.Exists(@"pak\World\_test$sample_1.p000"))
m_pWebClient.DownloadFile(WEBSITE + "launcher/new_patch.xml", "patch.xml");
else
m_pWebClient.DownloadFile(WEBSITE + "launcher/patch.xml", "patch.xml");
try
{
using (System.Xml.XmlTextReader pXmlTextReader = new System.Xml.XmlTextReader(Directory.GetCurrentDirectory() + "/patch.xml"))
//using (System.Xml.XmlTextReader pXmlTextReader = new System.Xml.XmlTextReader( WEBSITE + "files/patch.xml"))
{
int x = 0;
while (pXmlTextReader.ReadToFollowing("PATCHNODE"))
{
x++;
m_pMain.Status = "Interpreting Patch Information " + x + "...";
if (pXmlTextReader.MoveToFirstAttribute())
{
string strFilename = pXmlTextReader.GetAttribute("file").Replace("./", "");
string strCurrDir = System.IO.Directory.GetCurrentDirectory();
try
{
string Dir = Path.GetDirectoryName(strFilename);
if (!Directory.Exists(Dir) && Dir != "")
Directory.CreateDirectory(Dir);
}
catch
{
m_pMain.Status = "Failed to create or read folder info.";
}
//foreach (string strTemp in strFilename.Split('/'))
//{
// if (!strTemp.Contains("."))
// {
// System.IO.Directory.CreateDirectory(strTemp);
// continue;
// }
//}
uint nChecksum = 0;
if (pXmlTextReader.ReadToFollowing("CHECKSUM"))
{
nChecksum = (uint)pXmlTextReader.ReadElementContentAs(typeof(uint), null);
}
try
{
FileInfo FI = new FileInfo(strFilename);
if (strFilename.ToLower() == Path.GetFileName(Application.ExecutablePath).ToLower())
{
FileInfo FI2 = new FileInfo(strFilename + "_");
if (FI2.Exists)
FI2.Delete();
Thread.Sleep(500);
FI.CopyTo(strFilename + "_");
uint crc = getFileCrc(strFilename + "_");
FI2 = new FileInfo(strFilename + "_");
if (FI2.Exists)
FI2.Delete();
if (crc != nChecksum)
{
PatchSelf = true;
m_pUpdateList.Add(strFilename);
}
continue;
}
if (!FI.Exists)
m_pUpdateList.Add(strFilename);
else
{
uint crc = getFileCrc(strFilename);
if (crc != nChecksum)
{
m_pUpdateList.Add(strFilename);
}
}
}
catch (Exception E)
{
if (E.Message.Contains("msvcr71.dll' because it is being used by another process"))
{
//ignore because it's used by .net and gunz needs it... note that this is a possible abuse for exploitation
}
else
{
MessageBox.Show("Some of the files (" + strFilename + ") that need to be patched/edited are currently in use. Make sure SoulHunterZ is closed. If this error persists, restart your computer.", "Fatal Error");
Application.Exit();
}
}
System.IO.Directory.SetCurrentDirectory(strCurrDir);
//.........这里部分代码省略.........
示例2: IsMediumTrustSetInConfig
//Method two: Get is medium trust (get if config is set as medium trust)
private static bool IsMediumTrustSetInConfig()
{
bool result = false;
try
{
string webConfigFile = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.PhysicalApplicationPath, "web.config");
System.Xml.XmlTextReader webConfigReader = new System.Xml.XmlTextReader(new System.IO.StreamReader(webConfigFile));
webConfigReader.ReadToFollowing("trust");
result = webConfigReader.GetAttribute("level") == "Medium";
webConfigReader.Close(); //Close before return
return result;
}
catch
{
return result;
}
}