/// <summary>Gets a specific <see cref="InfoOutputProperty"/> object which represents the value of a property with respect to <see cref="GeneralPropertyGroupName"/>.
 /// </summary>
 /// <param name="propertyName">The name of the general property.</param>
 /// <param name="value">The general property (output).</param>
 /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
 public bool TryGetGeneralProperty(string propertyName, out InfoOutputProperty value)
 {
     if (propertyName != null)
     {
         return(m_GeneralProperties.TryGetValue(propertyName, out value));
     }
     value = default;
     return(false);
 }
        public void AddItem_TryGetValue_TestCase()
        {
            m_IdentifierStringDictionary.Add("TestItem", 1234);

            bool state = m_IdentifierStringDictionary.TryGetValue("TestItem", out object testOutput);

            Assert.That(state, NUnit.Framework.Is.EqualTo(true));
            Assert.That(testOutput, NUnit.Framework.Is.EqualTo(1234));
        }
 /// <summary>Gets a specific <see cref="InfoOutputProperty"/> object with repsect to a specific property group name.
 /// </summary>
 /// <param name="propertyName">The name of the property.</param>
 /// <param name="value">The property (output).</param>
 /// <param name="propertyGroupName">The name of the property group (i.e. 'General Properties' etc.).</param>
 /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
 public bool TryGetProperty(string propertyName, out InfoOutputProperty value, string propertyGroupName = "General properties")
 {
     if (propertyGroupName != null)
     {
         if (m_Properties.TryGetValue(propertyGroupName, out IdentifierStringDictionaryBase <InfoOutputProperty> propertyCollection) == true)
         {
             return(propertyCollection.TryGetValue(propertyName, out value));
         }
     }
     value = default;
     return(false);
 }
        /// <summary>Gets a specific <see cref="DataTable"/> object.
        /// </summary>
        /// <param name="tableName">The name of the table.</param>
        /// <param name="value">The <see cref="DataTable"/> and its name in its <see cref="IdentifierString"/> representation (output).</param>
        /// <param name="dataTableType">The type of the tables to take into account.</param>
        /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
        public bool TryGetDataTable(IdentifierString tableName, out DataTable value, DataTableType dataTableType = DataTableType.Single)
        {
            if (dataTableType.HasFlag(DataTableType.Single) == true)
            {
                if (m_Tables.TryGetValue(tableName, out value) == true)
                {
                    return(true);
                }
            }
            if (dataTableType.HasFlag(DataTableType.Parent) == true)
            {
                if (m_ParentChildTables.TryGetValue(tableName, out InfoOutputParentChildDataTable parentChildDataTable) == true)
                {
                    value = parentChildDataTable.ParentDataTable;
                    return(true);
                }
            }
            if (dataTableType.HasFlag(DataTableType.Child) == true)
            {
                int index = tableName.IDString.IndexOf(ParentChildTableNameSeparator);
                if (index >= 0)
                {
                    string parentTableName = tableName.IDString.Substring(0, index);
                    string childTableName  = tableName.IDString.Substring(index + ParentChildTableNameSeparator.Length, tableName.IDString.Length - index - ParentChildTableNameSeparator.Length);

                    if (m_ParentChildTables.TryGetValue(parentTableName, out InfoOutputParentChildDataTable parentChildDataTable) == true)
                    {
                        if (parentChildDataTable.ChildDataTable.TableName.ToIDString() == childTableName.ToIDString())
                        {
                            value = parentChildDataTable.ChildDataTable;
                            return(true);
                        }
                    }
                }
            }
            value = null;
            return(false);
        }
Beispiel #5
0
 /// <summary>Gets a <see cref="InfoOutputPackage"/> object with respect to a specific category name.
 /// </summary>
 /// <param name="categoryName">The name of the category, i.e. 'general' etc.</param>
 /// <param name="value">The value (output).</param>
 /// <returns>A value indicating whether <paramref name="value"/> contains valid data.</returns>
 public bool TryGetPackage(string categoryName, out InfoOutputPackage value)
 {
     return(m_Values.TryGetValue(categoryName, out value));
 }