Ejemplo n.º 1
0
        public string GetSystemTypeName(bool addComment = false)
        {
            string tag = GetRawTypeName();

            if (TypeWrapperFactory.DelegateGenerator.ContainsKey(tag))
            {
                return(TypeWrapperFactory.DelegateGenerator[tag].name);
            }
            else
            {
                DelegateDefine deleg = new DelegateDefine();
                deleg.tag  = tag;
                deleg.name = TypeWrapperFactory.CurrentPrefix + "_func_" + TypeWrapperFactory.DelegateGenerator.Count.ToString();
                //public delegate int GetBufferCallback(IntPtr pAVCodecContext, IntPtr pAVFrame);
                deleg.fullName  = "public delegate ";
                deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(type.ReturnType.Type).GetSystemTypeName(true);
                deleg.fullName += " " + deleg.name + "(\r\n";
                for (int i = 0; i < type.Parameters.Count; i++)
                {
                    var param = type.Parameters[i];
                    deleg.fullName += "\t" + TypeWrapperFactory.CreateTypeWrapper(param.Type).GetMarshalTag();
                    deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(param.Type).GetSystemTypeName(true);
                    if (!string.IsNullOrEmpty(param.Name))
                    {
                        deleg.fullName += " " + param.Name;
                    }
                    else
                    {
                        deleg.fullName += " __arg" + i.ToString();
                    }
                    if (i != (type.Parameters.Count - 1))
                    {
                        deleg.fullName += ", \r\n";
                    }
                }
                deleg.fullName += ");";
                TypeWrapperFactory.DelegateGenerator.Add(tag, deleg);
                return(deleg.name);
            }
        }
Ejemplo n.º 2
0
 public string GetSystemTypeName(bool addComment = false)
 {
     string tag = GetRawTypeName();
     if (TypeWrapperFactory.DelegateGenerator.ContainsKey(tag))
     {
         return TypeWrapperFactory.DelegateGenerator[tag].name;
     }
     else
     {
         DelegateDefine deleg = new DelegateDefine();
         deleg.tag = tag;
         deleg.name = TypeWrapperFactory.CurrentPrefix + "_func_" + TypeWrapperFactory.DelegateGenerator.Count.ToString();
         //public delegate int GetBufferCallback(IntPtr pAVCodecContext, IntPtr pAVFrame);
         deleg.fullName = "public delegate ";
         deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(type.ReturnType.Type).GetSystemTypeName(true);
         deleg.fullName += " " + deleg.name + "(\r\n";
         for (int i = 0; i < type.Parameters.Count; i++)
         {
             var param = type.Parameters[i];
             deleg.fullName += "\t"+TypeWrapperFactory.CreateTypeWrapper(param.Type).GetMarshalTag();
             deleg.fullName += TypeWrapperFactory.CreateTypeWrapper(param.Type).GetSystemTypeName(true);
             if (!string.IsNullOrEmpty(param.Name))
                 deleg.fullName += " " + param.Name;
             else
                 deleg.fullName += " __arg" + i.ToString();
             if (i != (type.Parameters.Count - 1))
                 deleg.fullName += ", \r\n";
         }
         deleg.fullName += ");";
         TypeWrapperFactory.DelegateGenerator.Add(tag, deleg);
         return deleg.name;
     }
 }