コード例 #1
0
        //*************************************************************************
        // Method:		FaultFunctionCheckResource
        // Description: Extracts a fault function  CheckResource from fault xml
        //
        // Parameters:
        //	childNaviator - the path navigator that represents the fault function  CheckResource node
        //		to extract
        //
        // Return Value: the extracted FaultFunctionCheckResource function
        //*************************************************************************
        protected FaultFunctionCheckResource ParseFaultFunctionCheckResource(XPathNavigator childNavigator)
        {
            XPathNavigator             CheckResourceNavigator = childNavigator.Clone();
            FaultFunctionCheckResource CheckResource          = new FaultFunctionCheckResource();

            // get the attributes of the Function tag
            bool hasMoreCheckResourceAttributes = CheckResourceNavigator.MoveToFirstAttribute();

            while (hasMoreCheckResourceAttributes)
            {
                switch (CheckResourceNavigator.Name)
                {
                case "ParamIndex":
                {
                    CheckResource.ParamIndex = CheckResourceNavigator.Value;
                    break;
                }

                case "Exists":
                {
                    CheckResource.Exists = CheckResourceNavigator.Value;
                    break;
                }
                }

                hasMoreCheckResourceAttributes = CheckResourceNavigator.MoveToNextAttribute();
            }

            return(CheckResource);
        }
コード例 #2
0
        //*************************************************************************
        // Method:		ParseFaultFunction
        // Description: parses the xml document and extracts a fault function from it
        //
        // Parameters:
        //	childNaviator - the path navigator that represents the fault function node
        //		to extract
        //
        // Return Value: the extracted fault function
        //*************************************************************************
        protected FaultFunction ParseFaultFunction(XPathNavigator childNavigator)
        {
            XPathNavigator functionNavigator = childNavigator.Clone();
            FaultFunction  function          = new FaultFunction();

            function.Name = functionNavigator.Value;

            // get the attributes of the function tag
            bool hasMoreAttributes = functionNavigator.MoveToFirstAttribute();

            while (hasMoreAttributes)
            {
                switch (functionNavigator.Name)
                {
                case "Name":
                {
                    function.Name = functionNavigator.Value;
                    break;
                }

                case "OverrideErrorCode":
                {
                    function.OverrideErrorCode = functionNavigator.Value;
                    break;
                }

                case "OverrideReturnValue":
                {
                    function.OverrideReturnValue = functionNavigator.Value;
                    break;
                }

                case "PassThrough":
                {
                    function.PassThrough = functionNavigator.Value;
                    break;
                }

                case "Exception":
                {
                    function.Exception = functionNavigator.Value;
                    break;
                }

                case "Allocation":
                {
                    function.Allocation = functionNavigator.Value;
                    break;
                }
                }

                hasMoreAttributes = functionNavigator.MoveToNextAttribute();
            }

            // get back to the function tag
            functionNavigator.MoveToParent();

            bool hasMoreFunctionElements = functionNavigator.MoveToFirstChild();

            while (hasMoreFunctionElements)
            {
                switch (functionNavigator.Name)
                {
                case "MatchParams":
                {
                    FaultFunctionMatchParams FunctionMatchParams = ParseFaultFunctionMatchParams(functionNavigator);
                    if (FunctionMatchParams != null)
                    {
                        function.MatchParams.Add(FunctionMatchParams);
                    }
                    break;
                }

                case "CheckResource":
                {
                    FaultFunctionCheckResource FunctionCheckResource = ParseFaultFunctionCheckResource(functionNavigator);
                    if (FunctionCheckResource != null)
                    {
                        function.CheckResource.Add(FunctionCheckResource);
                    }
                    break;
                }
                }

                hasMoreFunctionElements = functionNavigator.MoveToNext();
            }

            functionNavigator.MoveToParent();

            return(function);
        }
コード例 #3
0
ファイル: FaultXMLNavigator.cs プロジェクト: uvbs/Holodeck
        //*************************************************************************
        // Method:		FaultFunctionCheckResource
        // Description: Extracts a fault function  CheckResource from fault xml
        //
        // Parameters:
        //    childNaviator - the path navigator that represents the fault function  CheckResource node
        //        to extract
        //
        // Return Value: the extracted FaultFunctionCheckResource function
        //*************************************************************************
        protected FaultFunctionCheckResource ParseFaultFunctionCheckResource(XPathNavigator childNavigator)
        {
            XPathNavigator CheckResourceNavigator = childNavigator.Clone();
            FaultFunctionCheckResource CheckResource = new FaultFunctionCheckResource();

            // get the attributes of the Function tag
            bool hasMoreCheckResourceAttributes = CheckResourceNavigator.MoveToFirstAttribute();
            while(hasMoreCheckResourceAttributes)
            {
                switch(CheckResourceNavigator.Name)
                {
                    case "ParamIndex":
                    {
                        CheckResource.ParamIndex = CheckResourceNavigator.Value;
                        break;
                    }
                    case "Exists":
                    {
                        CheckResource.Exists = CheckResourceNavigator.Value;
                        break;
                    }
                }

                hasMoreCheckResourceAttributes = CheckResourceNavigator.MoveToNextAttribute();
            }

            return CheckResource;
        }