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
{
///
/// The name of the layer
///
public string Name { get; /*[MoonSharpVisible(false)]*/ set; }
///
/// Is the layer hidden in the editor?
///
public bool Hidden { get; /*[MoonSharpVisible(false)]*/ set; }
///
/// The color of the layer (default is white)
///
public string ColorRgb { get; /*[MoonSharpVisible(false)]*/ set; }
///
/// Converts the stringified color to a System.Drawing color
///
///
/*[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;
}
}
///
/// By-value comparer, auto-generated by Rider.
///
private sealed class ByValueEqualityComparer : IEqualityComparer
{
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 ByValueComparer { get; } = new ByValueEqualityComparer();
}
}