//===========================================================================================
        private void WriteCallMethods(IndentedTextWriter writer)
        {
            foreach (MethodBase method in Methods)
            {
                string          xsdMethodName = MagickNET.GetXsdName(method);
                ParameterInfo[] parameters    = method.GetParameters();

                writer.Write("XmlElement^ ");
                writer.Write(xsdMethodName);
                writer.Write(" = (XmlElement^)element->SelectSingleNode(\"");
                writer.Write(xsdMethodName);
                writer.WriteLine("\");");

                writer.Write("if (");
                writer.Write(xsdMethodName);
                writer.WriteLine(" != nullptr)");
                writer.WriteLine("{");

                writer.Indent++;

                foreach (ParameterInfo parameter in parameters)
                {
                    string typeName = MagickNET.GetCppTypeName(parameter);

                    writer.Write(typeName);
                    writer.Write(" ");
                    writer.Write(parameter.Name);
                    writer.Write("_ = XmlHelper::GetAttribute<");
                    writer.Write(typeName);
                    writer.Write(">(");
                    writer.Write(xsdMethodName);
                    writer.Write(", \"");
                    writer.Write(parameter.Name);
                    writer.WriteLine("\");");
                }

                writer.Write("result->");
                writer.Write(method.Name);
                writer.Write("(");

                for (int i = 0; i < parameters.Length; i++)
                {
                    if (i > 0)
                    {
                        writer.Write(",");
                    }

                    writer.Write(parameters[i].Name);
                    writer.Write("_");
                }

                writer.WriteLine(");");
                writer.Indent--;

                writer.WriteLine("}");
            }
        }
예제 #2
0
        //===========================================================================================
        private void WriteMethod(IndentedTextWriter writer, MethodBase method, ParameterInfo[] parameters)
        {
            foreach (ParameterInfo parameter in parameters)
            {
                string typeName = MagickNET.GetCppTypeName(parameter);

                writer.Write(typeName);
                writer.Write(" ");
                writer.Write(parameter.Name);
                writer.Write("_ = ");
                WriteGetValue(writer, parameter);
            }

            WriteCall(writer, method, parameters);
        }
        //===========================================================================================
        protected void WriteGetValue(IndentedTextWriter writer, PropertyInfo property)
        {
            string typeName    = MagickNET.GetCppTypeName(property);
            string xsdTypeName = MagickNET.GetXsdAttributeType(property);

            if (xsdTypeName != null)
            {
                WriteGetElementValue(writer, typeName, "value");
            }
            else
            {
                WriteCreateMethod(writer, typeName);
                writer.Write("(");
                WriteSelectElement(writer, typeName, null);
                writer.WriteLine(");");
            }
        }