예제 #1
0
        /// <summary>
        /// The method is used to check the valid of database.
        /// </summary>
        /// <returns></returns>
        public bool checkDatabaseIsValid()
        {
            // Version and header must be existent and valid.
            if (ValidityOfContent.ExistentAndValid == (versionIsValid = checkVersionIsValid()) &&
                ValidityOfContent.ExistentAndValid == (header.HeaderIsValidValue = header.checkHeaderIsValid()))
            {
                return(true);
            }

            return(false);
        }
예제 #2
0
        public ValidityOfContent checkHeaderIsValid()
        {
            if (headerIsValid == ValidityOfContent.NonExistent ||
                headerIsValid == ValidityOfContent.ParseError)
            {
                return(headerIsValid);
            }

            if (headerIsValid == ValidityOfContent.Existent)
            {
                descriptionIsValid          = checkDescriptionIsValid();
                swPartNumberIsValid         = checkSwPartNumberIsValid();
                swPartTypeIsValid           = checkSwPartType();
                dataFormatIdentifierIsValid = checkDataFormatIdentifier();
                frameFormatIsValid          = checkFrameFormat();
                ecuAddressIsValid           = checkEcuAddress();
                eraseIsValid        = checkErase();
                omitIsValid         = checkOmit();
                callIsValid         = checkCall();
                fileCheckSumIsValid = checkFileCheckSum();

                // The following contents are mandatory requirements, must be existent and valid.
                if (swPartNumberIsValid != ValidityOfContent.ExistentAndValid ||
                    swPartTypeIsValid != ValidityOfContent.ExistentAndValid ||
                    ecuAddressIsValid != ValidityOfContent.ExistentAndValid ||
                    frameFormatIsValid != ValidityOfContent.ExistentAndValid ||
                    fileCheckSumIsValid != ValidityOfContent.ExistentAndValid)
                {
                    return(ValidityOfContent.ExistentButInvalid);
                }

                // The following contents are optional, but existent and invalid.
                if (descriptionIsValid == ValidityOfContent.ExistentButInvalid ||
                    dataFormatIdentifierIsValid == ValidityOfContent.ExistentButInvalid ||
                    eraseIsValid == ValidityOfContent.ExistentButInvalid ||
                    omitIsValid == ValidityOfContent.ExistentButInvalid ||
                    callIsValid == ValidityOfContent.ExistentButInvalid)
                {
                    return(ValidityOfContent.ExistentButInvalid);
                }
            }

            return(ValidityOfContent.ExistentAndValid);
        }