/// <summary>
        /// Сохранение системного стиля в специальный файл
        /// </summary>
        /// <param name="style">Системный стиль</param>
        public static void SaveSystemStyleToFile(IMPCOStyle style)
        {
            // Загружаем файл системных стилей
            var xFile = XElement.Load(MPCOInitialize.SystemStylesFile);

            if (!xFile.Elements("Style").Any(x =>
            {
                var xAttribute = x.Attribute("Name");
                return(xAttribute != null && xAttribute.Value.Equals(style.Name));
            }))
            {
                XElement newStyle = new XElement("Style");
                newStyle.SetAttributeValue("Name", style.Name);
                newStyle.SetAttributeValue("FunctionName", style.FunctionName);
                newStyle.SetAttributeValue("Description", style.Description);
                newStyle.SetAttributeValue("Guid", style.Guid);
                newStyle.SetAttributeValue("StyleType", style.StyleType);
                foreach (MPCOStyleProperty property in style.Properties)
                {
                    var propXel = new XElement("Property");
                    propXel.SetElementValue("Name", property.Name);
                    propXel.SetElementValue("Value", property.Value);
                    propXel.SetElementValue("DisplayName", property.DisplayName);
                    propXel.SetElementValue("Description", property.Description);
                    propXel.SetElementValue("StylePropertyType", property.StylePropertyType);
                    if (property.MinInt != null)
                    {
                        propXel.SetElementValue("MinInt", property.MinInt.Value);
                    }
                    if (property.MaxInt != null)
                    {
                        propXel.SetElementValue("MaxInt", property.MaxInt.Value);
                    }
                    if (property.MinDouble != null)
                    {
                        propXel.SetElementValue("MinDouble", property.MinDouble.Value);
                    }
                    if (property.MaxDouble != null)
                    {
                        propXel.SetElementValue("MaxDouble", property.MaxDouble.Value);
                    }
                    newStyle.Add(propXel);
                }
                xFile.Add(newStyle);
                xFile.Save(MPCOInitialize.SystemStylesFile);
            }
        }
 private static object GetProperty(IMPCOStyle style, string name)
 {
     return(style.Properties.FirstOrDefault(x => x.Name.Equals(name))?.Value);
 }
 /// <summary>
 /// Получение целочисленного параметра из стиля
 /// </summary>
 /// <param name="style">Стиль</param>
 /// <param name="name">Имя параметра</param>
 /// <param name="defaultValue">Значение по умолчанию, возвращаемое в случае неудачного парсинга</param>
 /// <returns>Целочисленное значение параметра</returns>
 public static int GetIntegerPropery(IMPCOStyle style, string name, int defaultValue)
 {
     return(int.TryParse(GetProperty(style, name).ToString(), out int i) ? i : defaultValue);
 }