Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 47 additions & 0 deletions SetupMenuItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

#if UNITY_EDITOR
public static class SetupMenuItem
{
[MenuItem("QFSW/SSIE/Setup")]
public static void Setup()
{
string text =
File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "ProjectSettings/TagManager.asset"));
text = text.Replace("%YAML 1.1", "");
text = text.Replace("%TAG !u! tag:unity3d.com,2011:", "");
text = text.Replace("--- !u!78 &1", "");
var input = new StringReader(text);

var deserializer = new DeserializerBuilder().WithNamingConvention(new CamelCaseNamingConvention()).Build();

var obj = deserializer.Deserialize<Dictionary<string, object>>(input);
var tagManager = obj["TagManager"] as Dictionary<object, object>;
if (tagManager != null)
{
List<object> layers = tagManager["layers"] as List<object>;
if (layers != null && !layers.Contains("SelectableInversion"))
{
layers.Add("SelectableInversion");

var serializer = new SerializerBuilder().Build();
var yaml = serializer.Serialize(obj);

File.WriteAllLines(Path.Combine(Directory.GetCurrentDirectory(), "ProjectSettings/TagManager.asset"),
new[] {"%YAML 1.1\n%TAG !u! tag:unity3d.com,2011:\n--- !u!78 &1", yaml});

EditorUtility.DisplayDialog("SSIE", "Layer has been added to your project.", "Okay");
}
else
{
EditorUtility.DisplayDialog("SSIE", "Layer has already been added to your project.", "Okay");
}

}
}
}
#endif
9 changes: 9 additions & 0 deletions YamlDotNet/Core.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions YamlDotNet/Core/AnchorNotFoundException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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.Runtime.Serialization;

namespace YamlDotNet.Core
{
/// <summary>
/// The exception that is thrown when an alias references an anchor that does not exist.
/// </summary>
[Serializable]
public class AnchorNotFoundException : YamlException
{
/// <summary>
/// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
/// </summary>
public AnchorNotFoundException()
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
/// </summary>
/// <param name="message">The message.</param>
public AnchorNotFoundException(string message)
: base(message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
/// </summary>
public AnchorNotFoundException(Mark start, Mark end, string message)
: base(start, end, message)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="AnchorNotFoundException"/> class.
/// </summary>
/// <param name="message">The message.</param>
/// <param name="inner">The inner.</param>
public AnchorNotFoundException(string message, Exception inner)
: base(message, inner)
{
}

}
}
12 changes: 12 additions & 0 deletions YamlDotNet/Core/AnchorNotFoundException.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

182 changes: 182 additions & 0 deletions YamlDotNet/Core/CharacterAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
// 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.Diagnostics;
using System.Linq;

namespace YamlDotNet.Core
{
[Serializable]
internal class CharacterAnalyzer<TBuffer> where TBuffer : ILookAheadBuffer
{
private readonly TBuffer buffer;

public CharacterAnalyzer(TBuffer buffer)
{
this.buffer = buffer;
}

public TBuffer Buffer
{
get
{
return buffer;
}
}

public bool EndOfInput
{
get
{
return buffer.EndOfInput;
}
}

public char Peek(int offset)
{
return buffer.Peek(offset);
}

public void Skip(int length)
{
buffer.Skip(length);
}

public bool IsAlphaNumericDashOrUnderscore(int offset = 0)
{
var character = buffer.Peek(offset);
return
(character >= '0' && character <= '9') ||
(character >= 'A' && character <= 'Z') ||
(character >= 'a' && character <= 'z') ||
character == '_' ||
character == '-';
}

public bool IsAscii(int offset = 0)
{
return buffer.Peek(offset) <= '\x7F';
}

public bool IsPrintable(int offset = 0)
{
var character = buffer.Peek(offset);
return
character == '\x9' ||
character == '\xA' ||
character == '\xD' ||
(character >= '\x20' && character <= '\x7E') ||
character == '\x85' ||
(character >= '\xA0' && character <= '\xD7FF') ||
(character >= '\xE000' && character <= '\xFFFD');
}

public bool IsDigit(int offset = 0)
{
var character = buffer.Peek(offset);
return character >= '0' && character <= '9';
}

public int AsDigit(int offset = 0)
{
return buffer.Peek(offset) - '0';
}

public bool IsHex(int offset)
{
var character = buffer.Peek(offset);
return
(character >= '0' && character <= '9') ||
(character >= 'A' && character <= 'F') ||
(character >= 'a' && character <= 'f');
}

public int AsHex(int offset)
{
var character = buffer.Peek(offset);

if (character <= '9')
{
return character - '0';
}
if (character <= 'F')
{
return character - 'A' + 10;
}
return character - 'a' + 10;
}

public bool IsSpace(int offset = 0)
{
return Check(' ', offset);
}

public bool IsZero(int offset = 0)
{
return Check('\0', offset);
}

public bool IsTab(int offset = 0)
{
return Check('\t', offset);
}

public bool IsWhite(int offset = 0)
{
return IsSpace(offset) || IsTab(offset);
}

public bool IsBreak(int offset = 0)
{
return Check("\r\n\x85\x2028\x2029", offset);
}

public bool IsCrLf(int offset = 0)
{
return Check('\r', offset) && Check('\n', offset + 1);
}

public bool IsBreakOrZero(int offset = 0)
{
return IsBreak(offset) || IsZero(offset);
}

public bool IsWhiteBreakOrZero(int offset = 0)
{
return IsWhite(offset) || IsBreakOrZero(offset);
}

public bool Check(char expected, int offset = 0)
{
return buffer.Peek(offset) == expected;
}

public bool Check(string expectedCharacters, int offset = 0)
{
// Todo: using it this way doesn't break anything, it's not realy wrong...
Debug.Assert(expectedCharacters.Length > 1, "Use Check(char, int) instead.");

var character = buffer.Peek(offset);
return expectedCharacters.IndexOf(character) != -1;
}
}
}
12 changes: 12 additions & 0 deletions YamlDotNet/Core/CharacterAnalyzer.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 44 additions & 0 deletions YamlDotNet/Core/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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 YamlDotNet.Core.Tokens;

namespace YamlDotNet.Core
{
/// <summary>
/// Defines constants thar relate to the YAML specification.
/// </summary>
internal static class Constants
{
public static readonly TagDirective[] DefaultTagDirectives =
{
new TagDirective("!", "!"),
new TagDirective("!!", "tag:yaml.org,2002:")
};

public const int MajorVersion = 1;
public const int MinorVersion = 1;

public const char HandleCharacter = '!';
public const string DefaultHandle = "!";
}
}
12 changes: 12 additions & 0 deletions YamlDotNet/Core/Constants.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading