예제 #1
0
		///////////////////////////////////////////////////////////////////////////

		public void Identifier( JSONParser jp, string identifier )
		{
			// ******
			//Trace.Write( "Identifier: {0}\n", identifier );

			// ******
			lastIdentifier = identifier;
		}
예제 #2
0
		///////////////////////////////////////////////////////////////////////////

		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;
			}
		}
예제 #3
0
		///////////////////////////////////////////////////////////////////////////

		public void ExitArray( JSONParser jp )
		{
			// ******
			//Trace.Write( "Exit array\n" );

			// ******
			listStack.Pop();
		}
예제 #4
0
		///////////////////////////////////////////////////////////////////////////

		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 );
		}
예제 #5
0
		///////////////////////////////////////////////////////////////////////////

		public void ExitObject( JSONParser jp )
		{
			// ******
			//Trace.Write( "Exit object\n" );

			// ******
			arrayStack.Pop();
		}
예제 #6
0
		///////////////////////////////////////////////////////////////////////////

		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 );
			}
		}
예제 #7
0
		/////////////////////////////////////////////////////////////////////////////

		public NmpJSONException( JSONParser parser, string message, params object [] args )
			:	base( Helpers.SafeStringFormat(message, args) )
		{
			this.jp = parser;
		}