|
|
@ -153,18 +153,21 @@ namespace CppSharp.Generators.CSharp |
|
|
|
public virtual void GenerateUsings() |
|
|
|
public virtual void GenerateUsings() |
|
|
|
{ |
|
|
|
{ |
|
|
|
PushBlock(BlockKind.Usings); |
|
|
|
PushBlock(BlockKind.Usings); |
|
|
|
WriteLine("using System;"); |
|
|
|
var requiredNameSpaces = new List<string> { |
|
|
|
WriteLine("using System.Runtime.InteropServices;"); |
|
|
|
"System", |
|
|
|
WriteLine("using System.Security;"); |
|
|
|
"System.Runtime.InteropServices", |
|
|
|
|
|
|
|
"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).ToList(); |
|
|
|
select m.LibraryName).ToList(); |
|
|
|
|
|
|
|
|
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
if (internalsVisibleTo.Any()) |
|
|
|
WriteLine("using System.Runtime.CompilerServices;"); |
|
|
|
requiredNameSpaces.Add("System.Runtime.CompilerServices"); |
|
|
|
|
|
|
|
|
|
|
|
foreach (var customUsingStatement in Options.DependentNameSpaces) |
|
|
|
foreach (var @namespace in requiredNameSpaces.Union(Options.DependentNameSpaces).OrderBy(x => x)) |
|
|
|
WriteLine("using {0};", customUsingStatement); |
|
|
|
WriteLine($"using {@namespace};"); |
|
|
|
|
|
|
|
|
|
|
|
WriteLine("using __CallingConvention = global::System.Runtime.InteropServices.CallingConvention;"); |
|
|
|
WriteLine("using __CallingConvention = global::System.Runtime.InteropServices.CallingConvention;"); |
|
|
|
WriteLine("using __IntPtr = global::System.IntPtr;"); |
|
|
|
WriteLine("using __IntPtr = global::System.IntPtr;"); |
|
|
|