/// <summary> /// Initializes a new instance of the <see cref="PluginData"/> class. /// </summary> /// <param name="path">The path.</param> /// <param name="resourceName">Name of the resource.</param> /// <param name="resourceLanguage">The resource language.</param> /// <param name="piplProperties">The properties.</param> public PluginData(string path, PIPLResourceName resourceName, ushort resourceLanguage, PIProperty[] piplProperties) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (resourceName == null) { throw new ArgumentNullException(nameof(resourceName)); } if (piplProperties == null) { throw new ArgumentNullException(nameof(piplProperties)); } this.path = path; this.resourceName = resourceName; this.resourceLanguage = resourceLanguage; int propertyArrayLength = piplProperties.Length; if (piplProperties[propertyArrayLength - 1].Key != PIPropertyID.PICategoryProperty) { // Reserve space for a new category property at the end of the array. propertyArrayLength++; } properties = new PIProperty[propertyArrayLength]; piplProperties.CopyTo(properties, 0); newCategoryIndex = properties.Length - 1; for (int i = 0; i < piplProperties.Length; i++) { PIProperty prop = piplProperties[i]; switch (prop.Key) { case PIPropertyID.PICategoryProperty: category = PascalStringHelpers.ConvertToString(prop.GetPropertyDataReadOnly()); break; case PIPropertyID.PINameProperty: title = PascalStringHelpers.ConvertToString(prop.GetPropertyDataReadOnly()); break; } } dirty = false; }
/// <summary> /// Determines whether the specified value is too long for a filter category name. /// </summary> /// <param name="value">The value to check.</param> /// <returns><c>true</c> if the specified value too long for a filter category name; otherwise, <c>false</c>.</returns> /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> internal static bool IsCategoryNameTooLong(string value) { return(!PascalStringHelpers.IsLengthValid(value)); }