using System.Collections.Generic; using UnityEngine; using ModTool.Shared.Verification; namespace ModTool.Shared { /// /// Stores settings related to code verification for Mods. /// public class CodeSettings : Singleton { /// /// Restrictions related to inheritance of Types inside Mod Assemblies. /// public static List inheritanceRestrictions { get { return instance._inheritanceRestrictions; } } /// /// Restrictions related to the use of fields, properties and methods from other types. /// public static List memberRestrictions { get { return instance._memberRestrictions; } } /// /// Restrictions related to the use of Types for fields and properties. /// public static List typeRestrictions { get { return instance._typeRestrictions; } } /// /// Restrictions related to the use of entire namespaces. /// public static List namespaceRestrictions { get { return instance._namespaceRestrictions; } } [SerializeField] private List _inheritanceRestrictions = new List(); [SerializeField] private List _memberRestrictions = new List(); [SerializeField] private List _typeRestrictions = new List(); [SerializeField] private List _namespaceRestrictions = new List(); protected CodeSettings() { namespaceRestrictions.Add(new NamespaceRestriction("System.Reflection", true, null, "Reflection is not allowed.", RestrictionMode.Prohibited)); namespaceRestrictions.Add(new NamespaceRestriction("System.IO", true, null, "IO is not allowed.", RestrictionMode.Prohibited)); } [RuntimeInitializeOnLoadMethod] private static void Initialize() { GetInstance(); } } }