Esempio n. 1
0
 private static void ReleaseCachedInterfaces(CppCodeWriter writer, TypeDefinition declaringType)
 {
     TypeReference[] referenceArray = declaringType.ImplementedComOrWindowsRuntimeInterfaces().ToArray <TypeReference>();
     if (referenceArray.Length != 0)
     {
         bool flag = declaringType.GetComposableFactoryTypes().Count <TypeReference>() > 0;
         if (flag)
         {
             writer.WriteLine($"if ({Naming.ThisParameterName}->klass->is_import_or_windows_runtime)");
             writer.BeginBlock();
         }
         foreach (TypeReference reference in referenceArray)
         {
             string str = Naming.ForComTypeInterfaceFieldName(reference);
             writer.WriteLine($"if ({Naming.ThisParameterName}->{str} != {Naming.Null})");
             using (new BlockWriter(writer, false))
             {
                 writer.WriteLine($"{Naming.ThisParameterName}->{str}->Release();");
             }
         }
         if (flag)
         {
             writer.EndBlock(false);
         }
         writer.WriteLine();
         foreach (TypeReference reference2 in referenceArray)
         {
             string str2 = Naming.ForComTypeInterfaceFieldName(reference2);
             writer.WriteLine($"{Naming.ThisParameterName}->{str2} = {Naming.Null};");
         }
         writer.WriteLine();
     }
 }