예제 #1
0
 private void Deserialized(StreamingContext context)
 {
   if (string.IsNullOrEmpty(_Type))
     ReturnType = new MagickType(CreatesInstance ? "voidInstance" : "void");
   else
     ReturnType = new MagickType(CreatesInstance ? "Instance" : _Type);
 }
 private string GetAction(string action, MagickType type)
 {
   if (type.IsString)
     return "UTF8Marshaler.NativeToManaged(" + action + ");";
   else
     return type.ManagedTypeCast + action + ";";
 }
예제 #3
0
 private void Deserializated(StreamingContext context)
 {
   Type = new MagickType(_Type);
 }
    private void WriteReturn(MagickType type)
    {
      if (type.IsVoid)
        return;

      if (IsDynamic(type))
        WriteLine("return " + type.Managed + ".CreateInstance(result);");
      else if (type.IsNativeString)
        WriteLine("return UTF8Marshaler.NativeToManagedAndRelinquish(result);");
      else if (type.IsString)
        WriteLine("return UTF8Marshaler.NativeToManaged(result);");
      else if (type.HasInstance)
        WriteLine("return " + type.Managed + ".Create(result);");
      else
        WriteLine("return " + type.ManagedTypeCast + "result;");
    }
 private void WriteCreateStartOut(string name, MagickType type)
 {
   WriteLine("using (INativeInstance " + name + "Native = " + type.Managed + ".CreateInstance())");
   WriteStartColon();
   WriteLine("IntPtr " + name + "NativeOut = " + name + "Native.Instance;");
 }
    private void WriteCreateStart(string name, MagickType type)
    {
      Write("using (INativeInstance " + name + "Native = ");

      if (type.IsString)
        Write("UTF8Marshaler");
      else
        Write(type.Managed);

      WriteLine(".CreateInstance(" + name + "))");
      WriteStartColon();
    }
예제 #7
0
 private void WriteMarshal(MagickType type)
 {
   if (type.IsBool)
     WriteLine("[return: MarshalAs(UnmanagedType.Bool)]");
 }
예제 #8
0
 private void Deserializated(StreamingContext context)
 => Type = new MagickType(_type);
예제 #9
0
 protected bool IsDynamic(MagickType type)
 {
     return(IsDynamic(type.Managed));
 }
예제 #10
0
 private void WriteCreateStartOut(string name, MagickType type)
 {
     WriteLine("using (INativeInstance " + name + "Native = " + type.Managed + ".CreateInstance())");
     WriteStartColon();
     WriteLine("IntPtr " + name + "NativeOut = " + name + "Native.Instance;");
 }
예제 #11
0
    protected bool NeedsCreate(MagickType type)
    {
      if (type.IsString)
        return true;

      return IsDynamic(type.Managed);
    }
예제 #12
0
 protected bool IsDynamic(MagickType type)
 {
   return IsDynamic(type.Managed);
 }