/
EvilBeaver
/
OneScript
Обзор
Документация
Войти
/
EvilBeaver
/
OneScript
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
src/OneScript.StandardLibrary/XMLSchema/Objects/XSMaxInclusiveFacet.cs
147 строк
5 KB
EvilBeaver
Удален устаревший метод OnAttach и массово исправлены неиспользуемые using
02 дек 2025, 11:20
02 дек 2025, 11:20
0301fed
Код
Авторство
О чём код?
/*---------------------------------------------------------- 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/. ----------------------------------------------------------*/ using System; using System.Diagnostics.Contracts; using System.Xml.Schema; using OneScript.Contexts; using OneScript.StandardLibrary.XMLSchema.Collections; using OneScript.StandardLibrary.XMLSchema.Enumerations; using OneScript.StandardLibrary.XMLSchema.Interfaces; using ScriptEngine.Machine; using ScriptEngine.Machine.Contexts; namespace OneScript.StandardLibrary.XMLSchema.Objects { [ContextClass("ФасетМаксимальногоВключающегоЗначенияXS", "XSMaxInclusiveFacet")] public sealed class XSMaxInclusiveFacet : AutoContext<XSMaxInclusiveFacet>, IXSFacet { private readonly XmlSchemaMaxInclusiveFacet _facet; private XSAnnotation _annotation; private IValue _value; private XSMaxInclusiveFacet() => _facet = new XmlSchemaMaxInclusiveFacet(); internal XSMaxInclusiveFacet(XmlSchemaMaxInclusiveFacet maxInclusiveFacet) { _facet = maxInclusiveFacet; _value = ValueFactory.Create(_facet.Value); if (_facet.Annotation is XmlSchemaAnnotation annotation) { _annotation = XMLSchemaSerializer.CreateXSAnnotation(annotation); _annotation.BindToContainer(RootContainer, this); } } #region OneScript #region Properties [ContextProperty("Аннотация", "Annotation")] public XSAnnotation Annotation { get => _annotation; set { _annotation = value; _annotation?.BindToContainer(RootContainer, this); XSAnnotation.SetComponentAnnotation(_annotation, _facet); } } [ContextProperty("Компоненты", "Components")] public XSComponentFixedList Components => XSComponentFixedList.EmptyList(); [ContextProperty("Контейнер", "Container")] public IXSComponent Container => SimpleTypeDefinition; [ContextProperty("КорневойКонтейнер", "RootContainer")] public IXSComponent RootContainer { get; private set; } [ContextProperty("Схема", "Schema")] public XMLSchema Schema => RootContainer.Schema; [ContextProperty("ТипКомпоненты", "ComponentType")] public XSComponentType ComponentType => XSComponentType.MaxInclusiveFacet; [ContextProperty("ЛексическоеЗначение", "LexicalValue")] public string LexicalValue { get => _facet.Value; set { _facet.Value = value; _value = ValueFactory.Create(value); } } [ContextProperty("ОпределениеПростогоТипа", "SimpleTypeDefinition")] public XSSimpleTypeDefinition SimpleTypeDefinition { get; private set; } [ContextProperty("Фиксированный", "Fixed")] public bool Fixed { get => _facet.IsFixed; set => _facet.IsFixed = value; } [ContextProperty("Включающий", "Inclusive")] public bool Inclusive => true; [ContextProperty("Значение", "Value")] public IValue Value { get => _value; set { _value = value; _facet.Value = XMLSchema.XMLStringIValue(_value); } } [ContextProperty("Исключающий", "Exclusive")] public bool Exclusive => false; #endregion #region Methods [ContextMethod("КлонироватьКомпоненту", "CloneComponent")] public IXSComponent CloneComponent(bool recursive = true) => throw new NotImplementedException(); [ContextMethod("ОбновитьЭлементDOM", "UpdateDOMElement")] public void UpdateDOMElement() => throw new NotImplementedException(); [ContextMethod("Содержит", "Contains")] public bool Contains(IXSComponent component) => false; #endregion #region Constructors [ScriptConstructor(Name = "По умолчанию")] public static XSMaxInclusiveFacet Constructor() => new XSMaxInclusiveFacet(); #endregion #endregion #region IXSComponent XmlSchemaObject IXSComponent.SchemaObject => _facet; void IXSComponent.BindToContainer(IXSComponent rootContainer, IXSComponent container) { Contract.Requires(container is XSSimpleTypeDefinition); RootContainer = rootContainer; SimpleTypeDefinition = container as XSSimpleTypeDefinition; } #endregion } }