Remove extensions.
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9bd9e24d7c553341a2a12391843542f
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,189 +0,0 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Common.Math;
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.Bestdori {
|
||||
public class BestdoriChartConverter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".bestdori" };
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
List<Resource> result = new List<Resource>();
|
||||
List<BestdoriChartEvent> src;
|
||||
using (var reader = new StreamReader(file.FullName)) {
|
||||
src = JsonConvert.DeserializeObject<List<BestdoriChartEvent>>(reader.ReadToEnd());
|
||||
}
|
||||
var group = new Chart.Group() {
|
||||
tracks = new List<Chart.Track>(),
|
||||
notes = new List<Chart.Note>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
};
|
||||
Chart chart = new Chart {
|
||||
format = 2,
|
||||
time = new BeatTime(0, 0, 1),
|
||||
ruleset = "bang_dream_girls_band_party",
|
||||
sigs = new List<Chart.Signature>(),
|
||||
sounds = new List<Chart.Sound>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
groups = new List<Chart.Group> { group },
|
||||
};
|
||||
var tm = new BeatTimeTimingModel();
|
||||
string bgm = null;
|
||||
double endbeat = 0;
|
||||
foreach (var ev in src) {
|
||||
tm.ForwardTo(ev.StartBeat);
|
||||
if (ev.StartBeat > endbeat) endbeat = ev.StartBeat;
|
||||
if (ev is BestdoriChartEvent.System) {
|
||||
if (bgm != null) continue;
|
||||
var tev = (BestdoriChartEvent.System)ev;
|
||||
bgm = StringUtils.TrimExt(tev.data);
|
||||
var name = "bang_dream_girls_band_party__" + bgm;
|
||||
result.Add(new SongResource(name, new FileInfo(Path.Combine(file.Directory.FullName, tev.data))));
|
||||
chart.sounds.Add(new Chart.Sound { time = ToBeatTime(tev.beat), id = name });
|
||||
}
|
||||
else if (ev is BestdoriChartEvent.BPM) {
|
||||
var tev = (BestdoriChartEvent.BPM)ev;
|
||||
tm.BPM = tev.bpm;
|
||||
chart.sigs.Add(new Chart.Signature { time = ToBeatTime(tev.beat), tempo = (float)tev.bpm });
|
||||
}
|
||||
else if (ev is BestdoriChartEvent.Single) {
|
||||
var tev = (BestdoriChartEvent.Single)ev;
|
||||
group.notes.Add(new Chart.Note {
|
||||
time = ToBeatTime(tev.beat),
|
||||
judges = new List<Chart.Judge> { new Chart.Judge { name = tev.flick ? "single_flick" : "single" } },
|
||||
motions = new List<Chart.Motion> { new Chart.Motion { motion = "track:" + tev.lane.ToString(CultureInfo.InvariantCulture) } },
|
||||
});
|
||||
}
|
||||
else if (ev is BestdoriChartEvent.Long) {
|
||||
var tev = (BestdoriChartEvent.Long)ev;
|
||||
var c1 = tev.connections[tev.connections.Count - 1];
|
||||
var note = new Chart.Note {
|
||||
time = ToBeatTime(tev.connections[0].beat),
|
||||
endtime = ToBeatTime(c1.beat),
|
||||
judges = new List<Chart.Judge>(),
|
||||
};
|
||||
for (int i = 0; i < tev.connections.Count; i++) {
|
||||
BestdoriChartEvent.Connection c = tev.connections[i];
|
||||
var motion = new Chart.Motion { motion = "track:" + c.lane.ToString(CultureInfo.InvariantCulture) };
|
||||
if (i == 0) {
|
||||
note.judges.Add(new Chart.Judge { name = "single" });
|
||||
note.motions.Add(motion);
|
||||
}
|
||||
else {
|
||||
var cbeat = motion.endtime = ToBeatTime(c.beat);
|
||||
if (i > 1) motion.time = ToBeatTime(tev.connections[i - 1].beat);
|
||||
note.motions.Add(motion);
|
||||
if (i == tev.connections.Count - 1)
|
||||
note.judges.Add(new Chart.Judge { time = cbeat, name = c.flick ? "longend_flick" : "longend" });
|
||||
else if (!c.hidden)
|
||||
note.judges.Add(new Chart.Judge { time = cbeat, name = "longnode" });
|
||||
}
|
||||
}
|
||||
if (c1.beat > endbeat) endbeat = c1.beat;
|
||||
group.notes.Add(note);
|
||||
}
|
||||
else throw new NotImplementedException("Unsupported event: " + ev.type);
|
||||
}
|
||||
if (bgm == null) throw new FormatException("Chart contains no song");
|
||||
chart.endtime = ToBeatTime(endbeat + 4);
|
||||
if (endbeat > tm.BeatTime) tm.ForwardTo(endbeat);
|
||||
result.Add(new RawChartResource(string.Format("bang_dream_girls_band_party__{0}__{1}", bgm, StringUtils.TrimExt(file.Name)), chart, new ChartMeta {
|
||||
name = string.Format("Bandori {0} {1}", bgm, StringUtils.TrimExt(file.Name)),
|
||||
author = "©BanG Dream! Project ©Craft Egg Inc. ©bushiroad",
|
||||
ruleset = "bang_dream_girls_band_party",
|
||||
note_count = group.notes.Count,
|
||||
length = (float)tm.Time,
|
||||
song = new SongMetaInfo {
|
||||
name = bgm,
|
||||
author = "©BanG Dream! Project ©Craft Egg Inc. ©bushiroad",
|
||||
}
|
||||
}));
|
||||
return result;
|
||||
}
|
||||
|
||||
BeatTime ToBeatTime(double beat, double error = 1e-4) {
|
||||
int i, n, d;
|
||||
FractionUtils.ToFraction(beat, error, out n, out d);
|
||||
i = n / d; n %= d;
|
||||
return new BeatTime(i, n, d);
|
||||
}
|
||||
|
||||
#pragma warning disable IDE1006
|
||||
[JsonConverter(typeof(BestdoriChartEventCreator))]
|
||||
abstract class BestdoriChartEvent {
|
||||
public abstract string type { get; }
|
||||
public abstract double StartBeat { get; }
|
||||
public abstract class InstantEvent : BestdoriChartEvent {
|
||||
public double beat;
|
||||
public override double StartBeat { get { return beat; } }
|
||||
}
|
||||
public class BPM : InstantEvent {
|
||||
public override string type { get { return "BPM"; } }
|
||||
public double bpm;
|
||||
}
|
||||
public class System : InstantEvent {
|
||||
public override string type { get { return "System"; } }
|
||||
public string data;
|
||||
}
|
||||
public abstract class SingleBase : InstantEvent {
|
||||
public double lane;
|
||||
public bool skill;
|
||||
public bool flick;
|
||||
}
|
||||
public class Single : SingleBase {
|
||||
public override string type { get { return "Single"; } }
|
||||
}
|
||||
public class Directional : SingleBase {
|
||||
public override string type { get { return "Directional"; } }
|
||||
public string direction;
|
||||
public int width;
|
||||
}
|
||||
public class Connection : SingleBase {
|
||||
public override string type { get { return null; } }
|
||||
public bool hidden;
|
||||
}
|
||||
public class Long : BestdoriChartEvent {
|
||||
public override string type { get { return "Long"; } }
|
||||
public List<Connection> connections;
|
||||
public override double StartBeat { get { return connections[0].beat; } }
|
||||
}
|
||||
public class Slide : Long {
|
||||
public override string type { get { return "Slide"; } }
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
class BestdoriChartEventCreator : CustomCreationConverter<BestdoriChartEvent> {
|
||||
string _currentType;
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) {
|
||||
var obj = JObject.ReadFrom(reader);
|
||||
var type = obj["type"];
|
||||
if (type == null) _currentType = null;
|
||||
else _currentType = obj["type"].ToObject<string>();
|
||||
return base.ReadJson(obj.CreateReader(), objectType, existingValue, serializer);
|
||||
}
|
||||
|
||||
public override BestdoriChartEvent Create(Type objectType) {
|
||||
switch (_currentType) {
|
||||
case "BPM": return new BestdoriChartEvent.BPM();
|
||||
case "System": return new BestdoriChartEvent.System();
|
||||
case "Single": return new BestdoriChartEvent.Single();
|
||||
case "Directional": return new BestdoriChartEvent.Directional();
|
||||
case null: return new BestdoriChartEvent.Connection();
|
||||
case "Long": return new BestdoriChartEvent.Long();
|
||||
case "Slide": return new BestdoriChartEvent.Slide();
|
||||
default: throw new ArgumentException("Unknown event type: " + _currentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3c5a8bf05d5e284ba498e91cb0dd35e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,27 +0,0 @@
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Cryville.Crtr.Extensions.Bestdori;
|
||||
using Cryville.Crtr.Extensions.Malody;
|
||||
using Cryville.Crtr.Extensions.osu;
|
||||
using Cryville.Crtr.Extensions.Quaver;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cryville.Crtr.Extensions {
|
||||
public class Extensions : ExtensionInterface {
|
||||
public override IEnumerable<ResourceConverter> GetResourceConverters() {
|
||||
return new ResourceConverter[] {
|
||||
new BestdoriChartConverter(),
|
||||
new MalodyChartConverter(),
|
||||
new osuChartConverter(),
|
||||
new QuaverChartConverter(),
|
||||
};
|
||||
}
|
||||
|
||||
public override IEnumerable<LocalResourceFinder> GetResourceFinders() {
|
||||
return new LocalResourceFinder[] {
|
||||
new MalodyChartFinder(),
|
||||
new osuChartFinder(),
|
||||
new QuaverChartFinder(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23377bf2926d93a4b8e3f3ab6040c7f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfd44d1c0681e4842a1f031556519042
|
||||
folderAsset: yes
|
||||
timeCreated: 1637936550
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,225 +0,0 @@
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.Malody {
|
||||
public class MalodyChartConverter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".mc", ".mcz" };
|
||||
static readonly string[] MODES = { "key", "step", "dj", "catch", "pad", "taiko", "ring", "slide", "live" };
|
||||
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
List<Resource> result = new List<Resource>();
|
||||
MalodyChart src;
|
||||
if (file.Extension != ".mc") throw new NotImplementedException("mcz file is not supported yet");
|
||||
using (var reader = new StreamReader(file.FullName)) {
|
||||
src = JsonConvert.DeserializeObject<MalodyChart>(reader.ReadToEnd());
|
||||
}
|
||||
if (src.meta.mode != 0) throw new NotImplementedException(string.Format("{0} mode is not supported yet", MODES[src.meta.mode]));
|
||||
|
||||
var ruleset = "malody!" + MODES[src.meta.mode];
|
||||
if (src.meta.mode == 0) {
|
||||
ruleset += "." + src.meta.mode_ext.column.ToString(CultureInfo.InvariantCulture) + "k";
|
||||
}
|
||||
|
||||
ChartMeta meta = new ChartMeta() {
|
||||
name = src.meta.version,
|
||||
author = src.meta.creator,
|
||||
song = new SongMetaInfo() {
|
||||
name = src.meta.song.titleorg != null ? src.meta.song.titleorg : src.meta.song.title,
|
||||
author = src.meta.song.artistorg != null ? src.meta.song.artistorg : src.meta.song.artist,
|
||||
},
|
||||
ruleset = ruleset,
|
||||
};
|
||||
|
||||
Chart chart = new Chart {
|
||||
format = 2,
|
||||
time = new BeatTime(-4, 0, 1),
|
||||
ruleset = ruleset,
|
||||
sigs = new List<Chart.Signature>(),
|
||||
sounds = new List<Chart.Sound>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
groups = new List<Chart.Group>(),
|
||||
};
|
||||
var group = new Chart.Group() {
|
||||
tracks = new List<Chart.Track>(),
|
||||
notes = new List<Chart.Note>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
};
|
||||
chart.groups.Add(group);
|
||||
int col = src.meta.mode_ext.column;
|
||||
|
||||
IEnumerable<MalodyChart.IEvent> events = src.time.Cast<MalodyChart.IEvent>();
|
||||
if (src.effect != null) events = events.Concat(src.effect.Cast<MalodyChart.IEvent>());
|
||||
events = events.Concat(src.note.Cast<MalodyChart.IEvent>());
|
||||
List<MalodyChart.IEvent> endEvents = new List<MalodyChart.IEvent>();
|
||||
foreach (var ev in events)
|
||||
if (ev.endbeat != null)
|
||||
endEvents.Add(new MalodyChart.EndEvent {
|
||||
beat = ev.endbeat,
|
||||
StartEvent = ev,
|
||||
});
|
||||
events = events.Concat(endEvents)
|
||||
.OrderBy(e => e.beat[0] + (float)e.beat[1] / e.beat[2])
|
||||
.ThenBy(e => e.Priority);
|
||||
|
||||
Dictionary<MalodyChart.IEvent, StartEventState> longEvents
|
||||
= new Dictionary<MalodyChart.IEvent, StartEventState>();
|
||||
|
||||
float? baseBpm = null;
|
||||
var tm = new FractionalBeatTimeTimingModel();
|
||||
foreach (var ev in events) {
|
||||
var beat = new BeatTime(ev.beat[0], ev.beat[1], ev.beat[2]);
|
||||
tm.ForwardTo(beat);
|
||||
if (ev is MalodyChart.Time) {
|
||||
var tev = (MalodyChart.Time)ev;
|
||||
if (baseBpm == null) baseBpm = tev.bpm;
|
||||
tm.BPM = tev.bpm;
|
||||
chart.sigs.Add(new Chart.Signature {
|
||||
time = beat,
|
||||
tempo = tev.bpm,
|
||||
});
|
||||
chart.motions.Add(new Chart.Motion {
|
||||
time = beat,
|
||||
motion = "svm:" + (tev.bpm / baseBpm.Value).ToString(CultureInfo.InvariantCulture)
|
||||
});
|
||||
}
|
||||
else if (ev is MalodyChart.Effect) {
|
||||
var tev = (MalodyChart.Effect)ev;
|
||||
if (tev.scroll != null) group.motions.Add(new Chart.Motion {
|
||||
time = beat,
|
||||
motion = "svm:" + tev.scroll.Value.ToString(CultureInfo.InvariantCulture)
|
||||
});
|
||||
}
|
||||
else if (ev is MalodyChart.Note) {
|
||||
var tev = (MalodyChart.Note)ev;
|
||||
if (tev.type == 1) {
|
||||
if (tev.beat[0] == 0 && tev.beat[1] == 0) {
|
||||
var res = new SongResource(meta.song.name, new FileInfo(file.DirectoryName + "/" + tev.sound));
|
||||
result.Add(res);
|
||||
chart.sounds.Add(new Chart.Sound {
|
||||
time = new BeatTime(0, 0, 1),
|
||||
id = res.Name,
|
||||
offset = -tev.offset / 1000f,
|
||||
});
|
||||
}
|
||||
else throw new NotImplementedException("Key sounds are not supported yet");
|
||||
}
|
||||
else {
|
||||
var rn = new Chart.Note() {
|
||||
time = beat,
|
||||
motions = new List<Chart.Motion> {
|
||||
new Chart.Motion() { motion = "track:" + tev.column.ToString(CultureInfo.InvariantCulture) }
|
||||
},
|
||||
};
|
||||
if (tev.endbeat != null) {
|
||||
rn.endtime = new BeatTime(tev.endbeat[0], tev.endbeat[1], tev.endbeat[2]);
|
||||
longEvents.Add(ev, new StartEventState {
|
||||
Destination = rn,
|
||||
Time = tm.Time,
|
||||
});
|
||||
}
|
||||
group.notes.Add(rn);
|
||||
}
|
||||
}
|
||||
else if (ev is MalodyChart.EndEvent) {
|
||||
var tev = (MalodyChart.EndEvent)ev;
|
||||
if (tev.StartEvent is MalodyChart.Note) {
|
||||
var sev = tev.StartEvent;
|
||||
longEvents.Remove(sev);
|
||||
}
|
||||
else throw new NotSupportedException("Unrecognized long event");
|
||||
}
|
||||
else throw new NotSupportedException("Unrecognized event");
|
||||
}
|
||||
var endbeat = tm.FractionalBeatTime;
|
||||
endbeat.b += 4;
|
||||
chart.endtime = endbeat;
|
||||
meta.length = (float)tm.Time;
|
||||
meta.note_count = group.notes.Count;
|
||||
string chartName = string.Format("{0} - {1}", meta.song.name, meta.name);
|
||||
if (src.meta.background != null) {
|
||||
meta.cover = src.meta.background;
|
||||
}
|
||||
result.Add(new RawChartResource(chartName, chart, meta));
|
||||
return result;
|
||||
}
|
||||
|
||||
struct StartEventState {
|
||||
public double Time { get; set; }
|
||||
public ChartEvent Destination { get; set; }
|
||||
}
|
||||
|
||||
#pragma warning disable IDE1006
|
||||
struct MalodyChart {
|
||||
public interface IEvent {
|
||||
int[] beat { get; set; }
|
||||
int[] endbeat { get; set; }
|
||||
int Priority { get; }
|
||||
}
|
||||
public struct EndEvent : IEvent {
|
||||
public int[] beat { get; set; }
|
||||
public int[] endbeat { get; set; }
|
||||
public IEvent StartEvent { get; set; }
|
||||
public int Priority { get { return StartEvent.Priority - 1; } }
|
||||
}
|
||||
|
||||
public Meta meta;
|
||||
public struct Meta {
|
||||
public SongInfo song;
|
||||
public struct SongInfo {
|
||||
public string title;
|
||||
public string artist;
|
||||
public string titleorg;
|
||||
public string artistorg;
|
||||
}
|
||||
|
||||
public string background;
|
||||
|
||||
public string creator;
|
||||
public string version;
|
||||
|
||||
public int mode;
|
||||
public ModeExt mode_ext;
|
||||
public struct ModeExt {
|
||||
public int column;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Time> time;
|
||||
public struct Time : IEvent {
|
||||
public int[] beat { get; set; }
|
||||
public int[] endbeat { get; set; }
|
||||
public float bpm;
|
||||
public int Priority { get { return -2; } }
|
||||
}
|
||||
|
||||
public List<Effect> effect;
|
||||
public struct Effect : IEvent {
|
||||
public int[] beat { get; set; }
|
||||
public int[] endbeat { get; set; }
|
||||
public float? scroll;
|
||||
public int Priority { get { return 0; } }
|
||||
}
|
||||
|
||||
public List<Note> note;
|
||||
public struct Note : IEvent {
|
||||
public int[] beat { get; set; }
|
||||
public int[] endbeat { get; set; }
|
||||
public int column;
|
||||
public string sound;
|
||||
public int offset;
|
||||
public int type;
|
||||
public int Priority { get { return 0; } }
|
||||
}
|
||||
}
|
||||
#pragma warning restore IDE1006
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b3624013a6911ba45933085332724ff1
|
||||
timeCreated: 1637936498
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,47 +0,0 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.Malody {
|
||||
public class MalodyChartFinder : LocalResourceFinder {
|
||||
public override string Name { get { return "Malody beatmaps"; } }
|
||||
|
||||
public override string GetRootPath() {
|
||||
var malodyDataPath = GetMalodyDataPath();
|
||||
var malodyConfigPath = Path.Combine(malodyDataPath, "config.json");
|
||||
if (File.Exists(malodyConfigPath)) {
|
||||
using (var reader = new StreamReader(malodyConfigPath, Encoding.UTF8)) {
|
||||
var config = JsonConvert.DeserializeObject<Dictionary<string, object>>(reader.ReadToEnd());
|
||||
object userPath;
|
||||
if (config.TryGetValue("user_chart_path", out userPath)) {
|
||||
var strUserPath = userPath as string;
|
||||
if (!string.IsNullOrEmpty(strUserPath)) {
|
||||
return strUserPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Path.Combine(malodyDataPath, "beatmap");
|
||||
}
|
||||
|
||||
string GetMalodyDataPath() {
|
||||
switch (Environment.OSVersion.Platform) {
|
||||
case PlatformID.Unix:
|
||||
return "/storage/emulated/0/data/malody";
|
||||
case PlatformID.Win32NT:
|
||||
var reg = Registry.ClassesRoot.OpenSubKey(@"malody\Shell\Open\Command");
|
||||
if (reg == null) return null;
|
||||
var pathObj = reg.GetValue(null);
|
||||
if (pathObj == null) return null;
|
||||
var path = (string)pathObj;
|
||||
return new FileInfo(StringUtils.GetProcessPathFromCommand(path)).Directory.FullName;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c9beaff62143a2468e18ad4642232c0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6823ead66b33bc048bbad48719feb25d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,154 +0,0 @@
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Quaver.API.Maps;
|
||||
using Quaver.API.Maps.Structures;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.Quaver {
|
||||
public class QuaverChartConverter : ResourceConverter {
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".qua" };
|
||||
const double OFFSET = 0.05;
|
||||
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
List<Resource> result = new List<Resource>();
|
||||
var src = Qua.Parse(file.FullName);
|
||||
var ruleset = "quaver!" + src.Mode.ToString().ToLower();
|
||||
var meta = new ChartMeta {
|
||||
name = src.DifficultyName,
|
||||
author = src.Creator,
|
||||
song = new SongMetaInfo {
|
||||
name = src.Title,
|
||||
author = src.Artist,
|
||||
},
|
||||
ruleset = ruleset,
|
||||
cover = src.BackgroundFile,
|
||||
note_count = src.HitObjects.Count,
|
||||
};
|
||||
var chart = new Chart {
|
||||
format = 2,
|
||||
time = new BeatTime(-4, 0, 1),
|
||||
ruleset = ruleset,
|
||||
sigs = new List<Chart.Signature>(),
|
||||
sounds = new List<Chart.Sound> {
|
||||
new Chart.Sound { time = new BeatTime(0, 0, 1), id = src.Title, offset = (float)(src.TimingPoints[0].StartTime / 1e3 + OFFSET) }
|
||||
},
|
||||
motions = new List<Chart.Motion>(),
|
||||
groups = new List<Chart.Group>(),
|
||||
};
|
||||
var group = new Chart.Group() {
|
||||
tracks = new List<Chart.Track>(),
|
||||
notes = new List<Chart.Note>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
};
|
||||
chart.groups.Add(group);
|
||||
result.Add(new RawChartResource(string.Format("{0} - {1}", meta.song.name, meta.name), chart, meta));
|
||||
result.Add(new SongResource(meta.song.name, new FileInfo(Path.Combine(file.DirectoryName, src.AudioFile))));
|
||||
|
||||
var evs = new List<EventWrapper>();
|
||||
foreach (var e in src.HitObjects) evs.Add(new EventWrapper.HitObject(e));
|
||||
foreach (var e in src.SliderVelocities) evs.Add(new EventWrapper.SliderVelocity(e));
|
||||
foreach (var e in src.SoundEffects) evs.Add(new EventWrapper.SoundEffect(e));
|
||||
foreach (var e in src.TimingPoints) evs.Add(new EventWrapper.TimingPoint(e));
|
||||
var evc = evs.Count;
|
||||
for (int i = 0; i < evc; i++) if (evs[i].IsLong) evs.Add(new EventWrapper.EndEvent(evs[i]));
|
||||
evs.Sort();
|
||||
|
||||
var longevs = new Dictionary<EventWrapper, ChartEvent>();
|
||||
var tm = new TimeTimingModel(src.TimingPoints[0].StartTime / 1e3, 2e-3);
|
||||
foreach (var ev in evs) {
|
||||
tm.ForwardTo(ev.StartTime / 1e3);
|
||||
if (ev is EventWrapper.HitObject) {
|
||||
var tev = (EventWrapper.HitObject)ev;
|
||||
var rn = new Chart.Note {
|
||||
time = tm.FractionalBeatTime,
|
||||
motions = new List<Chart.Motion> {
|
||||
new Chart.Motion { motion = string.Format(CultureInfo.InvariantCulture, "track:{0}", tev.Event.Lane - 1) }
|
||||
},
|
||||
};
|
||||
if (ev.IsLong) longevs.Add(ev, rn);
|
||||
group.notes.Add(rn);
|
||||
}
|
||||
else if (ev is EventWrapper.SliderVelocity) {
|
||||
var tev = (EventWrapper.SliderVelocity)ev;
|
||||
group.motions.Add(new Chart.Motion {
|
||||
time = tm.FractionalBeatTime,
|
||||
motion = string.Format(CultureInfo.InvariantCulture, "svm:{0}", tev.Event.Multiplier),
|
||||
});
|
||||
}
|
||||
else if (ev is EventWrapper.TimingPoint) {
|
||||
var tev = (EventWrapper.TimingPoint)ev;
|
||||
tm.BPM = tev.Event.Bpm;
|
||||
tm.ForceSnap();
|
||||
chart.sigs.Add(new Chart.Signature {
|
||||
time = tm.FractionalBeatTime,
|
||||
tempo = tev.Event.Bpm,
|
||||
});
|
||||
}
|
||||
else if (ev is EventWrapper.EndEvent) {
|
||||
var tev = (EventWrapper.EndEvent)ev;
|
||||
var oev = tev.Original;
|
||||
longevs[oev].endtime = tm.FractionalBeatTime;
|
||||
}
|
||||
else throw new NotSupportedException("Sound effects are not supported yet");
|
||||
}
|
||||
var endbeat = tm.FractionalBeatTime;
|
||||
endbeat.b += 4;
|
||||
chart.endtime = endbeat;
|
||||
meta.length = (float)tm.Time;
|
||||
return result;
|
||||
}
|
||||
|
||||
abstract class EventWrapper : IComparable<EventWrapper> {
|
||||
public abstract int StartTime { get; }
|
||||
public abstract int EndTime { get; }
|
||||
public bool IsLong { get { return EndTime > 0; } }
|
||||
public abstract int Priority { get; }
|
||||
public int CompareTo(EventWrapper other) {
|
||||
var c = StartTime.CompareTo(other.StartTime);
|
||||
if (c != 0) return c;
|
||||
return Priority.CompareTo(other.Priority);
|
||||
}
|
||||
public class HitObject : EventWrapper {
|
||||
public HitObjectInfo Event;
|
||||
public HitObject(HitObjectInfo ev) { Event = ev; }
|
||||
public override int StartTime { get { return Event.StartTime; } }
|
||||
public override int EndTime { get { return Event.EndTime; } }
|
||||
public override int Priority { get { return 0; } }
|
||||
}
|
||||
public class SliderVelocity : EventWrapper {
|
||||
public SliderVelocityInfo Event;
|
||||
public SliderVelocity(SliderVelocityInfo ev) { Event = ev; }
|
||||
public override int StartTime { get { return (int)Event.StartTime; } }
|
||||
public override int EndTime { get { return 0; } }
|
||||
public override int Priority { get { return 0; } }
|
||||
}
|
||||
public class SoundEffect : EventWrapper {
|
||||
public SoundEffectInfo Event;
|
||||
public SoundEffect(SoundEffectInfo ev) { Event = ev; }
|
||||
public override int StartTime { get { return (int)Event.StartTime; } }
|
||||
public override int EndTime { get { return 0; } }
|
||||
public override int Priority { get { return 0; } }
|
||||
}
|
||||
public class TimingPoint : EventWrapper {
|
||||
public TimingPointInfo Event;
|
||||
public TimingPoint(TimingPointInfo ev) { Event = ev; }
|
||||
public override int StartTime { get { return (int)Event.StartTime; } }
|
||||
public override int EndTime { get { return 0; } }
|
||||
public override int Priority { get { return -2; } }
|
||||
}
|
||||
public class EndEvent : EventWrapper {
|
||||
public EventWrapper Original;
|
||||
public EndEvent(EventWrapper ev) { if (!ev.IsLong) throw new ArgumentException("Event is not long"); Original = ev; }
|
||||
public override int StartTime { get { return Original.EndTime; } }
|
||||
public override int EndTime { get { return 0; } }
|
||||
public override int Priority { get { return Original.Priority - 1; } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b073cac7ce0d41a4f8ca589845678aa2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,24 +0,0 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.Quaver {
|
||||
public class QuaverChartFinder : LocalResourceFinder {
|
||||
public override string Name { get { return "Quaver beatmaps"; } }
|
||||
|
||||
public override string GetRootPath() {
|
||||
switch (Environment.OSVersion.Platform) {
|
||||
case PlatformID.Win32NT:
|
||||
var reg = Registry.ClassesRoot.OpenSubKey(@"quaver\Shell\Open\Command");
|
||||
if (reg == null) return null;
|
||||
var pathObj = reg.GetValue(null);
|
||||
if (pathObj == null) return null;
|
||||
var path = (string)pathObj;
|
||||
return Path.Combine(new FileInfo(StringUtils.GetProcessPathFromCommand(path)).Directory.FullName, "Songs");
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 68bacf7746cbeea42a78a7d55cfdbea0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,65 +0,0 @@
|
||||
using Cryville.Common.Math;
|
||||
using System;
|
||||
|
||||
namespace Cryville.Crtr.Extensions {
|
||||
public abstract class TimingModel {
|
||||
public double Time { get; protected set; }
|
||||
public double BeatTime { get; protected set; }
|
||||
public BeatTime FractionalBeatTime { get; protected set; }
|
||||
double m_bpm;
|
||||
public double BPM { get { return m_bpm; } set { m_bpm = value; } }
|
||||
public double BeatLength { get { return 60 / m_bpm; } set { m_bpm = 60 / value; } }
|
||||
public TimingModel(double offset) {
|
||||
Time = offset;
|
||||
FractionalBeatTime = new BeatTime(0, 0, 1);
|
||||
}
|
||||
}
|
||||
public class FractionalBeatTimeTimingModel : TimingModel {
|
||||
public FractionalBeatTimeTimingModel(double offset = 0) : base(offset) { }
|
||||
public void ForwardTo(BeatTime t) {
|
||||
if (t == FractionalBeatTime) return;
|
||||
if (BPM == 0) throw new InvalidOperationException("BPM not determined");
|
||||
FractionalBeatTime = t;
|
||||
var nt = t.Decimal;
|
||||
Time += (nt - BeatTime) / BPM * 60;
|
||||
BeatTime = nt;
|
||||
}
|
||||
}
|
||||
public class BeatTimeTimingModel : TimingModel {
|
||||
public BeatTimeTimingModel(double offset = 0) : base(offset) { }
|
||||
public void ForwardTo(double t) {
|
||||
if (t == BeatTime) return;
|
||||
if (BPM == 0) throw new InvalidOperationException("BPM not determined");
|
||||
Time += (t - BeatTime) / BPM * 60;
|
||||
BeatTime = t;
|
||||
FractionalBeatTime = ToBeatTime(t);
|
||||
}
|
||||
static BeatTime ToBeatTime(double beat, double error = 1e-4) {
|
||||
int i, n, d;
|
||||
FractionUtils.ToFraction(beat, error, out n, out d);
|
||||
i = n / d; n %= d;
|
||||
return new BeatTime(i, n, d);
|
||||
}
|
||||
}
|
||||
public class TimeTimingModel : TimingModel {
|
||||
public readonly double InputTimeAccuracy;
|
||||
public TimeTimingModel(double offset = 0, double accuracy = 2e-3) : base(offset) {
|
||||
if (accuracy <= 0) throw new ArgumentOutOfRangeException("accuracy");
|
||||
InputTimeAccuracy = accuracy;
|
||||
}
|
||||
public void ForwardTo(double t) {
|
||||
if (t == Time) return;
|
||||
if (BPM == 0) throw new InvalidOperationException("BPM not determined");
|
||||
BeatTime += (t - Time) * BPM / 60;
|
||||
int n, d;
|
||||
FractionUtils.ToFraction(BeatTime, Math.Min(1, InputTimeAccuracy * BPM / 60), out n, out d);
|
||||
FractionalBeatTime = new BeatTime(n, d);
|
||||
Time = t;
|
||||
}
|
||||
public void ForceSnap() {
|
||||
var alignedBeat = (int)Math.Round(BeatTime);
|
||||
BeatTime = alignedBeat;
|
||||
FractionalBeatTime = new BeatTime(alignedBeat, 1);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5c4a1fab8f53dd742ba6501d682eb7f6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dbc046e7cabacbb4fbf74520399a7340
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,384 +0,0 @@
|
||||
using Cryville.Crtr.Browsing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.osu {
|
||||
#pragma warning disable IDE1006
|
||||
public class osuChartConverter : ResourceConverter {
|
||||
#pragma warning restore IDE1006
|
||||
static readonly string[] SUPPORTED_FORMATS = { ".osu" };
|
||||
const double OFFSET = 0.011;
|
||||
|
||||
public override string[] GetSupportedFormats() {
|
||||
return SUPPORTED_FORMATS;
|
||||
}
|
||||
|
||||
public override IEnumerable<Resource> ConvertFrom(FileInfo file) {
|
||||
List<Resource> result = new List<Resource>();
|
||||
var meta = new ChartMeta { song = new SongMetaInfo() };
|
||||
var group = new Chart.Group() {
|
||||
tracks = new List<Chart.Track>(),
|
||||
notes = new List<Chart.Note>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
};
|
||||
var chart = new Chart {
|
||||
format = 2,
|
||||
time = new BeatTime(-4, 0, 1),
|
||||
sigs = new List<Chart.Signature>(),
|
||||
sounds = new List<Chart.Sound>(),
|
||||
motions = new List<Chart.Motion>(),
|
||||
groups = new List<Chart.Group> { group },
|
||||
};
|
||||
var diff = new DifficultyInfo();
|
||||
var evs = new List<osuEvent>();
|
||||
|
||||
bool ftc = false;
|
||||
using (var reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||
Section section = Section.General;
|
||||
int version;
|
||||
bool flag = false;
|
||||
string line;
|
||||
while ((line = reader.ReadLine()) != null) {
|
||||
if (!flag) {
|
||||
if (line.StartsWith("osu file format v")) {
|
||||
version = int.Parse(line.Substring(17), CultureInfo.InvariantCulture);
|
||||
if (version > 14) throw new NotSupportedException("osu! chart format version too high");
|
||||
else if (version < 5) throw new NotImplementedException("osu! chart format version too low"); // TODO apply offset
|
||||
}
|
||||
else throw new NotSupportedException("Unrecognized osu! chart format");
|
||||
flag = true;
|
||||
}
|
||||
if (ShouldSkipLine(line)) continue;
|
||||
if (section != Section.Metadata) line = StripComments(line);
|
||||
line = line.TrimEnd();
|
||||
if (line.StartsWith('[') && line.EndsWith(']')) {
|
||||
Enum.TryParse(line.Substring(1, line.Length - 2), out section);
|
||||
continue;
|
||||
}
|
||||
ParseLine(meta, chart, diff, evs, ref ftc, section, line);
|
||||
}
|
||||
}
|
||||
if (meta.ruleset == "osu!mania") {
|
||||
chart.ruleset = meta.ruleset += "." + diff.CircleSize.ToString(CultureInfo.InvariantCulture) + "k";
|
||||
}
|
||||
|
||||
if (!ftc) throw new InvalidOperationException("Unconvertible chart: no timing point is present in this beatmap");
|
||||
result.Add(new RawChartResource(string.Format("{0} - {1}", meta.song.name, meta.name), chart, meta));
|
||||
var evc = evs.Count;
|
||||
for (int i = 0; i < evc; i++) if (evs[i].IsLong) evs.Add(new osuEvent.EndEvent(evs[i]));
|
||||
evs.Sort();
|
||||
|
||||
var longevs = new Dictionary<osuEvent, ChartEvent>();
|
||||
Chart.Sound bgmEv = null;
|
||||
TimeTimingModel tm = null;
|
||||
foreach (var ev in evs) {
|
||||
if (tm != null) tm.ForwardTo(ev.StartTime / 1e3);
|
||||
if (ev is osuEvent.Audio) {
|
||||
var tev = (osuEvent.Audio)ev;
|
||||
chart.sounds.Add(bgmEv = new Chart.Sound { time = new BeatTime(0, 0, 1), id = meta.song.name });
|
||||
result.Add(new SongResource(meta.song.name, new FileInfo(Path.Combine(file.DirectoryName, tev.AudioFile))));
|
||||
}
|
||||
else if (ev is osuEvent.Background) {
|
||||
meta.cover = ((osuEvent.Background)ev).FileName;
|
||||
}
|
||||
else if (ev is osuEvent.EffectPoint) {
|
||||
var tev = (osuEvent.EffectPoint)ev;
|
||||
group.motions.Add(new Chart.Motion { time = tm.FractionalBeatTime, motion = string.Format(CultureInfo.InvariantCulture, "svm:{0}", tev.ScrollSpeed) });
|
||||
}
|
||||
else if (ev is osuEvent.EndEvent) {
|
||||
if (tm == null) throw new InvalidOperationException("Unconvertible chart: timed event before first timing point");
|
||||
var tev = (osuEvent.EndEvent)ev;
|
||||
longevs[tev.Original].endtime = tm.FractionalBeatTime;
|
||||
}
|
||||
else if (ev is osuEvent.HOMania) {
|
||||
if (tm == null) throw new InvalidOperationException("Unconvertible chart: timed event before first timing point");
|
||||
var tev = (osuEvent.HOMania)ev;
|
||||
var rn = new Chart.Note {
|
||||
time = tm.FractionalBeatTime,
|
||||
motions = new List<Chart.Motion> {
|
||||
new Chart.Motion{ motion = string.Format(CultureInfo.InvariantCulture, "track:{0}", (int)(tev.X * diff.CircleSize / 512)) }
|
||||
},
|
||||
};
|
||||
group.notes.Add(rn);
|
||||
if (tev.IsLong) longevs.Add(tev, rn);
|
||||
}
|
||||
else if (ev is osuEvent.TimingChange) {
|
||||
var tev = (osuEvent.TimingChange)ev;
|
||||
if (tm == null) {
|
||||
tm = new TimeTimingModel(tev.StartTime / 1e3, 2e-3);
|
||||
bgmEv.offset = (float)(tev.StartTime / 1e3 + OFFSET);
|
||||
}
|
||||
tm.BeatLength = tev.BeatLength / 1e3;
|
||||
tm.ForceSnap();
|
||||
chart.sigs.Add(new Chart.Signature {
|
||||
time = tm.FractionalBeatTime,
|
||||
tempo = (float)tm.BPM,
|
||||
});
|
||||
}
|
||||
else throw new NotSupportedException("Unsupported event detected");
|
||||
}
|
||||
var endbeat = tm.FractionalBeatTime;
|
||||
endbeat.b += 4;
|
||||
chart.endtime = endbeat;
|
||||
meta.length = (float)tm.Time;
|
||||
meta.note_count = group.notes.Count;
|
||||
return result;
|
||||
}
|
||||
|
||||
void ParseLine(ChartMeta meta, Chart chart, DifficultyInfo diff, List<osuEvent> evs, ref bool ftc, Section section, string line) {
|
||||
switch (section) {
|
||||
case Section.General: HandleGeneral(meta, chart, evs, line); return;
|
||||
case Section.Metadata: HandleMetadata(meta, line); return;
|
||||
case Section.Difficulty: HandleDifficulty(diff, line); return;
|
||||
case Section.Events: HandleEvent(evs, line); return;
|
||||
case Section.TimingPoints: HandleTimingPoint(chart, evs, ref ftc, line); return;
|
||||
case Section.HitObjects: HandleHitObject(evs, line); return;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleGeneral(ChartMeta meta, Chart chart, List<osuEvent> evs, string line) {
|
||||
var pair = SplitKeyVal(line);
|
||||
switch (pair.Key) {
|
||||
case @"AudioFilename":
|
||||
evs.Add(new osuEvent.Audio { StartTime = double.NegativeInfinity, AudioFile = pair.Value });
|
||||
break;
|
||||
case @"Mode":
|
||||
int rulesetID = int.Parse(pair.Value, CultureInfo.InvariantCulture);
|
||||
var ruleset = "osu!";
|
||||
switch (rulesetID) {
|
||||
case 0: /*ruleset += "standard";*/ throw new NotImplementedException("osu!standard mode is not supported yet");
|
||||
case 1: /*ruleset += "taiko";*/ throw new NotImplementedException("osu!taiko mode is not supported yet");
|
||||
case 2: /*ruleset += "catch";*/ throw new NotImplementedException("osu!catch mode is not supported yet");
|
||||
case 3: ruleset += "mania"; break;
|
||||
}
|
||||
meta.ruleset = chart.ruleset = ruleset;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleMetadata(ChartMeta meta, string line) {
|
||||
var pair = SplitKeyVal(line);
|
||||
switch (pair.Key) {
|
||||
case @"Title": if (meta.song.name == null) meta.song.name = pair.Value; break;
|
||||
case @"TitleUnicode": meta.song.name = pair.Value; break;
|
||||
case @"Artist": if (meta.song.author == null) meta.song.author = pair.Value; break;
|
||||
case @"ArtistUnicode": meta.song.author = pair.Value; break;
|
||||
case @"Creator": meta.author = pair.Value; break;
|
||||
case @"Version": meta.name = pair.Value; break;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleDifficulty(DifficultyInfo diff, string line) {
|
||||
var pair = SplitKeyVal(line);
|
||||
switch (pair.Key) {
|
||||
case @"CircleSize":
|
||||
diff.CircleSize = float.Parse(pair.Value, CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case @"SliderMultiplier":
|
||||
diff.SliderMultiplier = double.Parse(pair.Value, CultureInfo.InvariantCulture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void HandleEvent(List<osuEvent> evs, string line) {
|
||||
string[] split = line.Split(',');
|
||||
if (!Enum.TryParse(split[0], out LegacyEventType type))
|
||||
throw new InvalidDataException($@"Unknown event type: {split[0]}");
|
||||
switch (type) {
|
||||
case LegacyEventType.Sprite:
|
||||
if (evs.Count == 0 || !(evs[evs.Count - 1] is osuEvent.Background))
|
||||
evs.Add(new osuEvent.Background { StartTime = double.NegativeInfinity, FileName = CleanFilename(split[3]) });
|
||||
break;
|
||||
case LegacyEventType.Background:
|
||||
evs.Add(new osuEvent.Background { StartTime = double.NegativeInfinity, FileName = CleanFilename(split[2]) });
|
||||
break;
|
||||
}
|
||||
}
|
||||
enum LegacyEventType {
|
||||
Background = 0,
|
||||
Video = 1,
|
||||
Break = 2,
|
||||
Colour = 3,
|
||||
Sprite = 4,
|
||||
Sample = 5,
|
||||
Animation = 6
|
||||
}
|
||||
|
||||
void HandleTimingPoint(Chart chart, List<osuEvent> evs, ref bool ftc, string line) {
|
||||
string[] split = line.Split(',');
|
||||
|
||||
double time = double.Parse(split[0].Trim(), CultureInfo.InvariantCulture)/* + offset*/;
|
||||
|
||||
// beatLength is allowed to be NaN to handle an edge case in which some beatmaps use NaN slider velocity to disable slider tick generation (see LegacyDifficultyControlPoint).
|
||||
double beatLength = double.Parse(split[1].Trim(), CultureInfo.InvariantCulture);
|
||||
|
||||
// If beatLength is NaN, speedMultiplier should still be 1 because all comparisons against NaN are false.
|
||||
double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
|
||||
|
||||
int timeSignature = 4;
|
||||
if (split.Length >= 3)
|
||||
timeSignature = split[2][0] == '0' ? 4 : int.Parse(split[2], CultureInfo.InvariantCulture);
|
||||
|
||||
bool timingChange = true;
|
||||
if (split.Length >= 7)
|
||||
timingChange = split[6][0] == '1';
|
||||
|
||||
//bool omitFirstBarSignature = false;
|
||||
|
||||
//if (split.Length >= 8) {
|
||||
// int effectFlags = int.Parse(split[7], CultureInfo.InvariantCulture);
|
||||
// omitFirstBarSignature = (effectFlags & 0x8) != 0;
|
||||
//}
|
||||
|
||||
if (timingChange) {
|
||||
if (double.IsNaN(beatLength))
|
||||
throw new InvalidDataException("Beat length cannot be NaN in a timing control point");
|
||||
var ev = new osuEvent.TimingChange { StartTime = time, BeatLength = beatLength, TimeSignature = timeSignature };
|
||||
if (!ftc) {
|
||||
ftc = true;
|
||||
ev.StartTime = time % beatLength - beatLength;
|
||||
}
|
||||
evs.Add(ev);
|
||||
}
|
||||
|
||||
// osu!taiko and osu!mania use effect points rather than difficulty points for scroll speed adjustments.
|
||||
if (chart.ruleset == "osu!taiko" || chart.ruleset == "osu!mania")
|
||||
evs.Add(new osuEvent.EffectPoint { StartTime = time, ScrollSpeed = speedMultiplier });
|
||||
}
|
||||
|
||||
void HandleHitObject(List<osuEvent> evs, string line) {
|
||||
string[] split = line.Split(',');
|
||||
|
||||
int posx = (int)float.Parse(split[0], CultureInfo.InvariantCulture);
|
||||
// int posy = (int)float.Parse(split[1], CultureInfo.InvariantCulture);
|
||||
|
||||
double startTime = double.Parse(split[2], CultureInfo.InvariantCulture)/* + Offset*/;
|
||||
|
||||
LegacyHitObjectType type = (LegacyHitObjectType)int.Parse(split[3], CultureInfo.InvariantCulture);
|
||||
|
||||
// int comboOffset = (int)(type & LegacyHitObjectType.ComboOffset) >> 4;
|
||||
type &= ~LegacyHitObjectType.ComboOffset;
|
||||
|
||||
// bool combo = type.HasFlag(LegacyHitObjectType.NewCombo);
|
||||
type &= ~LegacyHitObjectType.NewCombo;
|
||||
|
||||
osuEvent.HitObject result;
|
||||
|
||||
if (type.HasFlag(LegacyHitObjectType.Circle)) {
|
||||
result = new osuEvent.HOManiaHit { X = posx };
|
||||
}
|
||||
else if (type.HasFlag(LegacyHitObjectType.Hold)) {
|
||||
double endTime = Math.Max(startTime, double.Parse(split[2], CultureInfo.InvariantCulture));
|
||||
if (split.Length > 5 && !string.IsNullOrEmpty(split[5])) {
|
||||
string[] ss = split[5].Split(':');
|
||||
endTime = Math.Max(startTime, double.Parse(ss[0], CultureInfo.InvariantCulture));
|
||||
}
|
||||
result = new osuEvent.HOManiaHold { X = posx, EndTime = endTime };
|
||||
}
|
||||
else throw new NotSupportedException(string.Format("Hit objects of type {0} is not supported yet", type));
|
||||
|
||||
if (result == null) throw new InvalidDataException($"Unknown hit object type: {split[3]}");
|
||||
|
||||
result.StartTime = startTime;
|
||||
|
||||
if (result != null) evs.Add(result);
|
||||
}
|
||||
[Flags]
|
||||
enum LegacyHitObjectType {
|
||||
Circle = 1,
|
||||
Slider = 1 << 1,
|
||||
NewCombo = 1 << 2,
|
||||
Spinner = 1 << 3,
|
||||
ComboOffset = (1 << 4) | (1 << 5) | (1 << 6),
|
||||
Hold = 1 << 7
|
||||
}
|
||||
|
||||
static bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.TrimStart().StartsWith("//", StringComparison.Ordinal)
|
||||
|| line.StartsWith(' ') || line.StartsWith('_');
|
||||
protected string StripComments(string line) {
|
||||
int index = line.IndexOf("//");
|
||||
if (index > 0) return line.Substring(0, index);
|
||||
return line;
|
||||
}
|
||||
KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':', bool shouldTrim = true) {
|
||||
string[] split = line.Split(separator, 2);
|
||||
if (shouldTrim) {
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
split[i] = split[i].Trim();
|
||||
}
|
||||
return new KeyValuePair<string, string> (
|
||||
split[0],
|
||||
split.Length > 1 ? split[1] : string.Empty
|
||||
);
|
||||
}
|
||||
static string CleanFilename(string path) => path.Replace(@"\\", @"\").Trim('"');
|
||||
|
||||
enum Section {
|
||||
General,
|
||||
Editor,
|
||||
Metadata,
|
||||
Difficulty,
|
||||
Events,
|
||||
TimingPoints,
|
||||
Colours,
|
||||
HitObjects,
|
||||
Variables,
|
||||
Fonts,
|
||||
CatchTheBeat,
|
||||
Mania,
|
||||
}
|
||||
|
||||
class DifficultyInfo {
|
||||
public float CircleSize { get; internal set; }
|
||||
public double SliderMultiplier { get; set; }
|
||||
}
|
||||
#pragma warning disable IDE1006 // Naming Styles
|
||||
abstract class osuEvent : IComparable<osuEvent> {
|
||||
public virtual double StartTime { get; set; }
|
||||
public virtual double EndTime { get; set; }
|
||||
public bool IsLong { get { return EndTime - StartTime > 0 && EndTime > 0; } }
|
||||
public abstract int Priority { get; }
|
||||
public int CompareTo(osuEvent other) {
|
||||
var c = StartTime.CompareTo(other.StartTime);
|
||||
if (c != 0) return c;
|
||||
return Priority.CompareTo(other.Priority);
|
||||
}
|
||||
public class EndEvent : osuEvent {
|
||||
public osuEvent Original;
|
||||
public EndEvent(osuEvent ev) { if (!ev.IsLong) throw new ArgumentException("Event is not long"); Original = ev; }
|
||||
public override double StartTime { get { return Original.EndTime; } }
|
||||
public override double EndTime { get { return 0; } }
|
||||
public override int Priority { get { return Original.Priority - 1; } }
|
||||
}
|
||||
public class Audio : osuEvent {
|
||||
public string AudioFile { get; set; }
|
||||
public override int Priority { get { return 0; } }
|
||||
}
|
||||
public class TimingChange : osuEvent {
|
||||
public double BeatLength { get; set; }
|
||||
public int TimeSignature { get; set; }
|
||||
public override int Priority { get { return -4; } }
|
||||
}
|
||||
public class EffectPoint : osuEvent {
|
||||
public double ScrollSpeed { get; set; }
|
||||
public override int Priority { get { return -2; } }
|
||||
}
|
||||
public class Background : osuEvent {
|
||||
public string FileName { get; set; }
|
||||
public override int Priority { get { return 0; } }
|
||||
}
|
||||
public class HitObject : osuEvent {
|
||||
public sealed override int Priority { get { return 0; } }
|
||||
}
|
||||
public class HOMania : HitObject {
|
||||
public float X { get; set; }
|
||||
}
|
||||
public class HOManiaHit : HOMania { }
|
||||
public class HOManiaHold : HOMania { }
|
||||
}
|
||||
#pragma warning restore IDE1006 // Naming Styles
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82838dd8639c2244caf3c830edfbc59c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,24 +0,0 @@
|
||||
using Cryville.Common;
|
||||
using Cryville.Crtr.Browsing;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Cryville.Crtr.Extensions.osu {
|
||||
public class osuChartFinder : LocalResourceFinder {
|
||||
public override string Name { get { return "osu! beatmaps"; } }
|
||||
|
||||
public override string GetRootPath() {
|
||||
switch (Environment.OSVersion.Platform) {
|
||||
case PlatformID.Win32NT:
|
||||
var reg = Registry.ClassesRoot.OpenSubKey(@"osu!\Shell\Open\Command");
|
||||
if (reg == null) return null;
|
||||
var pathObj = reg.GetValue(null);
|
||||
if (pathObj == null) return null;
|
||||
var path = (string)pathObj;
|
||||
return Path.Combine(new FileInfo(StringUtils.GetProcessPathFromCommand(path)).Directory.FullName, "Songs");
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 365d879536c05284fa2335a7676c6cf4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -2,7 +2,6 @@
|
||||
"name": "Cryville.Crtr",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:d8ea0e0da3ad53a45b65c912ffcacab0",
|
||||
"GUID:5686e5ee69d0e084c843d61c240d7fdb",
|
||||
"GUID:2922aa74af3b2854e81b8a8b286d8206",
|
||||
"GUID:da293eebbcb9a4947a212534c52d1a32"
|
||||
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5335612e48e4c3947808c99fb99411d5
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 82458af35dc0eff4f9f5bcfc7ffd9482
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 81c3fbb9e3606dd40908ceb861f822ea
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2018 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Quaver.API.Enums
|
||||
{
|
||||
public enum GameMode
|
||||
{
|
||||
Keys4 = 1,
|
||||
Keys7 = 2
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e80eaf8c181728041aefa03ada870aed
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2018 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Quaver.API.Enums
|
||||
{
|
||||
[Flags]
|
||||
public enum HitSounds
|
||||
{
|
||||
Normal = 1 << 0, // This is 1, but Normal should be played regardless if it's 0 or 1.
|
||||
Whistle = 1 << 1, // 2
|
||||
Finish = 1 << 2, // 4
|
||||
Clap = 1 << 3 // 8
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d483d5965d754445b9a330ba2e8dfbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace Quaver.API.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Signature of a timing point
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public enum TimeSignature
|
||||
{
|
||||
Quadruple = 4,
|
||||
Triple = 3,
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb27bc1bd269d214b8d8b95b91992955
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 15da1854a8e5270489fd79b20f741c1a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07f411a2b58802d408e547b9f1cf7ca7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0cdc2cff3891fb34d91ee006bafca3a9
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// CustomAudioSamples section of the .qua
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CustomAudioSampleInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The path to the audio sample.
|
||||
/// </summary>
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, the audio sample is always played back at 1.0x speed, regardless of the rate.
|
||||
/// </summary>
|
||||
public bool UnaffectedByRate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<CustomAudioSampleInfo>
|
||||
{
|
||||
public bool Equals(CustomAudioSampleInfo x, CustomAudioSampleInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return string.Equals(x.Path, y.Path) && x.UnaffectedByRate == y.UnaffectedByRate;
|
||||
}
|
||||
|
||||
public int GetHashCode(CustomAudioSampleInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return ((obj.Path != null ? obj.Path.GetHashCode() : 0) * 397) ^ obj.UnaffectedByRate.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<CustomAudioSampleInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0690882ce72359c409a12dfa0b4999ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,79 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
//using MoonSharp.Interpreter;
|
||||
//using MoonSharp.Interpreter.Interop;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
[Serializable]
|
||||
/*[MoonSharpUserData]*/
|
||||
public class EditorLayerInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of the layer
|
||||
/// </summary>
|
||||
public string Name { get; /*[MoonSharpVisible(false)]*/ set; }
|
||||
|
||||
/// <summary>
|
||||
/// Is the layer hidden in the editor?
|
||||
/// </summary>
|
||||
public bool Hidden { get; /*[MoonSharpVisible(false)]*/ set; }
|
||||
|
||||
/// <summary>
|
||||
/// The color of the layer (default is white)
|
||||
/// </summary>
|
||||
public string ColorRgb { get; /*[MoonSharpVisible(false)]*/ set; }
|
||||
|
||||
/// <summary>
|
||||
/// Converts the stringified color to a System.Drawing color
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/*[MoonSharpVisible(false)]*/
|
||||
public Color GetColor()
|
||||
{
|
||||
if (ColorRgb == null)
|
||||
return Color.White;
|
||||
|
||||
var split = ColorRgb.Split(',');
|
||||
|
||||
try
|
||||
{
|
||||
return Color.FromArgb(byte.Parse(split[0]), byte.Parse(split[1]), byte.Parse(split[2]));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<EditorLayerInfo>
|
||||
{
|
||||
public bool Equals(EditorLayerInfo x, EditorLayerInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return string.Equals(x.Name, y.Name) && x.Hidden == y.Hidden && string.Equals(x.ColorRgb, y.ColorRgb);
|
||||
}
|
||||
|
||||
public int GetHashCode(EditorLayerInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = obj.Name.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ obj.Hidden.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ obj.ColorRgb.GetHashCode();
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<EditorLayerInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5d19ab23108e3d41a2d77670afbab10
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,187 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
//using MoonSharp.Interpreter;
|
||||
//using MoonSharp.Interpreter.Interop;
|
||||
using Quaver.API.Enums;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// HitObjects section of the .qua
|
||||
/// </summary>
|
||||
/*[MoonSharpUserData]*/
|
||||
[Serializable]
|
||||
public class HitObjectInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds when the HitObject is supposed to be hit.
|
||||
/// </summary>
|
||||
public int StartTime
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lane the HitObject falls in
|
||||
/// </summary>
|
||||
public int Lane
|
||||
{
|
||||
get;
|
||||
/*MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The endtime of the HitObject (if greater than 0, it's considered a hold note.)
|
||||
/// </summary>
|
||||
public int EndTime
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bitwise combination of hit sounds for this object
|
||||
/// </summary>
|
||||
public HitSounds HitSound
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Key sounds to play when this object is hit.
|
||||
/// </summary>
|
||||
/*[MoonSharpVisible(false)]*/
|
||||
public List<KeySoundInfo> KeySounds { get; set; } = new List<KeySoundInfo>();
|
||||
|
||||
/// <summary>
|
||||
/// The layer in the editor that the object belongs to.
|
||||
/// </summary>
|
||||
public int EditorLayer
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the object is a long note. (EndTime > 0)
|
||||
/// </summary>
|
||||
[YamlIgnore]
|
||||
public bool IsLongNote => EndTime > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the object is allowed to be edited in lua scripts
|
||||
/// </summary>
|
||||
[YamlIgnore]
|
||||
public bool IsEditableInLuaScript
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the timing point this object is in range of.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public TimingPointInfo GetTimingPoint(List<TimingPointInfo> timingPoints)
|
||||
{
|
||||
// Search through the entire list for the correct point
|
||||
for (var i = timingPoints.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (StartTime >= timingPoints[i].StartTime)
|
||||
return timingPoints[i];
|
||||
}
|
||||
|
||||
return timingPoints.First();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public void SetStartTime(int time)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
StartTime = time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public void SetEndTime(int time)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
EndTime = time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="lane"></param>
|
||||
public void SetLane(int lane)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
Lane = lane;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="hitsounds"></param>
|
||||
public void SetHitSounds(HitSounds hitsounds)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
HitSound = hitsounds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
private void ThrowUneditableException()
|
||||
{
|
||||
if (!IsEditableInLuaScript)
|
||||
throw new InvalidOperationException("Value is not allowed to be edited in lua scripts.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, mostly auto-generated by Rider: KeySounds-related code is changed to by-value.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<HitObjectInfo>
|
||||
{
|
||||
public bool Equals(HitObjectInfo x, HitObjectInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return x.StartTime == y.StartTime && x.Lane == y.Lane && x.EndTime == y.EndTime && x.HitSound == y.HitSound && x.KeySounds.SequenceEqual(y.KeySounds, KeySoundInfo.ByValueComparer) && x.EditorLayer == y.EditorLayer;
|
||||
}
|
||||
|
||||
public int GetHashCode(HitObjectInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = obj.StartTime;
|
||||
hashCode = (hashCode * 397) ^ obj.Lane;
|
||||
hashCode = (hashCode * 397) ^ obj.EndTime;
|
||||
hashCode = (hashCode * 397) ^ (int) obj.HitSound;
|
||||
foreach (var keySound in obj.KeySounds)
|
||||
hashCode = (hashCode * 397) ^ KeySoundInfo.ByValueComparer.GetHashCode(keySound);
|
||||
hashCode = (hashCode * 397) ^ obj.EditorLayer;
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<HitObjectInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 14fc15101f91a2c439d64f27a699da09
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// KeySounds property of hit objects.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class KeySoundInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The one-based index of the sound sample in the CustomAudioSamples array.
|
||||
/// </summary>
|
||||
public int Sample { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The volume of the sound sample. Defaults to 100.
|
||||
/// </summary>
|
||||
public int Volume { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<KeySoundInfo>
|
||||
{
|
||||
public bool Equals(KeySoundInfo x, KeySoundInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return x.Sample == y.Sample && x.Volume == y.Volume;
|
||||
}
|
||||
|
||||
public int GetHashCode(KeySoundInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (obj.Sample * 397) ^ obj.Volume;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<KeySoundInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad94e179dbb3a5e47b47c8475e3e707f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using MoonSharp.Interpreter;
|
||||
//using MoonSharp.Interpreter.Interop;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// SliderVelocities section of the .qua
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
/*[MoonSharpUserData]*/
|
||||
public class SliderVelocityInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds when the new SliderVelocity section begins
|
||||
/// </summary>
|
||||
public float StartTime
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The velocity multiplier relative to the current timing section's BPM
|
||||
/// </summary>
|
||||
public float Multiplier
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns if the SV is allowed to be edited in lua scripts
|
||||
/// </summary>
|
||||
[YamlIgnore]
|
||||
public bool IsEditableInLuaScript
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the start time of the SV.
|
||||
/// FOR USE IN LUA SCRIPTS ONLY.
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public void SetStartTime(float time)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
StartTime = time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the multiplier of the SV.
|
||||
/// FOR USE IN LUA SCRIPTS ONLY.
|
||||
/// </summary>
|
||||
/// <param name="multiplier"></param>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
public void SetMultiplier(float multiplier)
|
||||
{
|
||||
ThrowUneditableException();
|
||||
Multiplier = multiplier;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <exception cref="InvalidOperationException"></exception>
|
||||
private void ThrowUneditableException()
|
||||
{
|
||||
if (!IsEditableInLuaScript)
|
||||
throw new InvalidOperationException("Value is not allowed to be edited in lua scripts.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<SliderVelocityInfo>
|
||||
{
|
||||
public bool Equals(SliderVelocityInfo x, SliderVelocityInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return x.StartTime.Equals(y.StartTime) && x.Multiplier.Equals(y.Multiplier);
|
||||
}
|
||||
|
||||
public int GetHashCode(SliderVelocityInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
return (obj.StartTime.GetHashCode() * 397) ^ obj.Multiplier.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<SliderVelocityInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cebb7330d6e4d9b4da4ceb367c1a2fd4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// SoundEffects section of the .qua
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SoundEffectInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The time at which to play the sound sample.
|
||||
/// </summary>
|
||||
public float StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The one-based index of the sound sample in the CustomAudioSamples array.
|
||||
/// </summary>
|
||||
public int Sample { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The volume of the sound sample. Defaults to 100.
|
||||
/// </summary>
|
||||
public int Volume { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<SoundEffectInfo>
|
||||
{
|
||||
public bool Equals(SoundEffectInfo x, SoundEffectInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return x.StartTime.Equals(y.StartTime) && x.Sample == y.Sample && x.Volume == y.Volume;
|
||||
}
|
||||
|
||||
public int GetHashCode(SoundEffectInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = obj.StartTime.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ obj.Sample;
|
||||
hashCode = (hashCode * 397) ^ obj.Volume;
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<SoundEffectInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2f1502b1df0fdb9459d43358ed857875
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
* Copyright (c) 2017-2019 Swan & The Quaver Team <support@quavergame.com>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
//using MoonSharp.Interpreter;
|
||||
//using MoonSharp.Interpreter.Interop;
|
||||
using Quaver.API.Enums;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace Quaver.API.Maps.Structures
|
||||
{
|
||||
/// <summary>
|
||||
/// TimingPoints section of the .qua
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
/*[MoonSharpUserData]*/
|
||||
public class TimingPointInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The time in milliseconds for when this timing point begins
|
||||
/// </summary>
|
||||
public float StartTime
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The BPM during this timing point
|
||||
/// </summary>
|
||||
public float Bpm
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The signature during this timing point
|
||||
/// </summary>
|
||||
public TimeSignature Signature
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether timing lines during this timing point should be hidden or not
|
||||
/// </summary>
|
||||
public bool Hidden
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
[YamlIgnore]
|
||||
public bool IsEditableInLuaScript
|
||||
{
|
||||
get;
|
||||
/*[MoonSharpVisible(false)]*/ set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The amount of milliseconds per beat this one takes up.
|
||||
/// </summary>
|
||||
[YamlIgnore]
|
||||
public float MillisecondsPerBeat => 60000 / Bpm;
|
||||
|
||||
/// <summary>
|
||||
/// By-value comparer, auto-generated by Rider.
|
||||
/// </summary>
|
||||
private sealed class ByValueEqualityComparer : IEqualityComparer<TimingPointInfo>
|
||||
{
|
||||
public bool Equals(TimingPointInfo x, TimingPointInfo y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
if (x.GetType() != y.GetType()) return false;
|
||||
return x.StartTime.Equals(y.StartTime) && x.Bpm.Equals(y.Bpm) && x.Signature == y.Signature && x.Hidden == y.Hidden;
|
||||
}
|
||||
|
||||
public int GetHashCode(TimingPointInfo obj)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
var hashCode = obj.StartTime.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ obj.Bpm.GetHashCode();
|
||||
hashCode = (hashCode * 397) ^ (int) obj.Signature;
|
||||
hashCode = (hashCode * 397) ^ (obj.Hidden ? 1 : 0);
|
||||
return hashCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IEqualityComparer<TimingPointInfo> ByValueComparer { get; } = new ByValueEqualityComparer();
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02c7f0a85b74dc34cad4f1e3dea4dbbc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "Quaver.API",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:b3f49edfedc855a48aa1a9e5d3cba438"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": true,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": true
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8ea0e0da3ad53a45b65c912ffcacab0
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a19996d4b24ff14f99f7b17e0b45ecf
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cbe04dd6a5622cf4fb8a12e664da340d
|
||||
folderAsset: yes
|
||||
timeCreated: 1427145262
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,76 +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.Text.RegularExpressions;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public struct AnchorName : IEquatable<AnchorName>
|
||||
{
|
||||
public static readonly AnchorName Empty = default;
|
||||
|
||||
// https://yaml.org/spec/1.2/spec.html#id2785586
|
||||
private static readonly Regex AnchorPattern = new Regex(@"^[^\[\]\{\},]+$", StandardRegexOptions.Compiled);
|
||||
|
||||
private readonly string? value;
|
||||
|
||||
public string Value => value ?? throw new InvalidOperationException("Cannot read the Value of an empty anchor");
|
||||
|
||||
public bool IsEmpty => value is null;
|
||||
|
||||
public AnchorName(string value)
|
||||
{
|
||||
this.value = value ?? throw new ArgumentNullException(nameof(value));
|
||||
|
||||
if (!AnchorPattern.IsMatch(value))
|
||||
{
|
||||
throw new ArgumentException($"Anchor cannot be empty or contain disallowed characters: []{{}},\nThe value was '{value}'.", nameof(value));
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => value ?? "[empty]";
|
||||
|
||||
public bool Equals(AnchorName other) => Equals(value, other.value);
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is AnchorName other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return value?.GetHashCode() ?? 0;
|
||||
}
|
||||
|
||||
public static bool operator ==(AnchorName left, AnchorName right)
|
||||
{
|
||||
return left.Equals(right);
|
||||
}
|
||||
|
||||
public static bool operator !=(AnchorName left, AnchorName right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public static implicit operator AnchorName(string? value) => value == null ? Empty : new AnchorName(value);
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4b743e73dd5df19488bf7108b4a7e5a8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,58 +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;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// The exception that is thrown when an alias references an anchor that does not exist.
|
||||
/// </summary>
|
||||
public class AnchorNotFoundException : YamlException
|
||||
{
|
||||
/// <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)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bef940054d2c25041ba1a961abae6c79
|
||||
timeCreated: 1427145266
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,166 +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.Diagnostics;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
internal sealed class CharacterAnalyzer<TBuffer> where TBuffer : class, ILookAheadBuffer
|
||||
{
|
||||
public CharacterAnalyzer(TBuffer buffer)
|
||||
{
|
||||
this.Buffer = buffer ?? throw new ArgumentNullException(nameof(buffer));
|
||||
}
|
||||
|
||||
public TBuffer Buffer { get; }
|
||||
|
||||
public bool EndOfInput => 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 really wrong...
|
||||
Debug.Assert(expectedCharacters.Length > 1, "Use Check(char, int) instead.");
|
||||
|
||||
var character = Buffer.Peek(offset);
|
||||
return expectedCharacters.IndexOf(character) != -1;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cdb65e878b6f92347849551efad9eb74
|
||||
timeCreated: 1427145266
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,40 +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 YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines constants that relate to the YAML specification.
|
||||
/// </summary>
|
||||
public 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 = 3;
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6143f3f95b0bcb74c92b9996309fab40
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,69 +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.
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public sealed class Cursor
|
||||
{
|
||||
public int Index { get; private set; }
|
||||
public int Line { get; private set; }
|
||||
public int LineOffset { get; private set; }
|
||||
|
||||
public Cursor()
|
||||
{
|
||||
Line = 1;
|
||||
}
|
||||
|
||||
public Cursor(Cursor cursor)
|
||||
{
|
||||
Index = cursor.Index;
|
||||
Line = cursor.Line;
|
||||
LineOffset = cursor.LineOffset;
|
||||
}
|
||||
|
||||
public Mark Mark()
|
||||
{
|
||||
return new Mark(Index, Line, LineOffset + 1);
|
||||
}
|
||||
|
||||
public void Skip()
|
||||
{
|
||||
Index++;
|
||||
LineOffset++;
|
||||
}
|
||||
|
||||
public void SkipLineByOffset(int offset)
|
||||
{
|
||||
Index += offset;
|
||||
Line++;
|
||||
LineOffset = 0;
|
||||
}
|
||||
|
||||
public void ForceSkipLineAfterNonBreak()
|
||||
{
|
||||
if (LineOffset != 0)
|
||||
{
|
||||
Line++;
|
||||
LineOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4262bdec0f3c254b9a29e755ba3a609
|
||||
timeCreated: 1427145265
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f526134efcd8e424c86e492f85fc56ba
|
||||
timeCreated: 1427145267
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,159 +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;
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
public sealed class EmitterSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// The preferred indentation.
|
||||
/// </summary>
|
||||
public int BestIndent { get; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// The preferred text width.
|
||||
/// </summary>
|
||||
public int BestWidth { get; } = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// If true, write the output in canonical form.
|
||||
/// </summary>
|
||||
public bool IsCanonical { get; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// If true, write output without anchor names.
|
||||
/// </summary>
|
||||
public bool SkipAnchorName { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum allowed length for simple keys.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The specifiction mandates 1024 characters, but any desired value may be used.
|
||||
/// </remarks>
|
||||
public int MaxSimpleKeyLength { get; } = 1024;
|
||||
|
||||
/// <summary>
|
||||
/// Indent sequences. The default is to not indent.
|
||||
/// </summary>
|
||||
public bool IndentSequences { get; } = false;
|
||||
|
||||
public static readonly EmitterSettings Default = new EmitterSettings();
|
||||
|
||||
public EmitterSettings()
|
||||
{
|
||||
}
|
||||
|
||||
public EmitterSettings(int bestIndent, int bestWidth, bool isCanonical, int maxSimpleKeyLength, bool skipAnchorName = false, bool indentSequences = false)
|
||||
{
|
||||
if (bestIndent < 2 || bestIndent > 9)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(bestIndent), $"BestIndent must be between 2 and 9, inclusive");
|
||||
}
|
||||
|
||||
if (bestWidth <= bestIndent * 2)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(bestWidth), "BestWidth must be greater than BestIndent x 2.");
|
||||
}
|
||||
|
||||
if (maxSimpleKeyLength < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(nameof(maxSimpleKeyLength), "MaxSimpleKeyLength must be >= 0");
|
||||
}
|
||||
|
||||
BestIndent = bestIndent;
|
||||
BestWidth = bestWidth;
|
||||
IsCanonical = isCanonical;
|
||||
MaxSimpleKeyLength = maxSimpleKeyLength;
|
||||
SkipAnchorName = skipAnchorName;
|
||||
IndentSequences = indentSequences;
|
||||
}
|
||||
|
||||
public EmitterSettings WithBestIndent(int bestIndent)
|
||||
{
|
||||
return new EmitterSettings(
|
||||
bestIndent,
|
||||
BestWidth,
|
||||
IsCanonical,
|
||||
MaxSimpleKeyLength,
|
||||
SkipAnchorName
|
||||
);
|
||||
}
|
||||
|
||||
public EmitterSettings WithBestWidth(int bestWidth)
|
||||
{
|
||||
return new EmitterSettings(
|
||||
BestIndent,
|
||||
bestWidth,
|
||||
IsCanonical,
|
||||
MaxSimpleKeyLength,
|
||||
SkipAnchorName
|
||||
);
|
||||
}
|
||||
|
||||
public EmitterSettings WithMaxSimpleKeyLength(int maxSimpleKeyLength)
|
||||
{
|
||||
return new EmitterSettings(
|
||||
BestIndent,
|
||||
BestWidth,
|
||||
IsCanonical,
|
||||
maxSimpleKeyLength,
|
||||
SkipAnchorName
|
||||
);
|
||||
}
|
||||
|
||||
public EmitterSettings Canonical()
|
||||
{
|
||||
return new EmitterSettings(
|
||||
BestIndent,
|
||||
BestWidth,
|
||||
true,
|
||||
MaxSimpleKeyLength,
|
||||
SkipAnchorName
|
||||
);
|
||||
}
|
||||
|
||||
public EmitterSettings WithoutAnchorName()
|
||||
{
|
||||
return new EmitterSettings(
|
||||
BestIndent,
|
||||
BestWidth,
|
||||
IsCanonical,
|
||||
MaxSimpleKeyLength,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public EmitterSettings WithIndentedSequences()
|
||||
{
|
||||
return new EmitterSettings(
|
||||
BestIndent,
|
||||
BestWidth,
|
||||
IsCanonical,
|
||||
MaxSimpleKeyLength,
|
||||
SkipAnchorName,
|
||||
true
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7496371f913cd4a4aa6e1d7009a88169
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,45 +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.
|
||||
|
||||
namespace YamlDotNet.Core
|
||||
{
|
||||
internal enum EmitterState
|
||||
{
|
||||
StreamStart,
|
||||
StreamEnd,
|
||||
FirstDocumentStart,
|
||||
DocumentStart,
|
||||
DocumentContent,
|
||||
DocumentEnd,
|
||||
FlowSequenceFirstItem,
|
||||
FlowSequenceItem,
|
||||
FlowMappingFirstKey,
|
||||
FlowMappingKey,
|
||||
FlowMappingSimpleValue,
|
||||
FlowMappingValue,
|
||||
BlockSequenceFirstItem,
|
||||
BlockSequenceItem,
|
||||
BlockMappingFirstKey,
|
||||
BlockMappingKey,
|
||||
BlockMappingSimpleValue,
|
||||
BlockMappingValue
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7127212075b19ce4f99a370f02d26037
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2dd1df9756078164587ab6fc3579145d
|
||||
folderAsset: yes
|
||||
timeCreated: 1427145262
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,85 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an alias event.
|
||||
/// </summary>
|
||||
public sealed class AnchorAlias : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.Alias;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the alias.
|
||||
/// </summary>
|
||||
public AnchorName Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnchorAlias"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value of the alias.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public AnchorAlias(AnchorName value, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
if (value.IsEmpty)
|
||||
{
|
||||
throw new YamlException(start, end, "Anchor value must not be empty.");
|
||||
}
|
||||
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AnchorAlias"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value of the alias.</param>
|
||||
public AnchorAlias(AnchorName value)
|
||||
: this(value, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Alias [value = {Value}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09b29b54793d9644398fe8e4da326353
|
||||
timeCreated: 1427145262
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,59 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
public sealed class Comment : ParsingEvent
|
||||
{
|
||||
public string Value { get; }
|
||||
public bool IsInline { get; }
|
||||
|
||||
public Comment(string value, bool isInline)
|
||||
: this(value, isInline, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public Comment(string value, bool isInline, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
Value = value;
|
||||
IsInline = isInline;
|
||||
}
|
||||
|
||||
internal override EventType Type => EventType.Comment;
|
||||
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{(IsInline ? "Inline" : "Block")} Comment [{Value}]";
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e96511072ac5a30488623987ca605570
|
||||
timeCreated: 1427145267
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,90 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document end event.
|
||||
/// </summary>
|
||||
public sealed class DocumentEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => -1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.DocumentEnd;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is implicit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is implicit; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentEnd(bool isImplicit, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.IsImplicit = isImplicit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
public DocumentEnd(bool isImplicit)
|
||||
: this(isImplicit, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Document end [isImplicit = {IsImplicit}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99b4ea3b75d2e754cb5fea7cc0f1a4d3
|
||||
timeCreated: 1427145265
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,128 +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 YamlDotNet.Core.Tokens;
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a document start event.
|
||||
/// </summary>
|
||||
public sealed class DocumentStart : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.DocumentStart;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tags.
|
||||
/// </summary>
|
||||
/// <value>The tags.</value>
|
||||
public TagDirectiveCollection? Tags { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the version.
|
||||
/// </summary>
|
||||
/// <value>The version.</value>
|
||||
public VersionDirective? Version { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is implicit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is implicit; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="tags">The tags.</param>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentStart(VersionDirective? version, TagDirectiveCollection? tags, bool isImplicit, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.Version = version;
|
||||
this.Tags = tags;
|
||||
this.IsImplicit = isImplicit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="version">The version.</param>
|
||||
/// <param name="tags">The tags.</param>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
public DocumentStart(VersionDirective? version, TagDirectiveCollection? tags, bool isImplicit)
|
||||
: this(version, tags, isImplicit, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public DocumentStart(Mark start, Mark end)
|
||||
: this(null, null, true, start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DocumentStart"/> class.
|
||||
/// </summary>
|
||||
public DocumentStart()
|
||||
: this(null, null, true, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Document start [isImplicit = {IsImplicit}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06cc13f1bc1622246924546d044eede9
|
||||
timeCreated: 1427145262
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,39 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
internal enum EventType
|
||||
{
|
||||
None,
|
||||
StreamStart,
|
||||
StreamEnd,
|
||||
DocumentStart,
|
||||
DocumentEnd,
|
||||
Alias,
|
||||
Scalar,
|
||||
SequenceStart,
|
||||
SequenceEnd,
|
||||
MappingStart,
|
||||
MappingEnd,
|
||||
Comment,
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a7e249b62575e048929c7a3e0420470
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,41 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Callback interface for external event Visitor.
|
||||
/// </summary>
|
||||
public interface IParsingEventVisitor
|
||||
{
|
||||
void Visit(AnchorAlias e);
|
||||
void Visit(StreamStart e);
|
||||
void Visit(StreamEnd e);
|
||||
void Visit(DocumentStart e);
|
||||
void Visit(DocumentEnd e);
|
||||
void Visit(Scalar e);
|
||||
void Visit(SequenceStart e);
|
||||
void Visit(SequenceEnd e);
|
||||
void Visit(MappingStart e);
|
||||
void Visit(MappingEnd e);
|
||||
void Visit(Comment e);
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34cdef8e5d4918149bf7185da865504b
|
||||
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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mapping end event.
|
||||
/// </summary>
|
||||
public class MappingEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => -1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.MappingEnd;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public MappingEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingEnd"/> class.
|
||||
/// </summary>
|
||||
public MappingEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return "Mapping end";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32f12dd96a8cb4d4792ed76749f67b38
|
||||
timeCreated: 1427145263
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,116 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a mapping start event.
|
||||
/// </summary>
|
||||
public sealed class MappingStart : NodeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.MappingStart;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is implicit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is implicit; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is canonical.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public override bool IsCanonical => !IsImplicit;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the style of the mapping.
|
||||
/// </summary>
|
||||
public MappingStyle Style { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
/// <param name="style">The style of the mapping.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public MappingStart(AnchorName anchor, TagName tag, bool isImplicit, MappingStyle style, Mark start, Mark end)
|
||||
: base(anchor, tag, start, end)
|
||||
{
|
||||
this.IsImplicit = isImplicit;
|
||||
this.Style = style;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="isImplicit">Indicates whether the event is implicit.</param>
|
||||
/// <param name="style">The style of the mapping.</param>
|
||||
public MappingStart(AnchorName anchor, TagName tag, bool isImplicit, MappingStyle style)
|
||||
: this(anchor, tag, isImplicit, style, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MappingStart"/> class.
|
||||
/// </summary>
|
||||
public MappingStart()
|
||||
: this(AnchorName.Empty, TagName.Empty, true, MappingStyle.Any, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Mapping start [anchor = {Anchor}, tag = {Tag}, isImplicit = {IsImplicit}, style = {Style}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 79e25e33bd9642a4ca1c8c5280b30984
|
||||
timeCreated: 1427145264
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,44 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the style of a mapping.
|
||||
/// </summary>
|
||||
public enum MappingStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Let the emitter choose the style.
|
||||
/// </summary>
|
||||
Any,
|
||||
|
||||
/// <summary>
|
||||
/// The block mapping style.
|
||||
/// </summary>
|
||||
Block,
|
||||
|
||||
/// <summary>
|
||||
/// The flow mapping style.
|
||||
/// </summary>
|
||||
Flow
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bc885bebca1fac428d7482f06b4f41e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,72 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the behavior that is common between node events.
|
||||
/// </summary>
|
||||
public abstract class NodeEvent : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the anchor.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public AnchorName Anchor { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the tag.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public TagName Tag { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is canonical.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public abstract bool IsCanonical
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeEvent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
protected NodeEvent(AnchorName anchor, TagName tag, Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
this.Anchor = anchor;
|
||||
this.Tag = tag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NodeEvent"/> class.
|
||||
/// </summary>
|
||||
protected NodeEvent(AnchorName anchor, TagName tag)
|
||||
: this(anchor, tag, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4fa0681239f68a3468223fe925e01d33
|
||||
timeCreated: 1427145264
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,68 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for parsing events.
|
||||
/// </summary>
|
||||
public abstract class ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public virtual int NestingIncrease => 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal abstract EventType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the position in the input stream where the event starts.
|
||||
/// </summary>
|
||||
public Mark Start { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the position in the input stream where the event ends.
|
||||
/// </summary>
|
||||
public Mark End { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Accepts the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">Visitor to accept, may not be null</param>
|
||||
public abstract void Accept(IParsingEventVisitor visitor);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ParsingEvent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
internal ParsingEvent(Mark start, Mark end)
|
||||
{
|
||||
this.Start = start ?? throw new System.ArgumentNullException(nameof(start));
|
||||
this.End = end ?? throw new System.ArgumentNullException(nameof(end));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5dcecbbabc813c74bb16837d87a36f7e
|
||||
timeCreated: 1427145264
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,143 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a scalar event.
|
||||
/// </summary>
|
||||
public sealed class Scalar : NodeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.Scalar;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
public string Value { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the style of the scalar.
|
||||
/// </summary>
|
||||
/// <value>The style.</value>
|
||||
public ScalarStyle Style { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the tag is optional for the plain style.
|
||||
/// </summary>
|
||||
public bool IsPlainImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the tag is optional for any non-plain style.
|
||||
/// </summary>
|
||||
public bool IsQuotedImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is canonical.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public override bool IsCanonical => !IsPlainImplicit && !IsQuotedImplicit;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="style">The style.</param>
|
||||
/// <param name="isPlainImplicit">.</param>
|
||||
/// <param name="isQuotedImplicit">.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public Scalar(AnchorName anchor, TagName tag, string value, ScalarStyle style, bool isPlainImplicit, bool isQuotedImplicit, Mark start, Mark end)
|
||||
: base(anchor, tag, start, end)
|
||||
{
|
||||
this.Value = value;
|
||||
this.Style = style;
|
||||
this.IsPlainImplicit = isPlainImplicit;
|
||||
this.IsQuotedImplicit = isQuotedImplicit;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="style">The style.</param>
|
||||
/// <param name="isPlainImplicit">.</param>
|
||||
/// <param name="isQuotedImplicit">.</param>
|
||||
public Scalar(AnchorName anchor, TagName tag, string value, ScalarStyle style, bool isPlainImplicit, bool isQuotedImplicit)
|
||||
: this(anchor, tag, value, style, isPlainImplicit, isQuotedImplicit, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="value">The value.</param>
|
||||
public Scalar(string value)
|
||||
: this(AnchorName.Empty, TagName.Empty, value, ScalarStyle.Any, true, true, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
public Scalar(TagName tag, string value)
|
||||
: this(AnchorName.Empty, tag, value, ScalarStyle.Any, true, true, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Scalar"/> class.
|
||||
/// </summary>
|
||||
public Scalar(AnchorName anchor, TagName tag, string value)
|
||||
: this(anchor, tag, value, ScalarStyle.Any, true, true, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Scalar [anchor = {Anchor}, tag = {Tag}, value = {Value}, style = {Style}, isPlainImplicit = {IsPlainImplicit}, isQuotedImplicit = {IsQuotedImplicit}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7c9ef7a4a2cc85b40aea8fda0d00cb33
|
||||
timeCreated: 1427145265
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a sequence end event.
|
||||
/// </summary>
|
||||
public sealed class SequenceEnd : ParsingEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => -1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.SequenceEnd;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceEnd"/> class.
|
||||
/// </summary>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public SequenceEnd(Mark start, Mark end)
|
||||
: base(start, end)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceEnd"/> class.
|
||||
/// </summary>
|
||||
public SequenceEnd()
|
||||
: this(Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return "Sequence end";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37a7a63228a311b46ae903ea604105df
|
||||
timeCreated: 1427145263
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,105 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a sequence start event.
|
||||
/// </summary>
|
||||
public sealed class SequenceStart : NodeEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating the variation of depth caused by this event.
|
||||
/// The value can be either -1, 0 or 1. For start events, it will be 1,
|
||||
/// for end events, it will be -1, and for the remaining events, it will be 0.
|
||||
/// </summary>
|
||||
public override int NestingIncrease => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the event type, which allows for simpler type comparisons.
|
||||
/// </summary>
|
||||
internal override EventType Type => EventType.SequenceStart;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is implicit.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// <c>true</c> if this instance is implicit; otherwise, <c>false</c>.
|
||||
/// </value>
|
||||
public bool IsImplicit { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is canonical.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public override bool IsCanonical => !IsImplicit;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the style.
|
||||
/// </summary>
|
||||
/// <value>The style.</value>
|
||||
public SequenceStyle Style { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceStart"/> class.
|
||||
/// </summary>
|
||||
/// <param name="anchor">The anchor.</param>
|
||||
/// <param name="tag">The tag.</param>
|
||||
/// <param name="isImplicit">if set to <c>true</c> [is implicit].</param>
|
||||
/// <param name="style">The style.</param>
|
||||
/// <param name="start">The start position of the event.</param>
|
||||
/// <param name="end">The end position of the event.</param>
|
||||
public SequenceStart(AnchorName anchor, TagName tag, bool isImplicit, SequenceStyle style, Mark start, Mark end)
|
||||
: base(anchor, tag, start, end)
|
||||
{
|
||||
this.IsImplicit = isImplicit;
|
||||
this.Style = style;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SequenceStart"/> class.
|
||||
/// </summary>
|
||||
public SequenceStart(AnchorName anchor, TagName tag, bool isImplicit, SequenceStyle style)
|
||||
: this(anchor, tag, isImplicit, style, Mark.Empty, Mark.Empty)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
|
||||
/// </returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Sequence start [anchor = {Anchor}, tag = {Tag}, isImplicit = {IsImplicit}, style = {Style}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes run-time type specific Visit() method of the specified visitor.
|
||||
/// </summary>
|
||||
/// <param name="visitor">visitor, may not be null.</param>
|
||||
public override void Accept(IParsingEventVisitor visitor)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0414698332e0c643ad3fddd1b907b5e
|
||||
timeCreated: 1427145266
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,44 +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.
|
||||
|
||||
namespace YamlDotNet.Core.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifies the style of a sequence.
|
||||
/// </summary>
|
||||
public enum SequenceStyle
|
||||
{
|
||||
/// <summary>
|
||||
/// Let the emitter choose the style.
|
||||
/// </summary>
|
||||
Any,
|
||||
|
||||
/// <summary>
|
||||
/// The block sequence style.
|
||||
/// </summary>
|
||||
Block,
|
||||
|
||||
/// <summary>
|
||||
/// The flow sequence style.
|
||||
/// </summary>
|
||||
Flow
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user