コード例 #1
0
        void ExportApi(ICollection <string> referencePaths)
        {
            string[] includeNamespaces = this.PluginInfo.AndroidPlatform.NamespaceMappings.Select(m => m.Namespace)
                                         .Concat(new[] { typeof(AndroidApiCompiler).Namespace }).ToArray();
            Assembly apiAssembly = ClrApi.LoadFrom(
                this.BuiltBindingsAssemblyPath,
                referencePaths,
                includeNamespaces);

            ClrApi androidApi = new ClrApi
            {
                Platform   = PluginInfo.AndroidPlatformName,
                Assemblies = new List <Assembly>(new[] { apiAssembly }),
            };

            string apiXmlPath = Path.GetFullPath(Path.Combine(
                                                     this.PlatformIntermediatePath, this.PlatformName + "-api.xml"));

            using (StreamWriter writer = File.CreateText(apiXmlPath))
            {
                androidApi.ToXml(writer);
            }

            Log.Important($"Exported {this.PlatformName} API metadata to {apiXmlPath}");
        }
コード例 #2
0
        void ExportApi()
        {
            string refPath = @"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework";

            string[] referenceAssemblyPaths = new string[]
            {
                refPath + @"\v4.5\System.dll",
                refPath + @"\v4.5\Facades\System.Runtime.dll",
                refPath + @"\v4.6.1\Facades\System.Diagnostics.Debug.dll",
                refPath + @"\v4.6.1\Facades\System.Runtime.dll",
                refPath + @"\v4.6.1\Facades\System.Threading.Tasks.dll",
                this.pluginMetadataFilePath,
            };
            string[] includeNamespaces = this.PluginInfo.WindowsPlatform.IncludeNamespaces?.Select(m => m.Namespace)
                                         .Concat(new[] { typeof(WindowsApiCompiler).Namespace }).ToArray();

            Assembly apiAssembly = ClrApi.LoadFrom(
                this.BuiltBindingsAssemblyPath, referenceAssemblyPaths, includeNamespaces);

            ClrApi androidApi = new ClrApi
            {
                Platform   = PluginInfo.WindowsPlatformName,
                Assemblies = new List <Assembly>(new[] { apiAssembly }),
                Language   = this.Language,
            };

            string apiXmlPath = Path.GetFullPath(Path.Combine(
                                                     this.PlatformIntermediatePath, this.PlatformName + "-api.xml"));

            using (StreamWriter writer = File.CreateText(apiXmlPath))
            {
                androidApi.ToXml(writer);
            }

            Log.Important($"Exported {this.PlatformName} API metadata to {apiXmlPath}");
        }