Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="VError"></param>
        /// <returns></returns>
        private void OneObjectErrorUpdate(VerificationError VError)
        {
            //Problem with the design ---
            //Once it HasChanged been updated we need to exit the loop.
            //Each error is only going to be there 1 time.
            //Once we find it we need out!!

            //string searchString = VError.IOPName;
            //module
            // if null then it is a module, else it is an IOP
            if (VError.IOPName == null)
            {
                #region Module Level Error Method
                foreach (EarlabModule currentModule in EarlabModules)
                {
                    //This is NOT working b/c it is not referencing the right Object!!!
                    if (currentModule.theEarlabModuleInformation.InstanceName.ToLower() == VError.ModuleInstanceName.ToLower())
                    {
                        //update module with verror info
                        currentModule.Message  = VError.Message;
                        currentModule.Severity = VError.Severity;
                        return;
                    }
                }
                #endregion
            }

            //this is a input-output-parameter
            //VError.IOPType.ToLower()
            else if (VError.IOPType.ToLower() == "parameter" || VError.IOPType.ToLower() == "input" || VError.IOPType.ToLower() == "output")
            {
                #region IOP Level Error Method
                //go through each module
                foreach (EarlabModule currentModule in EarlabModules)
                {
                    //We have the right module now
                    if (VError.ModuleInstanceName.ToLower() == currentModule.theEarlabModuleInformation.InstanceName.ToLower())
                    {
                        //Now we need the input output or parameter
                        switch (VError.IOPType.ToLower())
                        {
                        case "parameter":
                            //code pattern for finding the IOP
                            foreach (EarlabParameter parameter in currentModule.EarlabParameters)
                            {
                                if (parameter.PName.ToLower() == VError.IOPName.ToLower())
                                {
                                    //update parameter with verror info
                                    parameter.Message  = VError.Message;
                                    parameter.Severity = VError.Severity;
                                    //return true;
                                    return;
                                }
                            }
                            //This means that the error sent back from the EFI is a parameter, but not named properly.
                            throw new System.NotSupportedException("The Parameter Name " + VError.IOPName + " is not recognized.");
                        //break;

                        case "input":

                            //foreach (EarlabInput input in currentModule.EarlabInputs)
                            //{
                            //    if (input.PName == VError.IOPName)
                            //        TheVar = input;
                            //return;
                            break;


                        //}



                        case "output":

                            //foreach (EarlabOutput output in currentModule.EarlabOutputs)
                            //{
                            //    if (output.PName == VError.IOPName)
                            //        TheVar = output;
                            //return true;
                            //}
                            break;

                        default:
                            throw new System.NotSupportedException("The Error type " + VError.IOPType + " is not recognized.");
                        } //end switch
                    }     //end if

                    //module name is not recognized what would this mean?
                    //else
                    //throw new System.NotSupportedException("The Error type " + VError.ModuleName + " is not recognized.");
                }//end foreach
                #endregion
                //this is the same problem as above -- module name not recognized, no reason to have the code twice.
                //throw new System.NotSupportedException("The Error type " + VError.ModuleName + " is not recognized.");
            }//end else if

            //catch -- all we have soem error and it doesn't correspond to a module or module's IOP.
            else
            {
                throw new System.NotSupportedException("The Full Verification Error type with path " + VError.FullErrorPath + " is not recognized.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This allows you to access the Earlabsession object you want by using the path.
        /// 1.) Module
        /// 2.) I-O-P
        /// 3.) Thus you have to cast the object when you want to use it.
        /// </summary>
        /// <param name="VError"></param>
        /// <returns></returns>
        public EarlabSession this[VerificationError VError]
        {
            //problem if module error and parameter error.
            //how to you return the problem twice.
            //no problem, b/c there will be two diffferetn paths
            //VError.ModuleName
            //VError.parameter
            //VError.IOPName

            get
            {
                //string searchString = VError.IOPName;
                //module
                if (VError.IOPName == null)
                {
                    foreach (EarlabModule currentModule in EarlabModules)
                    {
                        if (currentModule.theEarlabModuleInformation.InstanceName.ToLower() == VError.ModuleInstanceName)
                        {
                            return(currentModule);
                        }
                    }
                }


                //this is a input-output-parameter
                //VError.IOPType.ToLower()
                else
                {
                    //go through each module
                    foreach (EarlabModule currentModule in EarlabModules)
                    {
                        //We have the right module now
                        if (VError.ModuleInstanceName == currentModule.theEarlabModuleInformation.InstanceName.ToLower())
                        {
                            //Now we need the input output or parameter
                            switch (VError.IOPType.ToLower())
                            {
                            case "parameter":
                                //code pattern for finding the IOP
                                foreach (EarlabParameter parameter in currentModule.EarlabParameters)
                                {
                                    if (parameter.PName == VError.IOPName)
                                    {
                                        return(parameter);
                                    }

                                    //we have some error
                                    else
                                    {
                                        return(null);
                                    }
                                }
                                break;

                            case "input":

                                //foreach (EarlabInput input in currentModule.EarlabInputs)
                                //{
                                //    if (input.PName == VError.IOPName)
                                //        TheVar = input;
                                return(null);

                            //}



                            case "output":

                                //foreach (EarlabOutput output in currentModule.EarlabOutputs)
                                //{
                                //    if (output.PName == VError.IOPName)
                                //        TheVar = output;
                                return(null);

                            //}

                            default:
                                throw new System.NotSupportedException("The Error type " + VError.IOPType + " is not recognized.");
                            } //end switch
                        }     //end if

                        //module name is not recognized what would this mean?
                        //else
                        //throw new System.NotSupportedException("The Error type " + VError.ModuleName + " is not recognized.");
                    }   //end foreach
                        //this is the same problem as above -- module name not recognized, no reason to have the code twice.
                    throw new System.NotSupportedException("The Error type " + VError.ModuleInstanceName + " is not recognized.");
                }   //end else

                throw new System.NotSupportedException("The Full Verification Error type with path" + VError.FullErrorPath + "is not recognized.");
            }
        }