/////////////////////////////////////////////////////////////////////////// public void Identifier( JSONParser jp, string identifier ) { // ****** //Trace.Write( "Identifier: {0}\n", identifier ); // ****** lastIdentifier = identifier; }
/////////////////////////////////////////////////////////////////////////// public void Value( JSONParser jp, object value ) { // ****** //Trace.Write( "Value: {0}\n", value.ToString() ); // ****** if( string.IsNullOrEmpty(lastIdentifier) ) { CurrentList.Add( value ); } else { CurrentArray.Add( lastIdentifier, value ); lastIdentifier = null; } }
/////////////////////////////////////////////////////////////////////////// public void ExitArray( JSONParser jp ) { // ****** //Trace.Write( "Exit array\n" ); // ****** listStack.Pop(); }
/////////////////////////////////////////////////////////////////////////// public void EnterArray( JSONParser jp ) { // ****** //Trace.Write( "Enter array\n" ); // ****** var list = new NmpObjectList(); if( string.IsNullOrEmpty(lastIdentifier) ) { CurrentList.Add( list ); } else { CurrentArray.Add( lastIdentifier, list ); lastIdentifier = null; } // ****** listStack.Push( list ); }
/////////////////////////////////////////////////////////////////////////// public void ExitObject( JSONParser jp ) { // ****** //Trace.Write( "Exit object\n" ); // ****** arrayStack.Pop(); }
/////////////////////////////////////////////////////////////////////////// public void EnterObject( JSONParser jp ) { // ****** //Trace.Write( "Enter object\n" ); // ****** if( null == rootArray ) { rootArray = new NmpArray(); arrayStack.Push( rootArray ); } else { // // arrays can have unnamed objects // var array = new NmpArray(); if( string.IsNullOrEmpty(lastIdentifier) ) { CurrentList.Add( array ); } else { CurrentArray.Add( lastIdentifier, array ); lastIdentifier = null; } // ****** arrayStack.Push( array ); } }
///////////////////////////////////////////////////////////////////////////// public NmpJSONException( JSONParser parser, string message, params object [] args ) : base( Helpers.SafeStringFormat(message, args) ) { this.jp = parser; }