Resource cleanup.
This commit is contained in:
@@ -1,8 +0,0 @@
|
|||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: AssemblyCompany("Cryville")]
|
|
||||||
[assembly: AssemblyCopyright("Copyright © Cryville 2020-2022")]
|
|
||||||
[assembly: AssemblyDefaultAlias("Cosmo Resona")]
|
|
||||||
[assembly: AssemblyProduct("Cosmo Resona")]
|
|
||||||
[assembly: AssemblyTitle("Cosmo Resona")]
|
|
||||||
[assembly: AssemblyVersion("0.5.0")]
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: a69a6c726b01961419c4835bba37a218
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
16
Assets/Cryville/Cryville.Crtr.asmdef
Normal file
16
Assets/Cryville/Cryville.Crtr.asmdef
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"name": "Cryville.Crtr",
|
||||||
|
"rootNamespace": "",
|
||||||
|
"references": [
|
||||||
|
"GUID:d8ea0e0da3ad53a45b65c912ffcacab0"
|
||||||
|
],
|
||||||
|
"includePlatforms": [],
|
||||||
|
"excludePlatforms": [],
|
||||||
|
"allowUnsafeCode": true,
|
||||||
|
"overrideReferences": false,
|
||||||
|
"precompiledReferences": [],
|
||||||
|
"autoReferenced": true,
|
||||||
|
"defineConstraints": [],
|
||||||
|
"versionDefines": [],
|
||||||
|
"noEngineReferences": false
|
||||||
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: c23d1189efdcccd43ba976c73f20fa1d
|
guid: 6eb95bd93da7fd54c8c2da321efabb1f
|
||||||
AssemblyDefinitionImporter:
|
AssemblyDefinitionImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: abad95983f1ca394a92bb061b76ebb2f
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1638411493
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,144 +0,0 @@
|
|||||||
namespace EricHaines {
|
|
||||||
// Only works on ARGB32, RGB24 and Alpha8 textures that are marked readable
|
|
||||||
|
|
||||||
using System.Threading;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
public class TextureScale {
|
|
||||||
public class ThreadData {
|
|
||||||
public int start;
|
|
||||||
public int end;
|
|
||||||
public ThreadData(int s, int e) {
|
|
||||||
start = s;
|
|
||||||
end = e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color[] texColors;
|
|
||||||
private static Color[] newColors;
|
|
||||||
private static int w;
|
|
||||||
private static float ratioX;
|
|
||||||
private static float ratioY;
|
|
||||||
private static int w2;
|
|
||||||
private static int finishCount;
|
|
||||||
private static Mutex mutex;
|
|
||||||
|
|
||||||
public static void Point(Texture2D tex, int newWidth, int newHeight) {
|
|
||||||
ThreadedScale(tex, newWidth, newHeight, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Bilinear(Texture2D tex, int newWidth, int newHeight) {
|
|
||||||
ThreadedScale(tex, newWidth, newHeight, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void ThreadedScale(Texture2D tex, int newWidth, int newHeight, bool useBilinear) {
|
|
||||||
texColors = tex.GetPixels();
|
|
||||||
newColors = new Color[newWidth * newHeight];
|
|
||||||
if (useBilinear) {
|
|
||||||
ratioX = 1.0f / ((float)newWidth / (tex.width - 1));
|
|
||||||
ratioY = 1.0f / ((float)newHeight / (tex.height - 1));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ratioX = (float)tex.width / newWidth;
|
|
||||||
ratioY = (float)tex.height / newHeight;
|
|
||||||
}
|
|
||||||
w = tex.width;
|
|
||||||
w2 = newWidth;
|
|
||||||
var cores = Mathf.Min(SystemInfo.processorCount, newHeight);
|
|
||||||
var slice = newHeight/cores;
|
|
||||||
|
|
||||||
finishCount = 0;
|
|
||||||
if (mutex == null) {
|
|
||||||
mutex = new Mutex(false);
|
|
||||||
}
|
|
||||||
if (cores > 1) {
|
|
||||||
int i = 0;
|
|
||||||
ThreadData threadData;
|
|
||||||
for (i = 0; i < cores - 1; i++) {
|
|
||||||
threadData = new ThreadData(slice * i, slice * (i + 1));
|
|
||||||
ParameterizedThreadStart ts = useBilinear ? new ParameterizedThreadStart(BilinearScale) : new ParameterizedThreadStart(PointScale);
|
|
||||||
Thread thread = new Thread(ts);
|
|
||||||
thread.Start(threadData);
|
|
||||||
}
|
|
||||||
threadData = new ThreadData(slice * i, newHeight);
|
|
||||||
if (useBilinear) {
|
|
||||||
BilinearScale(threadData);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
PointScale(threadData);
|
|
||||||
}
|
|
||||||
while (finishCount < cores) {
|
|
||||||
Thread.Sleep(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ThreadData threadData = new ThreadData(0, newHeight);
|
|
||||||
if (useBilinear) {
|
|
||||||
BilinearScale(threadData);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
PointScale(threadData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_2021_2_OR_NEWER
|
|
||||||
tex.Reinitialize(newWidth, newHeight);
|
|
||||||
#else
|
|
||||||
tex.Resize(newWidth, newHeight);
|
|
||||||
#endif
|
|
||||||
tex.SetPixels(newColors);
|
|
||||||
tex.Apply();
|
|
||||||
|
|
||||||
texColors = null;
|
|
||||||
newColors = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void BilinearScale(object obj) {
|
|
||||||
ThreadData threadData = (ThreadData) obj;
|
|
||||||
for (var y = threadData.start; y < threadData.end; y++) {
|
|
||||||
int yFloor = (int)Mathf.Floor(y * ratioY);
|
|
||||||
var y1 = yFloor * w;
|
|
||||||
var y2 = (yFloor+1) * w;
|
|
||||||
var yw = y * w2;
|
|
||||||
|
|
||||||
for (var x = 0; x < w2; x++) {
|
|
||||||
int xFloor = (int)Mathf.Floor(x * ratioX);
|
|
||||||
var xLerp = x * ratioX-xFloor;
|
|
||||||
newColors[yw + x] = ColorLerpUnclamped(
|
|
||||||
ColorLerpUnclamped(texColors[y1 + xFloor], texColors[y1 + xFloor + 1], xLerp),
|
|
||||||
ColorLerpUnclamped(texColors[y2 + xFloor], texColors[y2 + xFloor + 1], xLerp),
|
|
||||||
y * ratioY - yFloor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex.WaitOne();
|
|
||||||
finishCount++;
|
|
||||||
mutex.ReleaseMutex();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void PointScale(object obj) {
|
|
||||||
ThreadData threadData = (ThreadData) obj;
|
|
||||||
for (var y = threadData.start; y < threadData.end; y++) {
|
|
||||||
var thisY = (int)(ratioY * y) * w;
|
|
||||||
var yw = y * w2;
|
|
||||||
for (var x = 0; x < w2; x++) {
|
|
||||||
newColors[yw + x] = texColors[(int)(thisY + ratioX * x)];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex.WaitOne();
|
|
||||||
finishCount++;
|
|
||||||
mutex.ReleaseMutex();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Color ColorLerpUnclamped(Color c1, Color c2, float value) {
|
|
||||||
return new Color(
|
|
||||||
c1.r + (c2.r - c1.r) * value,
|
|
||||||
c1.g + (c2.g - c1.g) * value,
|
|
||||||
c1.b + (c2.b - c1.b) * value,
|
|
||||||
c1.a + (c2.a - c1.a) * value
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 58e01e1e11af164408a19c1086709bd7
|
|
||||||
timeCreated: 1638411495
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "YamlDotNet.Examples",
|
"name": "Quaver.API",
|
||||||
|
"rootNamespace": "",
|
||||||
"references": [
|
"references": [
|
||||||
"YamlDotNet"
|
"GUID:b3f49edfedc855a48aa1a9e5d3cba438"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
"allowUnsafeCode": false,
|
"allowUnsafeCode": false,
|
||||||
"overrideReferences": true,
|
"overrideReferences": true,
|
||||||
"precompiledReferences": [],
|
"precompiledReferences": [],
|
||||||
"autoReferenced": false,
|
"autoReferenced": true,
|
||||||
"defineConstraints": [],
|
"defineConstraints": [],
|
||||||
"versionDefines": [],
|
"versionDefines": [],
|
||||||
"noEngineReferences": false
|
"noEngineReferences": true
|
||||||
}
|
}
|
@@ -1,7 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: daabd28f177eb0946b93b026e9d6e738
|
guid: d8ea0e0da3ad53a45b65c912ffcacab0
|
||||||
folderAsset: yes
|
AssemblyDefinitionImporter:
|
||||||
DefaultImporter:
|
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
assetBundleName:
|
assetBundleName:
|
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dc2947c139e087f43b375d2510a449df
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1621384032
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: d6a3a023271b82a4985d1bbcc86e6fa8
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,9 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: f44c0df627c830e4d8e60525feb0c5a9
|
|
||||||
folderAsset: yes
|
|
||||||
timeCreated: 1429640505
|
|
||||||
licenseType: Store
|
|
||||||
DefaultImporter:
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,63 +0,0 @@
|
|||||||
// This file is part of YamlDotNet - A .NET library for YAML.
|
|
||||||
// Copyright (c) Antoine Aubry and contributors
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
// so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
using YamlDotNet.Samples.Helpers;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples
|
|
||||||
{
|
|
||||||
public class ConvertYamlToJson
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper output;
|
|
||||||
|
|
||||||
public ConvertYamlToJson(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Sample(
|
|
||||||
DisplayName = "Convert YAML to JSON",
|
|
||||||
Description = "Shows how to convert a YAML document to JSON."
|
|
||||||
)]
|
|
||||||
public void Main()
|
|
||||||
{
|
|
||||||
// convert string/file to YAML object
|
|
||||||
var r = new StringReader(@"
|
|
||||||
scalar: a scalar
|
|
||||||
sequence:
|
|
||||||
- one
|
|
||||||
- two
|
|
||||||
");
|
|
||||||
var deserializer = new DeserializerBuilder().Build();
|
|
||||||
var yamlObject = deserializer.Deserialize(r);
|
|
||||||
|
|
||||||
var serializer = new SerializerBuilder()
|
|
||||||
.JsonCompatible()
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var json = serializer.Serialize(yamlObject);
|
|
||||||
|
|
||||||
output.WriteLine(json);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8614a029d313e6344a3ac93ddbd92dd2
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,165 +0,0 @@
|
|||||||
// This file is part of YamlDotNet - A .NET library for YAML.
|
|
||||||
// Copyright (c) Antoine Aubry and contributors
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
// so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
using YamlDotNet.Samples.Helpers;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
using YamlDotNet.Serialization.NamingConventions;
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples
|
|
||||||
{
|
|
||||||
public class DeserializeObjectGraph
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper output;
|
|
||||||
|
|
||||||
public DeserializeObjectGraph(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Sample(
|
|
||||||
DisplayName = "Deserializing an object graph",
|
|
||||||
Description = "Shows how to convert a YAML document to an object graph."
|
|
||||||
)]
|
|
||||||
public void Main()
|
|
||||||
{
|
|
||||||
var input = new StringReader(Document);
|
|
||||||
|
|
||||||
var deserializer = new DeserializerBuilder()
|
|
||||||
.WithNamingConvention(CamelCaseNamingConvention.Instance)
|
|
||||||
.Build();
|
|
||||||
|
|
||||||
var order = deserializer.Deserialize<Order>(input);
|
|
||||||
|
|
||||||
output.WriteLine("Order");
|
|
||||||
output.WriteLine("-----");
|
|
||||||
output.WriteLine();
|
|
||||||
foreach (var item in order.Items)
|
|
||||||
{
|
|
||||||
output.WriteLine("{0}\t{1}\t{2}\t{3}", item.PartNo, item.Quantity, item.Price, item.Descrip);
|
|
||||||
}
|
|
||||||
output.WriteLine();
|
|
||||||
|
|
||||||
output.WriteLine("Shipping");
|
|
||||||
output.WriteLine("--------");
|
|
||||||
output.WriteLine();
|
|
||||||
output.WriteLine(order.ShipTo.Street);
|
|
||||||
output.WriteLine(order.ShipTo.City);
|
|
||||||
output.WriteLine(order.ShipTo.State);
|
|
||||||
output.WriteLine();
|
|
||||||
|
|
||||||
output.WriteLine("Billing");
|
|
||||||
output.WriteLine("-------");
|
|
||||||
output.WriteLine();
|
|
||||||
if (order.BillTo == order.ShipTo)
|
|
||||||
{
|
|
||||||
output.WriteLine("*same as shipping address*");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
output.WriteLine(order.ShipTo.Street);
|
|
||||||
output.WriteLine(order.ShipTo.City);
|
|
||||||
output.WriteLine(order.ShipTo.State);
|
|
||||||
}
|
|
||||||
output.WriteLine();
|
|
||||||
|
|
||||||
output.WriteLine("Delivery instructions");
|
|
||||||
output.WriteLine("---------------------");
|
|
||||||
output.WriteLine();
|
|
||||||
output.WriteLine(order.SpecialDelivery);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Order
|
|
||||||
{
|
|
||||||
public string Receipt { get; set; }
|
|
||||||
public DateTime Date { get; set; }
|
|
||||||
public Customer Customer { get; set; }
|
|
||||||
public List<OrderItem> Items { get; set; }
|
|
||||||
|
|
||||||
[YamlMember(Alias = "bill-to", ApplyNamingConventions = false)]
|
|
||||||
public Address BillTo { get; set; }
|
|
||||||
|
|
||||||
[YamlMember(Alias = "ship-to", ApplyNamingConventions = false)]
|
|
||||||
public Address ShipTo { get; set; }
|
|
||||||
|
|
||||||
public string SpecialDelivery { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Customer
|
|
||||||
{
|
|
||||||
public string Given { get; set; }
|
|
||||||
public string Family { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class OrderItem
|
|
||||||
{
|
|
||||||
[YamlMember(Alias = "part_no", ApplyNamingConventions = false)]
|
|
||||||
public string PartNo { get; set; }
|
|
||||||
public string Descrip { get; set; }
|
|
||||||
public decimal Price { get; set; }
|
|
||||||
public int Quantity { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Address
|
|
||||||
{
|
|
||||||
public string Street { get; set; }
|
|
||||||
public string City { get; set; }
|
|
||||||
public string State { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string Document = @"---
|
|
||||||
receipt: Oz-Ware Purchase Invoice
|
|
||||||
date: 2007-08-06
|
|
||||||
customer:
|
|
||||||
given: Dorothy
|
|
||||||
family: Gale
|
|
||||||
|
|
||||||
items:
|
|
||||||
- part_no: A4786
|
|
||||||
descrip: Water Bucket (Filled)
|
|
||||||
price: 1.47
|
|
||||||
quantity: 4
|
|
||||||
|
|
||||||
- part_no: E1628
|
|
||||||
descrip: High Heeled ""Ruby"" Slippers
|
|
||||||
price: 100.27
|
|
||||||
quantity: 1
|
|
||||||
|
|
||||||
bill-to: &id001
|
|
||||||
street: |-
|
|
||||||
123 Tornado Alley
|
|
||||||
Suite 16
|
|
||||||
city: East Westville
|
|
||||||
state: KS
|
|
||||||
|
|
||||||
ship-to: *id001
|
|
||||||
|
|
||||||
specialDelivery: >
|
|
||||||
Follow the Yellow Brick
|
|
||||||
Road to the Emerald City.
|
|
||||||
Pay no attention to the
|
|
||||||
man behind the curtain.
|
|
||||||
...";
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: e214dfed74d68a24d86a603072744b69
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,79 +0,0 @@
|
|||||||
// This file is part of YamlDotNet - A .NET library for YAML.
|
|
||||||
// Copyright (c) Antoine Aubry and contributors
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
// so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
using YamlDotNet.Core;
|
|
||||||
using YamlDotNet.Core.Events;
|
|
||||||
using YamlDotNet.Samples.Helpers;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples
|
|
||||||
{
|
|
||||||
public class DeserializingMultipleDocuments
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper output;
|
|
||||||
|
|
||||||
public DeserializingMultipleDocuments(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Sample(
|
|
||||||
DisplayName = "Deserializing multiple documents",
|
|
||||||
Description = "Explains how to load multiple YAML documents from a stream."
|
|
||||||
)]
|
|
||||||
public void Main()
|
|
||||||
{
|
|
||||||
var input = new StringReader(Document);
|
|
||||||
|
|
||||||
var deserializer = new DeserializerBuilder().Build();
|
|
||||||
|
|
||||||
var parser = new Parser(input);
|
|
||||||
|
|
||||||
// Consume the stream start event "manually"
|
|
||||||
parser.Consume<StreamStart>();
|
|
||||||
|
|
||||||
while (parser.Accept<DocumentStart>(out var _))
|
|
||||||
{
|
|
||||||
// Deserialize the document
|
|
||||||
var doc = deserializer.Deserialize<List<string>>(parser);
|
|
||||||
|
|
||||||
output.WriteLine("## Document");
|
|
||||||
foreach (var item in doc)
|
|
||||||
{
|
|
||||||
output.WriteLine(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string Document = @"---
|
|
||||||
- Prisoner
|
|
||||||
- Goblet
|
|
||||||
- Phoenix
|
|
||||||
---
|
|
||||||
- Memoirs
|
|
||||||
- Snow
|
|
||||||
- Ghost
|
|
||||||
...";
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: bc4609a10c8a43549a1ec4dfdb0990a4
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,147 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.Serialization;
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
using UnityEditor;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples.Helpers {
|
|
||||||
public class ExampleRunner : MonoBehaviour {
|
|
||||||
|
|
||||||
private StringTestOutputHelper helper = new StringTestOutputHelper();
|
|
||||||
|
|
||||||
public string[] disabledTests = new string[] {};
|
|
||||||
|
|
||||||
private class StringTestOutputHelper : ITestOutputHelper {
|
|
||||||
private StringBuilder output = new StringBuilder();
|
|
||||||
public void WriteLine() {
|
|
||||||
output.AppendLine();
|
|
||||||
}
|
|
||||||
public void WriteLine(string value) {
|
|
||||||
output.AppendLine(value);
|
|
||||||
}
|
|
||||||
public void WriteLine(string format, params object[] args) {
|
|
||||||
output.AppendFormat(format, args);
|
|
||||||
output.AppendLine();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() { return output.ToString(); }
|
|
||||||
public void Clear() { output = new StringBuilder(); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string[] GetAllTestNames() {
|
|
||||||
bool skipMethods;
|
|
||||||
var results = new List<string>();
|
|
||||||
foreach (Type t in Assembly.GetExecutingAssembly().GetTypes()) {
|
|
||||||
if (t.Namespace == "YamlDotNet.Samples" && t.IsClass) {
|
|
||||||
skipMethods = false;
|
|
||||||
foreach (MethodInfo mi in t.GetMethods()) {
|
|
||||||
if (mi.Name == "Main") {
|
|
||||||
SampleAttribute sa = (SampleAttribute) Attribute.GetCustomAttribute(mi, typeof(SampleAttribute));
|
|
||||||
if (sa != null) {
|
|
||||||
results.Add(t.Name);
|
|
||||||
skipMethods = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (skipMethods) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string[] GetAllTestDisplayNames() {
|
|
||||||
bool skipMethods;
|
|
||||||
var results = new List<string>();
|
|
||||||
foreach (Type t in Assembly.GetExecutingAssembly().GetTypes()) {
|
|
||||||
if (t.Namespace == "YamlDotNet.Samples" && t.IsClass) {
|
|
||||||
skipMethods = false;
|
|
||||||
foreach (MethodInfo mi in t.GetMethods()) {
|
|
||||||
if (mi.Name == "Main") {
|
|
||||||
SampleAttribute sa = (SampleAttribute) Attribute.GetCustomAttribute(mi, typeof(SampleAttribute));
|
|
||||||
if (sa != null) {
|
|
||||||
results.Add(sa.DisplayName);
|
|
||||||
skipMethods = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (skipMethods) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return results.ToArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Start() {
|
|
||||||
bool skipMethods;
|
|
||||||
foreach (Type t in Assembly.GetExecutingAssembly().GetTypes()) {
|
|
||||||
if (t.Namespace == "YamlDotNet.Samples" && t.IsClass && Array.IndexOf(disabledTests, t.Name) == -1) {
|
|
||||||
skipMethods = false;
|
|
||||||
foreach (MethodInfo mi in t.GetMethods()) {
|
|
||||||
if (mi.Name == "Main") {
|
|
||||||
SampleAttribute sa = (SampleAttribute) Attribute.GetCustomAttribute(mi, typeof(SampleAttribute));
|
|
||||||
if (sa != null) {
|
|
||||||
helper.WriteLine("{0} - {1}", sa.DisplayName, sa.Description);
|
|
||||||
var testObject = t.GetConstructor(new Type[] { typeof(StringTestOutputHelper) }).Invoke(new object[] { helper });
|
|
||||||
mi.Invoke(testObject, new object[] {});
|
|
||||||
Debug.Log(helper.ToString());
|
|
||||||
helper.Clear();
|
|
||||||
skipMethods = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (skipMethods) break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
|
||||||
[CustomEditor(typeof(ExampleRunner))]
|
|
||||||
public class ExampleRunnerEditor : Editor {
|
|
||||||
private ExampleRunner runner;
|
|
||||||
private string[] allTests;
|
|
||||||
private string[] allDisplayNames;
|
|
||||||
private bool[] enabledTests;
|
|
||||||
|
|
||||||
public void OnEnable() {
|
|
||||||
runner = (ExampleRunner) target;
|
|
||||||
|
|
||||||
allTests = ExampleRunner.GetAllTestNames();
|
|
||||||
allDisplayNames = ExampleRunner.GetAllTestDisplayNames();
|
|
||||||
enabledTests = new bool[allTests.Length];
|
|
||||||
for (int i = 0; i < allTests.Length; i++)
|
|
||||||
enabledTests[i] = Array.IndexOf(runner.disabledTests, allTests[i]) == -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
|
||||||
int nextDisabledIndex = 0;
|
|
||||||
for (int i = 0; i < allTests.Length; i++) {
|
|
||||||
EditorGUI.BeginChangeCheck();
|
|
||||||
if (!enabledTests[i])
|
|
||||||
nextDisabledIndex++;
|
|
||||||
enabledTests[i] = EditorGUILayout.Toggle(allDisplayNames[i], enabledTests[i]);
|
|
||||||
if (EditorGUI.EndChangeCheck()) {
|
|
||||||
if (enabledTests[i]) {
|
|
||||||
var l = new List<string>(runner.disabledTests);
|
|
||||||
l.Remove(allTests[i]);
|
|
||||||
runner.disabledTests = l.ToArray();
|
|
||||||
} else {
|
|
||||||
var l = new List<string>(runner.disabledTests);
|
|
||||||
l.Insert(nextDisabledIndex, allTests[i]);
|
|
||||||
runner.disabledTests = l.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c7b67eba0ebbcd6418a881e3028c9901
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace Xunit.Abstractions
|
|
||||||
{
|
|
||||||
public interface ITestOutputHelper {
|
|
||||||
void WriteLine();
|
|
||||||
void WriteLine(string value);
|
|
||||||
void WriteLine(string format, params object[] args);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 8bf0bb99b386041429154edb2eec127f
|
|
||||||
timeCreated: 1485606138
|
|
||||||
licenseType: Store
|
|
||||||
MonoImporter:
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,11 +0,0 @@
|
|||||||
namespace YamlDotNet.Samples.Helpers
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Marks a test as being a code sample.
|
|
||||||
/// </summary>
|
|
||||||
internal class SampleAttribute : System.Attribute
|
|
||||||
{
|
|
||||||
public string DisplayName { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: de45c0081a4f5e7478f400ebc2446ce5
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,106 +0,0 @@
|
|||||||
// This file is part of YamlDotNet - A .NET library for YAML.
|
|
||||||
// Copyright (c) Antoine Aubry and contributors
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
// so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
using YamlDotNet.Samples.Helpers;
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples
|
|
||||||
{
|
|
||||||
public class LoadingAYamlStream
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper output;
|
|
||||||
|
|
||||||
public LoadingAYamlStream(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Sample(
|
|
||||||
DisplayName = "Loading a YAML Stream",
|
|
||||||
Description = "Explains how to load YAML using the representation model."
|
|
||||||
)]
|
|
||||||
public void Main()
|
|
||||||
{
|
|
||||||
// Setup the input
|
|
||||||
var input = new StringReader(Document);
|
|
||||||
|
|
||||||
// Load the stream
|
|
||||||
var yaml = new YamlStream();
|
|
||||||
yaml.Load(input);
|
|
||||||
|
|
||||||
// Examine the stream
|
|
||||||
var mapping =
|
|
||||||
(YamlMappingNode)yaml.Documents[0].RootNode;
|
|
||||||
|
|
||||||
foreach (var entry in mapping.Children)
|
|
||||||
{
|
|
||||||
output.WriteLine(((YamlScalarNode)entry.Key).Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// List all the items
|
|
||||||
var items = (YamlSequenceNode)mapping.Children[new YamlScalarNode("items")];
|
|
||||||
foreach (YamlMappingNode item in items)
|
|
||||||
{
|
|
||||||
output.WriteLine(
|
|
||||||
"{0}\t{1}",
|
|
||||||
item.Children[new YamlScalarNode("part_no")],
|
|
||||||
item.Children[new YamlScalarNode("descrip")]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private const string Document = @"---
|
|
||||||
receipt: Oz-Ware Purchase Invoice
|
|
||||||
date: 2007-08-06
|
|
||||||
customer:
|
|
||||||
given: Dorothy
|
|
||||||
family: Gale
|
|
||||||
|
|
||||||
items:
|
|
||||||
- part_no: A4786
|
|
||||||
descrip: Water Bucket (Filled)
|
|
||||||
price: 1.47
|
|
||||||
quantity: 4
|
|
||||||
|
|
||||||
- part_no: E1628
|
|
||||||
descrip: High Heeled ""Ruby"" Slippers
|
|
||||||
price: 100.27
|
|
||||||
quantity: 1
|
|
||||||
|
|
||||||
bill-to: &id001
|
|
||||||
street: |
|
|
||||||
123 Tornado Alley
|
|
||||||
Suite 16
|
|
||||||
city: East Westville
|
|
||||||
state: KS
|
|
||||||
|
|
||||||
ship-to: *id001
|
|
||||||
|
|
||||||
specialDelivery: >
|
|
||||||
Follow the Yellow Brick
|
|
||||||
Road to the Emerald City.
|
|
||||||
Pay no attention to the
|
|
||||||
man behind the curtain.
|
|
||||||
...";
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 28fd354d37e1bcb43baaff38988830a4
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
@@ -1,124 +0,0 @@
|
|||||||
// This file is part of YamlDotNet - A .NET library for YAML.
|
|
||||||
// Copyright (c) Antoine Aubry and contributors
|
|
||||||
//
|
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
// this software and associated documentation files (the "Software"), to deal in
|
|
||||||
// the Software without restriction, including without limitation the rights to
|
|
||||||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
// of the Software, and to permit persons to whom the Software is furnished to do
|
|
||||||
// so, subject to the following conditions:
|
|
||||||
//
|
|
||||||
// The above copyright notice and this permission notice shall be included in all
|
|
||||||
// copies or substantial portions of the Software.
|
|
||||||
//
|
|
||||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
// SOFTWARE.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using Xunit.Abstractions;
|
|
||||||
using YamlDotNet.Samples.Helpers;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace YamlDotNet.Samples
|
|
||||||
{
|
|
||||||
public class SerializeObjectGraph
|
|
||||||
{
|
|
||||||
private readonly ITestOutputHelper output;
|
|
||||||
|
|
||||||
public SerializeObjectGraph(ITestOutputHelper output)
|
|
||||||
{
|
|
||||||
this.output = output;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Sample(
|
|
||||||
DisplayName = "Serializing an object graph",
|
|
||||||
Description = "Shows how to convert an object to its YAML representation."
|
|
||||||
)]
|
|
||||||
public void Main()
|
|
||||||
{
|
|
||||||
var address = new Address
|
|
||||||
{
|
|
||||||
street = "123 Tornado Alley\nSuite 16",
|
|
||||||
city = "East Westville",
|
|
||||||
state = "KS"
|
|
||||||
};
|
|
||||||
|
|
||||||
var receipt = new Receipt
|
|
||||||
{
|
|
||||||
receipt = "Oz-Ware Purchase Invoice",
|
|
||||||
date = new DateTime(2007, 8, 6),
|
|
||||||
customer = new Customer
|
|
||||||
{
|
|
||||||
given = "Dorothy",
|
|
||||||
family = "Gale"
|
|
||||||
},
|
|
||||||
items = new Item[]
|
|
||||||
{
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
part_no = "A4786",
|
|
||||||
descrip = "Water Bucket (Filled)",
|
|
||||||
price = 1.47M,
|
|
||||||
quantity = 4
|
|
||||||
},
|
|
||||||
new Item
|
|
||||||
{
|
|
||||||
part_no = "E1628",
|
|
||||||
descrip = "High Heeled \"Ruby\" Slippers",
|
|
||||||
price = 100.27M,
|
|
||||||
quantity = 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
bill_to = address,
|
|
||||||
ship_to = address,
|
|
||||||
specialDelivery = "Follow the Yellow Brick\n" +
|
|
||||||
"Road to the Emerald City.\n" +
|
|
||||||
"Pay no attention to the\n" +
|
|
||||||
"man behind the curtain."
|
|
||||||
};
|
|
||||||
|
|
||||||
var serializer = new SerializerBuilder().Build();
|
|
||||||
var yaml = serializer.Serialize(receipt);
|
|
||||||
output.WriteLine(yaml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma warning disable IDE1006 // Naming Styles
|
|
||||||
public class Address
|
|
||||||
{
|
|
||||||
public string street { get; set; }
|
|
||||||
public string city { get; set; }
|
|
||||||
public string state { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Receipt
|
|
||||||
{
|
|
||||||
public string receipt { get; set; }
|
|
||||||
public DateTime date { get; set; }
|
|
||||||
public Customer customer { get; set; }
|
|
||||||
public Item[] items { get; set; }
|
|
||||||
public Address bill_to { get; set; }
|
|
||||||
public Address ship_to { get; set; }
|
|
||||||
public string specialDelivery { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Customer
|
|
||||||
{
|
|
||||||
public string given { get; set; }
|
|
||||||
public string family { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Item
|
|
||||||
{
|
|
||||||
public string part_no { get; set; }
|
|
||||||
public string descrip { get; set; }
|
|
||||||
public decimal price { get; set; }
|
|
||||||
public int quantity { get; set; }
|
|
||||||
}
|
|
||||||
#pragma warning restore IDE1006 // Naming Styles
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: dc19598abe764044f9baf52c06f5b8c9
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Reference in New Issue
Block a user