Beispiel #1
0
 private void WriteApplicationClass(WindowsAccessBridgeModel model, SourceCodeWriter sourceWriter, ClassDefinition definition)
 {
     if (!model.ClassNeedsWrapper(definition))
     {
         WriteStructLayoutAttributeLine(sourceWriter);
     }
     sourceWriter.WriteLine("public class {0} {{", sourceWriter.GetTypeName(definition.Name));
     WriteFields(model, sourceWriter, definition);
     sourceWriter.WriteLine("}}");
 }
Beispiel #2
0
 private void WriteLibraryClasses(WindowsAccessBridgeModel model, StreamWriter writer, SourceCodeWriter sourceWriter)
 {
     sourceWriter.IsNativeTypes = true;
     model.Classes.ForEach(x => {
         if (model.ClassNeedsWrapper(x))
         {
             WriteLibraryClass(model, sourceWriter, x);
             writer.WriteLine();
         }
     });
 }
Beispiel #3
0
        private void WriteApplicationFunctionsClass(WindowsAccessBridgeModel model, SourceCodeWriter sourceWriter)
        {
            sourceWriter.IsNativeTypes = false;
            sourceWriter.WriteLine("/// <summary>");
            sourceWriter.WriteLine("/// Implementation of <see cref=\"AccessBridgeFunctions\"/> using <code>WindowsAccessBridge DLL</code>", GetLegacySuffix(sourceWriter));
            sourceWriter.WriteLine("/// entry points implemented in <see cref=\"AccessBridgeEntryPoints{0}\"/>", GetLegacySuffix(sourceWriter));
            sourceWriter.WriteLine("/// </summary>");
            sourceWriter.WriteLine("internal partial class AccessBridgeNativeFunctions{0} : AccessBridgeFunctions {{", GetLegacySuffix(sourceWriter));
            sourceWriter.IncIndent();

            sourceWriter.WriteLine();
            sourceWriter.WriteLine("#region Function implementations");
            sourceWriter.WriteLine();
            foreach (var function in model.Functions)
            {
                WriteApplicationFunctionImplementation(model, sourceWriter, function);
            }
            sourceWriter.WriteLine("#endregion");
            sourceWriter.WriteLine();

            sourceWriter.WriteLine("#region Wrap/Unwrap structs");
            sourceWriter.WriteLine();
            foreach (var definition in model.Structs)
            {
                if (model.StructNeedsWrapper(definition))
                {
                    WriteApplicationWrapStructFunctions(model, sourceWriter, definition);
                }
            }
            sourceWriter.WriteLine("#endregion");
            sourceWriter.WriteLine();

            sourceWriter.WriteLine("#region CopyWrap/CopyUnwrap classes");
            sourceWriter.WriteLine();
            foreach (var definition in model.Classes)
            {
                if (model.ClassNeedsWrapper(definition))
                {
                    WriteApplicationCopyClassFunctions(model, sourceWriter, definition);
                }
            }
            sourceWriter.WriteLine("#endregion");
            sourceWriter.WriteLine();

            sourceWriter.DecIndent();
            sourceWriter.WriteLine("}}");
            sourceWriter.WriteLine();
        }