Skip to content

Compilable library in .Net project #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Editor/JSONChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ THE SOFTWARE.
//#define JSONOBJECT_PERFORMANCE_TEST //For testing performance of parse/stringify. Turn on editor profiling to see how we're doing
// ReSharper disable UseStringInterpolation

#if UNITY_2 || UNITY_3 || UNITY_4 || UNITY_5 || UNITY_5_3_OR_NEWER
#define USING_UNITY
#endif

#if USING_UNITY

using Defective.JSON.Tests;
using UnityEngine;
using UnityEditor;
Expand Down Expand Up @@ -118,3 +124,5 @@ void OnGUI() {
}
}
}

#endif
28 changes: 24 additions & 4 deletions JSONObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,12 @@ static bool ParseObjectEnd(string inputString, int offset, bool openQuote, JSONO
return true;

if (container == null) {
Debug.LogError("Parsing error: encountered `}` with no container object");
#if USING_UNITY
Debug.LogError
#else
Debug.WriteLine
#endif
("Parsing error: encountered `}` with no container object");
return false;
}

Expand All @@ -870,7 +875,12 @@ static bool ParseArrayEnd(string inputString, int offset, bool openQuote, JSONOb
return true;

if (container == null) {
Debug.LogError("Parsing error: encountered `]` with no container object");
#if USING_UNITY
Debug.LogError
#else
Debug.WriteLine
#endif
("Parsing error: encountered `]` with no container object");
return false;
}

Expand Down Expand Up @@ -907,7 +917,12 @@ static bool ParseColon(string inputString, bool openQuote, JSONObject container,
return true;

if (container == null) {
Debug.LogError("Parsing error: encountered `:` with no container object");
#if USING_UNITY
Debug.LogError
#else
Debug.WriteLine
#endif
("Parsing error: encountered `:` with no container object");
return false;
}

Expand All @@ -929,7 +944,12 @@ static bool ParseComma(string inputString, bool openQuote, JSONObject container,
return true;

if (container == null) {
Debug.LogError("Parsing error: encountered `,` with no container object");
#if USING_UNITY
Debug.LogError
#else
Debug.WriteLine
#endif
("Parsing error: encountered `,` with no container object");
return false;
}

Expand Down
8 changes: 8 additions & 0 deletions VectorTemplates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#if UNITY_2 || UNITY_3 || UNITY_4 || UNITY_5 || UNITY_5_3_OR_NEWER
#define USING_UNITY
#endif

#if USING_UNITY

using UnityEngine;

namespace Defective.JSON {
Expand Down Expand Up @@ -299,3 +305,5 @@ public static JSONObject ToJson(this RectOffset rectOffset) {
}
}
}

#endif