-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support .net6, add samples for unity
- Loading branch information
Showing
16 changed files
with
206 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,3 +71,5 @@ crashlytics-build.properties | |
/[Aa]ssets/[Ss]treamingAssets/aa/* | ||
|
||
.vsconfig | ||
|
||
!/[Aa]ssets/Plugins/U8XmlParser/*~/ |
2 changes: 1 addition & 1 deletion
2
src/U8XmlParserUnity/Assets/Scenes.meta → ...XmlParser/Samples~/U8XmlParserSample.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
src/U8XmlParserUnity/Assets/Plugins/U8XmlParser/Samples~/U8XmlParserSample/Scripts.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
45 changes: 45 additions & 0 deletions
45
...lParserUnity/Assets/Plugins/U8XmlParser/Samples~/U8XmlParserSample/Scripts/U8XmlSample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using UnityEngine; | ||
|
||
namespace U8Xml.Samples | ||
{ | ||
public class U8XmlSample : MonoBehaviour | ||
{ | ||
private const string SampleXml = @"<?xml version=""1.0"" encoding=""UTF-8""?> | ||
<!-- This is a sample xml. --> | ||
<foo> | ||
<bar aaa=""10""/> | ||
<baz>The quick brown fox jumps over the lazy dog</baz> | ||
</foo> | ||
"; | ||
|
||
private void Start() | ||
{ | ||
string rootNodeName; | ||
|
||
Debug.Log(SampleXml); | ||
using(var xml = XmlParser.Parse(SampleXml)) { | ||
|
||
var root = xml.Root; | ||
rootNodeName = root.Name.ToString(); | ||
|
||
if(root.TryGetFirstChild(out var node1)) { | ||
var attr = node1.FindAttribute("aaa"); | ||
string attrName = attr.Name.ToString(); | ||
int attrValue = attr.Value.ToInt32(); | ||
Debug.Log($"node1: {node1.Name}, [{attrName} = {attrValue}]"); | ||
} | ||
|
||
if(root.TryFindChild("baz", out var node2)) { | ||
Debug.Log(node2.InnerText); | ||
} | ||
} | ||
|
||
// [NOTE] | ||
// Don't use XmlObject, RawString, or any objects from XmlParser after Dispose(). | ||
// All thier memory are already released. | ||
// Evaluate them into int, float, string, etc... if you use after disposed. | ||
|
||
Debug.Log($"root node name: {rootNodeName}"); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...erUnity/Assets/Plugins/U8XmlParser/Samples~/U8XmlParserSample/Scripts/U8XmlSample.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...nity/Assets/Plugins/U8XmlParser/Samples~/U8XmlParserSample/U8Xml.U8XmlParserSample.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"name": "U8XmlParserSample", | ||
"rootNamespace": "U8Xml.Samples", | ||
"references": [ | ||
"GUID:99988bbb805cede47a3a6f22765caf54" | ||
], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
...Assets/Plugins/U8XmlParser/Samples~/U8XmlParserSample/U8Xml.U8XmlParserSample.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.