private List <object> Convert(string code) { BasicConverter converter = new BasicConverter(LanguageType.VisualBasic, StorageFactory.CreateStandard()); CodeTypeDeclarationCollection ctd = converter.ConvertNativeCodeToCodeDom(code, new PInvoke.ErrorProvider()); CodeDomIterator it = new CodeDomIterator(); return(it.Iterate(ctd)); }
/// <summary> /// Add any of the helper types that we need /// </summary> private void AddHelperTypes(CodeTypeDeclarationCollection col) { var needed = false; var it = new CodeDomIterator(); foreach (var ctdRef in it.Iterate(col).OfType <CodeTypeReference>()) { if (String.Equals(ctdRef.BaseType, MarshalTypeFactory.PInvokePointerTypeName)) { needed = true; break; } } if (needed) { col.Add(MarshalTypeFactory.CreatePInvokePointerType()); } }