本文整理汇总了C#中SteamKit2.KeyValue.RecursiveLoadFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:C# KeyValue.RecursiveLoadFromBuffer方法的具体用法?C# KeyValue.RecursiveLoadFromBuffer怎么用?C# KeyValue.RecursiveLoadFromBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SteamKit2.KeyValue
的用法示例。
在下文中一共展示了KeyValue.RecursiveLoadFromBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecursiveLoadFromBuffer
internal void RecursiveLoadFromBuffer( KVTextReader kvr )
{
bool wasQuoted;
bool wasConditional;
while ( true )
{
bool bAccepted = true;
// get the key name
string name = kvr.ReadToken( out wasQuoted, out wasConditional );
if ( string.IsNullOrEmpty( name ) )
{
throw new Exception( "RecursiveLoadFromBuffer: got EOF or empty keyname" );
}
if ( name.StartsWith( "}" ) && !wasQuoted ) // top level closed, stop reading
break;
KeyValue dat = new KeyValue( name );
dat.Children = new List<KeyValue>();
this.Children.Add( dat );
// get the value
string value = kvr.ReadToken( out wasQuoted, out wasConditional );
if ( wasConditional && value != null )
{
bAccepted = ( value == "[$WIN32]" );
value = kvr.ReadToken( out wasQuoted, out wasConditional );
}
if ( value == null )
throw new Exception( "RecursiveLoadFromBuffer: got NULL key" );
if ( value.StartsWith( "}" ) && !wasQuoted )
throw new Exception( "RecursiveLoadFromBuffer: got } in key" );
if ( value.StartsWith( "{" ) && !wasQuoted )
{
dat.RecursiveLoadFromBuffer( kvr );
}
else
{
if ( wasConditional )
{
throw new Exception( "RecursiveLoadFromBuffer: got conditional between key and value" );
}
dat.Value = value;
// blahconditionalsdontcare
}
}
}