Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin Jae-yeon (Windows) committed Dec 28, 2015
1 parent 3ab2291 commit 55fa7e6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Daramkun.Blockar.Test/json1.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@
"school" : {
"university" : "Chungnam National University",
"highschool" : "Korea Game Science Highschool"
}
},

"result" : {"status":"succeed","message":"login succeed.","result":{"nickname":"\ub2e4\ub78c\uad70","no":"6"}}
}
Binary file modified Daramkun.Blockar.nupkg
Binary file not shown.
15 changes: 9 additions & 6 deletions Daramkun.Blockar/Json/JsonContainer.Parse.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -62,7 +63,7 @@ private JsonContainer ParseString ( MyStringReader jsonString )
if ( rc == ':' )
{
if ( !( parseMode == ParseState.Object && parseState == ParseState.Key ) )
throw new Exception ( "Invalid JSON document." );
throw new Exception ( "Invalid JSON document: Whe the Parse mode is Object, You must have key." );
parseState = ParseState.Value;
}
else if ( rc == ',' )
Expand Down Expand Up @@ -95,7 +96,7 @@ private JsonContainer ParseString ( MyStringReader jsonString )

return Build ( parseMode, tokenStack );
}
catch { throw new ArgumentException ( "Invalid JSON document." ); }
catch ( Exception ex ) { throw new ArgumentException ( "Invalid JSON document.", ex ); }
}

private JsonContainer ParseBinary ( BinaryReader jsonBinary, ParseState parseMode = ParseState.Object )
Expand Down Expand Up @@ -200,8 +201,10 @@ private string GetStringFromString ( MyStringReader jsonString )
case 'f': sb [ sb.Length - 1 ] = '\f'; break;
case 'u':
sb.Remove ( sb.Length - 1, 1 );
sb.Append ( ToNumberFromHexa ( jsonString.ReadChars ( 2 ) ) );
sb.Append ( ToNumberFromHexa ( jsonString.ReadChars ( 2 ) ) );
sb.Append ( ToCharFromHexa ( jsonString.ReadChars ( 4 ) ) );
break;
case 'x':
sb.Append ( ToCharFromHexa ( jsonString.ReadChars ( 2 ) ) );
break;

default: throw new Exception ();
Expand All @@ -218,9 +221,9 @@ private string GetStringFromString ( MyStringReader jsonString )
return sb.ToString ();
}

private byte ToNumberFromHexa ( char [] p )
private char ToCharFromHexa ( char [] p )
{
return byte.Parse ( string.Format ( "0x{0}{1}", p [ 0 ], p [ 1 ] ) );
return Convert.ToChar ( ushort.Parse ( string.Concat ( p ), NumberStyles.AllowHexSpecifier ) );
}

private bool CheckArray ( char [] v1, char [] v2 )
Expand Down
4 changes: 2 additions & 2 deletions Daramkun.Blockar/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
// 지정되도록 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ( "2.0.3.*" )]
[assembly: AssemblyFileVersion ( "2.0.3.0" )]
[assembly: AssemblyVersion ( "2.0.4.*" )]
[assembly: AssemblyFileVersion ( "2.0.4.0" )]

0 comments on commit 55fa7e6

Please sign in to comment.