RobotNet/RobotNet.ScriptManager/Models/ScriptVariable.cs
2025-10-15 15:15:53 +07:00

24 lines
813 B
C#

using RobotNet.ScriptManager.Helpers;
namespace RobotNet.ScriptManager.Models;
public class ScriptVariableSyntax(string name, Type type, object? defaultValue, bool publicRead, bool publicWrite)
{
public string Name { get; } = name;
public Type Type { get; } = type;
public string TypeName { get; } = CSharpSyntaxHelper.ToTypeString(type);
public object? DefaultValue { get; } = defaultValue;
public bool PublicRead { get; } = publicRead;
public bool PublicWrite { get; } = publicWrite;
public override bool Equals(object? obj)
{
if (obj == null) return false;
if(obj is not ScriptVariableSyntax variable) return false;
if (variable.Name != Name) return false;
return true;
}
public override int GetHashCode() => Name.GetHashCode();
}