示例#1
0
        public string FromNative(string var)
        {
            if (IGen == null)
            {
                return(String.Empty);
            }

            if (ElementType != String.Empty)
            {
                string args = (owned ? "true" : "false") + ", " + (elements_owned ? "true" : "false");
                if (IGen.QualifiedName == "GLib.PtrArray")
                {
                    return(String.Format("({0}[]) GLib.Marshaller.PtrArrayToArray ({1}, {2}, typeof({0}))", ElementType, var, args));
                }
                else
                {
                    return(String.Format("({0}[]) GLib.Marshaller.ListPtrToArray ({1}, typeof({2}), {3}, typeof({4}))", ElementType, var, IGen.QualifiedName, args, element_ctype == "gfilename*" ? "GLib.ListBase.FilenameString" : ElementType));
                }
            }
            else if (IGen is HandleBase)
            {
                return(((HandleBase)IGen).FromNative(var, owned));
            }
            else if (is_null_term)
            {
                return(String.Format("GLib.Marshaller.NullTermPtrToStringArray ({0}, {1})", var, owned ? "true" : "false"));
            }
            else
            {
                return(IGen.FromNative(var));
            }
        }
        public string FromNative(string var)
        {
            if (IGen == null)
            {
                return(String.Empty);
            }

            if (ElementType != String.Empty)
            {
                string args = (owned ? "true" : "false") + ", " + (elements_owned ? "true" : "false");
                if (IGen.QualifiedName == "GLib.PtrArray")
                {
                    return(String.Format("({0}[]) GLib.Marshaller.PtrArrayToArray ({1}, {2}, typeof({0}))", ElementType, var, args));
                }
                else
                {
                    return(String.Format("({0}[]) GLib.Marshaller.ListPtrToArray ({1}, typeof({2}), {3}, typeof({4}))", ElementType, var, IGen.QualifiedName, args, element_ctype == "gfilename*" ? "GLib.ListBase.FilenameString" : ElementType));
                }
            }
            else if (IGen is IOwnable)
            {
                return(((IOwnable)IGen).FromNative(var, owned));
            }
            else if (is_null_term)
            {
                return(String.Format("Gst.Marshaller.NullTermPtrToStringArray ({0}, {1})", var, owned ? "true" : "false"));
            }
            else if (is_array)
            {
                return(String.Format("({0}) GLib.Marshaller.ArrayPtrToArray ({1}, typeof ({2}), (int){3}native_{4}, true)", CSType, var, IGen.QualifiedName, CountParameter.CSType == "int" ? String.Empty : "(" + CountParameter.CSType + ")", CountParameter.Name));
            }
            else
            {
                return(IGen.FromNative(var));
            }
        }