Esempio n. 1
0
        /// <summary>
        /// Retrieves the row in the TypeDefs data table in the Header Data Set object linked to the DataAccess class with the name specified
        /// in the function's TypeDefName parameter.
        /// </summary>
        /// <param name="strTypeDefName"></param>
        /// <returns></returns>
        public CHeaderDataSet.tblTypeDefsRow GetTypeDef(string strTypeDefName)
        {
            try
            {
                CHeaderDataSet.tblTypeDefsRow rowTypeDef = TypeDefsTable.FindByTypeDefName(strTypeDefName);

                return(rowTypeDef);
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in GetTypeDef function of DataAccess class.");
                return(null);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Adds a row to the TypeDefs data table in the Header Data Set object linked to the DataAccess class using the data contained in the
        /// TypeDefData object passed to the function.  The TypeDefData object will contain all the required information needed to create a type
        /// definition record in the TypeDefs table.
        /// </summary>
        /// <param name="tdTypeDef"></param>
        /// <returns></returns>
        public bool AddTypeDefRow(TypeDefData tdTypeDef)
        {
            try
            {
                CHeaderDataSet.tblTypeDefsRow rowTypeDef = TypeDefsTable.NewtblTypeDefsRow();

                rowTypeDef.TypeDefName = tdTypeDef.TypeDefName;
                rowTypeDef.Elements    = tdTypeDef.Elements;
                rowTypeDef.DataSize    = tdTypeDef.DataSize;

                TypeDefsTable.AddtblTypeDefsRow(rowTypeDef);

                return(true);
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in AddTypeDefRow function of DataAccess class.");
                return(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Queries the data type associated with the field with the specified key passed to the function.  The linked data type record will be returned
        /// by the function.   Depending on what type of data type is associated with the field, will determine whether a structure data row, typedef data row
        /// or primitive data object is returned by the function.  Primtive data types will not be stored in the Header Data Set and will have its data returned
        /// from the Global Primitive data object.
        /// </summary>
        /// <param name="strFieldKey"></param>
        /// <returns></returns>
        public object QueryFieldTypeDataByKey(string strFieldKey)
        {
            try
            {
                CHeaderDataSet.tblFieldsRow rowField = FieldsTable.FindByFieldKey(strFieldKey);

                if (rowField == null)
                {
                    return(null);
                }

                switch ((FieldTypeEnum)rowField.FieldType)
                {
                case FieldTypeEnum.Primitive:
                case FieldTypeEnum.Enum:
                case FieldTypeEnum.Pointer:
                    object[] aryPrimTypeData = new object[] { rowField.FieldTypeName, DataAccess.PrimDataTypes[rowField.FieldTypeName] };

                    return(aryPrimTypeData);

                case FieldTypeEnum.TypeDef:
                    CHeaderDataSet.tblTypeDefsRow rowTypeDef = TypeDefsTable.FindByTypeDefName(rowField.FieldTypeName);

                    return(rowTypeDef);

                case FieldTypeEnum.Structure:
                    CHeaderDataSet.tblStructuresRow rowStruct = StructuresTable.FindByStructName(rowField.FieldTypeName);

                    return(rowStruct);
                }
                ;

                return(null);
            }
            catch (Exception err)
            {
                ErrorHandler.ShowErrorMessage(err, "Error in QueryFieldTypeDataByKey function of DataAccess class.");

                return(null);
            }
        }