|
|
|
@ -149,14 +149,17 @@ namespace CppSharp.Generators.CSharp |
|
|
|
{ |
|
|
|
{ |
|
|
|
GenerateFilePreamble(); |
|
|
|
GenerateFilePreamble(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var module = TranslationUnits.Count == 0 ? |
|
|
|
|
|
|
|
Context.Options.SystemModule : TranslationUnit.Module; |
|
|
|
|
|
|
|
|
|
|
|
PushBlock(CSharpBlockKind.Usings); |
|
|
|
PushBlock(CSharpBlockKind.Usings); |
|
|
|
WriteLine("using System;"); |
|
|
|
WriteLine("using System;"); |
|
|
|
WriteLine("using System.Runtime.InteropServices;"); |
|
|
|
WriteLine("using System.Runtime.InteropServices;"); |
|
|
|
WriteLine("using System.Security;"); |
|
|
|
WriteLine("using System.Security;"); |
|
|
|
|
|
|
|
|
|
|
|
var internalsVisibleTo = from m in Options.Modules |
|
|
|
var internalsVisibleTo = (from m in Options.Modules |
|
|
|
where m.Dependencies.Contains(Module) |
|
|
|
where m.Dependencies.Contains(module) |
|
|
|
select m.LibraryName; |
|
|
|
select m.LibraryName).ToList(); |
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
WriteLine("using System.Runtime.CompilerServices;"); |
|
|
|
WriteLine("using System.Runtime.CompilerServices;"); |
|
|
|
|
|
|
|
|
|
|
|
@ -170,17 +173,17 @@ namespace CppSharp.Generators.CSharp |
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
NewLine(); |
|
|
|
NewLine(); |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Module.OutputNamespace)) |
|
|
|
if (!string.IsNullOrEmpty(module.OutputNamespace)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
PushBlock(CSharpBlockKind.Namespace); |
|
|
|
PushBlock(CSharpBlockKind.Namespace); |
|
|
|
WriteLine("namespace {0}", Module.OutputNamespace); |
|
|
|
WriteLine("namespace {0}", module.OutputNamespace); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
WriteStartBraceIndent(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
foreach (var unit in TranslationUnits) |
|
|
|
foreach (var unit in TranslationUnits) |
|
|
|
unit.Visit(this); |
|
|
|
unit.Visit(this); |
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(Module.OutputNamespace)) |
|
|
|
if (!string.IsNullOrEmpty(module.OutputNamespace)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
WriteCloseBraceIndent(); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
PopBlock(NewLineKind.BeforeNextBlock); |
|
|
|
|