本文整理汇总了C#中Server.GenericReader.End方法的典型用法代码示例。如果您正苦于以下问题:C# GenericReader.End方法的具体用法?C# GenericReader.End怎么用?C# GenericReader.End使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.GenericReader
的用法示例。
在下文中一共展示了GenericReader.End方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public virtual void Load(XmlTextReader reader, GenericReader rcreader)
{
int version = Int32.Parse(reader.GetAttribute("version"));
reader.ReadStartElement("ResourceData");
switch (version)
{
case 0:
{
m_Name = reader.ReadElementString("Name");
m_Type = Type.GetType(reader.ReadElementString("Type"));
m_BunchName = reader.ReadElementString("BunchName");
m_ResalePrice = Double.Parse(reader.ReadElementString("ResalePrice"));
m_WholesalePrice = Double.Parse(reader.ReadElementString("WholesalePrice"));
m_ItemID = Int32.Parse(reader.ReadElementString("ItemID"));
m_Hue = Int32.Parse(reader.ReadElementString("Hue"));
m_SmallestFirstFactor = Double.Parse(reader.ReadElementString("SmallestFirstFactor"));
m_ValidFailsafe = bool.Parse(reader.ReadElementString("ValidFailsafe"));
if (m_Type == null || m_Type.GetInterface("ICommodity", false) == null)
throw new Exception(String.Format("Error: Type of resource '{0}' does not exist or does not implement ICommodity.", m_Name));
m_ConsignmentList = new ArrayList();
if (rcreader == null)// || !FindPosition(rcreader))
break;
((BinaryFileReader)rcreader).Seek(0, SeekOrigin.Begin);
if (rcreader.End())
break;
int rcversion = rcreader.ReadInt();
switch (rcversion)
{
case 0:
{
while (!rcreader.End())
{
ResourceConsignment rc = new ResourceConsignment(rcreader);
if (rc.Type == m_Type)
m_ConsignmentList.Add(rc);
}
break;
}
default:
throw new Exception("ResourcePool error: Invalid file version for Consignments.dat");
}
/*if (!rcreader.End() && rcreader.ReadString() == m_Type.FullName)
{
int rcversion = rcreader.ReadInt();
switch (rcversion)
{
case 0:
{
count = rcreader.ReadInt();
for (; count > 0; count--)
m_ConsignmentList.Add(new ResourceConsignment(rcreader));
break;
}
default:
{
throw new Exception("ResourcePool error: Invalid ResourceData entry save version in Consignments.dat");
}
}
}*/
break;
}
default:
{
throw new Exception("Error loading ResourceData: Invalid saveversion");
}
}
reader.ReadEndElement();
}
示例2: FindPosition
private bool FindPosition(GenericReader rcreader)
{
((BinaryFileReader)rcreader).Seek(0, SeekOrigin.Begin);
if (rcreader.End())
return false;
int rcversion = rcreader.ReadInt();
switch (rcversion)
{
case 0:
{
long tableposition = rcreader.ReadLong();
Console.WriteLine("Tableposition: {0}", tableposition);
((BinaryFileReader)rcreader).Seek(tableposition, SeekOrigin.Begin);
while (!rcreader.End())
{
string typename = rcreader.ReadString();
long location = rcreader.ReadLong();
Console.WriteLine("{0}, {1}", typename, location);
if (typename == m_Type.FullName)
{
((BinaryFileReader)rcreader).Seek(location, SeekOrigin.Begin);
return true;
}
}
break;
}
default:
{
throw new Exception("ResourcePool error: Invalid consignments.dat save version");
}
}
return false;
}