예제 #1
0
        override public void Translate(XPathNavigator overrides, string category)
        {
            base.Translate(overrides, category);

            // Find out the necessary wrapper types.
            if (Pointer != 0)/* || CurrentType == "IntPtr")*/
            {
                if (CurrentType.ToLower().Contains("string"))
                {
                    // string* -> [In] String[] or [Out] StringBuilder[]
                    QualifiedType =
                        Flow == FlowDirection.Out ?
                        "StringBuilder[]" :
                        "String[]";

                    Pointer     = 0;
                    WrapperType = WrapperTypes.StringParameter;
                }
                else if (CurrentType.ToLower().Contains("char"))
                {
                    // char* -> [In] String or [Out] StringBuilder
                    QualifiedType =
                        Flow == FlowDirection.Out ?
                        "StringBuilder" :
                        "String";

                    Pointer     = 0;
                    WrapperType = WrapperTypes.StringParameter;
                }
                else if (CurrentType.ToLower().Contains("void") ||
                         (!String.IsNullOrEmpty(PreviousType) && PreviousType.ToLower().Contains("void"))) /*|| CurrentType.Contains("IntPtr"))*/
                {
                    CurrentType = "IntPtr";
                    Pointer     = 0;
                    WrapperType = WrapperTypes.GenericParameter;
                }
                else
                {
                    WrapperType = WrapperTypes.ArrayParameter;
                }
            }

            if (Reference)
            {
                WrapperType |= WrapperTypes.ReferenceParameter;
            }

            if (Name == "params")
            {
                Name = "@params";
            }
            if (Name == "event")
            {
                Name = "@event";
            }

            // This causes problems with bool arrays
            //if (CurrentType.ToLower().Contains("bool"))
            //    WrapperType = WrapperTypes.BoolParameter;
        }
예제 #2
0
        override public void Translate(string category)
        {
            base.Translate(category);

            // Find out the necessary wrapper types.
            if (Pointer)/* || CurrentType == "IntPtr")*/
            {
                WrapperType = WrapperTypes.ArrayParameter;

                if (CurrentType.ToLower().Contains("char") || CurrentType.ToLower().Contains("string"))
                {
                    // char* or string -> [In] String or [Out] StringBuilder
                    CurrentType =
                        Flow == Parameter.FlowDirection.Out ?
                        "System.Text.StringBuilder" :
                        "System.String";

                    Pointer     = false;
                    WrapperType = WrapperTypes.None;
                }
                else if (PreviousType != null && (CurrentType.ToLower().Contains("void") || PreviousType.ToLower().Contains("void"))) /*|| CurrentType.Contains("IntPtr"))*/
                {
                    CurrentType = "IntPtr";
                    Pointer     = false;
                    WrapperType = WrapperTypes.GenericParameter;
                }
            }

            if (Reference)
            {
                WrapperType = WrapperTypes.ReferenceParameter;
            }

            // This causes problems with bool arrays
            //if (CurrentType.ToLower().Contains("bool"))
            //    WrapperType = WrapperTypes.BoolParameter;
        }