Merge remote-tracking branch 'opentk/develop' into develop

This commit is contained in:
Tzach Shabtay 2017-12-19 22:35:10 -05:00
commit 3ac862693d
456 changed files with 260509 additions and 115341 deletions

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
### Purpose of this PR
* Description of feature/change.
* Which part of OpenTK does this affect (Math, OpenGL, Platform, Input, etc).
* Links to screenshots, design docs, user docs, etc.
### Testing status
* Explanation of whats tested, how tested and existing or new automation tests.
* Can include manual testing by self.
* Specify test plans.
* Rarely acceptable to have no testing.
### Comments
* Any other comments to help understand the change.

418
.gitignore vendored
View file

@ -1,31 +1,63 @@
# =============================================
# Visual Studio & Associated technologies
# =============================================
## Ignore Visual Studio temporary files, build results, and ## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons. ## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files # User-specific files
*.suo *.suo
*.user *.user
*.userosscache
*.sln.docstates *.sln.docstates
# Xamarin Studio / monodevelop user-specific # User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs *.userprefs
*.dll.mdb
*.exe.mdb
# Build results # Build results
[Dd]ebug/ [Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/ [Rr]elease/
[Rr]eleases/
x64/ x64/
build/ x86/
bld/
[Bb]in/ [Bb]in/
[Oo]bj/ [Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results # MSTest test Results
[Tt]est[Rr]esult*/ [Tt]est[Rr]esult*/
[Bb]uild[Ll]og.* [Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c *_i.c
*_p.c *_p.c
*_i.h
*.ilk *.ilk
*.meta *.meta
*.obj *.obj
@ -45,24 +77,31 @@ build/
*.vssscc *.vssscc
.builds .builds
*.pidb *.pidb
*.log *.svclog
*.scc *.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files # Visual C++ cache files
ipch/ ipch/
*.aps *.aps
*.ncb *.ncb
*.opendb
*.opensdf *.opensdf
*.sdf *.sdf
*.cachefile *.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler # Visual Studio profiler
*.psess *.psess
*.vsp *.vsp
*.vspx *.vspx
*.sap
# Other Visual Studio data # TFS 2012 Local Workspace
.vs/ $tf/
# Guidance Automation Toolkit # Guidance Automation Toolkit
*.gpState *.gpState
@ -70,6 +109,10 @@ ipch/
# ReSharper is a .NET coding add-in # ReSharper is a .NET coding add-in
_ReSharper*/ _ReSharper*/
*.[Rr]e[Ss]harper *.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in # TeamCity is a build add-in
_TeamCity* _TeamCity*
@ -77,9 +120,21 @@ _TeamCity*
# DotCover is a Code Coverage Tool # DotCover is a Code Coverage Tool
*.dotCover *.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch # NCrunch
*.ncrunch* _NCrunch_*
.*crunch*.local.xml .*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder # Installshield output folder
[Ee]xpress/ [Ee]xpress/
@ -98,57 +153,158 @@ DocProject/Help/html
publish/ publish/
# Publish Web Output # Publish Web Output
*.Publish.xml *.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Enable nuget.exe in the .nuget folder (though normally executables are not tracked) # Microsoft Azure Web App publish settings. Comment the next line if you want to
!.nuget/NuGet.exe # checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# Windows Azure Build Output # NuGet Packages
csx *.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef *.build.csdef
# Windows Store app package directory # Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/ AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others # Others
sql/
*.Cache
ClientBin/ ClientBin/
[Ss]tyle[Cc]op.*
~$* ~$*
*~ *~
*.dbmdl *.dbmdl
*.[Pp]ublish.xml *.dbproj.schemaview
*.jfm
*.pfx *.pfx
*.publishsettings *.publishsettings
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects # RIA/Silverlight projects
Generated_Code/ Generated_Code/
# Backup & report files from converting an old project file to a newer # Backup & report files from converting an old project file
# Visual Studio version. Backup files are not needed, because we have git ;-) # to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/ _UpgradeReport_Files/
Backup*/ Backup*/
UpgradeLog*.XML UpgradeLog*.XML
UpgradeLog*.htm UpgradeLog*.htm
# SQL Server files # SQL Server files
App_Data/*.mdf *.mdf
App_Data/*.ldf *.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
#LightSwitch generated files # Microsoft Fakes
GeneratedArtifacts/ FakesAssemblies/
_Pvt_Extensions/
ModelManifest.xml # GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Typescript v1 declaration files
typings/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# ========================= # =========================
# Windows detritus # Windows detritus
# ========================= # =========================
# Windows image file caches # Windows thumbnail cache files
Thumbs.db Thumbs.db
ehthumbs.db ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file # Folder config file
Desktop.ini Desktop.ini
@ -156,8 +312,46 @@ Desktop.ini
# Recycle Bin used on file shares # Recycle Bin used on file shares
$RECYCLE.BIN/ $RECYCLE.BIN/
# Mac desktop service store files # Windows Installer files
.DS_Store *.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# ===========
# Macintosh
# ===========
# General
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# =================================================== # ===================================================
# Exclude F# project specific directories and files # Exclude F# project specific directories and files
@ -174,6 +368,8 @@ temp/
# Test results produced by build # Test results produced by build
TestResults.xml TestResults.xml
output.mlpd
coverage.xml
# Nuget outputs # Nuget outputs
nuget/*.nupkg nuget/*.nupkg
@ -187,3 +383,165 @@ docs/content/license.md
docs/content/release-notes.md docs/content/release-notes.md
.fake .fake
docs/tools/FSharp.Formatting.svclog docs/tools/FSharp.Formatting.svclog
# ===========
# Covers JetBrains IDEs: Rider, IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# ===========
# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries
# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
# Gradle:
.idea/**/gradle.xml
.idea/**/libraries
# CMake
cmake-build-debug/
# Mongo Explorer plugin:
.idea/**/mongoSettings.xml
## File-based project format:
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# ============
# MonoDevelop
# ============
#User Specific
*.userprefs
*.usertasks
#Mono Project Files
*.pidb
*.resources
test-results/
# ================
# Linux-specific
# ================
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# ============
# VS Code
# ============
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# ============
# Emacs
# ============
# -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# ===========
# Vim
# ===========
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# Session
Session.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags

View file

@ -5,5 +5,16 @@ sudo: false # use the new container-based Travis infrastructure
before_install: before_install:
- chmod +x build.sh - chmod +x build.sh
before_script:
# Start a virtual framebuffer as described: https://docs.travis-ci.com/user/gui-and-headless-browsers/
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start
script: script:
- ./build.sh NuGet - travis_wait ./build.sh NuGet
after_script:
- mono --debug --profile=log:coverage,covfilter=+OpenTK,covfilter=-OpenTK.Tests,covfilter=-FSharp.Core,covfilter=-FsCheck,covfilter=-xunit.assert "packages/xunit.runner.console/tools/xunit.console.exe" "tests/OpenTK.Tests/bin/Release/OpenTK.Tests.dll" -parallel none
- mprof-report --reports=coverage --coverage-out=coverage.xml output.mlpd
- bash <(curl -s https://codecov.io/bash)

View file

@ -21,8 +21,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.GLWidget", "src\Open
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1857BB8E-1A35-4EBF-9F6D-685F11DC025B}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1857BB8E-1A35-4EBF-9F6D-685F11DC025B}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenTK.Tests", "tests\OpenTK.Tests\OpenTK.Tests.csproj", "{930A780C-A67C-422F-9EED-DB38DAA47AB0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.API.Desktop", "tests\Test.API.Desktop\Test.API.Desktop.csproj", "{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.API.Desktop", "tests\Test.API.Desktop\Test.API.Desktop.csproj", "{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{F1A57014-71CE-4032-A652-01B7E35E14DB}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{F1A57014-71CE-4032-A652-01B7E35E14DB}"
@ -38,6 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{5EEE
RELEASE_NOTES.md = RELEASE_NOTES.md RELEASE_NOTES.md = RELEASE_NOTES.md
EndProjectSection EndProjectSection
EndProject EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "OpenTK.Tests", "tests\OpenTK.Tests\OpenTK.Tests.fsproj", "{6801C263-ADDA-4A7B-979D-649BCB5A1DF7}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "OpenTK.Tests.Integration", "tests\OpenTK.Tests.Integration\OpenTK.Tests.Integration.fsproj", "{522D9279-3ED6-475F-867A-6AE69A53C24A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -76,23 +78,25 @@ Global
{A625BE87-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {A625BE87-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A625BE87-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {A625BE87-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A625BE87-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {A625BE87-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU
{930A780C-A67C-422F-9EED-DB38DAA47AB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{930A780C-A67C-422F-9EED-DB38DAA47AB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{930A780C-A67C-422F-9EED-DB38DAA47AB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{930A780C-A67C-422F-9EED-DB38DAA47AB0}.Release|Any CPU.Build.0 = Release|Any CPU
{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Debug|Any CPU.Build.0 = Debug|Any CPU {C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Release|Any CPU.ActiveCfg = Release|Any CPU {C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Release|Any CPU.Build.0 = Release|Any CPU {C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99}.Release|Any CPU.Build.0 = Release|Any CPU
{6801C263-ADDA-4A7B-979D-649BCB5A1DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6801C263-ADDA-4A7B-979D-649BCB5A1DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6801C263-ADDA-4A7B-979D-649BCB5A1DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6801C263-ADDA-4A7B-979D-649BCB5A1DF7}.Release|Any CPU.Build.0 = Release|Any CPU
{522D9279-3ED6-475F-867A-6AE69A53C24A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{522D9279-3ED6-475F-867A-6AE69A53C24A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{522D9279-3ED6-475F-867A-6AE69A53C24A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{522D9279-3ED6-475F-867A-6AE69A53C24A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{930A780C-A67C-422F-9EED-DB38DAA47AB0} = {1857BB8E-1A35-4EBF-9F6D-685F11DC025B}
{C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99} = {1857BB8E-1A35-4EBF-9F6D-685F11DC025B} {C4DDD20F-CB4E-43F4-A75C-4A3D668E1F99} = {1857BB8E-1A35-4EBF-9F6D-685F11DC025B}
EndGlobalSection {6801C263-ADDA-4A7B-979D-649BCB5A1DF7} = {1857BB8E-1A35-4EBF-9F6D-685F11DC025B}
GlobalSection(MonoDevelopProperties) = preSolution {522D9279-3ED6-475F-867A-6AE69A53C24A} = {1857BB8E-1A35-4EBF-9F6D-685F11DC025B}
StartupItem = Source\Examples\OpenTK.Examples.csproj
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View file

@ -18,10 +18,19 @@ Project website: https://opentk.github.io/
Official git repository: https://github.com/opentk/opentk Official git repository: https://github.com/opentk/opentk
Build Status
========
| Platform | Status |
| -------------- | -------------- |
| Windows | [![Build status](https://ci.appveyor.com/api/projects/status/opentk/branch/develop?svg=true)](https://ci.appveyor.com/project/varon/opentk/branch/develop) |
| Mono/Linux | [![Build status](https://travis-ci.org/opentk/opentk.svg?branch=develop)](https://travis-ci.org/opentk/opentk) |
Features Features
======== ========
- Create cutting-edge graphics with OpenGL 4.4 and OpenGL ES 3.0 - Create cutting-edge graphics with OpenGL 4.6 and OpenGL ES 3.0
- Spice up your GUI with 3d acceleration - Spice up your GUI with 3d acceleration
- Improve your code flow with strong types and inline documentation - Improve your code flow with strong types and inline documentation
- Write once run everywhere - Write once run everywhere
@ -35,6 +44,7 @@ Instructions
============ ============
The simplest way to use OpenTK in your project is to install the [NuGet package](http://www.nuget.org/packages/OpenTK/). The simplest way to use OpenTK in your project is to install the [NuGet package](http://www.nuget.org/packages/OpenTK/).
If you want to try out the latest development build from the `develop` branch, we also have a [MyGet feed](https://www.myget.org/F/opentk-develop/api/v3/index.json).
Note what installing NuGet package will add reference to OpenTK.dll, but OpenTK.dll.config Note what installing NuGet package will add reference to OpenTK.dll, but OpenTK.dll.config
will not be copied to the project output directory automatically, so you need to add it to your project will not be copied to the project output directory automatically, so you need to add it to your project
@ -54,6 +64,14 @@ cd opentk # Enter the source directory
News News
==== ====
### 2017-05-08
A pre-release package is available.
https://www.nuget.org/packages/OpenTK/3.0.0-pre
https://www.nuget.org/packages/OpenTK.GLControl/3.0.0-pre
### 2016-09-23 ### 2016-09-23
OpenTK 2.0.0 is now available for download from [Nuget](https://www.nuget.org/packages/OpenTK/2.0.0). OpenTK 2.0.0 is now available for download from [Nuget](https://www.nuget.org/packages/OpenTK/2.0.0).
@ -163,7 +181,7 @@ Requirements
Documentation Documentation
============= =============
Your favorite IDE will display inline documentation for all OpenTK APIs. Additional information can be found in the [OpenTK Manual](http://www.opentk.com/doc) and in the [opentk/Documentation/](https://github.com/opentk/opentk/tree/develop/Documentation) folder. Your favorite IDE will display inline documentation for all OpenTK APIs. Additional information can be found in the [OpenTK Manual](http://web.archive.org/web/20150325224427/http://www.opentk.com/doc).
Technical documentation about the implementation of OpenTK can be found in the [Technical Wiki](https://github.com/opentk/opentk/wiki). Technical documentation about the implementation of OpenTK can be found in the [Technical Wiki](https://github.com/opentk/opentk/wiki).

View file

@ -1,4 +1,22 @@
### 2.0.0 - alpha ### 3.0.0-pre
* Support for OpenGL 4.6
* Replaced JoystickButton enum with simple long. (breaking API change)
* Increase available joystick buttons to 64.
* Add support for OpenGL ES3 through Angle + DIrect3D.
* Fix 2 crashes on android
* Move to built-in System.Diagnostics.Debug for Android + iOS
* Fix for certain joysticks returning invalid HID pages.
* Fix for certain joysticks with negative axis range being inverted.
* Fix Xbox controller D-pad on windows
* Fix joystick hat position sticking on Linux
* Enhance xbox button detection to include GUIDE button.
* Fix iOS GL bindings issue introduced by 2ea8334
* Fix crash on setting time to <= 0 for iOS + Android.
* Several minor XML documentation fixes and enhancements
* Fix for angle backbuffer size issue on window resize
* Possible fix for broken GLControl package.
### 2.0.0
* Moved to new FAKE/Paket based build system * Moved to new FAKE/Paket based build system
* Removed superfluous release configurations * Removed superfluous release configurations
* Numerous other fixes and enhancements * Numerous other fixes and enhancements

View file

@ -1,3 +1,4 @@
image: Visual Studio 2017
init: init:
- git config --global core.autocrlf input - git config --global core.autocrlf input
build_script: build_script:

View file

@ -15,4 +15,14 @@ IF NOT EXIST build.fsx (
.paket\paket.exe update .paket\paket.exe update
packages\FAKE\tools\FAKE.exe init.fsx packages\FAKE\tools\FAKE.exe init.fsx
) )
packages\FAKE\tools\FAKE.exe build.fsx %*
SET BuildTarget=
if "%BuildRunner%" == "MyGet" (
SET BuildTarget=NuGet
:: Replace the existing release notes file with one for this build only
echo ### %PackageVersion% > RELEASE_NOTES.md
echo * git build >> RELEASE_NOTES.md
)
packages\FAKE\tools\FAKE.exe build.fsx %* %BuildTarget%

View file

@ -88,7 +88,7 @@ let activeProjects =
-- "**/OpenTK.iOS.csproj" -- "**/OpenTK.iOS.csproj"
!! "src/**/*.??proj" !! "src/**/*.??proj"
-- "**/OpenTK.GLWidget.csproj" ++ "tests/**/OpenTK.Tests*.fsproj"
|> xamarinFilter |> xamarinFilter
// Generate assembly info files with the right version & up-to-date information // Generate assembly info files with the right version & up-to-date information
@ -105,7 +105,8 @@ Target "AssemblyInfo" (fun _ ->
Attribute.Version release.AssemblyVersion Attribute.Version release.AssemblyVersion
Attribute.FileVersion release.AssemblyVersion Attribute.FileVersion release.AssemblyVersion
Attribute.CLSCompliant true Attribute.CLSCompliant true
Attribute.Copyright copyright ] Attribute.Copyright copyright
]
let getProjectDetails projectPath = let getProjectDetails projectPath =
let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath)
@ -146,7 +147,7 @@ Target "Clean" (fun _ ->
Target "Build" (fun _ -> Target "Build" (fun _ ->
activeProjects activeProjects
|> MSBuildRelease "" "Rebuild" |> MSBuildRelease "" "Build"
|> ignore |> ignore
) )
@ -177,7 +178,7 @@ Target "NuGet" (fun _ ->
Paket.Pack(fun p -> Paket.Pack(fun p ->
{ p with { p with
OutputPath = "bin" OutputPath = "bin"
ExcludedTemplates = "OpenTK.GLWidget" :: xamExcludes ExcludedTemplates = xamExcludes
Version = release.NugetVersion Version = release.NugetVersion
ReleaseNotes = toLines release.Notes}) ReleaseNotes = toLines release.Notes})
) )
@ -194,7 +195,7 @@ Target "All" DoNothing
==> "AssemblyInfo" ==> "AssemblyInfo"
==> "Build" ==> "Build"
==> "CopyBinaries" ==> "CopyBinaries"
// ==> "RunTests" ==> "RunTests"
==> "All" ==> "All"
"All" "All"

View file

@ -34,4 +34,3 @@ run .paket/paket.exe restore
[ ! -e build.fsx ] && run .paket/paket.exe update [ ! -e build.fsx ] && run .paket/paket.exe update
[ ! -e build.fsx ] && run packages/FAKE/tools/FAKE.exe init.fsx [ ! -e build.fsx ] && run packages/FAKE/tools/FAKE.exe init.fsx
run packages/FAKE/tools/FAKE.exe "$@" $FSIARGS build.fsx run packages/FAKE/tools/FAKE.exe "$@" $FSIARGS build.fsx

View file

@ -2,10 +2,13 @@ source https://nuget.org/api/v2
#Open packages #Open packages
nuget CommandLineParser >= 2.1.1-beta
nuget FSharp.Formatting nuget FSharp.Formatting
nuget FsCheck
nuget FsCheck.Xunit nuget FsCheck.Xunit
nuget StyleCop.Analyzers
nuget xunit.runner.console nuget xunit.runner.console
nuget xunit.assert nuget xunit.assert
nuget FAKE nuget FAKE
nuget Mono.Cecil nuget Mono.Cecil >= 0.10.0-beta6
nuget GtkSharp nuget gtk-sharp3

View file

@ -1,165 +1,620 @@
NUGET NUGET
remote: https://www.nuget.org/api/v2 remote: https://www.nuget.org/api/v2
FAKE (4.28) CommandLineParser (2.1.1-beta)
FsCheck (2.4) System.Collections (>= 4.0.11-rc2-24027) - restriction: >= netstandard1.5
FSharp.Core (>= 3.1.2.5) System.Console (>= 4.0.0-rc2-24027) - restriction: >= netstandard1.5
FsCheck.Xunit (2.4) System.Diagnostics.Debug (>= 4.0.11-rc2-24027) - restriction: >= netstandard1.5
FsCheck (>= 2.4) System.Globalization (>= 4.0.11-rc2-24027) - restriction: >= netstandard1.5
xunit.extensibility.execution (>= 2.1 < 3.0) System.IO (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
System.Linq (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
System.Linq.Expressions (>= 4.0.11-rc2-24027) - restriction: >= netstandard1.5
System.Reflection (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
System.Reflection.Extensions (>= 4.0.1-rc2-24027) - restriction: >= netstandard1.5
System.Reflection.TypeExtensions (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
System.Resources.ResourceManager (>= 4.0.1-rc2-24027) - restriction: >= netstandard1.5
System.Runtime (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
System.Runtime.Extensions (>= 4.1.0-rc2-24027) - restriction: >= netstandard1.5
FAKE (4.62.5)
FsCheck (2.9)
FSharp.Core (>= 4.1) - restriction: < netstandard1.6
FSharp.Core (>= 4.1.17) - restriction: >= netstandard1.6
NETStandard.Library (>= 1.6.1) - restriction: >= netstandard1.6
FsCheck.Xunit (2.9)
FsCheck (>= 2.9)
FSharp.Core (>= 4.1.17) - restriction: >= netstandard1.6
NETStandard.Library (>= 1.6.1) - restriction: >= netstandard1.6
xunit.abstractions (>= 2.0.1) - restriction: >= netstandard1.6
xunit.core (>= 2.2) - restriction: >= netstandard1.6
xunit.extensibility.execution (>= 2.2 < 3.0) - restriction: < netstandard1.6
FSharp.Compiler.Service (2.0.0.6) FSharp.Compiler.Service (2.0.0.6)
FSharp.Core (4.0.0.1) FSharp.Core (4.2.1)
System.Collections (>= 4.0.11) - restriction: >= netstandard1.6
System.Console (>= 4.0) - restriction: >= netstandard1.6
System.Diagnostics.Debug (>= 4.0.11) - restriction: >= netstandard1.6
System.Diagnostics.Tools (>= 4.0.1) - restriction: >= netstandard1.6
System.Globalization (>= 4.0.11) - restriction: >= netstandard1.6
System.IO (>= 4.1) - restriction: >= netstandard1.6
System.Linq (>= 4.1) - restriction: >= netstandard1.6
System.Linq.Expressions (>= 4.1) - restriction: >= netstandard1.6
System.Linq.Queryable (>= 4.0.1) - restriction: >= netstandard1.6
System.Net.Requests (>= 4.0.11) - restriction: >= netstandard1.6
System.Reflection (>= 4.1) - restriction: >= netstandard1.6
System.Reflection.Extensions (>= 4.0.1) - restriction: >= netstandard1.6
System.Resources.ResourceManager (>= 4.0.1) - restriction: >= netstandard1.6
System.Runtime (>= 4.1) - restriction: >= netstandard1.6
System.Runtime.Extensions (>= 4.1) - restriction: >= netstandard1.6
System.Runtime.Numerics (>= 4.0.1) - restriction: >= netstandard1.6
System.Text.RegularExpressions (>= 4.1) - restriction: >= netstandard1.6
System.Threading (>= 4.0.11) - restriction: >= netstandard1.6
System.Threading.Tasks (>= 4.0.11) - restriction: >= netstandard1.6
System.Threading.Tasks.Parallel (>= 4.0.1) - restriction: >= netstandard1.6
System.Threading.Thread (>= 4.0) - restriction: >= netstandard1.6
System.Threading.ThreadPool (>= 4.0.10) - restriction: >= netstandard1.6
System.Threading.Timer (>= 4.0.1) - restriction: >= netstandard1.6
FSharp.Formatting (2.14.4) FSharp.Formatting (2.14.4)
FSharp.Compiler.Service (2.0.0.6) FSharp.Compiler.Service (2.0.0.6)
FSharpVSPowerTools.Core (>= 2.3 < 2.4) FSharpVSPowerTools.Core (>= 2.3 < 2.4)
FSharpVSPowerTools.Core (2.3) FSharpVSPowerTools.Core (2.3)
FSharp.Compiler.Service (>= 2.0.0.3) FSharp.Compiler.Service (>= 2.0.0.3)
GtkSharp (3.1.3) gtk-sharp3 (3.22)
Mono.Cecil (0.9.6.1) Microsoft.NETCore.Platforms (1.1) - restriction: || (&& (< net35) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net35) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.2) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.3) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net46) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.2)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (>= netstandard1.6)
System.Collections (4.0.10) - framework: dnxcore50 Microsoft.NETCore.Targets (1.1) - restriction: || (&& (< net35) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net35) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.2) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.3) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net46) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.2)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.1) (>= netstandard1.6) (< monoandroid)) (&& (< netstandard1.2) (>= netstandard1.6) (< monoandroid)) (&& (< netstandard1.3) (>= netstandard1.6) (< monoandroid)) (&& (< netstandard1.5) (>= netstandard1.6) (< monoandroid)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)) (>= netcore1.1)
System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 Microsoft.Win32.Primitives (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.3)) (>= netstandard1.6)
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 Mono.Cecil (0.10.0-beta6)
System.Threading (>= 4.0) - framework: dnxcore50 System.Collections (>= 4.0.11) - restriction: && (< net35) (>= netstandard1.3)
System.Diagnostics.Contracts (4.0) - framework: dnxcore50 System.IO.FileSystem (>= 4.0.1) - restriction: && (< net35) (>= netstandard1.3)
System.Runtime (>= 4.0) - framework: dnxcore50 System.IO.FileSystem.Primitives (>= 4.0.1) - restriction: && (< net35) (>= netstandard1.3)
System.Diagnostics.Debug (4.0.10) - framework: dnxcore50 System.Reflection (>= 4.1) - restriction: && (< net35) (>= netstandard1.3)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Runtime.Extensions (>= 4.1) - restriction: && (< net35) (>= netstandard1.3)
System.Globalization (4.0.10) - framework: dnxcore50 System.Security.Cryptography.Algorithms (>= 4.2) - restriction: && (< net35) (>= netstandard1.3)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Security.Cryptography.Csp (>= 4.0) - restriction: && (< net35) (>= netstandard1.3)
System.IO (4.0.10) - framework: dnxcore50 System.Threading (>= 4.0.11) - restriction: && (< net35) (>= netstandard1.3)
System.Globalization (>= 4.0) - framework: dnxcore50 NETStandard.Library (1.6.1) - restriction: || (&& (< net35) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.1)) (>= netstandard1.6)
System.Runtime (>= 4.0.20) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: >= netstandard1.0
System.Text.Encoding (>= 4.0) - framework: dnxcore50 Microsoft.Win32.Primitives (>= 4.3) - restriction: >= netstandard1.3
System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 System.AppContext (>= 4.3) - restriction: >= netstandard1.3
System.Text.Encoding.Extensions (>= 4.0) - framework: dnxcore50 System.Collections (>= 4.3) - restriction: >= netstandard1.0
System.Threading (>= 4.0) - framework: dnxcore50 System.Collections.Concurrent (>= 4.3) - restriction: >= netstandard1.1
System.Threading.Tasks (>= 4.0) - framework: dnxcore50 System.Console (>= 4.3) - restriction: >= netstandard1.3
System.Linq (4.0) - framework: dnxcore50 System.Diagnostics.Debug (>= 4.3) - restriction: >= netstandard1.0
System.Collections (>= 4.0.10) - framework: dnxcore50 System.Diagnostics.Tools (>= 4.3) - restriction: >= netstandard1.0
System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 System.Diagnostics.Tracing (>= 4.3) - restriction: >= netstandard1.1
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 System.Globalization (>= 4.3) - restriction: >= netstandard1.0
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Globalization.Calendars (>= 4.3) - restriction: >= netstandard1.3
System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 System.IO (>= 4.3) - restriction: >= netstandard1.0
System.Linq.Expressions (4.0.10) - framework: dnxcore50 System.IO.Compression (>= 4.3) - restriction: >= netstandard1.1
System.Collections (>= 4.0) - framework: dnxcore50 System.IO.Compression.ZipFile (>= 4.3) - restriction: >= netstandard1.3
System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 System.IO.FileSystem (>= 4.3) - restriction: >= netstandard1.3
System.Globalization (>= 4.0) - framework: dnxcore50 System.IO.FileSystem.Primitives (>= 4.3) - restriction: >= netstandard1.3
System.IO (>= 4.0) - framework: dnxcore50 System.Linq (>= 4.3) - restriction: >= netstandard1.0
System.Linq (>= 4.0) - framework: dnxcore50 System.Linq.Expressions (>= 4.3) - restriction: >= netstandard1.0
System.ObjectModel (>= 4.0) - framework: dnxcore50 System.Net.Http (>= 4.3) - restriction: >= netstandard1.1
System.Reflection (>= 4.0) - framework: dnxcore50 System.Net.Primitives (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Emit (>= 4.0) - framework: dnxcore50 System.Net.Sockets (>= 4.3) - restriction: >= netstandard1.3
System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 System.ObjectModel (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 System.Reflection (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 System.Reflection.Extensions (>= 4.3) - restriction: >= netstandard1.0
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 System.Reflection.Primitives (>= 4.3) - restriction: >= netstandard1.0
System.Runtime (>= 4.0) - framework: dnxcore50 System.Resources.ResourceManager (>= 4.3) - restriction: >= netstandard1.0
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: >= netstandard1.0
System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 System.Runtime.Extensions (>= 4.3) - restriction: >= netstandard1.0
System.Threading (>= 4.0) - framework: dnxcore50 System.Runtime.Handles (>= 4.3) - restriction: >= netstandard1.3
System.ObjectModel (4.0.10) - framework: dnxcore50 System.Runtime.InteropServices (>= 4.3) - restriction: >= netstandard1.1
System.Collections (>= 4.0.10) - framework: dnxcore50 System.Runtime.InteropServices.RuntimeInformation (>= 4.3) - restriction: >= netstandard1.1
System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 System.Runtime.Numerics (>= 4.3) - restriction: >= netstandard1.1
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 System.Security.Cryptography.Algorithms (>= 4.3) - restriction: >= netstandard1.3
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Security.Cryptography.Encoding (>= 4.3) - restriction: >= netstandard1.3
System.Threading (>= 4.0.10) - framework: dnxcore50 System.Security.Cryptography.Primitives (>= 4.3) - restriction: >= netstandard1.3
System.Private.Uri (4.0) - framework: dnxcore50 System.Security.Cryptography.X509Certificates (>= 4.3) - restriction: >= netstandard1.3
System.Reflection (4.0.10) - framework: dnxcore50 System.Text.Encoding (>= 4.3) - restriction: >= netstandard1.0
System.IO (>= 4.0) - framework: dnxcore50 System.Text.Encoding.Extensions (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 System.Text.RegularExpressions (>= 4.3) - restriction: >= netstandard1.0
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Threading (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Emit (4.0) - framework: dnxcore50 System.Threading.Tasks (>= 4.3) - restriction: >= netstandard1.0
System.IO (>= 4.0) - framework: dnxcore50 System.Threading.Timer (>= 4.3) - restriction: >= netstandard1.2
System.Reflection (>= 4.0) - framework: dnxcore50 System.Xml.ReaderWriter (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Emit.ILGeneration (>= 4.0) - framework: dnxcore50 System.Xml.XDocument (>= 4.3) - restriction: >= netstandard1.0
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.0) - framework: dnxcore50 runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Emit.ILGeneration (4.0) - framework: dnxcore50 runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.0) - framework: dnxcore50 runtime.native.System (4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1)
System.Runtime (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1)
System.Reflection.Extensions (4.0) - framework: dnxcore50 runtime.native.System.IO.Compression (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1)
System.Reflection (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1)
System.Reflection (>= 4.0.10) - framework: dnxcore50 runtime.native.System.Net.Http (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1)
System.Reflection.TypeExtensions (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1)
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 runtime.native.System.Security.Cryptography.Apple (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.0) - framework: dnxcore50 runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3)
System.Runtime (>= 4.0.20) - framework: dnxcore50 runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Reflection.Primitives (4.0) - framework: dnxcore50 runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Runtime (>= 4.0) - framework: dnxcore50 runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Threading (>= 4.0) - framework: dnxcore50 runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Reflection.TypeExtensions (4.0) - framework: dnxcore50 runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Diagnostics.Contracts (>= 4.0) - framework: dnxcore50 runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Diagnostics.Debug (>= 4.0.10) - framework: dnxcore50 runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Linq (>= 4.0) - framework: dnxcore50 runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Reflection (>= 4.0) - framework: dnxcore50 runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Reflection (>= 4.0.10) - framework: dnxcore50 runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1)
System.Reflection.Primitives (>= 4.0) - framework: dnxcore50 runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.0) - framework: dnxcore50 runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.0.20) - framework: dnxcore50 runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (4.0) - framework: dnxcore50 runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization (>= 4.0) - framework: dnxcore50 runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.0) - framework: dnxcore50 runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - restriction: || (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.0.10) - framework: dnxcore50 StyleCop.Analyzers (1.0.2)
System.Runtime (>= 4.0) - framework: dnxcore50 System.AppContext (4.3) - restriction: || (&& (< net452) (>= netstandard1.3)) (>= netstandard1.6)
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.6) (< monoandroid)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (4.0.20) - framework: dnxcore50 System.Buffers (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Private.Uri (>= 4.0) - framework: dnxcore50 System.Diagnostics.Debug (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Runtime.Extensions (4.0.10) - framework: dnxcore50 System.Diagnostics.Tracing (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Resources.ResourceManager (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Text.Encoding (4.0.10) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Threading (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Text.Encoding.Extensions (4.0.10) - framework: dnxcore50 System.Collections (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.3) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding (>= 4.0.10) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.RegularExpressions (4.0.10) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Collections (>= 4.0.10) - framework: dnxcore50 System.Collections.Concurrent (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (>= netstandard1.6)
System.Globalization (>= 4.0.10) - framework: dnxcore50 System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.0) - framework: dnxcore50 System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.0.20) - framework: dnxcore50 System.Diagnostics.Tracing (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.0.10) - framework: dnxcore50 System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading (>= 4.0.10) - framework: dnxcore50 System.Reflection (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Threading (4.0.10) - framework: dnxcore50 System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.0) - framework: dnxcore50 System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (4.0.10) - framework: dnxcore50 System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
xunit.abstractions (2.0) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 System.Console (4.3) - restriction: || (&& (< net452) (>= netstandard1.3)) (>= netstandard1.5)
xunit.assert (2.1) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization (>= 4.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Linq (>= 4.0) - framework: dnxcore50 System.Text.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.ObjectModel (>= 4.0) - framework: dnxcore50 System.Diagnostics.Debug (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 System.Diagnostics.DiagnosticSource (4.4) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.RegularExpressions (>= 4.0) - framework: dnxcore50 System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac))
System.Threading.Tasks (>= 4.0) - framework: dnxcore50 System.Diagnostics.Debug (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac)
xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 System.Diagnostics.Tracing (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac))
xunit.abstractions (2.0) System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac))
xunit.extensibility.execution (2.1) System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac))
System.Collections (>= 4.0) - framework: dnxcore50 System.Runtime.Extensions (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac)
System.Diagnostics.Debug (>= 4.0) - framework: dnxcore50 System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netcore2.0) (< xamarinmac))
System.Globalization (>= 4.0) - framework: dnxcore50 System.Diagnostics.Tools (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
System.IO (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Linq (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Linq.Expressions (>= 4.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Reflection (>= 4.0) - framework: dnxcore50 System.Diagnostics.Tracing (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
System.Reflection.Extensions (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Text.Encoding (>= 4.0) - framework: dnxcore50 System.Globalization (4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.0) - framework: dnxcore50 Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
xunit.abstractions (>= 2.0) - framework: dnxcore50 System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
xunit.extensibility.core (2.1) - framework: >= net45, dnx451, dnxcore50, monoandroid, monotouch, xamarinios, winv4.5, wpv8.0, wpav8.1 System.Globalization.Calendars (4.3) - restriction: || (&& (< net452) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
xunit.runner.console (2.1) Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization.Extensions (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.InteropServices (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (4.3) - restriction: || (&& (< net35) (>= net463)) (&& (< net35) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net35) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net35) (>= netstandard1.4) (< monoandroid)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.3) (>= netstandard1.6) (< monoandroid)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.IO.Compression (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
runtime.native.System (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
runtime.native.System.IO.Compression (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Buffers (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.InteropServices (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO.Compression.ZipFile (4.3) - restriction: || (&& (< net452) (>= netstandard1.3)) (>= netstandard1.6)
System.Buffers (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.Compression (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.FileSystem (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.FileSystem.Primitives (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Text.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.FileSystem (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.FileSystem.Primitives (>= 4.3) - restriction: || (>= net46) (&& (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Handles (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Text.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading.Tasks (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO.FileSystem.Primitives (4.3) - restriction: || (&& (< net35) (>= net46)) (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Linq (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.6) (< monoandroid) (< win8) (< wp8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Debug (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.6) (< monoandroid) (< win8) (< wp8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Linq.Expressions (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.3) (>= netstandard1.6) (< monoandroid)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Collections (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Debug (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.IO (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Linq (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.ObjectModel (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Emit (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection.Emit.ILGeneration (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Emit.Lightweight (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.Primitives (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection.TypeExtensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Linq.Queryable (4.3) - restriction: >= netstandard1.6
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Linq (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Linq.Expressions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Net.Http (4.3.2) - restriction: || (&& (< net452) (>= netstandard1.1)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.Win32.Primitives (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)
runtime.native.System (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Net.Http (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.DiagnosticSource (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Tracing (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization.Extensions (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.IO.Compression (>= 4.3) - restriction: && (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)
System.IO.FileSystem (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Net.Primitives (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.InteropServices (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Algorithms (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Primitives (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.X509Certificates (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= net46) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Net.Primitives (4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Net.Requests (4.3) - restriction: >= netstandard1.6
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Tracing (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
System.Net.Http (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Net.Primitives (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
System.Net.WebHeaderCollection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.0) (< netstandard1.1) (< monoandroid) (< win8) (< wp8))
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Net.Sockets (4.3) - restriction: || (&& (< net452) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Net.Primitives (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading.Tasks (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Net.WebHeaderCollection (4.3) - restriction: || (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Collections (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.ObjectModel (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (>= netstandard1.6)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.3) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monoandroid)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Reflection.Primitives (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Reflection.Emit (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection.Emit.ILGeneration (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection.Primitives (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection.Emit.ILGeneration (4.3) - restriction: || (&& (>= dnxcore50) (>= netstandard1.5)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Reflection.Primitives (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Runtime (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Reflection.Emit.Lightweight (4.3) - restriction: || (&& (>= dnxcore50) (>= netstandard1.5)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Reflection.Emit.ILGeneration (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Reflection.Primitives (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Runtime (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< wp8)
System.Reflection.Extensions (4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Reflection.Primitives (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net35) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.3) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Reflection.TypeExtensions (4.3) - restriction: || (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Reflection (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.5) (< monoandroid)) (&& (< net46) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= net462) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.5) (< monoandroid)) (&& (< net46) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Resources.ResourceManager (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)) (>= dnxcore50)
System.Runtime (4.3) - restriction: || (&& (< net35) (>= net463)) (&& (< net35) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net35) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net35) (>= netstandard1.4) (< monoandroid)) (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.1) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (&& (< net452) (>= net462)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net452) (>= netstandard1.3) (< netstandard1.6) (< monoandroid)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net452) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (&& (>= net462) (>= netstandard1.6)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.2)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (< netstandard1.3) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monoandroid)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.2) (< monoandroid) (< win8) (< wp8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.2) (< monoandroid) (< win8) (< wp8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime.Extensions (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (>= netstandard1.5) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50)
System.Runtime.Handles (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net452) (>= netstandard1.3)) (&& (< net452) (>= netstandard1.4) (< monoandroid)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
Microsoft.NETCore.Targets (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.InteropServices (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50) (>= netcore1.1)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50) (>= netcore1.1)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50) (>= netcore1.1)
System.Reflection.Primitives (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50) (>= netcore1.1)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.2) (< monoandroid) (< win8)) (&& (< net45) (>= netstandard1.2) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= net462) (>= dnxcore50) (>= netcore1.1)
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< netstandard1.5) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (>= dnxcore50) (>= netcore1.1)
System.Runtime.InteropServices.RuntimeInformation (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (>= netstandard1.6)
runtime.native.System (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.InteropServices (>= 4.3) - restriction: && (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Numerics (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Security.Cryptography.Algorithms (4.3) - restriction: || (&& (< net35) (>= net46)) (&& (< net35) (>= netstandard1.3)) (&& (< net452) (>= net46) (< netstandard1.4)) (&& (< net452) (>= net461)) (&& (< net452) (>= netstandard1.3)) (&& (< net452) (>= netstandard1.4) (< monoandroid)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
runtime.native.System.Security.Cryptography.Apple (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= net463) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= net463) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Handles (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.InteropServices (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Numerics (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (>= net463) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (&& (>= net46) (< netstandard1.4)) (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= net461) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Cng (4.3) - restriction: || (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.IO (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Runtime (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Runtime.InteropServices (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Security.Cryptography.Algorithms (>= 4.3) - restriction: || (&& (>= net46) (< netstandard1.4)) (&& (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< net46) (>= netstandard1.4)) (>= net461) (>= netstandard1.6)
System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (&& (>= net46) (< netstandard1.4)) (&& (< net46) (>= netstandard1.3) (< netstandard1.4)) (&& (< net46) (>= netstandard1.4)) (>= net461) (>= netstandard1.6)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.4)) (>= netstandard1.6)
System.Security.Cryptography.Csp (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Reflection (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Handles (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.InteropServices (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Algorithms (>= 4.3) - restriction: || (>= net46) (&& (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (>= net46) (&& (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Encoding (4.3) - restriction: || (&& (< net35) (>= net463)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net452) (>= net46) (< netstandard1.4)) (&& (< net452) (>= net461)) (&& (< net452) (>= netstandard1.3)) (&& (< net452) (>= netstandard1.4) (< monoandroid)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections.Concurrent (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Linq (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Extensions (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Handles (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.InteropServices (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Primitives (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Text.Encoding (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.OpenSsl (4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: || (>= net463) (>= netstandard1.6) (>= monoandroid)
System.Collections (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Handles (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.InteropServices (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Numerics (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Algorithms (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (>= net463) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Primitives (4.3) - restriction: || (&& (< net35) (>= net46)) (&& (< net35) (>= net461)) (&& (< net35) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net35) (>= netstandard1.4) (< monoandroid)) (&& (< net452) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.3)) (>= netstandard1.6)
System.Diagnostics.Debug (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.IO (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading.Tasks (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.X509Certificates (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net452) (>= net46)) (&& (< net452) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
runtime.native.System (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Net.Http (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Collections (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Diagnostics.Debug (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Globalization (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization.Calendars (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.IO (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.IO.FileSystem (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.IO.FileSystem.Primitives (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Resources.ResourceManager (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Handles (>= 4.3) - restriction: || (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.InteropServices (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime.Numerics (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Algorithms (>= 4.3) - restriction: || (&& (>= net46) (< netstandard1.4)) (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= net461) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Cng (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.Csp (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Encoding (>= 4.3) - restriction: || (&& (>= net46) (< netstandard1.4)) (&& (< net46) (>= netstandard1.3) (< netstandard1.4) (< monoandroid)) (&& (< net46) (>= netstandard1.4) (< netstandard1.6) (< monoandroid)) (>= net461) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Security.Cryptography.OpenSsl (>= 4.3) - restriction: && (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)
System.Security.Cryptography.Primitives (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Text.Encoding (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.3) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net46) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding.Extensions (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.RegularExpressions (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
System.Collections (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< netcore1.1) (< monotouch) (< xamarinios) (< xamarinmac))
System.Globalization (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< netcore1.1) (< monotouch) (< xamarinios) (< xamarinmac))
System.Resources.ResourceManager (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< netcore1.1) (< monotouch) (< xamarinios) (< xamarinmac))
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< netstandard1.6) (< monoandroid) (< win8) (< wpa81)) (>= dnxcore50) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac)) (>= netcore1.1)
System.Runtime.Extensions (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< netcore1.1) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (>= 4.3) - restriction: || (>= dnxcore50) (&& (>= netstandard1.6) (< netcore1.1) (< monotouch) (< xamarinios) (< xamarinmac))
System.Threading (4.3) - restriction: || (&& (< net35) (>= netstandard1.3)) (&& (< net45) (>= netstandard1.1) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (>= netstandard1.6)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (4.3) - restriction: || (&& (< net35) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net45) (< netstandard1.3) (>= netstandard1.5) (< monoandroid)) (&& (< net45) (>= netstandard1.5) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (< net452) (>= netstandard1.1)) (&& (< net452) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.3)) (&& (>= dnxcore50) (>= netstandard1.5)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks.Extensions (4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (>= dnxcore50) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.6)) (&& (>= netstandard1.6) (< monotouch) (< xamarinios) (< xamarinmac))
System.Collections (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)
System.Runtime (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)
System.Threading.Tasks (>= 4.3) - restriction: && (< net45) (>= netstandard1.0) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wp8) (< wpa81)
System.Threading.Tasks.Parallel (4.3) - restriction: >= netstandard1.6
System.Collections.Concurrent (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Tracing (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Thread (4.3) - restriction: >= netstandard1.6
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading.ThreadPool (4.3) - restriction: >= netstandard1.6
System.Runtime (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Runtime.Handles (>= 4.3) - restriction: && (< net46) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac)
System.Threading.Timer (4.3) - restriction: || (&& (< net452) (>= netstandard1.2)) (>= netstandard1.6)
Microsoft.NETCore.Platforms (>= 1.1) - restriction: || (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (>= dnxcore50)
Microsoft.NETCore.Targets (>= 1.1) - restriction: || (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net451) (>= netstandard1.2) (< monotouch) (< xamarinios) (< xamarinmac) (< win81) (< wpa81)) (>= dnxcore50)
System.Xml.ReaderWriter (4.3) - restriction: || (&& (< net45) (>= netstandard1.1) (< netstandard1.3) (< monoandroid) (< win8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (&& (< net452) (>= netstandard1.1)) (&& (>= dnxcore50) (>= netstandard1.1)) (>= netstandard1.6)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO.FileSystem (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO.FileSystem.Primitives (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.InteropServices (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.RegularExpressions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading.Tasks.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Xml.XDocument (4.3) - restriction: || (&& (< net452) (>= netstandard1.1)) (>= netstandard1.6)
System.Collections (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Debug (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Diagnostics.Tools (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Globalization (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.IO (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Reflection (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Resources.ResourceManager (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Runtime.Extensions (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Text.Encoding (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Threading (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
System.Xml.ReaderWriter (>= 4.3) - restriction: || (&& (< net45) (>= netstandard1.0) (< netstandard1.3) (< monoandroid) (< win8) (< wp8) (< wpa81)) (&& (< net45) (>= netstandard1.3) (< monotouch) (< xamarinios) (< xamarinmac) (< win8) (< wpa81)) (>= dnxcore50)
xunit.abstractions (2.0.1) - restriction: >= netstandard1.1
NETStandard.Library (>= 1.6) - restriction: && (< net35) (>= netstandard1.0)
xunit.assert (2.2)
NETStandard.Library (>= 1.6) - restriction: && (< net452) (>= netstandard1.1)
xunit.core (2.2) - restriction: >= netstandard1.6
xunit.extensibility.core (2.2)
xunit.extensibility.execution (2.2)
xunit.extensibility.core (2.2) - restriction: >= netstandard1.1
NETStandard.Library (>= 1.6) - restriction: && (< net452) (>= netstandard1.1)
xunit.abstractions (>= 2.0.1) - restriction: >= netstandard1.1
xunit.extensibility.execution (2.2)
NETStandard.Library (>= 1.6) - restriction: && (< net452) (>= netstandard1.1)
xunit.extensibility.core (2.2) - restriction: >= netstandard1.1
xunit.runner.console (2.2)

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library // Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit Library
@ -24,31 +23,25 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using Bind.Structures;
using Enum=Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
enum WriteOptions internal enum WriteOptions
{ {
Default = 0, Default = 0,
NoIndent = 1 NoIndent = 1
} }
class BindStreamWriter : IDisposable internal class BindStreamWriter : IDisposable
{ {
static readonly string[] SplitStrings = new string[] { System.Environment.NewLine }; private static readonly string[] SplitStrings = new string[] { System.Environment.NewLine };
readonly StreamWriter sw; private readonly StreamWriter sw;
public readonly string File; public readonly string File;
bool newline = true; private bool newline = true;
int indent_level = 0; private int indent_level = 0;
public BindStreamWriter(string file) public BindStreamWriter(string file)
{ {
@ -64,8 +57,10 @@ namespace Bind
public void Unindent() public void Unindent()
{ {
if (indent_level > 0) if (indent_level > 0)
{
--indent_level; --indent_level;
} }
}
public void Write(WriteOptions options, string value) public void Write(WriteOptions options, string value)
{ {
@ -143,14 +138,16 @@ namespace Bind
sw.Close(); sw.Close();
} }
void WriteIndentations(WriteOptions options) private void WriteIndentations(WriteOptions options)
{ {
if (options != WriteOptions.NoIndent) if (options != WriteOptions.NoIndent)
{ {
for (int i = indent_level; i > 0; i--) for (int i = indent_level; i > 0; i--)
{
sw.Write(" "); sw.Write(" ");
} }
} }
}
public void Dispose() public void Dispose()
{ {

View file

@ -1,15 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.CL namespace Bind.CL
{ {
class CLGenerator : ES.ESGenerator internal class CLGenerator : ES.ESGenerator
{ {
public CLGenerator(Settings settings) public CLGenerator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2010 the Open Toolkit library. // Copyright (c) 2006 - 2010 the Open Toolkit library.
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -39,12 +37,10 @@ namespace Bind
using Enum = Bind.Structures.Enum; using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type; using Type = Bind.Structures.Type;
sealed class CSharpSpecWriter internal sealed class CSharpSpecWriter
{ {
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
#region ISpecWriter Members
public void WriteBindings(IBind generator) public void WriteBindings(IBind generator)
{ {
@ -52,28 +48,26 @@ namespace Bind
WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums); WriteBindings(generator.Delegates, generator.Wrappers, generator.Enums);
} }
#endregion
#region Private Members
private static void ConsoleRewrite(string text) private static void ConsoleRewrite(string text)
{ {
int left = Console.CursorLeft; int left = Console.CursorLeft;
int top = Console.CursorTop; int top = Console.CursorTop;
Console.Write(text); Console.Write(text);
for (int i = text.Length; i < 80; i++) for (int i = text.Length; i < 80; i++)
{
Console.Write(" "); Console.Write(" ");
}
Console.WriteLine(); Console.WriteLine();
Console.SetCursorPosition(left, top); Console.SetCursorPosition(left, top);
} }
#region WriteBindings private void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
void WriteBindings(DelegateCollection delegates, FunctionCollection wrappers, EnumCollection enums)
{ {
Console.WriteLine("Writing bindings to {0}", Settings.OutputPath); Console.WriteLine("Writing bindings to {0}", Settings.OutputPath);
if (!Directory.Exists(Settings.OutputPath)) if (!Directory.Exists(Settings.OutputPath))
{
Directory.CreateDirectory(Settings.OutputPath); Directory.CreateDirectory(Settings.OutputPath);
}
string temp_enums_file = Path.GetTempFileName(); string temp_enums_file = Path.GetTempFileName();
string temp_wrappers_file = Path.GetTempFileName(); string temp_wrappers_file = Path.GetTempFileName();
@ -94,7 +88,9 @@ namespace Bind
sw.WriteLine("static partial class {0}", Settings.OutputClass); sw.WriteLine("static partial class {0}", Settings.OutputClass);
} }
else else
{
sw.WriteLine("namespace {0}", Settings.EnumsOutput); sw.WriteLine("namespace {0}", Settings.EnumsOutput);
}
sw.WriteLine("{"); sw.WriteLine("{");
@ -134,20 +130,28 @@ namespace Bind
string output_core = Path.Combine(Settings.OutputPath, Settings.ImportsFile); string output_core = Path.Combine(Settings.OutputPath, Settings.ImportsFile);
string output_wrappers = Path.Combine(Settings.OutputPath, Settings.WrappersFile); string output_wrappers = Path.Combine(Settings.OutputPath, Settings.WrappersFile);
if (File.Exists(output_enums)) File.Delete(output_enums); if (File.Exists(output_enums))
if (File.Exists(output_delegates)) File.Delete(output_delegates); {
if (File.Exists(output_core)) File.Delete(output_core); File.Delete(output_enums);
if (File.Exists(output_wrappers)) File.Delete(output_wrappers); }
if (File.Exists(output_delegates))
{
File.Delete(output_delegates);
}
if (File.Exists(output_core))
{
File.Delete(output_core);
}
if (File.Exists(output_wrappers))
{
File.Delete(output_wrappers);
}
File.Move(temp_enums_file, output_enums); File.Move(temp_enums_file, output_enums);
File.Move(temp_wrappers_file, output_wrappers); File.Move(temp_wrappers_file, output_wrappers);
} }
#endregion private void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
#region WriteWrappers
void WriteWrappers(BindStreamWriter sw, FunctionCollection wrappers,
DelegateCollection delegates, EnumCollection enums, DelegateCollection delegates, EnumCollection enums,
IDictionary<string, string> CSTypes) IDictionary<string, string> CSTypes)
{ {
@ -248,7 +252,7 @@ namespace Bind
{ {
sw.WriteLine("[Slot({0})]", d.Slot); sw.WriteLine("[Slot({0})]", d.Slot);
sw.WriteLine("[DllImport(Library, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]"); sw.WriteLine("[DllImport(Library, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)]");
sw.WriteLine("static extern {0};", GetDeclarationString(d, false)); sw.WriteLine("private static extern {0};", GetDeclarationString(d, false));
current_signature++; current_signature++;
} }
@ -258,7 +262,7 @@ namespace Bind
Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature); Console.WriteLine("Wrote {0} wrappers for {1} signatures", current_wrapper, current_signature);
} }
void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums) private void WriteWrapper(BindStreamWriter sw, Function f, EnumCollection enums)
{ {
if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0) if ((Settings.Compatibility & Settings.Legacy.NoDocumentation) == 0)
{ {
@ -287,10 +291,10 @@ namespace Bind
sw.WriteLine("[CLSCompliant(false)]"); sw.WriteLine("[CLSCompliant(false)]");
} }
sw.WriteLine("public static {0} {{ throw new NotImplementedException(); }}", GetDeclarationString(f, Settings.Compatibility)); sw.WriteLine("public static {0} {{ throw new BindingsNotRewrittenException(); }}", GetDeclarationString(f, Settings.Compatibility));
} }
void WriteDocumentation(BindStreamWriter sw, Function f) private void WriteDocumentation(BindStreamWriter sw, Function f)
{ {
var docs = f.Documentation; var docs = f.Documentation;
@ -310,10 +314,14 @@ namespace Bind
else if (!String.IsNullOrEmpty(f.Version)) else if (!String.IsNullOrEmpty(f.Version))
{ {
if (f.Category.StartsWith("VERSION")) if (f.Category.StartsWith("VERSION"))
{
category = String.Format("[requires: {0}]", "v" + f.Version); category = String.Format("[requires: {0}]", "v" + f.Version);
}
else else
{
category = String.Format("[requires: {0}]", "v" + f.Version + " or " + f.Category); category = String.Format("[requires: {0}]", "v" + f.Version + " or " + f.Category);
} }
}
// Write function summary // Write function summary
sw.Write("/// <summary>"); sw.Write("/// <summary>");
@ -398,10 +406,6 @@ namespace Bind
} }
} }
#endregion
#region WriteTypes
public void WriteTypes(BindStreamWriter sw, Dictionary<string, string> CSTypes) public void WriteTypes(BindStreamWriter sw, Dictionary<string, string> CSTypes)
{ {
sw.WriteLine(); sw.WriteLine();
@ -411,11 +415,7 @@ namespace Bind
} }
} }
#endregion private void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants)
#region WriteConstants
void WriteConstants(BindStreamWriter sw, IEnumerable<Constant> constants)
{ {
// Make sure everything is sorted. This will avoid random changes between // Make sure everything is sorted. This will avoid random changes between
// consecutive runs of the program. // consecutive runs of the program.
@ -435,24 +435,26 @@ namespace Bind
sw.Write(str); sw.Write(str);
if (!String.IsNullOrEmpty(str)) if (!String.IsNullOrEmpty(str))
{
sw.WriteLine(","); sw.WriteLine(",");
} }
} }
}
#endregion private void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers)
#region WriteEnums
void WriteEnums(BindStreamWriter sw, EnumCollection enums, FunctionCollection wrappers)
{ {
//sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute //sw.WriteLine("#pragma warning disable 3019"); // CLSCompliant attribute
//sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments //sw.WriteLine("#pragma warning disable 1591"); // Missing doc comments
//sw.WriteLine(); //sw.WriteLine();
if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None) if ((Settings.Compatibility & Settings.Legacy.NestedEnums) != Settings.Legacy.None)
{
Trace.WriteLine(String.Format("Writing enums to:\t{0}.{1}.{2}", Settings.OutputNamespace, Settings.OutputClass, Settings.NestedEnumsClass)); Trace.WriteLine(String.Format("Writing enums to:\t{0}.{1}.{2}", Settings.OutputNamespace, Settings.OutputClass, Settings.NestedEnumsClass));
}
else else
{
Trace.WriteLine(String.Format("Writing enums to:\t{0}", Settings.EnumsOutput)); Trace.WriteLine(String.Format("Writing enums to:\t{0}", Settings.EnumsOutput));
}
if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None) if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None)
{ {
@ -506,11 +508,17 @@ namespace Bind
} }
if (@enum.IsObsolete) if (@enum.IsObsolete)
{
sw.WriteLine("[Obsolete(\"{0}\")]", @enum.Obsolete); sw.WriteLine("[Obsolete(\"{0}\")]", @enum.Obsolete);
}
if (!@enum.CLSCompliant) if (!@enum.CLSCompliant)
{
sw.WriteLine("[CLSCompliant(false)]"); sw.WriteLine("[CLSCompliant(false)]");
}
if (@enum.IsFlagCollection) if (@enum.IsFlagCollection)
{
sw.WriteLine("[Flags]"); sw.WriteLine("[Flags]");
}
sw.WriteLine("public enum " + @enum.Name + " : " + @enum.Type); sw.WriteLine("public enum " + @enum.Name + " : " + @enum.Type);
sw.WriteLine("{"); sw.WriteLine("{");
sw.Indent(); sw.Indent();
@ -548,29 +556,24 @@ namespace Bind
} }
} }
#endregion
#region WriteLicense
public void WriteLicense(BindStreamWriter sw) public void WriteLicense(BindStreamWriter sw)
{ {
sw.WriteLine(File.ReadAllText(Path.Combine(Settings.InputPath, Settings.LicenseFile))); sw.WriteLine(File.ReadAllText(Path.Combine(Settings.InputPath, Settings.LicenseFile)));
sw.WriteLine(); sw.WriteLine();
} }
#endregion
// For example, if parameter foo has indirection level = 1, then it // For example, if parameter foo has indirection level = 1, then it
// is consumed as 'foo*' in the fixed_statements and the call string. // is consumed as 'foo*' in the fixed_statements and the call string.
readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" }; private readonly static string[] pointer_levels = new string[] { "", "*", "**", "***", "****" };
readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
static bool IsEnum(string s, EnumCollection enums) private readonly static string[] array_levels = new string[] { "", "[]", "[,]", "[,,]", "[,,,]" };
private static bool IsEnum(string s, EnumCollection enums)
{ {
return enums.ContainsKey(s); return enums.ContainsKey(s);
} }
string GetDeclarationString(Constant c) private string GetDeclarationString(Constant c)
{ {
if (String.IsNullOrEmpty(c.Name)) if (String.IsNullOrEmpty(c.Name))
{ {
@ -586,13 +589,15 @@ namespace Bind
c.Value); c.Value);
} }
string GetDeclarationString(Delegate d, bool is_delegate) private string GetDeclarationString(Delegate d, bool is_delegate)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append(d.Unsafe ? "unsafe " : ""); sb.Append(d.Unsafe ? "unsafe " : "");
if (is_delegate) if (is_delegate)
{
sb.Append("delegate "); sb.Append("delegate ");
}
sb.Append(GetDeclarationString(d.ReturnType, Settings.Legacy.ConstIntEnums)); sb.Append(GetDeclarationString(d.ReturnType, Settings.Legacy.ConstIntEnums));
sb.Append(" "); sb.Append(" ");
sb.Append(Settings.FunctionPrefix); sb.Append(Settings.FunctionPrefix);
@ -602,7 +607,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Enum e) private string GetDeclarationString(Enum e)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<Constant> constants = new List<Constant>(e.ConstantCollection.Values); List<Constant> constants = new List<Constant>(e.ConstantCollection.Values);
@ -610,12 +615,16 @@ namespace Bind
{ {
int ret = String.Compare(c1.Value, c2.Value); int ret = String.Compare(c1.Value, c2.Value);
if (ret == 0) if (ret == 0)
{
return String.Compare(c1.Name, c2.Name); return String.Compare(c1.Name, c2.Name);
}
return ret; return ret;
}); });
if (e.IsFlagCollection) if (e.IsFlagCollection)
{
sb.AppendLine("[Flags]"); sb.AppendLine("[Flags]");
}
sb.Append("public enum "); sb.Append("public enum ");
sb.Append(e.Name); sb.Append(e.Name);
sb.Append(" : "); sb.Append(" : ");
@ -628,14 +637,16 @@ namespace Bind
sb.Append(" "); sb.Append(" ");
sb.Append(declaration); sb.Append(declaration);
if (!String.IsNullOrEmpty(declaration)) if (!String.IsNullOrEmpty(declaration))
{
sb.AppendLine(","); sb.AppendLine(",");
} }
}
sb.Append("}"); sb.Append("}");
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Function f, Settings.Legacy settings) private string GetDeclarationString(Function f, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -651,15 +662,13 @@ namespace Bind
if (f.Parameters.HasGenericParameters) if (f.Parameters.HasGenericParameters)
{ {
sb.Append("<"); sb.Append("<");
foreach (Parameter p in f.Parameters) foreach (Parameter p in f.Parameters.Where(p => p.Generic))
{
if (p.Generic)
{ {
sb.Append(p.CurrentType); sb.Append(p.CurrentType);
sb.Append(", "); sb.Append(", ");
} }
}
sb.Remove(sb.Length - 1, 1); sb.Remove(sb.Length - 2, 2);
sb.Append(">"); sb.Append(">");
} }
@ -668,9 +677,8 @@ namespace Bind
if (f.Parameters.HasGenericParameters) if (f.Parameters.HasGenericParameters)
{ {
sb.AppendLine(); sb.AppendLine();
foreach (Parameter p in f.Parameters) foreach (Parameter p in f.Parameters.Where(p => p.Generic))
{ {
if (p.Generic)
sb.AppendLine(String.Format(" where {0} : struct", p.CurrentType)); sb.AppendLine(String.Format(" where {0} : struct", p.CurrentType));
} }
} }
@ -678,22 +686,62 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings) private string GetDeclarationString(Parameter p, bool override_unsafe_setting, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
List<string> attributes = new List<string>();
if (p.Flow == FlowDirection.Out) if (p.Flow == FlowDirection.Out)
sb.Append("[OutAttribute] "); {
attributes.Add("OutAttribute");
}
else if (p.Flow == FlowDirection.Undefined) else if (p.Flow == FlowDirection.Undefined)
sb.Append("[InAttribute, OutAttribute] "); {
attributes.Add("InAttribute");
attributes.Add("OutAttribute");
}
if (!String.IsNullOrEmpty(p.ComputeSize))
{
int count;
if (Int32.TryParse(p.ComputeSize, out count))
{
attributes.Add(String.Format("CountAttribute(Count = {0})", count));
}
else
{
if (p.ComputeSize.StartsWith("COMPSIZE"))
{
//remove the compsize hint, just keep comma delimited param names
var len = "COMPSIZE(".Length;
var computed = p.ComputeSize.Substring(len, (p.ComputeSize.Length - len) - 1);
attributes.Add(String.Format("CountAttribute(Computed = \"{0}\")", computed));
}
else
{
attributes.Add(String.Format("CountAttribute(Parameter = \"{0}\")", p.ComputeSize));
}
}
}
if (attributes.Count != 0)
{
sb.Append("[");
sb.Append(string.Join(", ", attributes));
sb.Append("] ");
}
if (p.Reference) if (p.Reference)
{ {
if (p.Flow == FlowDirection.Out) if (p.Flow == FlowDirection.Out)
{
sb.Append("out "); sb.Append("out ");
}
else else
{
sb.Append("ref "); sb.Append("ref ");
} }
}
if (!override_unsafe_setting && ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) != Settings.Legacy.None)) if (!override_unsafe_setting && ((Settings.Compatibility & Settings.Legacy.NoPublicUnsafeFunctions) != Settings.Legacy.None))
{ {
@ -719,7 +767,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings) private string GetDeclarationString(ParameterCollection parameters, Settings.Legacy settings)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -741,7 +789,7 @@ namespace Bind
return sb.ToString(); return sb.ToString();
} }
string GetDeclarationString(Type type, Settings.Legacy settings) private string GetDeclarationString(Type type, Settings.Legacy settings)
{ {
var t = type.QualifiedType; var t = type.QualifiedType;
if ((settings & Settings.Legacy.ConstIntEnums) != 0) if ((settings & Settings.Legacy.ConstIntEnums) != 0)
@ -757,7 +805,5 @@ namespace Bind
pointer_levels[type.Pointer], pointer_levels[type.Pointer],
array_levels[type.Array]); array_levels[type.Array]);
} }
#endregion
} }
} }

View file

@ -3,9 +3,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using System.Xml.XPath; using System.Xml.XPath;
@ -13,32 +11,38 @@ using Bind.Structures;
namespace Bind namespace Bind
{ {
class DocProcessor internal class DocProcessor
{ {
static readonly char[] numbers = "0123456789".ToCharArray(); private static readonly char[] numbers = "0123456789".ToCharArray();
static readonly Regex remove_mathml = new Regex(
private static readonly Regex remove_mathml = new Regex(
@"<(mml:math|inlineequation)[^>]*?>(?:.|\n)*?</\s*\1\s*>", @"<(mml:math|inlineequation)[^>]*?>(?:.|\n)*?</\s*\1\s*>",
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);
static readonly Regex remove_doctype = new Regex(
private static readonly Regex remove_doctype = new Regex(
@"<!DOCTYPE[^>\[]*(\[.*\])?>", RegexOptions.Compiled | RegexOptions.Multiline); @"<!DOCTYPE[^>\[]*(\[.*\])?>", RegexOptions.Compiled | RegexOptions.Multiline);
static readonly Regex remove_xmlns = new Regex(
private static readonly Regex remove_xmlns = new Regex(
"xmlns=\".+\"", RegexOptions.Compiled); "xmlns=\".+\"", RegexOptions.Compiled);
readonly Dictionary<string, string> DocumentationFiles = private readonly Dictionary<string, string> DocumentationFiles =
new Dictionary<string, string>(); new Dictionary<string, string>();
readonly Dictionary<string, Documentation> DocumentationCache =
private readonly Dictionary<string, Documentation> DocumentationCache =
new Dictionary<string, Documentation>(); new Dictionary<string, Documentation>();
Documentation Cached; private Documentation Cached;
string LastFile; private string LastFile;
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
public DocProcessor(IBind generator) public DocProcessor(IBind generator)
{ {
if (generator == null) if (generator == null)
{
throw new ArgumentNullException(); throw new ArgumentNullException();
}
Generator = generator; Generator = generator;
foreach (string file in Directory.GetFiles(Settings.DocPath).Concat( foreach (string file in Directory.GetFiles(Settings.DocPath).Concat(
@ -64,9 +68,13 @@ namespace Bind
{ {
var file = Settings.FunctionPrefix + f.WrappedDelegate.Name + ".xml"; var file = Settings.FunctionPrefix + f.WrappedDelegate.Name + ".xml";
if (!DocumentationFiles.ContainsKey(file)) if (!DocumentationFiles.ContainsKey(file))
{
file = Settings.FunctionPrefix + f.TrimmedName + ".xml"; file = Settings.FunctionPrefix + f.TrimmedName + ".xml";
}
if (!DocumentationFiles.ContainsKey(file)) if (!DocumentationFiles.ContainsKey(file))
{
file = Settings.FunctionPrefix + f.TrimmedName.TrimEnd(numbers) + ".xml"; file = Settings.FunctionPrefix + f.TrimmedName.TrimEnd(numbers) + ".xml";
}
docs = docs =
(DocumentationFiles.ContainsKey(file) ? ProcessFile(DocumentationFiles[file], processor) : null) ?? (DocumentationFiles.ContainsKey(file) ? ProcessFile(DocumentationFiles[file], processor) : null) ??
@ -87,12 +95,14 @@ namespace Bind
// found in the <!-- eqn: :--> comments in the docs. // found in the <!-- eqn: :--> comments in the docs.
// Todo: Some simple MathML tags do not include comments, find a solution. // Todo: Some simple MathML tags do not include comments, find a solution.
// Todo: Some files include more than 1 function - find a way to map these extra functions. // Todo: Some files include more than 1 function - find a way to map these extra functions.
Documentation ProcessFile(string file, EnumProcessor processor) private Documentation ProcessFile(string file, EnumProcessor processor)
{ {
string text; string text;
if (LastFile == file) if (LastFile == file)
{
return Cached; return Cached;
}
LastFile = file; LastFile = file;
text = File.ReadAllText(file); text = File.ReadAllText(file);
@ -148,10 +158,12 @@ namespace Bind
} }
} }
Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor) private Documentation ToInlineDocs(XDocument doc, EnumProcessor enum_processor)
{ {
if (doc == null || enum_processor == null) if (doc == null || enum_processor == null)
{
throw new ArgumentNullException(); throw new ArgumentNullException();
}
var no_const_processing = Settings.Legacy.NoAdvancedEnumProcessing | Settings.Legacy.ConstIntEnums; var no_const_processing = Settings.Legacy.NoAdvancedEnumProcessing | Settings.Legacy.ConstIntEnums;
if (!Generator.Settings.IsEnabled(no_const_processing)) if (!Generator.Settings.IsEnabled(no_const_processing))
@ -190,8 +202,9 @@ namespace Bind
return inline; return inline;
} }
static readonly char[] newline = new char[] { '\n' }; private static readonly char[] newline = new char[] { '\n' };
static string Cleanup(string text)
private static string Cleanup(string text)
{ {
return return
String.Join(" ", text String.Join(" ", text

View file

@ -1,16 +1,10 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2; using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 2.0 and 3.0 // Generation implementation for OpenGL ES 2.0 and 3.0
class ES2Generator : Generator internal class ES2Generator : Generator
{ {
public ES2Generator(Settings settings) public ES2Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,16 +1,10 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2; using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 3.1 // Generation implementation for OpenGL ES 3.1
class ES31Generator : Generator internal class ES31Generator : Generator
{ {
public ES31Generator(Settings settings) public ES31Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,16 +1,10 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2; using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generation implementation for OpenGL ES 3.0 // Generation implementation for OpenGL ES 3.0
class ES3Generator : Generator internal class ES3Generator : Generator
{ {
public ES3Generator(Settings settings) public ES3Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,16 +1,10 @@
using System; using System.IO;
using System.Collections.Generic;
using System.IO;
using System.Xml.XPath;
using Bind.GL2; using Bind.GL2;
using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
namespace Bind.ES namespace Bind.ES
{ {
// Generator implementation for OpenGL ES 1.0 and 1.1 // Generator implementation for OpenGL ES 1.0 and 1.1
class ESGenerator : Generator internal class ESGenerator : Generator
{ {
public ESGenerator(Settings settings) public ESGenerator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2010 the Open Toolkit library. // Copyright (c) 2006 - 2010 the Open Toolkit library.
@ -23,12 +22,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Xml.XPath; using System.Xml.XPath;
@ -37,19 +34,23 @@ using Enum = Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
class EnumProcessor internal class EnumProcessor
{ {
readonly IEnumerable<string> Overrides; private readonly IEnumerable<string> Overrides;
IBind Generator { get; set; } private IBind Generator { get; set; }
Settings Settings { get { return Generator.Settings; } } private Settings Settings { get { return Generator.Settings; } }
public EnumProcessor(IBind generator, IEnumerable<string> overrides) public EnumProcessor(IBind generator, IEnumerable<string> overrides)
{ {
if (generator == null) if (generator == null)
{
throw new ArgumentNullException("generator"); throw new ArgumentNullException("generator");
}
if (overrides == null) if (overrides == null)
{
throw new ArgumentNullException("overrides"); throw new ArgumentNullException("overrides");
}
Generator = generator; Generator = generator;
Overrides = overrides; Overrides = overrides;
@ -71,7 +72,9 @@ namespace Bind
public static string GetOverridesPath(string apiname, string enumeration) public static string GetOverridesPath(string apiname, string enumeration)
{ {
if (enumeration == null) if (enumeration == null)
{
throw new ArgumentNullException("enumeration"); throw new ArgumentNullException("enumeration");
}
var path = new StringBuilder(); var path = new StringBuilder();
path.Append("/signatures/replace"); path.Append("/signatures/replace");
@ -87,9 +90,7 @@ namespace Bind
return path.ToString(); return path.ToString();
} }
#region Private Members private EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
EnumCollection ProcessNames(EnumCollection enums, XPathNavigator nav, string apiname)
{ {
EnumCollection processed_enums = new EnumCollection(); EnumCollection processed_enums = new EnumCollection();
foreach (var e in enums.Values) foreach (var e in enums.Values)
@ -125,7 +126,7 @@ namespace Bind
return processed_enums; return processed_enums;
} }
static string ReplaceName(XPathNavigator nav, string apiname, string name) private static string ReplaceName(XPathNavigator nav, string apiname, string name)
{ {
var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, name)); var enum_override = nav.SelectSingleNode(GetOverridesPath(apiname, name));
if (enum_override != null) if (enum_override != null)
@ -139,7 +140,7 @@ namespace Bind
return name; return name;
} }
static bool IsAlreadyProcessed(string name) private static bool IsAlreadyProcessed(string name)
{ {
string extension = Utilities.GetExtension(name, true); string extension = Utilities.GetExtension(name, true);
bool unprocessed = false; bool unprocessed = false;
@ -153,15 +154,21 @@ namespace Bind
public string TranslateEnumName(string name) public string TranslateEnumName(string name)
{ {
if (String.IsNullOrEmpty(name)) if (String.IsNullOrEmpty(name))
{
return name; return name;
}
if (Utilities.CSharpKeywords.Contains(name)) if (Utilities.CSharpKeywords.Contains(name))
{
return name; return name;
}
if (!IsAlreadyProcessed(name)) if (!IsAlreadyProcessed(name))
{ {
if (Char.IsDigit(name[0])) if (Char.IsDigit(name[0]))
{
name = Settings.ConstantPrefix + name; name = Settings.ConstantPrefix + name;
}
StringBuilder translator = new StringBuilder(name); StringBuilder translator = new StringBuilder(name);
@ -198,11 +205,17 @@ namespace Bind
} }
if (is_after_underscore_or_number) if (is_after_underscore_or_number)
{
char_to_add = Char.ToUpper(c); char_to_add = Char.ToUpper(c);
}
else if (is_previous_uppercase) else if (is_previous_uppercase)
{
char_to_add = Char.ToLower(c); char_to_add = Char.ToLower(c);
}
else else
{
char_to_add = c; char_to_add = c;
}
translator.Append(char_to_add); translator.Append(char_to_add);
@ -223,13 +236,15 @@ namespace Bind
name = translator.ToString(); name = translator.ToString();
if (name.StartsWith(Settings.EnumPrefix)) if (name.StartsWith(Settings.EnumPrefix))
{
name = name.Substring(Settings.EnumPrefix.Length); name = name.Substring(Settings.EnumPrefix.Length);
} }
}
return name; return name;
} }
EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname) private EnumCollection ProcessConstants(EnumCollection enums, XPathNavigator nav, string apiname)
{ {
foreach (var e in enums.Values) foreach (var e in enums.Values)
{ {
@ -262,7 +277,7 @@ namespace Bind
return enums; return enums;
} }
static void ReplaceConstant(XPathNavigator enum_override, Constant c) private static void ReplaceConstant(XPathNavigator enum_override, Constant c)
{ {
if (enum_override != null) if (enum_override != null)
{ {
@ -286,7 +301,9 @@ namespace Bind
public string TranslateConstantName(string s, bool isValue) public string TranslateConstantName(string s, bool isValue)
{ {
if (String.IsNullOrEmpty(s)) if (String.IsNullOrEmpty(s))
{
return s; return s;
}
StringBuilder translator = new StringBuilder(s.Length); StringBuilder translator = new StringBuilder(s.Length);
@ -306,7 +323,9 @@ namespace Bind
bool is_after_digit = false; bool is_after_digit = false;
if (!isValue && Char.IsDigit(s[0])) if (!isValue && Char.IsDigit(s[0]))
{
s = Settings.ConstantPrefix + s; s = Settings.ConstantPrefix + s;
}
foreach (char c in s) foreach (char c in s)
{ {
@ -337,8 +356,10 @@ namespace Bind
translator[0] = Char.ToUpper(translator[0]); translator[0] = Char.ToUpper(translator[0]);
} }
else else
{
translator.Append(s); translator.Append(s);
} }
}
return translator.ToString(); return translator.ToString();
} }
@ -350,14 +371,20 @@ namespace Bind
{ {
// Trim the unsigned or long specifiers used in C constants ('u' or 'ull'). // Trim the unsigned or long specifiers used in C constants ('u' or 'ull').
if (value.ToLower().EndsWith("ull")) if (value.ToLower().EndsWith("ull"))
{
value = value.Substring(0, value.Length - 3); value = value.Substring(0, value.Length - 3);
}
if (value.ToLower().EndsWith("u")) if (value.ToLower().EndsWith("u"))
{
value = value.Substring(0, value.Length - 1); value = value.Substring(0, value.Length - 1);
} }
}
// Strip the prefix, if any. // Strip the prefix, if any.
if (value.StartsWith(Settings.ConstantPrefix)) if (value.StartsWith(Settings.ConstantPrefix))
{
value = value.Substring(Settings.ConstantPrefix.Length); value = value.Substring(Settings.ConstantPrefix.Length);
}
return TranslateConstantName(value, IsValue(value)); return TranslateConstantName(value, IsValue(value));
} }
@ -366,7 +393,7 @@ namespace Bind
// (e.g. FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE) // (e.g. FOG_COORD_ARRAY_TYPE = GL_FOG_COORDINATE_ARRAY_TYPE)
// In this case try searching all enums for the correct constant to alias (stupid opengl specs). // In this case try searching all enums for the correct constant to alias (stupid opengl specs).
// This turns every bare alias into a normal alias that is processed afterwards. // This turns every bare alias into a normal alias that is processed afterwards.
static void ResolveBareAlias(Constant c, EnumCollection enums) private static void ResolveBareAlias(Constant c, EnumCollection enums)
{ {
// Constants are considered bare aliases when they don't have a reference and // Constants are considered bare aliases when they don't have a reference and
// their values are non-numeric. // their values are non-numeric.
@ -387,7 +414,7 @@ namespace Bind
// Resolve 'use' tokens by searching and replacing the correct // Resolve 'use' tokens by searching and replacing the correct
// value from the enum collection. // value from the enum collection.
// Tokens that can't be resolved are removed. // Tokens that can't be resolved are removed.
static void ResolveAliases(Enum e, EnumCollection enums) private static void ResolveAliases(Enum e, EnumCollection enums)
{ {
// Note that we have the removal must be a separate step, since // Note that we have the removal must be a separate step, since
// we cannot modify a collection while iterating with foreach. // we cannot modify a collection while iterating with foreach.
@ -401,7 +428,7 @@ namespace Bind
} }
} }
static bool IsValue(string test) private static bool IsValue(string test)
{ {
// Check if the result is a number. // Check if the result is a number.
long number; long number;
@ -420,7 +447,5 @@ namespace Bind
} }
return is_number; return is_number;
} }
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit library. // Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit library.
@ -23,12 +22,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -38,33 +35,38 @@ using Delegate = Bind.Structures.Delegate;
namespace Bind namespace Bind
{ {
using Enum = Bind.Structures.Enum;
using Type = Bind.Structures.Type; using Type = Bind.Structures.Type;
class FuncProcessor internal class FuncProcessor
{ {
static readonly Regex Endings = new Regex( private static readonly Regex Endings = new Regex(
@"([fd]v?|u?[isb](64)?v?|v|i_v|fi)$", @"([fd]v?|u?[isb](64)?v?|v|i_v|fi)$",
RegexOptions.Compiled); RegexOptions.Compiled);
static readonly Regex EndingsNotToTrim = new Regex(
private static readonly Regex EndingsNotToTrim = new Regex(
"(sh|ib|[tdrey]s|[eE]n[vd]|bled" + "(sh|ib|[tdrey]s|[eE]n[vd]|bled" +
"|Attrib|Access|Boolean|Coord|Depth|Feedbacks|Finish|Flag" + "|Attrib|Access|Boolean|Coord|Depth|Feedbacks|Finish|Flag" +
"|Groups|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Through" + "|Groups|IDs|Indexed|Instanced|Pixels|Queries|Status|Tess|Through" +
"|Uniforms|Varyings|Weight|Width)$", "|Uniforms|Varyings|Weight|Width)$",
RegexOptions.Compiled); RegexOptions.Compiled);
static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
readonly IEnumerable<string> Overrides; private static readonly Regex EndingsAddV = new Regex("^0", RegexOptions.Compiled);
IBind Generator { get; set; } private readonly IEnumerable<string> Overrides;
Settings Settings { get { return Generator.Settings; } }
private IBind Generator { get; set; }
private Settings Settings { get { return Generator.Settings; } }
public FuncProcessor(IBind generator, IEnumerable<string> overrides) public FuncProcessor(IBind generator, IEnumerable<string> overrides)
{ {
if (generator == null) if (generator == null)
{
throw new ArgumentNullException("generator"); throw new ArgumentNullException("generator");
}
if (overrides == null) if (overrides == null)
{
throw new ArgumentNullException("overrides"); throw new ArgumentNullException("overrides");
}
Generator = generator; Generator = generator;
Overrides = overrides; Overrides = overrides;
@ -141,9 +143,7 @@ namespace Bind
return wrappers; return wrappers;
} }
#region Private Members private void GenerateDocumentation(FunctionCollection wrappers,
void GenerateDocumentation(FunctionCollection wrappers,
EnumProcessor enum_processor, DocProcessor doc_processor) EnumProcessor enum_processor, DocProcessor doc_processor)
{ {
foreach (var list in wrappers) foreach (var list in wrappers)
@ -156,7 +156,7 @@ namespace Bind
} }
} }
void GenerateAddressTable(DelegateCollection delegates) private void GenerateAddressTable(DelegateCollection delegates)
{ {
// We allocate one slot per entry point. Rules: // We allocate one slot per entry point. Rules:
// - All extensions get a slot // - All extensions get a slot
@ -195,7 +195,7 @@ namespace Bind
// the overloaded ones. This allows us to reduce the amount // the overloaded ones. This allows us to reduce the amount
// of delegates we need to generate (1 per entry point instead // of delegates we need to generate (1 per entry point instead
// of 1 per overload), which improves loading times. // of 1 per overload), which improves loading times.
static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers) private static void RemoveOverloadedDelegates(DelegateCollection delegates, FunctionCollection wrappers)
{ {
foreach (var w in wrappers.Values.SelectMany(w => w)) foreach (var w in wrappers.Values.SelectMany(w => w))
{ {
@ -204,7 +204,7 @@ namespace Bind
} }
} }
static string GetPath(string apipath, string apiname, string apiversion, string function, string extension) private static string GetPath(string apipath, string apiname, string apiversion, string function, string extension)
{ {
var path = new StringBuilder(); var path = new StringBuilder();
path.Append("/signatures/"); path.Append("/signatures/");
@ -250,17 +250,17 @@ namespace Bind
return path.ToString(); return path.ToString();
} }
static string GetOverloadsPath(string apiname, string apiversion, string function, string extension) private static string GetOverloadsPath(string apiname, string apiversion, string function, string extension)
{ {
return GetPath("overload", apiname, apiversion, function, extension); return GetPath("overload", apiname, apiversion, function, extension);
} }
static string GetOverridesPath(string apiname, string apiversion, string function, string extension) private static string GetOverridesPath(string apiname, string apiversion, string function, string extension)
{ {
return GetPath("replace", apiname, apiversion, function, extension); return GetPath("replace", apiname, apiversion, function, extension);
} }
void TranslateType(Bind.Structures.Type type, private void TranslateType(Bind.Structures.Type type,
XPathNavigator function_override, XPathNavigator overrides, XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname) string category, string apiname)
@ -353,15 +353,23 @@ namespace Bind
{ {
// For consistency - many overrides use string instead of String. // For consistency - many overrides use string instead of String.
if (enum_override.Value == "string") if (enum_override.Value == "string")
{
type.QualifiedType = "String"; type.QualifiedType = "String";
}
else if (enum_override.Value == "StringBuilder") else if (enum_override.Value == "StringBuilder")
type.QualifiedType = "StringBuilder"; {
throw new NotSupportedException("StringBuilder enum overrides are no longer supported");
}
else else
{
type.CurrentType = enum_override.Value; type.CurrentType = enum_override.Value;
} }
}
if (type.CurrentType == "IntPtr" && String.IsNullOrEmpty(type.PreviousType)) if (type.CurrentType == "IntPtr" && String.IsNullOrEmpty(type.PreviousType))
{
type.Pointer = 0; type.Pointer = 0;
}
if (type.Pointer >= 3) if (type.Pointer >= 3)
{ {
@ -379,7 +387,7 @@ namespace Bind
} }
} }
static string TranslateExtension(string extension) private static string TranslateExtension(string extension)
{ {
extension = extension.ToUpper(); extension = extension.ToUpper();
if (extension.Length > 2) if (extension.Length > 2)
@ -389,12 +397,12 @@ namespace Bind
return extension; return extension;
} }
void TranslateExtension(Delegate d) private void TranslateExtension(Delegate d)
{ {
d.Extension = TranslateExtension(d.Extension); d.Extension = TranslateExtension(d.Extension);
} }
static string GetTrimmedExtension(string name, string extension) private static string GetTrimmedExtension(string name, string extension)
{ {
// Extensions are always uppercase // Extensions are always uppercase
int index = name.LastIndexOf(extension.ToUpper()); int index = name.LastIndexOf(extension.ToUpper());
@ -406,7 +414,7 @@ namespace Bind
} }
// Trims unecessary suffices from the specified OpenGL function name. // Trims unecessary suffices from the specified OpenGL function name.
static string GetTrimmedName(Delegate d) private static string GetTrimmedName(Delegate d)
{ {
string name = d.Name; string name = d.Name;
string extension = d.Extension; string extension = d.Extension;
@ -445,7 +453,7 @@ namespace Bind
return trimmed_name; return trimmed_name;
} }
static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion) private static XPathNodeIterator GetFuncOverload(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{ {
// Try a few different extension variations that appear in the overrides xml file // Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() }; string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -457,18 +465,24 @@ namespace Bind
string extensionless_name = GetTrimmedExtension(d.Name, ext); string extensionless_name = GetTrimmedExtension(d.Name, ext);
function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, d.Name, ext)); function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, d.Name, ext));
if (function_overload.Count != 0) if (function_overload.Count != 0)
{
break; break;
}
function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, extensionless_name, ext)); function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, extensionless_name, ext));
if (function_overload.Count != 0) if (function_overload.Count != 0)
{
break; break;
}
function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, trimmed_name, ext)); function_overload = nav.Select(GetOverloadsPath(apiname, apiversion, trimmed_name, ext));
if (function_overload.Count != 0) if (function_overload.Count != 0)
{
break; break;
} }
}
return function_overload; return function_overload;
} }
static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion) private static XPathNavigator GetFuncOverride(XPathNavigator nav, Delegate d, string apiname, string apiversion)
{ {
// Try a few different extension variations that appear in the overrides xml file // Try a few different extension variations that appear in the overrides xml file
string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() }; string[] extensions = { d.Extension, TranslateExtension(d.Extension), d.Extension.ToUpper() };
@ -491,12 +505,12 @@ namespace Bind
return function_override; return function_override;
} }
void TrimName(Function f) private void TrimName(Function f)
{ {
f.TrimmedName = GetTrimmedName(f); f.TrimmedName = GetTrimmedName(f);
} }
static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override) private static void ApplyParameterReplacement(Delegate d, XPathNavigator function_override)
{ {
if (function_override != null) if (function_override != null)
{ {
@ -522,9 +536,16 @@ namespace Bind
d.Parameters[i].Flow = Parameter.GetFlowDirection((string)node.TypedValue); d.Parameters[i].Flow = Parameter.GetFlowDirection((string)node.TypedValue);
break; break;
case "count": case "count":
d.Parameters[i].ComputeSize = node.Value.Trim();
int count; int count;
if (Int32.TryParse(node.Value, out count)) if (Int32.TryParse(d.Parameters[i].ComputeSize, out count))
{
d.Parameters[i].ElementCount = count; d.Parameters[i].ElementCount = count;
}
else
{
d.Parameters[i].ElementCount = 0;
}
break; break;
} }
} }
@ -533,7 +554,7 @@ namespace Bind
} }
} }
static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override) private static void ApplyReturnTypeReplacement(Delegate d, XPathNavigator function_override)
{ {
if (function_override != null) if (function_override != null)
{ {
@ -554,7 +575,7 @@ namespace Bind
// 3) A generic object or void* (translates to IntPtr) // 3) A generic object or void* (translates to IntPtr)
// 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise). // 4) A GLenum (translates to int on Legacy.Tao or GL.Enums.GLenum otherwise).
// Return types must always be CLS-compliant, because .Net does not support overloading on return types. // Return types must always be CLS-compliant, because .Net does not support overloading on return types.
void TranslateReturnType(Delegate d, private void TranslateReturnType(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion) string apiname, string apiversion)
@ -585,11 +606,15 @@ namespace Bind
if (d.ReturnType.CurrentType.Contains("GLenum")) if (d.ReturnType.CurrentType.Contains("GLenum"))
{ {
if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None) if ((Settings.Compatibility & Settings.Legacy.ConstIntEnums) == Settings.Legacy.None)
{
d.ReturnType.QualifiedType = String.Format("{0}{1}{2}", d.ReturnType.QualifiedType = String.Format("{0}{1}{2}",
Settings.EnumsOutput, Settings.NamespaceSeparator, Settings.CompleteEnumName); Settings.EnumsOutput, Settings.NamespaceSeparator, Settings.CompleteEnumName);
}
else else
{
d.ReturnType.QualifiedType = "int"; d.ReturnType.QualifiedType = "int";
} }
}
if (d.ReturnType.CurrentType.ToLower().Contains("bool")) if (d.ReturnType.CurrentType.ToLower().Contains("bool"))
{ {
@ -600,7 +625,7 @@ namespace Bind
d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType); d.ReturnType.CurrentType = GetCLSCompliantType(d.ReturnType);
} }
Delegate GetCLSCompliantDelegate(Delegate d) private Delegate GetCLSCompliantDelegate(Delegate d)
{ {
Delegate f = new Delegate(d); Delegate f = new Delegate(d);
@ -614,7 +639,7 @@ namespace Bind
return f; return f;
} }
void TranslateParameters(Delegate d, private void TranslateParameters(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string apiname, string apiversion) string apiname, string apiversion)
@ -625,11 +650,29 @@ namespace Bind
{ {
TranslateParameter(d.Parameters[i], function_override, nav, enum_processor, enums, d.Category, apiname); TranslateParameter(d.Parameters[i], function_override, nav, enum_processor, enums, d.Category, apiname);
if (d.Parameters[i].CurrentType == "UInt16" && d.Name.Contains("LineStipple")) if (d.Parameters[i].CurrentType == "UInt16" && d.Name.Contains("LineStipple"))
{
d.Parameters[i].WrapperType |= WrapperTypes.UncheckedParameter; d.Parameters[i].WrapperType |= WrapperTypes.UncheckedParameter;
} }
if (function_override != null)
{
XPathNavigator param_override = function_override.SelectSingleNode(String.Format(
"param[@name='{0}' or @index='{1}']",
d.Parameters[i].RawName,
i));
if (param_override != null)
{
var legacyArrayParameter = param_override.GetAttribute("legacyArrayParameter", String.Empty);
if (!String.IsNullOrEmpty(legacyArrayParameter))
{
d.Parameters[i].WrapperType |= WrapperTypes.LegacyArrayParameter;
}
}
}
}
} }
void TranslateParameter(Parameter p, private void TranslateParameter(Parameter p,
XPathNavigator function_override, XPathNavigator overrides, XPathNavigator function_override, XPathNavigator overrides,
EnumProcessor enum_processor, EnumCollection enums, EnumProcessor enum_processor, EnumCollection enums,
string category, string apiname) string category, string apiname)
@ -695,14 +738,16 @@ namespace Bind
} }
if (Utilities.CSharpKeywords.Contains(p.Name)) if (Utilities.CSharpKeywords.Contains(p.Name))
{
p.Name = Settings.KeywordEscapeCharacter + p.Name; p.Name = Settings.KeywordEscapeCharacter + p.Name;
}
// This causes problems with bool arrays // This causes problems with bool arrays
//if (CurrentType.ToLower().Contains("bool")) //if (CurrentType.ToLower().Contains("bool"))
// WrapperType = WrapperTypes.BoolParameter; // WrapperType = WrapperTypes.BoolParameter;
} }
void TranslateAttributes(Delegate d, private void TranslateAttributes(Delegate d,
XPathNavigator function_override, XPathNavigator nav, XPathNavigator function_override, XPathNavigator nav,
string apiname, string apiversion) string apiname, string apiversion)
{ {
@ -734,7 +779,7 @@ namespace Bind
} }
} }
FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums) private FunctionCollection CreateWrappers(DelegateCollection delegates, EnumCollection enums)
{ {
var wrappers = new FunctionCollection(); var wrappers = new FunctionCollection();
foreach (var d in delegates.Values.SelectMany(v => v)) foreach (var d in delegates.Values.SelectMany(v => v))
@ -769,7 +814,7 @@ namespace Bind
return wrappers; return wrappers;
} }
FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums) private FunctionCollection CreateCLSCompliantWrappers(FunctionCollection functions, EnumCollection enums)
{ {
// If the function is not CLS-compliant (e.g. it contains unsigned parameters) // If the function is not CLS-compliant (e.g. it contains unsigned parameters)
// we need to create a CLS-Compliant overload. However, we should only do this // we need to create a CLS-Compliant overload. However, we should only do this
@ -795,8 +840,10 @@ namespace Bind
{ {
cls.Parameters[i].CurrentType = GetCLSCompliantType(cls.Parameters[i]); cls.Parameters[i].CurrentType = GetCLSCompliantType(cls.Parameters[i]);
if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType) if (cls.Parameters[i].CurrentType != f.Parameters[i].CurrentType)
{
modified = true; modified = true;
} }
}
// Only add a cls-compliant overload if we have // Only add a cls-compliant overload if we have
// changed a parameter. // changed a parameter.
@ -810,7 +857,7 @@ namespace Bind
return wrappers; return wrappers;
} }
static FunctionCollection MarkCLSCompliance(FunctionCollection collection) private static FunctionCollection MarkCLSCompliance(FunctionCollection collection)
{ {
//foreach (var w in //foreach (var w in
// (from list in collection // (from list in collection
@ -842,25 +889,37 @@ namespace Bind
for (k = 0; k < wrappers[i].Parameters.Count; k++) for (k = 0; k < wrappers[i].Parameters.Count; k++)
{ {
if (wrappers[i].Parameters[k].CurrentType != wrappers[j].Parameters[k].CurrentType) if (wrappers[i].Parameters[k].CurrentType != wrappers[j].Parameters[k].CurrentType)
{
break; break;
}
if (wrappers[i].Parameters[k].DiffersOnlyOnReference(wrappers[j].Parameters[k])) if (wrappers[i].Parameters[k].DiffersOnlyOnReference(wrappers[j].Parameters[k]))
{
if (wrappers[i].Parameters[k].Reference) if (wrappers[i].Parameters[k].Reference)
{
function_i_is_problematic = true; function_i_is_problematic = true;
}
else else
{
function_j_is_problematic = true; function_j_is_problematic = true;
} }
}
}
if (k == wrappers[i].Parameters.Count) if (k == wrappers[i].Parameters.Count)
{ {
if (function_i_is_problematic) if (function_i_is_problematic)
{
must_remove.Add(i); must_remove.Add(i);
}
if (function_j_is_problematic) if (function_j_is_problematic)
{
must_remove.Add(j); must_remove.Add(j);
} }
} }
} }
} }
}
int count = 0; int count = 0;
must_remove.Sort(); must_remove.Sort();
@ -876,12 +935,14 @@ namespace Bind
return collection; return collection;
} }
string GetCLSCompliantType(Type type) private string GetCLSCompliantType(Type type)
{ {
if (!type.CLSCompliant) if (!type.CLSCompliant)
{ {
if (type.Pointer != 0 && Settings.Compatibility == Settings.Legacy.Tao) if (type.Pointer != 0 && Settings.Compatibility == Settings.Legacy.Tao)
{
return "IntPtr"; return "IntPtr";
}
switch (type.CurrentType) switch (type.CurrentType)
{ {
@ -905,7 +966,7 @@ namespace Bind
return type.CurrentType; return type.CurrentType;
} }
IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums) private IEnumerable<Function> CreateNormalWrappers(Delegate d, EnumCollection enums)
{ {
Function f = new Function(d); Function f = new Function(d);
TrimName(f); TrimName(f);
@ -917,7 +978,7 @@ namespace Bind
} }
} }
IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers) private IEnumerable<Function> CreateConvenienceOverloads(FunctionCollection wrappers)
{ {
var convenience_wrappers = new List<Function>(); var convenience_wrappers = new List<Function>();
foreach (var d in wrappers.Values.SelectMany(w => w)) foreach (var d in wrappers.Values.SelectMany(w => w))
@ -988,7 +1049,7 @@ namespace Bind
return convenience_wrappers; return convenience_wrappers;
} }
static Function CreateReturnTypeConvenienceWrapper(Function d) private static Function CreateReturnTypeConvenienceWrapper(Function d)
{ {
var f = new Function(d); var f = new Function(d);
f.ReturnType = new Type(f.Parameters.Last()); f.ReturnType = new Type(f.Parameters.Last());
@ -1008,7 +1069,7 @@ namespace Bind
return f; return f;
} }
static Function CreateArrayReturnTypeConvenienceWrapper(Function d) private static Function CreateArrayReturnTypeConvenienceWrapper(Function d)
{ {
var f = new Function(d); var f = new Function(d);
var p_array = f.Parameters.Last(); var p_array = f.Parameters.Last();
@ -1025,7 +1086,7 @@ namespace Bind
return f; return f;
} }
List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw) private List<Function> GetWrapper(IDictionary<WrapperTypes, List<Function>> dictionary, WrapperTypes key, Function raw)
{ {
if (!dictionary.ContainsKey(key)) if (!dictionary.ContainsKey(key))
{ {
@ -1057,6 +1118,17 @@ namespace Bind
// Generics are handled in a second pass. // Generics are handled in a second pass.
if ((parameter.WrapperType & WrapperTypes.GenericParameter) == 0) if ((parameter.WrapperType & WrapperTypes.GenericParameter) == 0)
{ {
if ((parameter.WrapperType & WrapperTypes.LegacyArrayParameter) != 0)
{
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.LegacyArrayParameter, func))
{
wrapper.Obsolete = "Use out overload instead";
var p = wrapper.Parameters[i];
p.Array++;
p.Pointer--;
}
}
if ((parameter.WrapperType & WrapperTypes.ArrayParameter) != 0) if ((parameter.WrapperType & WrapperTypes.ArrayParameter) != 0)
{ {
foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.ArrayParameter, func)) foreach (var wrapper in GetWrapper(wrappers, WrapperTypes.ArrayParameter, func))
@ -1197,13 +1269,10 @@ namespace Bind
var p = wrapper.Parameters[i]; var p = wrapper.Parameters[i];
if ((p.WrapperType & WrapperTypes.StringParameter) != 0) if ((p.WrapperType & WrapperTypes.StringParameter) != 0)
{ {
p.QualifiedType = "String";
if (p.Flow == FlowDirection.Out) if (p.Flow == FlowDirection.Out)
{ {
p.QualifiedType = "StringBuilder"; p.Reference = true;
}
else
{
p.QualifiedType = "String";
} }
} }
@ -1230,7 +1299,7 @@ namespace Bind
} }
} }
static void WrapReturnType(Function func) private static void WrapReturnType(Function func)
{ {
if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0) if ((func.ReturnType.WrapperType & WrapperTypes.StringReturnType) != 0)
{ {
@ -1248,7 +1317,5 @@ namespace Bind
func.ReturnType.QualifiedType = "bool"; func.ReturnType.QualifiedType = "bool";
} }
} }
#endregion
} }
} }

View file

@ -1,4 +1,3 @@
#region License
// //
// GL2Generator.cs // GL2Generator.cs
// //
@ -25,15 +24,12 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
// //
#endregion
using System;
using System.IO; using System.IO;
namespace Bind.GL2 namespace Bind.GL2
{ {
internal class GL2Generator : Generator
class GL2Generator : Generator
{ {
public GL2Generator(Settings settings) public GL2Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,17 +22,12 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
namespace Bind.GL2 namespace Bind.GL2
{ {
class GL4Generator : Generator internal class GL4Generator : Generator
{ {
public GL4Generator(Settings settings) public GL4Generator(Settings settings)
: base(settings) : base(settings)

View file

@ -1,27 +1,18 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml.XPath;
using Bind.Structures; using Bind.Structures;
using Delegate=Bind.Structures.Delegate;
using Enum=Bind.Structures.Enum;
using Type=Bind.Structures.Type;
namespace Bind.GL2 namespace Bind.GL2
{ {
abstract class Generator : IBind internal abstract class Generator : IBind
{ {
#region Fields
protected string glTypemap = "GL2/gl.tm"; protected string glTypemap = "GL2/gl.tm";
protected string csTypemap = "csharp.tm"; protected string csTypemap = "csharp.tm";
protected string enumSpec = "GL2/enum.spec"; protected string enumSpec = "GL2/enum.spec";
@ -56,14 +47,12 @@ namespace Bind.GL2
public Settings Settings { get; protected set; } public Settings Settings { get; protected set; }
#endregion
#region Constructors
public Generator(Settings settings) public Generator(Settings settings)
{ {
if (settings == null) if (settings == null)
{
throw new ArgumentNullException("settings"); throw new ArgumentNullException("settings");
}
Settings = settings.Clone(); Settings = settings.Clone();
@ -86,11 +75,7 @@ namespace Bind.GL2
SpecReader = new XmlSpecReader(Settings); SpecReader = new XmlSpecReader(Settings);
} }
#endregion private IEnumerable<string> GetFiles(string path)
#region Private Members
IEnumerable<string> GetFiles(string path)
{ {
path = Path.Combine(Settings.InputPath, path); path = Path.Combine(Settings.InputPath, path);
if ((File.GetAttributes(path) & FileAttributes.Directory) != 0) if ((File.GetAttributes(path) & FileAttributes.Directory) != 0)
@ -107,10 +92,6 @@ namespace Bind.GL2
} }
} }
#endregion
#region IBind Members
public DelegateCollection Delegates { get; private set; } public DelegateCollection Delegates { get; private set; }
public EnumCollection Enums { get; private set; } public EnumCollection Enums { get; private set; }
public FunctionCollection Wrappers { get; private set; } public FunctionCollection Wrappers { get; private set; }
@ -146,7 +127,5 @@ namespace Bind.GL2
Wrappers = func_processor.Process(enum_processor, doc_processor, Wrappers = func_processor.Process(enum_processor, doc_processor,
Delegates, Enums, Profile, Version); Delegates, Enums, Profile, Version);
} }
#endregion
} }
} }

View file

@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder> </AppDesignerFolder>
@ -40,12 +40,16 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<Deterministic>true</Deterministic>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants> <DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>bin\Debug\Bind.xml</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -53,7 +57,6 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType> <DebugType>full</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@ -61,13 +64,13 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants> <DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>bin\Release\Bind.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>none</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -211,7 +214,9 @@
</Compile> </Compile>
<Compile Include="GL2\GL2Generator.cs" /> <Compile Include="GL2\GL2Generator.cs" />
<Compile Include="Structures\Documentation.cs" /> <Compile Include="Structures\Documentation.cs" />
<None Include="Specifications\GL2\overrides.xml" /> <None Include="Specifications\GL2\overrides.xml">
<SubType>Designer</SubType>
</None>
<None Include="Specifications\GL2\GL\4.5\ARB_direct_state_access.xml" /> <None Include="Specifications\GL2\GL\4.5\ARB_direct_state_access.xml" />
<None Include="Specifications\GL2\ES\3.1\KHR_compute_shader.xml" /> <None Include="Specifications\GL2\ES\3.1\KHR_compute_shader.xml" />
<None Include="Specifications\GL2\ES\3.1\KHR_separate_shader_objects.xml" /> <None Include="Specifications\GL2\ES\3.1\KHR_separate_shader_objects.xml" />
@ -238,6 +243,14 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<AdditionalFiles Include="$(SolutionDir)\stylecop.ruleset">
<Link>stylecop.ruleset</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent> <PreBuildEvent>
@ -262,4 +275,12 @@
<ItemGroup> <ItemGroup>
<Folder Include="Specifications\Docs\" /> <Folder Include="Specifications\Docs\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll">
<Paket>True</Paket>
</Analyzer>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll">
<Paket>True</Paket>
</Analyzer>
</ItemGroup>
</Project> </Project>

View file

@ -1,15 +1,13 @@
#region --- License --- /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using Bind.Structures; using Bind.Structures;
using System.Collections.Generic; using System.Collections.Generic;
namespace Bind namespace Bind
{ {
interface IBind internal interface IBind
{ {
DelegateCollection Delegates { get; } DelegateCollection Delegates { get; }
EnumCollection Enums { get; } EnumCollection Enums { get; }

View file

@ -1,16 +1,13 @@
#region --- License --- /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using Bind.Structures; using Bind.Structures;
namespace Bind namespace Bind
{ {
interface ISpecReader internal interface ISpecReader
{ {
void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion); void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversion);
void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion); void ReadEnums(string file, EnumCollection enums, string apiname, string apiversion);

View file

@ -1,14 +1,10 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection; using System.Reflection;
using System.Security; using System.Security;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
@ -18,7 +14,7 @@ using Bind.GL2;
namespace Bind namespace Bind
{ {
enum GeneratorMode internal enum GeneratorMode
{ {
All = 0, All = 0,
Default = All, Default = All,
@ -33,13 +29,13 @@ namespace Bind
CL10, CL10,
} }
static class MainClass internal static class MainClass
{ {
static GeneratorMode mode = GeneratorMode.Default; private static GeneratorMode mode = GeneratorMode.Default;
static internal List<IBind> Generators = new List<IBind>(); static internal List<IBind> Generators = new List<IBind>();
static Settings Settings = new Settings(); private static Settings Settings = new Settings();
static void Main(string[] arguments) private static void Main(string[] arguments)
{ {
Debug.Listeners.Clear(); Debug.Listeners.Clear();
Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));
@ -101,7 +97,9 @@ namespace Bind
val = val.ToLower(); val = val.ToLower();
bool enable = !opt.StartsWith("-"); bool enable = !opt.StartsWith("-");
if (val.StartsWith("+") || val.StartsWith("-")) if (val.StartsWith("+") || val.StartsWith("-"))
{
val = val.Substring(1); val = val.Substring(1);
}
var settings = Settings.Legacy.None; var settings = Settings.Legacy.None;
switch (val) switch (val)

View file

@ -5,13 +5,18 @@ using System.Reflection;
[assembly: AssemblyTitleAttribute("Generator.Bind")] [assembly: AssemblyTitleAttribute("Generator.Bind")]
[assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")]
[assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")]
[assembly: AssemblyVersionAttribute("2.0.0")] [assembly: AssemblyVersionAttribute("3.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0")] [assembly: AssemblyFileVersionAttribute("3.0.0")]
[assembly: CLSCompliantAttribute(true)] [assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")]
namespace System { namespace System {
internal static class AssemblyVersionInformation { internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0"; internal const System.String AssemblyTitle = "Generator.Bind";
internal const string InformationalVersion = "2.0.0"; internal const System.String AssemblyProduct = "OpenTK";
internal const System.String AssemblyDescription = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.";
internal const System.String AssemblyVersion = "3.0.0";
internal const System.String AssemblyFileVersion = "3.0.0";
internal const System.Boolean CLSCompliant = true;
internal const System.String AssemblyCopyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.";
} }
} }

View file

@ -1,8 +1,6 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -13,18 +11,18 @@ using System.Runtime.Serialization.Formatters.Binary;
namespace Bind namespace Bind
{ {
[Serializable] [Serializable]
class Settings internal class Settings
{ {
public Settings() public Settings()
{ {
OverridesFiles = new List<string>(); OverridesFiles = new List<string>();
} }
public string DefaultInputPath = "../../../Source/Bind/Specifications"; public string DefaultInputPath = "src/Generator.Bind/Specifications";
public string DefaultOutputPath = "../../../Source/OpenTK/Graphics/OpenGL"; public string DefaultOutputPath = "src/OpenTK/Graphics/OpenGL";
public string DefaultOutputNamespace = "OpenTK.Graphics.OpenGL"; public string DefaultOutputNamespace = "OpenTK.Graphics.OpenGL";
public string DefaultDocPath = "../../../Source/Bind/Specifications/Docs"; public string DefaultDocPath = "src/Generator.Bind/Specifications/Docs";
public string DefaultFallbackDocPath = "../../../Source/Bind/Specifications/Docs/GL"; public string DefaultFallbackDocPath = "src/Generator.Bind/Specifications/Docs/GL";
public string DefaultLicenseFile = "License.txt"; public string DefaultLicenseFile = "License.txt";
public string DefaultLanguageTypeMapFile = "csharp.tm"; public string DefaultLanguageTypeMapFile = "csharp.tm";
public string DefaultKeywordEscapeCharacter = "@"; public string DefaultKeywordEscapeCharacter = "@";
@ -34,10 +32,11 @@ namespace Bind
public string DefaultWrappersFile = "GL.cs"; public string DefaultWrappersFile = "GL.cs";
public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens; public Legacy DefaultCompatibility = Legacy.NoDropMultipleTokens;
string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile, private string inputPath, outputPath, outputNamespace, docPath, fallbackDocPath, licenseFile,
languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile, languageTypeMapFile, keywordEscapeCharacter, importsFile, delegatesFile, enumsFile,
wrappersFile; wrappersFile;
Nullable<Legacy> compatibility;
private Nullable<Legacy> compatibility;
public string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } } public string InputPath { get { return inputPath ?? DefaultInputPath; } set { inputPath = value; } }
public string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } } public string OutputPath { get { return outputPath ?? DefaultOutputPath; } set { outputPath = value; } }
public string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } } public string OutputNamespace { get { return outputNamespace ?? DefaultOutputNamespace; } set { outputNamespace = value; } }
@ -85,22 +84,30 @@ namespace Bind
get get
{ {
if ((Compatibility & Legacy.NestedEnums) != Legacy.None) if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
{
return OutputNamespace + NamespaceSeparator + OutputClass + NamespaceSeparator + NestedEnumsClass; return OutputNamespace + NamespaceSeparator + OutputClass + NamespaceSeparator + NestedEnumsClass;
}
else else
{
return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + NamespaceSeparator + EnumsNamespace; return String.IsNullOrEmpty(EnumsNamespace) ? OutputNamespace : OutputNamespace + NamespaceSeparator + EnumsNamespace;
} }
} }
}
public string EnumsAuxOutput public string EnumsAuxOutput
{ {
get get
{ {
if ((Compatibility & Legacy.NestedEnums) != Legacy.None) if ((Compatibility & Legacy.NestedEnums) != Legacy.None)
{
return OutputNamespace + NamespaceSeparator + GLClass + NamespaceSeparator + NestedEnumsClass; return OutputNamespace + NamespaceSeparator + GLClass + NamespaceSeparator + NestedEnumsClass;
}
else else
{
return OutputNamespace + NamespaceSeparator + EnumsNamespace; return OutputNamespace + NamespaceSeparator + EnumsNamespace;
} }
} }
}
// New enums namespace (don't use a nested class). // New enums namespace (don't use a nested class).
public string EnumsNamespace = null; // = "Enums"; public string EnumsNamespace = null; // = "Enums";
@ -200,7 +207,15 @@ namespace Bind
public bool DropMultipleTokens public bool DropMultipleTokens
{ {
get { return (Compatibility & Legacy.NoDropMultipleTokens) == Legacy.None; } get { return (Compatibility & Legacy.NoDropMultipleTokens) == Legacy.None; }
set { if (value) Compatibility |= Legacy.NoDropMultipleTokens; else Compatibility &= ~Legacy.NoDropMultipleTokens; } set { if (value)
{
Compatibility |= Legacy.NoDropMultipleTokens;
}
else
{
Compatibility &= ~Legacy.NoDropMultipleTokens;
}
}
} }
public string WindowsGDI = "OpenTK.Platform.Windows.API"; public string WindowsGDI = "OpenTK.Platform.Windows.API";

View file

@ -228,12 +228,6 @@
</param> </param>
</function> </function>
<function name="ShaderSource" extension="Core|Arb">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetActiveAttrib" extension="Core"> <function name="GetActiveAttrib" extension="Core">
<param name="type"> <param name="type">
<type>ActiveAttribType</type> <type>ActiveAttribType</type>
@ -1104,6 +1098,7 @@
<param name="identifier"> <param name="identifier">
<type>ObjectLabelIdentifier</type> <type>ObjectLabelIdentifier</type>
</param> </param>
<param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetProgramInterfaceiv" extension="Core"> <function name="GetProgramInterfaceiv" extension="Core">
@ -1125,6 +1120,7 @@
<param name="programInterface"> <param name="programInterface">
<type>ProgramInterface</type> <type>ProgramInterface</type>
</param> </param>
<param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetProgramResourceiv" extension="Core"> <function name="GetProgramResourceiv" extension="Core">
@ -1134,6 +1130,7 @@
<param name="props"> <param name="props">
<type>ProgramProperty</type> <type>ProgramProperty</type>
</param> </param>
<param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetProgramResourceLocation" extension="Core"> <function name="GetProgramResourceLocation" extension="Core">
@ -1692,6 +1689,16 @@
</param> </param>
</function> </function>
<!-- For backwards compatibility -->
<function name="EdgeFlagv" extension="Core">
<param name="flag" legacyArrayParameter="true" />
</function>
<function name="GetObjectPtrLabel" extension="Core">
<param name="length" legacyArrayParameter="true" />
</function>
<function name="GetObjectPtrLabel" extension="KHR">
<param name="length" legacyArrayParameter="true" />
</function>
</replace> </replace>
<overload name="glcore"> <overload name="glcore">
@ -1701,34 +1708,27 @@
<type>int</type> <type>int</type>
</param> </param>
</function> </function>
<!-- For backwards compatibility -->
<function name="GetObjectLabel" extension="Core">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetObjectPtrLabel" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetProgramResourceiv" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetProgramResourceName" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetObjectPtrLabel" extension="KHR" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
</overload> </overload>
<!-- For backwards compatibility -->
<replace name="gl">
<function name="GetObjectLabel" extension="Ext">
<param name="length" legacyArrayParameter="true" />
</function>
<function name="GetObjectPtrLabel" extension="Core">
<param name="length" legacyArrayParameter="true" />
</function>
<function name="GetObjectPtrLabel" extension="KHR">
<param name="length" legacyArrayParameter="true" />
</function>
<function name="GetProgramPipelineInfoLog" extension="Core">
<param name="length" legacyArrayParameter="true" />
</function>
<function name="GetProgramPipelineInfoLog" extension="Ext">
<param name="length" legacyArrayParameter="true" />
</function>
</replace>
<overload name="gl"> <overload name="gl">
<!-- generated from apitest --> <!-- generated from apitest -->
<function name="TessellationMode" extension="Amd" obsolete="Use AmdVertexShaderTessellator overload instead"> <function name="TessellationMode" extension="Amd" obsolete="Use AmdVertexShaderTessellator overload instead">
@ -1866,46 +1866,12 @@
<type>BeginMode</type> <type>BeginMode</type>
</param> </param>
</function> </function>
<function name="EdgeFlagv" extension="Core" obsolete="Use ref overload instead">
<param name="flag">
<count>0</count>
</param>
</function>
<function name="GetObjectLabel" extension="Core">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetObjectPtrLabel" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetPointerv" extension="Core" obsolete="Use out overload instead">
<param name="params">
<count>0</count>
</param>
</function>
<function name="GetProgram" extension="Core" obsolete="Use GetProgramParameterName overload instead"> <function name="GetProgram" extension="Core" obsolete="Use GetProgramParameterName overload instead">
<param name="pname" index="1"> <param name="pname" index="1">
<type>ProgramParameter</type> <type>ProgramParameter</type>
</param> </param>
</function> </function>
<function name="GetProgramPipelineInfoLog" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetProgramResourceiv" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetProgramResourceName" extension="Core" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetString" extension="Core" obsolete="Use StringNameIndexed overload instead"> <function name="GetString" extension="Core" obsolete="Use StringNameIndexed overload instead">
<param name="name" index="0"> <param name="name" index="0">
<type>StringName</type> <type>StringName</type>
@ -2006,21 +1972,6 @@
<type>ExtDirectStateAccess</type> <type>ExtDirectStateAccess</type>
</param> </param>
</function> </function>
<function name="GetObjectLabel" extension="Ext">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetPointerv" extension="Ext" obsolete="Use out overload instead">
<param name="params">
<count>0</count>
</param>
</function>
<function name="GetProgramPipelineInfoLog" extension="Ext" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="IsEnabledIndexed" extension="Ext" obsolete="Use IndexedEnableCap overload instead"> <function name="IsEnabledIndexed" extension="Ext" obsolete="Use IndexedEnableCap overload instead">
<param name="target" index="0"> <param name="target" index="0">
<type>ExtDrawBuffers2</type> <type>ExtDrawBuffers2</type>
@ -2071,16 +2022,6 @@
<type>IbmVertexArrayLists</type> <type>IbmVertexArrayLists</type>
</param> </param>
</function> </function>
<function name="GetObjectPtrLabel" extension="KHR" obsolete="Use out overload instead">
<param name="length">
<count>0</count>
</param>
</function>
<function name="GetPointerv" extension="KHR" obsolete="Use out overload instead">
<param name="params">
<count>0</count>
</param>
</function>
<function name="DrawTransformFeedback" extension="NV" obsolete="Use PrimitiveType overload instead"> <function name="DrawTransformFeedback" extension="NV" obsolete="Use PrimitiveType overload instead">
<param name="mode" index="0"> <param name="mode" index="0">
<type>NvTransformFeedback2</type> <type>NvTransformFeedback2</type>
@ -4999,21 +4940,6 @@
<function name="DrawElements" obsolete="Use PrimitiveType overload instead"> <function name="DrawElements" obsolete="Use PrimitiveType overload instead">
<param name="mode"><type>BeginMode</type></param> <param name="mode"><type>BeginMode</type></param>
</function> </function>
<function name="ExtGetBuffersQCOM" extension="QCOM" obsolete="Use out overload instead">
<param name="numBuffers"><count>0</count></param>
</function>
<function name="ExtGetFramebuffersQCOM" extension="QCOM" obsolete="Use out overload instead">
<param name="numFramebuffers"><count>0</count></param>
</function>
<function name="ExtGetProgramsQCOM" extension="QCOM" obsolete="Use out overload instead">
<param name="numPrograms"><count>0</count></param>
</function>
<function name="ExtGetRenderbuffersQCOM" extension="QCOM" obsolete="Use out overload instead">
<param name="numRenderbuffers"><count>0</count></param>
</function>
<function name="ExtGetShadersQCOM" extension="QCOM" obsolete="Use out overload instead">
<param name="numShaders"><count>0</count></param>
</function>
</overload> </overload>
<replace name="gles1"> <replace name="gles1">
@ -5021,6 +4947,23 @@
<function name="DeletePerfMonitors" extension="AMD"> <function name="DeletePerfMonitors" extension="AMD">
<param name="monitors"><flow>in</flow></param> <param name="monitors"><flow>in</flow></param>
</function> </function>
<!-- For backwards compatibility -->
<function name="ExtGetBuffersQCOM" extension="QCOM">
<param name="numBuffers" legacyArrayParameter="true" />
</function>
<function name="ExtGetFramebuffersQCOM" extension="QCOM">
<param name="numFramebuffers" legacyArrayParameter="true" />
</function>
<function name="ExtGetProgramsQCOM" extension="QCOM">
<param name="numPrograms" legacyArrayParameter="true" />
</function>
<function name="ExtGetRenderbuffersQCOM" extension="QCOM">
<param name="numRenderbuffers" legacyArrayParameter="true" />
</function>
<function name="ExtGetShadersQCOM" extension="QCOM">
<param name="numShaders" legacyArrayParameter="true" />
</function>
</replace> </replace>
<add name="gles1"> <add name="gles1">
@ -5575,46 +5518,59 @@
</function> </function>
<function name="GetObjectLabel"> <function name="GetObjectLabel">
<param name="identifier"><type>ObjectLabelIdentifier</type></param> <param name="identifier"><type>ObjectLabelIdentifier</type></param>
<param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="ObjectLabel"> <function name="ObjectLabel">
<param name="identifier"><type>ObjectLabelIdentifier</type></param> <param name="identifier"><type>ObjectLabelIdentifier</type></param>
</function> </function>
</replace> </replace>
<!-- gles2 overloads for backwards compatibility (2.0 and 3.0) --> <!-- gles2 replacements for backwards compatibility -->
<overload name="gles2"> <replace name="gles2">
<function name="GetObjectLabel"> <function name="GetObjectLabel">
<param name="length"><count>0</count></param> <param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetObjectPtrLabel" obsolete="Use out overload instead"> <function name="GetObjectPtrLabel">
<param name="length"><count>0</count></param> <param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetTranslatedShaderSource" extension="ANGLE" obsolete="Use out overload instead"> <function name="GetProgramPipelineInfoLog" extension="EXT">
<param name="length"><count>0</count></param> <param name="length" legacyArrayParameter="true" />
</function> </function>
<function name="GetProgramPipelineInfoLog" extension="EXT" obsolete="Use out overload instead"> <!-- GetTranslatedShaderSource is missing count attributes -->
<param name="length"><count>0</count></param> <function name="GetTranslatedShaderSource" extension="ANGLE">
<param name="length" legacyArrayParameter="true" />
<param name="source">
<count>bufsize</count>
</param>
</function> </function>
<function name="GetProgramBinary" extension="OES" obsolete="Use out overload instead"> <function name="GetProgramBinary" extension="OES">
<param name="length"><count>0</count></param> <param name="length" legacyArrayParameter="true" />
<param name="binaryFormat"><count>0</count></param> <param name="binaryFormat" legacyArrayParameter="true" />
</function> </function>
<function name="ExtGetBuffers" extension="QCOM" obsolete="Use out overload instead"> <function name="ExtGetBuffers" extension="QCOM">
<param name="numBuffers"><count>0</count></param> <param name="numBuffers" legacyArrayParameter="true" />
</function> </function>
<function name="ExtGetFramebuffers" extension="QCOM" obsolete="Use out overload instead"> <function name="ExtGetFramebuffers" extension="QCOM">
<param name="numFramebuffers"><count>0</count></param> <param name="numFramebuffers" legacyArrayParameter="true" />
</function> </function>
<function name="ExtGetPrograms" extension="QCOM" obsolete="Use out overload instead"> <function name="ExtGetPrograms" extension="QCOM">
<param name="numPrograms"><count>0</count></param> <param name="numPrograms" legacyArrayParameter="true" />
</function> </function>
<function name="ExtGetRenderbuffers" extension="QCOM" obsolete="Use out overload instead"> <function name="ExtGetRenderbuffers" extension="QCOM">
<param name="numRenderbuffers"><count>0</count></param> <param name="numRenderbuffers" legacyArrayParameter="true" />
</function> </function>
<function name="ExtGetShaders" extension="QCOM" obsolete="Use out overload instead"> <function name="ExtGetShaders" extension="QCOM">
<param name="numShaders"><count>0</count></param> <param name="numShaders" legacyArrayParameter="true" />
</function> </function>
</overload> </replace>
<!-- gles2 replacements for backwards compatibility (2.0 only) -->
<replace name="gles2" version="2.0">
<!-- Khronos added count="1" to VertexAttrib1fv -->
<function name="VertexAttrib1fv">
<param name="v" legacyArrayParameter="true" />
</function>
</replace>
<!-- gles2 overloads for backwards compatibility (2.0 only) --> <!-- gles2 overloads for backwards compatibility (2.0 only) -->
<overload name="gles2" version="2.0"> <overload name="gles2" version="2.0">
@ -5674,13 +5630,6 @@
<param name="format"><type>PixelFormat</type></param> <param name="format"><type>PixelFormat</type></param>
</function> </function>
<!-- Khronos added count="1" to VertexAttrib1fv -->
<function name="VertexAttrib1fv">
<param name="v">
<count>0</count>
</param>
</function>
<!-- generated by apitest --> <!-- generated by apitest -->
<function name="FramebufferRenderbuffer" obsolete="Use FramebufferAttachment overload instead"> <function name="FramebufferRenderbuffer" obsolete="Use FramebufferAttachment overload instead">
<param name="attachment"> <param name="attachment">
@ -7495,4 +7444,40 @@
</add> </add>
<!-- INTEL_performance_query -->
<replace name="gl|glcore|gles1|gles2">
<!-- GetPerfQueryIdByNameINTEL is not const-correct -->
<function name="GetPerfQueryIdByNameINTEL" extension="INTEL">
<param name="queryName">
<flow>in</flow>
</param>
</function>
<!-- GetPerfCounterInfoINTEL is missing count attributes -->
<function name="GetPerfCounterInfoINTEL" extension="INTEL">
<param name="counterName">
<count>counterNameLength</count>
</param>
<param name="counterDesc">
<count>counterDescLength</count>
</param>
</function>
<!-- GetPerfQueryInfoINTEL is missing count attributes -->
<function name="GetPerfQueryInfoINTEL" extension="INTEL">
<param name="queryName">
<count>queryNameLength</count>
</param>
</function>
</replace>
<!-- ExtGetProgramBinarySourceQCOM -->
<replace name="gl|glcore|gles1|gles2">
<!-- ExtGetProgramBinarySourceQCOM is missing count attributes -->
<function name="ExtGetProgramBinarySourceQCOM" extension="QCOM">
<param name="source">
<count>*length</count>
</param>
</function>
</replace>
</signatures> </signatures>

File diff suppressed because it is too large Load diff

View file

@ -111,6 +111,14 @@ GLfixed, int
GLeglImageOES, IntPtr GLeglImageOES, IntPtr
# External egl buffer type added in OpenGL 4.6
GLeglClientBufferEXT, IntPtr
# nVidia vulkan entry point, added by NV_draw_vulkan_image extension
GLVULKANPROCNV, IntPtr
# OpenCL types. # OpenCL types.
_cl_context, IntPtr _cl_context, IntPtr
_cl_event, IntPtr _cl_event, IntPtr

View file

@ -1,14 +1,11 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using System.Text;
namespace Bind.Structures namespace Bind.Structures
{ {
@ -17,24 +14,12 @@ namespace Bind.Structures
/// can be retrieved or set. The value can be either a number, another constant /// can be retrieved or set. The value can be either a number, another constant
/// or an alias to a constant /// or an alias to a constant
/// </summary> /// </summary>
class Constant : IComparable<Constant> internal class Constant : IComparable<Constant>
{ {
#region PreviousName
string original_name;
// Gets the name prior to translation. // Gets the name prior to translation.
public string OriginalName public string OriginalName { get; private set; }
{
get { return original_name; }
private set { original_name = value; }
}
#endregion private string _name;
#region public string Name
string _name;
/// <summary> /// <summary>
/// Gets or sets the name of the opengl constant (eg. GL_LINES). /// Gets or sets the name of the opengl constant (eg. GL_LINES).
@ -46,20 +31,20 @@ namespace Bind.Structures
set set
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
}
if (OriginalName == null) if (OriginalName == null)
{
OriginalName = _name; OriginalName = _name;
}
_name = value; _name = value;
} }
} }
#endregion private string _value;
#region public string Value
string _value;
/// <summary> /// <summary>
/// Gets or sets the value of the opengl constant (eg. 0x00000001). /// Gets or sets the value of the opengl constant (eg. 0x00000001).
@ -73,34 +58,19 @@ namespace Bind.Structures
set set
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
}
_value = value; _value = value;
} }
} }
#endregion
#region public string Reference
string _reference;
/// <summary> /// <summary>
/// Gets or sets a string indicating the OpenGL enum reference by this constant. /// Gets or sets a string indicating the OpenGL enum reference by this constant.
/// Can be null. /// Can be null.
/// </summary> /// </summary>
public string Reference public string Reference { get; set; }
{
get { return _reference; }
set
{
_reference = value;
}
}
#endregion
#region public bool Unchecked
public bool Unchecked public bool Unchecked
{ {
@ -115,10 +85,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region Constructors
/// <summary> /// <summary>
/// Creates an empty Constant. /// Creates an empty Constant.
/// </summary> /// </summary>
@ -137,21 +103,22 @@ namespace Bind.Structures
Value = value; Value = value;
} }
#endregion
/// <summary> /// <summary>
/// Replces the Value of the given constant with the value referenced by the [c.Reference, c.Value] pair. /// Replces the Value of the given constant with the value referenced by the [c.Reference, c.Value] pair.
/// </summary> /// </summary>
/// <param name="c">The Constant to translate</param> /// <param name="c">The Constant to translate</param>
/// <param name="enums">The list of enums to check.</param> /// <param name="enums">The list of enums to check.</param>
/// <param name="auxEnums">The list of auxilliary enums to check.</param>
/// <returns>True if the reference was found; false otherwise.</returns> /// <returns>True if the reference was found; false otherwise.</returns>
public static bool TranslateConstantWithReference(Constant c, EnumCollection enums) public static bool TranslateConstantWithReference(Constant c, EnumCollection enums)
{ {
if (c == null) if (c == null)
{
throw new ArgumentNullException("c"); throw new ArgumentNullException("c");
}
if (enums == null) if (enums == null)
{
throw new ArgumentNullException("enums"); throw new ArgumentNullException("enums");
}
if (!String.IsNullOrEmpty(c.Reference)) if (!String.IsNullOrEmpty(c.Reference))
{ {
@ -192,8 +159,6 @@ namespace Bind.Structures
return true; return true;
} }
#region ToString
public override string ToString() public override string ToString()
{ {
return return
@ -204,18 +169,14 @@ namespace Bind.Structures
Value); Value);
} }
#endregion
#region IComparable <Constant>Members
public int CompareTo(Constant other) public int CompareTo(Constant other)
{ {
int ret = Value.CompareTo(other.Value); int ret = Value.CompareTo(other.Value);
if (ret == 0) if (ret == 0)
{
return Name.CompareTo(other.Name); return Name.CompareTo(other.Name);
}
return ret; return ret;
} }
#endregion
} }
} }

View file

@ -1,17 +1,12 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
@ -19,11 +14,11 @@ namespace Bind.Structures
/// Represents an opengl function. /// Represents an opengl function.
/// The return value, function name, function parameters and opengl version can be retrieved or set. /// The return value, function name, function parameters and opengl version can be retrieved or set.
/// </summary> /// </summary>
class Delegate : IComparable<Delegate>, IEquatable<Delegate> internal class Delegate : IComparable<Delegate>, IEquatable<Delegate>
{ {
//internal static DelegateCollection Delegates; //internal static DelegateCollection Delegates;
bool? cls_compliance_overriden; private bool? cls_compliance_overriden;
protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft); protected static Regex endings = new Regex(@"((((d|f|fi)|u?[isb])_?v?)|v)", RegexOptions.Compiled | RegexOptions.RightToLeft);
protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs)", RegexOptions.Compiled | RegexOptions.RightToLeft); protected static Regex endingsNotToTrim = new Regex("(ib|[tdrey]s|[eE]n[vd]|bled|Flag|Tess|Status|Pixels|Instanced|Indexed|Varyings|Boolean|IDs)", RegexOptions.Compiled | RegexOptions.RightToLeft);
@ -33,8 +28,6 @@ namespace Bind.Structures
// The default Regex matches no functions. Create a new Regex in Bind.Generator classes to override the default behavior. // The default Regex matches no functions. Create a new Regex in Bind.Generator classes to override the default behavior.
internal static Regex endingsAddV = new Regex("^0", RegexOptions.Compiled); internal static Regex endingsAddV = new Regex("^0", RegexOptions.Compiled);
#region --- Constructors ---
public Delegate() public Delegate()
{ {
Parameters = new ParameterCollection(); Parameters = new ParameterCollection();
@ -57,12 +50,6 @@ namespace Bind.Structures
Slot = d.Slot; Slot = d.Slot;
} }
#endregion
#region --- Properties ---
#region public bool CLSCompliant
/// <summary> /// <summary>
/// Gets the CLSCompliant property. True if the delegate is not CLSCompliant. /// Gets the CLSCompliant property. True if the delegate is not CLSCompliant.
/// </summary> /// </summary>
@ -71,19 +58,27 @@ namespace Bind.Structures
get get
{ {
if (cls_compliance_overriden != null) if (cls_compliance_overriden != null)
{
return (bool)cls_compliance_overriden; return (bool)cls_compliance_overriden;
}
if (Unsafe) if (Unsafe)
{
return false; return false;
}
if (!ReturnType.CLSCompliant) if (!ReturnType.CLSCompliant)
{
return false; return false;
}
foreach (Parameter p in Parameters) foreach (Parameter p in Parameters)
{ {
if (!p.CLSCompliant) if (!p.CLSCompliant)
{
return false; return false;
} }
}
return true; return true;
} }
set set
@ -92,21 +87,7 @@ namespace Bind.Structures
} }
} }
#endregion public string Category { get; set; }
#region public string Category
private string _category;
public string Category
{
get { return _category; }
set { _category = value; }
}
#endregion
#region public bool NeedsWrapper
/// <summary> /// <summary>
/// Gets a value that indicates whether this function needs to be wrapped with a Marshaling function. /// Gets a value that indicates whether this function needs to be wrapped with a Marshaling function.
@ -120,22 +101,22 @@ namespace Bind.Structures
// TODO: Add special cases for (Get)ShaderSource. // TODO: Add special cases for (Get)ShaderSource.
if (ReturnType.WrapperType != WrapperTypes.None) if (ReturnType.WrapperType != WrapperTypes.None)
{
return true; return true;
}
foreach (Parameter p in Parameters) foreach (Parameter p in Parameters)
{ {
if (p.WrapperType != WrapperTypes.None) if (p.WrapperType != WrapperTypes.None)
{
return true; return true;
} }
}
return false; return false;
} }
} }
#endregion
#region public virtual bool Unsafe
/// <summary> /// <summary>
/// True if the delegate must be declared as 'unsafe'. /// True if the delegate must be declared as 'unsafe'.
/// </summary> /// </summary>
@ -149,7 +130,9 @@ namespace Bind.Structures
// return false; // return false;
if (ReturnType.Pointer != 0) if (ReturnType.Pointer != 0)
{
return true; return true;
}
foreach (Parameter p in Parameters) foreach (Parameter p in Parameters)
{ {
@ -163,28 +146,12 @@ namespace Bind.Structures
} }
} }
#endregion
#region public Parameter ReturnType
Type _return_type = new Type();
/// <summary> /// <summary>
/// Gets or sets the return value of the opengl function. /// Gets or sets the return value of the opengl function.
/// </summary> /// </summary>
public Type ReturnType public Type ReturnType { get; set; } = new Type();
{
get { return _return_type; }
set
{
_return_type = value;
}
}
#endregion private string _name;
#region public virtual string Name
string _name;
/// <summary> /// <summary>
/// Gets or sets the name of the opengl function. /// Gets or sets the name of the opengl function.
/// </summary> /// </summary>
@ -200,36 +167,12 @@ namespace Bind.Structures
} }
} }
#endregion public ParameterCollection Parameters { get; set; }
#region public ParameterCollection Parameters
ParameterCollection _parameters;
public ParameterCollection Parameters
{
get { return _parameters; }
set { _parameters = value; }
}
#endregion
#region public string Version
string _version;
/// <summary> /// <summary>
/// Defines the opengl version that introduced this function. /// Defines the opengl version that introduced this function.
/// </summary> /// </summary>
public string Version public string Version { get; set; }
{
get { return _version; }
set { _version = value; }
}
#endregion
#region public bool Extension
public string Extension public string Extension
{ {
@ -237,8 +180,6 @@ namespace Bind.Structures
set; set;
} }
#endregion
public bool Deprecated { get; set; } public bool Deprecated { get; set; }
public string DeprecatedVersion { get; set; } public string DeprecatedVersion { get; set; }
public string EntryPoint { get; set; } public string EntryPoint { get; set; }
@ -247,8 +188,6 @@ namespace Bind.Structures
// Slot index in the address table // Slot index in the address table
public int Slot { get; set; } public int Slot { get; set; }
#endregion
// This method should only be used for debugging purposes, not for code generation! // This method should only be used for debugging purposes, not for code generation!
// Returns a string representing the full delegate declaration without decorations. // Returns a string representing the full delegate declaration without decorations.
// (ie "(unsafe) void delegate glXxxYyy(int a, float b, IntPtr c)" // (ie "(unsafe) void delegate glXxxYyy(int a, float b, IntPtr c)"
@ -266,22 +205,20 @@ namespace Bind.Structures
return sb.ToString(); return sb.ToString();
} }
#region IComparable<Delegate> Members
public int CompareTo(Delegate other) public int CompareTo(Delegate other)
{ {
int ret = Name.CompareTo(other.Name); int ret = Name.CompareTo(other.Name);
if (ret == 0) if (ret == 0)
{
ret = Parameters.CompareTo(other.Parameters); ret = Parameters.CompareTo(other.Parameters);
}
if (ret == 0) if (ret == 0)
{
ret = ReturnType.CompareTo(other.ReturnType); ret = ReturnType.CompareTo(other.ReturnType);
}
return ret; return ret;
} }
#endregion
#region IEquatable<Delegate> Members
public bool Equals(Delegate other) public bool Equals(Delegate other)
{ {
return return
@ -289,15 +226,11 @@ namespace Bind.Structures
Parameters.Equals(other.Parameters) && Parameters.Equals(other.Parameters) &&
ReturnType.Equals(other.ReturnType); ReturnType.Equals(other.ReturnType);
} }
#endregion
} }
#region DelegateCollection internal class DelegateCollection : IDictionary<string, List<Delegate>>
class DelegateCollection : IDictionary<string, List<Delegate>>
{ {
readonly SortedDictionary<string, List<Delegate>> Delegates = private readonly SortedDictionary<string, List<Delegate>> Delegates =
new SortedDictionary<string, List<Delegate>>(); new SortedDictionary<string, List<Delegate>>();
public void Add(Delegate d) public void Add(Delegate d)
@ -348,8 +281,6 @@ namespace Bind.Structures
} }
} }
#region IDictionary Members
public void Add(string key, List<Delegate> value) public void Add(string key, List<Delegate> value)
{ {
Delegates.Add(key, value.ToList()); Delegates.Add(key, value.ToList());
@ -398,10 +329,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region ICollection implementation
public void Add(KeyValuePair<string, List<Delegate>> item) public void Add(KeyValuePair<string, List<Delegate>> item)
{ {
Delegates.Add(item.Key, item.Value.ToList()); Delegates.Add(item.Key, item.Value.ToList());
@ -443,26 +370,14 @@ namespace Bind.Structures
} }
} }
#endregion
#region IEnumerable implementation
public IEnumerator<KeyValuePair<string, List<Delegate>>> GetEnumerator() public IEnumerator<KeyValuePair<string, List<Delegate>>> GetEnumerator()
{ {
return Delegates.GetEnumerator(); return Delegates.GetEnumerator();
} }
#endregion
#region IEnumerable implementation
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{ {
return Delegates.GetEnumerator(); return Delegates.GetEnumerator();
} }
#endregion
} }
#endregion
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// Documentation.cs // Documentation.cs
// //
// Author: // Author:
@ -25,20 +24,18 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Bind.Structures namespace Bind.Structures
{ {
class Documentation internal class Documentation
{ {
public string Summary { get; set; } public string Summary { get; set; }
public List<DocumentationParameter> Parameters { get; set; } public List<DocumentationParameter> Parameters { get; set; }
} }
class DocumentationParameter internal class DocumentationParameter
{ {
public string Name { get; set; } public string Name { get; set; }
public string Documentation { get; set; } public string Documentation { get; set; }

View file

@ -1,23 +1,16 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
#region class Enum internal class Enum
class Enum
{ {
string _name, _type; private string _name, _type;
public Enum() public Enum()
{ {
@ -43,7 +36,7 @@ namespace Bind.Structures
set { _type = value; } set { _type = value; }
} }
SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>(); private SortedDictionary<string, Constant> _constant_collection = new SortedDictionary<string, Constant>();
public IDictionary<string, Constant> ConstantCollection public IDictionary<string, Constant> ConstantCollection
{ {
@ -51,7 +44,9 @@ namespace Bind.Structures
set set
{ {
if (value == null) if (value == null)
{
throw new ArgumentNullException("value"); throw new ArgumentNullException("value");
}
_constant_collection.Clear(); _constant_collection.Clear();
foreach (var item in value) foreach (var item in value)
@ -81,45 +76,49 @@ namespace Bind.Structures
public bool CLSCompliant { get; set; } public bool CLSCompliant { get; set; }
} }
#endregion internal class EnumCollection : IDictionary<string, Enum>
#region class EnumCollection
class EnumCollection : IDictionary<string, Enum>
{ {
SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>(); private SortedDictionary<string, Enum> Enumerations = new SortedDictionary<string, Enum>();
// Return -1 for ext1, 1 for ext2 or 0 if no preference. // Return -1 for ext1, 1 for ext2 or 0 if no preference.
int OrderOfPreference(string ext1, string ext2) private int OrderOfPreference(string ext1, string ext2)
{ {
// If one is empty and the other not, prefer the empty one (empty == core) // If one is empty and the other not, prefer the empty one (empty == core)
// Otherwise check for Arb and Ext. To reuse the logic for the // Otherwise check for Arb and Ext. To reuse the logic for the
// empty check, let's try to remove first Arb, then Ext from the strings. // empty check, let's try to remove first Arb, then Ext from the strings.
int ret = PreferEmpty(ext1, ext2); int ret = PreferEmpty(ext1, ext2);
if (ret != 0) if (ret != 0)
{
return ret; return ret;
}
ext1 = ext1.Replace("Arb", ""); ext2 = ext2.Replace("Arb", ""); ext1 = ext1.Replace("Arb", ""); ext2 = ext2.Replace("Arb", "");
ret = PreferEmpty(ext1, ext2); ret = PreferEmpty(ext1, ext2);
if (ret != 0) if (ret != 0)
{
return ret; return ret;
}
ext1 = ext1.Replace("Ext", ""); ext2 = ext2.Replace("Ext", ""); ext1 = ext1.Replace("Ext", ""); ext2 = ext2.Replace("Ext", "");
return PreferEmpty(ext1, ext2); return PreferEmpty(ext1, ext2);
} }
// Prefer the empty string over the non-empty. // Prefer the empty string over the non-empty.
int PreferEmpty(string ext1, string ext2) private int PreferEmpty(string ext1, string ext2)
{ {
if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2)) if (String.IsNullOrEmpty(ext1) && !String.IsNullOrEmpty(ext2))
{
return -1; return -1;
}
else if (String.IsNullOrEmpty(ext2) && !String.IsNullOrEmpty(ext1)) else if (String.IsNullOrEmpty(ext2) && !String.IsNullOrEmpty(ext1))
{
return 1; return 1;
}
else else
{
return 0; return 0;
} }
}
#region Public Members
public void Add(Enum e) public void Add(Enum e)
{ {
@ -134,10 +133,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region IDictionary<string, Enum> Members
public void Add(string key, Enum value) public void Add(string key, Enum value)
{ {
if (ContainsKey(key)) if (ContainsKey(key))
@ -235,9 +230,5 @@ namespace Bind.Structures
{ {
return Enumerations.GetEnumerator(); return Enumerations.GetEnumerator();
} }
#endregion
} }
#endregion
} }

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
namespace Bind.Structures namespace Bind.Structures
{ {
@ -33,8 +31,19 @@ namespace Bind.Structures
/// </summary> /// </summary>
public enum FlowDirection public enum FlowDirection
{ {
/// <summary>
/// No defined flow.
/// </summary>
Undefined = 0, Undefined = 0,
/// <summary>
/// Input parameter.
/// </summary>
In, In,
/// <summary>
/// Output parameter, typically decorated with the out keyword.
/// </summary>
Out Out
} }
} }

View file

@ -1,8 +1,6 @@
#region --- License --- /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -12,16 +10,8 @@ using System.Text.RegularExpressions;
namespace Bind.Structures namespace Bind.Structures
{ {
class Function : Delegate, IEquatable<Function>, IComparable<Function> internal class Function : Delegate, IEquatable<Function>, IComparable<Function>
{ {
#region Fields
Delegate wrapped_delegate;
#endregion
#region --- Constructors ---
public Function(Delegate d) public Function(Delegate d)
: base(d) : base(d)
{ {
@ -42,19 +32,7 @@ namespace Bind.Structures
Body.AddRange(f.Body); Body.AddRange(f.Body);
} }
#endregion public Delegate WrappedDelegate { get; set; }
#region public Delegate WrappedDelegate
public Delegate WrappedDelegate
{
get { return wrapped_delegate; }
set { wrapped_delegate = value; }
}
#endregion
#region public void TurnVoidPointersToIntPtr()
public void TurnVoidPointersToIntPtr() public void TurnVoidPointersToIntPtr()
{ {
@ -68,10 +46,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public override bool Unsafe
public override bool Unsafe public override bool Unsafe
{ {
get get
@ -80,34 +54,12 @@ namespace Bind.Structures
} }
} }
#endregion public FunctionBody Body { get; set; }
#region public FunctionBody Body
FunctionBody _body;
public FunctionBody Body
{
get { return _body; }
set { _body = value; }
}
#endregion
#region public string TrimmedName
public string TrimmedName { get; set; } public string TrimmedName { get; set; }
#endregion
#region Documentation
public Documentation Documentation { get; set; } public Documentation Documentation { get; set; }
#endregion
#region ToString
public override string ToString() public override string ToString()
{ {
return String.Format("{0} {1}{2}", return String.Format("{0} {1}{2}",
@ -116,10 +68,6 @@ namespace Bind.Structures
Parameters); Parameters);
} }
#endregion
#region IEquatable<Function> Members
public bool Equals(Function other) public bool Equals(Function other)
{ {
bool result = bool result =
@ -129,31 +77,38 @@ namespace Bind.Structures
return result; return result;
} }
#endregion
#region IComparable<Function> Members
public int CompareTo(Function other) public int CompareTo(Function other)
{ {
int ret = Name.CompareTo(other.Name); int ret = Name.CompareTo(other.Name);
if (ret == 0) if (ret == 0)
{
ret = Parameters.CompareTo(other.Parameters); ret = Parameters.CompareTo(other.Parameters);
}
if (ret == 0) if (ret == 0)
{
ret = ReturnType.CompareTo(other.ReturnType); ret = ReturnType.CompareTo(other.ReturnType);
}
return ret; return ret;
} }
#endregion
} }
#region class FunctionBody : List<string> /// <summary>
/// The <see cref="FunctionBody"/> class acts as a wrapper around a block of source code that makes up the body
/// of a function.
/// </summary>
public class FunctionBody : List<string> public class FunctionBody : List<string>
{ {
/// <summary>
/// Initializes an empty <see cref="FunctionBody"/>.
/// </summary>
public FunctionBody() public FunctionBody()
{ {
} }
/// <summary>
/// Initializes a <see cref="FunctionBody"/> from an existing FunctionBody.
/// </summary>
/// <param name="fb">The body to copy from.</param>
public FunctionBody(FunctionBody fb) public FunctionBody(FunctionBody fb)
{ {
foreach (string s in fb) foreach (string s in fb)
@ -164,24 +119,42 @@ namespace Bind.Structures
private string indent = ""; private string indent = "";
/// <summary>
/// Indents this <see cref="FunctionBody"/> another level.
/// </summary>
public void Indent() public void Indent()
{ {
indent += " "; indent += " ";
} }
/// <summary>
/// Removes a level of indentation from this <see cref="FunctionBody"/>.
/// </summary>
public void Unindent() public void Unindent()
{ {
if (indent.Length > 4) if (indent.Length > 4)
{
indent = indent.Substring(4); indent = indent.Substring(4);
}
else else
{
indent = String.Empty; indent = String.Empty;
} }
}
/// <summary>
/// Adds a line of source code to the body at the current indentation level.
/// </summary>
/// <param name="s">The line to add.</param>
new public void Add(string s) new public void Add(string s)
{ {
base.Add(indent + s.TrimEnd('\r', '\n')); base.Add(indent + s.TrimEnd('\r', '\n'));
} }
/// <summary>
/// Adds a range of source code lines to the body at the current indentation level.
/// </summary>
/// <param name="collection"></param>
new public void AddRange(IEnumerable<string> collection) new public void AddRange(IEnumerable<string> collection)
{ {
foreach (string t in collection) foreach (string t in collection)
@ -190,10 +163,16 @@ namespace Bind.Structures
} }
} }
/// <summary>
/// Builds the contents of the function body into a string and encloses it with braces.
/// </summary>
/// <returns>The body, enclosed in braces.</returns>
public override string ToString() public override string ToString()
{ {
if (Count == 0) if (Count == 0)
{
return String.Empty; return String.Empty;
}
StringBuilder sb = new StringBuilder(Count); StringBuilder sb = new StringBuilder(Count);
@ -208,15 +187,11 @@ namespace Bind.Structures
} }
} }
#endregion internal class FunctionCollection : SortedDictionary<string, List<Function>>
#region class FunctionCollection : SortedDictionary<string, List<Function>>
class FunctionCollection : SortedDictionary<string, List<Function>>
{ {
Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled); private Regex unsignedFunctions = new Regex(@".+(u[dfisb]v?)", RegexOptions.Compiled);
void Add(Function f) private void Add(Function f)
{ {
if (!ContainsKey(f.Extension)) if (!ContainsKey(f.Extension))
{ {
@ -276,6 +251,4 @@ namespace Bind.Structures
} }
} }
} }
#endregion
} }

View file

@ -1,31 +1,25 @@
#region --- License ---
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
/// <summary> /// <summary>
/// Represents a single parameter of an opengl function. /// Represents a single parameter of an opengl function.
/// </summary> /// </summary>
class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter> internal class Parameter : Type, IComparable<Parameter>, IEquatable<Parameter>
{ {
string cache; private string cache;
#region Constructors
/// <summary> /// <summary>
/// Creates a new Parameter without type and name. /// Creates a new Parameter without type and name.
/// </summary> /// </summary>
public Parameter() public Parameter()
:base()
{ {
} }
@ -37,7 +31,9 @@ namespace Bind.Structures
: base(p) : base(p)
{ {
if (p == null) if (p == null)
{
return; return;
}
Name = p.Name; Name = p.Name;
Unchecked = p.Unchecked; Unchecked = p.Unchecked;
@ -49,10 +45,6 @@ namespace Bind.Structures
//this.rebuild = false; //this.rebuild = false;
} }
#endregion
#region RawName
/// <summary> /// <summary>
/// Gets or sets the raw name of the parameter. /// Gets or sets the raw name of the parameter.
/// </summary> /// </summary>
@ -62,10 +54,6 @@ namespace Bind.Structures
private set; private set;
} }
#endregion
#region Name
/// <summary> /// <summary>
/// Gets the name of the parameter. If the name matches a keyword of the current language, /// Gets the name of the parameter. If the name matches a keyword of the current language,
/// then it is escaped with <see cref="Settings.KeywordEscapeCharacter"/>. /// then it is escaped with <see cref="Settings.KeywordEscapeCharacter"/>.
@ -90,11 +78,7 @@ namespace Bind.Structures
} }
} }
#endregion private UnmanagedType _unmanaged_type;
#region UnmanagedType
UnmanagedType _unmanaged_type;
/// <summary> /// <summary>
/// Gets or sets the name of the parameter. /// Gets or sets the name of the parameter.
/// </summary> /// </summary>
@ -110,11 +94,7 @@ namespace Bind.Structures
} }
} }
#endregion private FlowDirection _flow;
#region public FlowDirection Flow
FlowDirection _flow;
/// <summary> /// <summary>
/// Gets or sets the flow of the parameter. /// Gets or sets the flow of the parameter.
@ -131,10 +111,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool NeedsPin
public bool NeedsPin public bool NeedsPin
{ {
get get
@ -144,10 +120,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool Unchecked
private bool _unchecked; private bool _unchecked;
public bool Unchecked public bool Unchecked
@ -162,20 +134,7 @@ namespace Bind.Structures
} }
} }
#endregion public bool Generic { get; set; }
#region public bool Generic
bool generic;
public bool Generic
{
get { return generic; }
set { generic = value; }
}
#endregion
#region public bool DiffersOnlyOnReference
// Returns true if this parameter differs only on reference compared to another parameter, i.e: // Returns true if this parameter differs only on reference compared to another parameter, i.e:
// returns true for 'int' & 'ref int' // returns true for 'int' & 'ref int'
@ -191,20 +150,7 @@ namespace Bind.Structures
other.Reference && !(Reference || Array > 0 || Pointer != 0)); other.Reference && !(Reference || Array > 0 || Pointer != 0));
} }
#endregion public string ComputeSize { get; set; }
#region public string ComputeSize
string computeSize;
public string ComputeSize
{
get { return computeSize; }
set { computeSize = value; }
}
#endregion
#region Static Members
// Returns the FlowDirection that matches the specified string // Returns the FlowDirection that matches the specified string
// ("out" or "in", otherwise undefined). // ("out" or "in", otherwise undefined).
@ -213,22 +159,17 @@ namespace Bind.Structures
return direction == "out" ? FlowDirection.Out : direction == "in" ? FlowDirection.In : FlowDirection.Undefined; return direction == "out" ? FlowDirection.Out : direction == "in" ? FlowDirection.In : FlowDirection.Undefined;
} }
#endregion
#region IComparable<Parameter> Members
public int CompareTo(Parameter other) public int CompareTo(Parameter other)
{ {
int result = base.CompareTo(other); int result = base.CompareTo(other);
if (result == 0) if (result == 0)
{
result = Name.CompareTo(other.Name); result = Name.CompareTo(other.Name);
}
return result; return result;
} }
#endregion
#region ToString
public override string ToString() public override string ToString()
{ {
return String.Format("{2}{0} {1}", return String.Format("{2}{0} {1}",
@ -239,10 +180,6 @@ namespace Bind.Structures
String.Empty); String.Empty);
} }
#endregion
#region IEquatable<Parameter> Members
public bool Equals(Parameter other) public bool Equals(Parameter other)
{ {
bool result = bool result =
@ -251,26 +188,22 @@ namespace Bind.Structures
return result; return result;
} }
#endregion
} }
/// <summary> /// <summary>
/// Holds the parameter list of an opengl function. /// Holds the parameter list of an opengl function.
/// </summary> /// </summary>
class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection> internal class ParameterCollection : IList<Parameter>, IComparable<ParameterCollection>, IEquatable<ParameterCollection>
{ {
readonly List<Parameter> Parameters = new List<Parameter>(); private readonly List<Parameter> Parameters = new List<Parameter>();
bool hasPointerParameters; private bool hasPointerParameters;
bool hasReferenceParameters; private bool hasReferenceParameters;
bool hasUnsignedParameters; private bool hasUnsignedParameters;
bool hasGenericParameters; private bool hasGenericParameters;
public bool Rebuild { get; set; } public bool Rebuild { get; set; }
Settings Settings { get; set; } private Settings Settings { get; set; }
#region Constructors
public ParameterCollection() public ParameterCollection()
{ {
@ -287,23 +220,17 @@ namespace Bind.Structures
public ParameterCollection(IEnumerable<Parameter> parameters) public ParameterCollection(IEnumerable<Parameter> parameters)
{ {
foreach (Parameter p in parameters) foreach (Parameter p in parameters)
{
Add(new Parameter(p)); Add(new Parameter(p));
} }
}
#endregion private void BuildCache()
#region BuildCache
void BuildCache()
{ {
BuildReferenceAndPointerParametersCache(); BuildReferenceAndPointerParametersCache();
Rebuild = false; Rebuild = false;
} }
#endregion
#region public bool HasPointerParameters
public bool HasPointerParameters public bool HasPointerParameters
{ {
get get
@ -317,10 +244,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool HasReferenceParameters
public bool HasReferenceParameters public bool HasReferenceParameters
{ {
get get
@ -334,10 +257,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool HasUnsignedParameters
public bool HasUnsignedParameters public bool HasUnsignedParameters
{ {
get get
@ -351,10 +270,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool HasGenericParameters
public bool HasGenericParameters public bool HasGenericParameters
{ {
get get
@ -368,31 +283,32 @@ namespace Bind.Structures
} }
} }
#endregion
#region void BuildReferenceAndPointerParametersCache() private void BuildReferenceAndPointerParametersCache()
void BuildReferenceAndPointerParametersCache()
{ {
foreach (Parameter p in this) foreach (Parameter p in this)
{ {
if (p.Pointer != 0 || p.CurrentType.Contains("IntPtr")) if (p.Pointer != 0 || p.CurrentType.Contains("IntPtr"))
{
hasPointerParameters = true; hasPointerParameters = true;
}
if (p.Reference) if (p.Reference)
{
hasReferenceParameters = true; hasReferenceParameters = true;
}
if (p.Unsigned) if (p.Unsigned)
{
hasUnsignedParameters = true; hasUnsignedParameters = true;
}
if (p.Generic) if (p.Generic)
{
hasGenericParameters = true; hasGenericParameters = true;
} }
} }
}
#endregion
#region ToString
// Only use for debugging, not for code generation! // Only use for debugging, not for code generation!
public override string ToString() public override string ToString()
@ -409,27 +325,25 @@ namespace Bind.Structures
sb.Replace(", ", ")", sb.Length - 2, 2); sb.Replace(", ", ")", sb.Length - 2, 2);
} }
else else
{
sb.Append(")"); sb.Append(")");
}
return sb.ToString(); return sb.ToString();
} }
#endregion
#region ContainsType
public bool ContainsType(string type) public bool ContainsType(string type)
{ {
foreach (Parameter p in this) foreach (Parameter p in this)
{
if (p.CurrentType == type) if (p.CurrentType == type)
{
return true; return true;
}
}
return false; return false;
} }
#endregion
#region IList<Parameter> Members
public void Add(Parameter p) public void Add(Parameter p)
{ {
Parameters.Add(p); Parameters.Add(p);
@ -511,10 +425,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region IComparable<ParameterCollection> Members
public int CompareTo(ParameterCollection other) public int CompareTo(ParameterCollection other)
{ {
if (Count < other.Count) if (Count < other.Count)
@ -531,20 +441,20 @@ namespace Bind.Structures
{ {
int result = this[i].CompareTo(other[i]); int result = this[i].CompareTo(other[i]);
if (result != 0) if (result != 0)
{
return result; return result;
} }
}
return 0; return 0;
} }
} }
#endregion
#region IEquatable<ParameterCollection> Members
public bool Equals(ParameterCollection other) public bool Equals(ParameterCollection other)
{ {
if (Count != other.Count) if (Count != other.Count)
{
return false; return false;
}
bool result = true; bool result = true;
for (int i = 0; i < Count && result; i++) for (int i = 0; i < Count && result; i++)
@ -553,7 +463,5 @@ namespace Bind.Structures
} }
return result; return result;
} }
#endregion
} }
} }

View file

@ -1,23 +1,14 @@
#region --- License --- /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Xml.XPath;
namespace Bind.Structures namespace Bind.Structures
{ {
class Type : IComparable<Type>, IEquatable<Type> internal class Type : IComparable<Type>, IEquatable<Type>
{ {
string current_qualifier = String.Empty; private string current_qualifier = String.Empty;
string previous_qualifier = String.Empty;
#region --- Constructors ---
public Type() public Type()
{ {
@ -39,25 +30,13 @@ namespace Bind.Structures
} }
} }
#endregion private string CurrentQualifier
#region Private Members
string CurrentQualifier
{ {
get { return current_qualifier; } get { return current_qualifier; }
set { PreviousQualifier = CurrentQualifier; current_qualifier = value; } set { PreviousQualifier = CurrentQualifier; current_qualifier = value; }
} }
string PreviousQualifier private string PreviousQualifier { get; set; } = String.Empty;
{
get { return previous_qualifier; }
set { previous_qualifier = value; }
}
#endregion
#region Public Members
public string QualifiedType public string QualifiedType
{ {
@ -71,7 +50,9 @@ namespace Bind.Structures
set set
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{
throw new ArgumentNullException(); throw new ArgumentNullException();
}
int qualifier_end = value.LastIndexOf('.'); int qualifier_end = value.LastIndexOf('.');
if (qualifier_end > -1) if (qualifier_end > -1)
@ -87,9 +68,7 @@ namespace Bind.Structures
} }
} }
#region public string CurrentType private string type;
string type;
/// <summary> /// <summary>
/// Gets the type of the parameter. /// Gets the type of the parameter.
/// </summary> /// </summary>
@ -102,12 +81,18 @@ namespace Bind.Structures
set set
{ {
if (String.IsNullOrEmpty(value)) if (String.IsNullOrEmpty(value))
{
throw new ArgumentException(); throw new ArgumentException();
}
if (!String.IsNullOrEmpty(type)) if (!String.IsNullOrEmpty(type))
{
PreviousType = type; PreviousType = type;
}
if (!String.IsNullOrEmpty(value)) if (!String.IsNullOrEmpty(value))
{
type = value.Trim(); type = value.Trim();
}
while (type.EndsWith("*")) while (type.EndsWith("*"))
{ {
@ -117,35 +102,11 @@ namespace Bind.Structures
} }
} }
#endregion public string PreviousType { get; private set; }
#region public string PreviousType public bool Reference { get; set; }
private string _previous_type; private int array;
public string PreviousType
{
get { return _previous_type; }
private set { _previous_type = value; }
}
#endregion
#region public bool Reference
bool reference;
public bool Reference
{
get { return reference; }
set { reference = value; }
}
#endregion
#region public int Array
int array;
public int Array public int Array
{ {
@ -153,11 +114,7 @@ namespace Bind.Structures
set { array = value > 0 ? value : 0; } set { array = value > 0 ? value : 0; }
} }
#endregion private int element_count;
#region public int ElementCount
int element_count;
// If the type is an array and ElementCount > 0, then ElemenCount defines the expected array length. // If the type is an array and ElementCount > 0, then ElemenCount defines the expected array length.
public int ElementCount public int ElementCount
@ -166,11 +123,7 @@ namespace Bind.Structures
set { element_count = value > 0 ? value : 0; } set { element_count = value > 0 ? value : 0; }
} }
#endregion private int pointer;
#region public int Pointer
int pointer;
public int Pointer public int Pointer
{ {
@ -178,12 +131,9 @@ namespace Bind.Structures
set { pointer = value > 0 ? value : 0; } set { pointer = value > 0 ? value : 0; }
} }
#endregion
// Set to true if parameter is an enum. // Set to true if parameter is an enum.
public bool IsEnum { get; set; } public bool IsEnum { get; set; }
#region public bool CLSCompliant
public bool CLSCompliant public bool CLSCompliant
{ {
@ -238,10 +188,6 @@ namespace Bind.Structures
} }
} }
#endregion
#region public bool Unsigned
public bool Unsigned public bool Unsigned
{ {
get get
@ -250,23 +196,9 @@ namespace Bind.Structures
} }
} }
#endregion public WrapperTypes WrapperType { get; set; } = WrapperTypes.None;
#region public WrapperTypes WrapperType private static readonly string[] PointerLevels =
private WrapperTypes _wrapper_type = WrapperTypes.None;
public WrapperTypes WrapperType
{
get { return _wrapper_type; }
set { _wrapper_type = value; }
}
#endregion
#region public override string ToString()
static readonly string[] PointerLevels =
{ {
"", "",
"*", "*",
@ -275,7 +207,7 @@ namespace Bind.Structures
"****" "****"
}; };
static readonly string[] ArrayLevels = private static readonly string[] ArrayLevels =
{ {
"", "",
"[]", "[]",
@ -292,12 +224,6 @@ namespace Bind.Structures
ArrayLevels[Array]); ArrayLevels[Array]);
} }
#endregion
#endregion
#region IComparable<Type> Members
public int CompareTo(Type other) public int CompareTo(Type other)
{ {
// Make sure that Pointer parameters are sorted last to avoid bug [#1098]. // Make sure that Pointer parameters are sorted last to avoid bug [#1098].
@ -306,26 +232,32 @@ namespace Bind.Structures
// DelegateCollection.Add that depends on this fact. // DelegateCollection.Add that depends on this fact.
int result = this.CurrentType.CompareTo(other.CurrentType); int result = this.CurrentType.CompareTo(other.CurrentType);
if (result == 0) if (result == 0)
{
result = Pointer.CompareTo(other.Pointer); // Must come after array/ref, see issue [#1098] result = Pointer.CompareTo(other.Pointer); // Must come after array/ref, see issue [#1098]
}
if (result == 0) if (result == 0)
{
result = Reference.CompareTo(other.Reference); result = Reference.CompareTo(other.Reference);
}
if (result == 0) if (result == 0)
{
result = Array.CompareTo(other.Array); result = Array.CompareTo(other.Array);
}
// Note: CLS-compliance and element counts // Note: CLS-compliance and element counts
// are used for comparison calculations, in order // are used for comparison calculations, in order
// to maintain a stable sorting order, even though // to maintain a stable sorting order, even though
// they are not used in equality calculations. // they are not used in equality calculations.
if (result == 0) if (result == 0)
{
result = CLSCompliant.CompareTo(other.CLSCompliant); result = CLSCompliant.CompareTo(other.CLSCompliant);
}
if (result == 0) if (result == 0)
{
result = ElementCount.CompareTo(other.ElementCount); result = ElementCount.CompareTo(other.ElementCount);
}
return result; return result;
} }
#endregion
#region IEquatable<Type> Members
public bool Equals(Type other) public bool Equals(Type other)
{ {
bool result = bool result =
@ -341,7 +273,5 @@ namespace Bind.Structures
// redefinition errors in the generated bindings. // redefinition errors in the generated bindings.
return result; return result;
} }
#endregion
} }
} }

View file

@ -1,8 +1,6 @@
#region --- License --- /* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
/* Copyright (c) 2006, 2007 Stefanos Apostolopoulos
* See license.txt for license info * See license.txt for license info
*/ */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -15,8 +13,10 @@ using Enum=Bind.Structures.Enum;
namespace Bind namespace Bind
{ {
#region WrapperTypes enum /// <summary>
/// Defines different types of parameter wrapper identifiers, which are used for hinting at how the method
/// signatures should be generated.
/// </summary>
[Flags] [Flags]
public enum WrapperTypes public enum WrapperTypes
{ {
@ -94,11 +94,13 @@ namespace Bind
/// Add an int32 overload for convenience. /// Add an int32 overload for convenience.
/// </summary> /// </summary>
SizeParameter = 1 << 14, SizeParameter = 1 << 14,
/// <summary>
/// Function takes a ref but we emit a legacy array overload to maintain backwards compatability.
/// </summary>
LegacyArrayParameter = 1 << 15,
} }
#endregion internal static class Utilities
static class Utilities
{ {
public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' }; public static readonly char[] Separators = { ' ', '\n', ',', '(', ')', ';', '#' };
public static Regex Extensions { get; private set; } public static Regex Extensions { get; private set; }
@ -109,7 +111,7 @@ namespace Bind
// Note: REMOVING THESE WILL BREAK BINARY-COMPATIBILITY WITH OPENTK 1.0, // Note: REMOVING THESE WILL BREAK BINARY-COMPATIBILITY WITH OPENTK 1.0,
// WRT THE ES 1.1 API. // WRT THE ES 1.1 API.
// You have been warned. // You have been warned.
static List<string> extension_names = new List<string> private static List<string> extension_names = new List<string>
{ {
"SGI", "SGIS", "SGIX", "IBM", "AMD", "INTEL", "SGI", "SGIS", "SGIX", "IBM", "AMD", "INTEL",
}; };
@ -149,12 +151,12 @@ namespace Bind
} }
} }
#region internal StreamReader OpenSpecFile(string file)
internal static StreamReader OpenSpecFile(string folder, string file) internal static StreamReader OpenSpecFile(string folder, string file)
{ {
if (String.IsNullOrEmpty(folder) || String.IsNullOrEmpty(file)) if (String.IsNullOrEmpty(folder) || String.IsNullOrEmpty(file))
{
return null; return null;
}
Console.WriteLine(folder); Console.WriteLine(folder);
Console.WriteLine(file); Console.WriteLine(file);
@ -163,10 +165,6 @@ namespace Bind
return new StreamReader(path); return new StreamReader(path);
} }
#endregion
#region Keywords
public static readonly List<string> CSharpKeywords = new List<string>( public static readonly List<string> CSharpKeywords = new List<string>(
new string[] new string[]
{ {
@ -193,10 +191,6 @@ namespace Bind
} }
); );
#endregion
#region Merge
// Merges the specified enum collections. // Merges the specified enum collections.
internal static void Merge(EnumCollection enums, EnumCollection new_enums) internal static void Merge(EnumCollection enums, EnumCollection new_enums)
{ {
@ -256,10 +250,6 @@ namespace Bind
return s; return s;
} }
#endregion
#region internal static string GetGL2Extension(string name)
internal static string GetGL2Extension(string name) internal static string GetGL2Extension(string name)
{ {
return GetExtension(name, false); return GetExtension(name, false);
@ -286,26 +276,16 @@ namespace Bind
} }
} }
#endregion
#region private static bool IsGL2Extension(string function)
private static bool IsGL2Extension(string function) private static bool IsGL2Extension(string function)
{ {
return !String.IsNullOrEmpty(GetGL2Extension(function)); return !String.IsNullOrEmpty(GetGL2Extension(function));
} }
#endregion
#region internal static string StripGL2Extension(string p)
internal static string StripGL2Extension(string p) internal static string StripGL2Extension(string p)
{ {
return p.Substring(0, p.Length - GetGL2Extension(p).Length); return p.Substring(0, p.Length - GetGL2Extension(p).Length);
} }
#endregion
public static bool RequiresSlot(this Delegate d, Settings settings) public static bool RequiresSlot(this Delegate d, Settings settings)
{ {
double version; double version;

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit library. // Copyright (c) 2006 - 2013 Stefanos Apostolopoulos for the Open Toolkit library.
@ -23,14 +22,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Xml.XPath; using System.Xml.XPath;
using Bind.Structures; using Bind.Structures;
@ -39,23 +34,19 @@ namespace Bind
using Delegate = Bind.Structures.Delegate; using Delegate = Bind.Structures.Delegate;
using Enum = Bind.Structures.Enum; using Enum = Bind.Structures.Enum;
class XmlSpecReader : ISpecReader internal class XmlSpecReader : ISpecReader
{ {
Settings Settings { get; set; } private Settings Settings { get; set; }
#region Constructors
public XmlSpecReader(Settings settings) public XmlSpecReader(Settings settings)
{ {
if (settings == null) if (settings == null)
{
throw new ArgumentNullException("settings"); throw new ArgumentNullException("settings");
}
Settings = settings; Settings = settings;
} }
#endregion
#region ISpecReader Members
public void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversions) public void ReadDelegates(string file, DelegateCollection delegates, string apiname, string apiversions)
{ {
var specs = new XPathDocument(file); var specs = new XPathDocument(file);
@ -79,8 +70,10 @@ namespace Bind
foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_delete)) foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_delete))
{ {
foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty)) foreach (XPathNavigator node in nav.SelectChildren("function", String.Empty))
{
delegates.Remove(node.GetAttribute("name", String.Empty)); delegates.Remove(node.GetAttribute("name", String.Empty));
} }
}
foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_add)) foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_add))
{ {
delegates.AddRange(ReadDelegates(nav, apiversion)); delegates.AddRange(ReadDelegates(nav, apiversion));
@ -113,8 +106,10 @@ namespace Bind
foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_delete)) foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_delete))
{ {
foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty)) foreach (XPathNavigator node in nav.SelectChildren("enum", String.Empty))
{
enums.Remove(node.GetAttribute("name", String.Empty)); enums.Remove(node.GetAttribute("name", String.Empty));
} }
}
foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_add)) foreach (XPathNavigator nav in specs.CreateNavigator().Select(xpath_add))
{ {
Utilities.Merge(enums, ReadEnums(nav)); Utilities.Merge(enums, ReadEnums(nav));
@ -130,14 +125,18 @@ namespace Bind
Dictionary<string, string> GLTypes = new Dictionary<string, string>(); Dictionary<string, string> GLTypes = new Dictionary<string, string>();
if (sr == null) if (sr == null)
{
return GLTypes; return GLTypes;
}
do do
{ {
string line = sr.ReadLine(); string line = sr.ReadLine();
if (String.IsNullOrEmpty(line) || line.StartsWith("#")) if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
{
continue; continue;
}
string[] words = line.Split(" ,*\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] words = line.Split(" ,*\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
@ -198,14 +197,20 @@ namespace Bind
{ {
string line = sr.ReadLine(); string line = sr.ReadLine();
if (String.IsNullOrEmpty(line) || line.StartsWith("#")) if (String.IsNullOrEmpty(line) || line.StartsWith("#"))
{
continue; continue;
}
string[] words = line.Split(" ,\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] words = line.Split(" ,\t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (words.Length < 2) if (words.Length < 2)
{
continue; continue;
}
if (((Settings.Compatibility & Settings.Legacy.NoBoolParameters) != Settings.Legacy.None) && words[1] == "bool") if (((Settings.Compatibility & Settings.Legacy.NoBoolParameters) != Settings.Legacy.None) && words[1] == "bool")
{
words[1] = "Int32"; words[1] = "Int32";
}
CSTypes.Add(words[0], words[1]); CSTypes.Add(words[0], words[1]);
} }
@ -214,11 +219,7 @@ namespace Bind
} }
} }
#endregion private static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete)
#region Private Members
static void GetSignaturePaths(string apiname, string apiversion, out string xpath_add, out string xpath_delete)
{ {
xpath_add = "/signatures/add"; xpath_add = "/signatures/add";
xpath_delete = "/signatures/delete"; xpath_delete = "/signatures/delete";
@ -241,7 +242,7 @@ namespace Bind
} }
} }
string GetSpecVersion(XPathDocument specs) private string GetSpecVersion(XPathDocument specs)
{ {
var version = var version =
specs.CreateNavigator().SelectSingleNode("/signatures") specs.CreateNavigator().SelectSingleNode("/signatures")
@ -253,7 +254,7 @@ namespace Bind
return version; return version;
} }
DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion) private DelegateCollection ReadDelegates(XPathNavigator specs, string apiversion)
{ {
DelegateCollection delegates = new DelegateCollection(); DelegateCollection delegates = new DelegateCollection();
var extensions = new List<string>(); var extensions = new List<string>();
@ -269,7 +270,9 @@ namespace Bind
// so we add them anyway (which is desirable). // so we add them anyway (which is desirable).
if (!String.IsNullOrEmpty(version) && !String.IsNullOrEmpty(apiversion) && if (!String.IsNullOrEmpty(version) && !String.IsNullOrEmpty(apiversion) &&
Decimal.Parse(version) > Decimal.Parse(apiversion)) Decimal.Parse(version) > Decimal.Parse(apiversion))
{
continue; continue;
}
// Check whether we are adding to an existing delegate or creating a new one. // Check whether we are adding to an existing delegate or creating a new one.
var d = new Delegate var d = new Delegate
@ -284,7 +287,9 @@ namespace Bind
Obsolete = node.GetAttribute("obsolete", String.Empty).Trim() Obsolete = node.GetAttribute("obsolete", String.Empty).Trim()
}; };
if (!extensions.Contains(d.Extension)) if (!extensions.Contains(d.Extension))
{
extensions.Add(d.Extension); extensions.Add(d.Extension);
}
foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element)) foreach (XPathNavigator param in node.SelectChildren(XPathNodeType.Element))
{ {
@ -299,26 +304,12 @@ namespace Bind
p.CurrentType = param.GetAttribute("type", String.Empty).Trim(); p.CurrentType = param.GetAttribute("type", String.Empty).Trim();
p.Name = param.GetAttribute("name", String.Empty).Trim(); p.Name = param.GetAttribute("name", String.Empty).Trim();
string element_count = param.GetAttribute("elementcount", String.Empty).Trim();
if (String.IsNullOrEmpty(element_count))
{
element_count = param.GetAttribute("count", String.Empty).Trim();
if (!String.IsNullOrEmpty(element_count))
{
int count;
if (Int32.TryParse(element_count, out count))
{
p.ElementCount = count;
}
}
}
p.ComputeSize = param.GetAttribute("count", String.Empty).Trim(); p.ComputeSize = param.GetAttribute("count", String.Empty).Trim();
if (p.ComputeSize.StartsWith("COMPSIZE"))
int elementCount;
if (Int32.TryParse(p.ComputeSize, out elementCount))
{ {
//remove the compsize hint, just keep comma delimited param names p.ElementCount = elementCount;
var len = "COMPSIZE(".Length;
p.ComputeSize = p.ComputeSize.Substring(len, (p.ComputeSize.Length - len) - 1);
} }
p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty).Trim()); p.Flow = Parameter.GetFlowDirection(param.GetAttribute("flow", String.Empty).Trim());
@ -335,7 +326,7 @@ namespace Bind
return delegates; return delegates;
} }
EnumCollection ReadEnums(XPathNavigator nav) private EnumCollection ReadEnums(XPathNavigator nav)
{ {
EnumCollection enums = new EnumCollection(); EnumCollection enums = new EnumCollection();
Enum all = new Enum() { Name = Settings.CompleteEnumName }; Enum all = new Enum() { Name = Settings.CompleteEnumName };
@ -356,7 +347,9 @@ namespace Bind
e.Obsolete = node.GetAttribute("obsolete", String.Empty).Trim(); e.Obsolete = node.GetAttribute("obsolete", String.Empty).Trim();
if (String.IsNullOrEmpty(e.Name)) if (String.IsNullOrEmpty(e.Name))
{
throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString())); throw new InvalidOperationException(String.Format("Empty name for enum element {0}", node.ToString()));
}
// It seems that all flag collections contain "Mask" in their names. // It seems that all flag collections contain "Mask" in their names.
// This looks like a heuristic, but it holds 100% in practice // This looks like a heuristic, but it holds 100% in practice
@ -466,7 +459,5 @@ restart:
Utilities.Merge(enums, all); Utilities.Merge(enums, all);
return enums; return enums;
} }
#endregion
} }
} }

View file

@ -0,0 +1 @@
StyleCop.Analyzers

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -34,7 +32,7 @@ using System.Xml.Linq;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
static class Extension internal static class Extension
{ {
public static string ValueOrDefault(this XAttribute a) public static string ValueOrDefault(this XAttribute a)
{ {
@ -42,13 +40,11 @@ namespace OpenTK.Convert
} }
} }
class GLXmlParser : Parser internal class GLXmlParser : XmlParser
{ {
static readonly Regex ExtensionRegex = new Regex( private static readonly Regex ExtensionRegex = new Regex(
@"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$", @"3DFX|(?!(?<=[1-4])D)[A-Z]{2,}$",
RegexOptions.Compiled); RegexOptions.Compiled);
string EnumPrefix { get { return Prefix.ToUpper() + "_"; } }
string FuncPrefix { get { return Prefix; } }
public GLXmlParser() public GLXmlParser()
{ {
@ -65,15 +61,19 @@ namespace OpenTK.Convert
var version = (e.Attribute("version") ?? new XAttribute("version", String.Empty)).Value; var version = (e.Attribute("version") ?? new XAttribute("version", String.Empty)).Value;
var key = name + version; var key = name + version;
if (!elements.ContainsKey(key)) if (!elements.ContainsKey(key))
{
elements.Add(key, e); elements.Add(key, e);
}
else else
{
elements[key].Add(e.Elements()); elements[key].Add(e.Elements());
} }
}
return elements.Values; return elements.Values;
} }
static string[] GetApiNames(XElement feature) private static string[] GetApiNames(XElement feature)
{ {
string[] apinames = null; string[] apinames = null;
switch (feature.Name.LocalName) switch (feature.Name.LocalName)
@ -111,7 +111,7 @@ namespace OpenTK.Convert
return apinames; return apinames;
} }
IEnumerable<XElement> ParseEnums(XDocument input) private IEnumerable<XElement> ParseEnums(XDocument input)
{ {
var features = input.Root.Elements("feature"); var features = input.Root.Elements("feature");
var extensions = input.Root.Elements("extensions").Elements("extension"); var extensions = input.Root.Elements("extensions").Elements("extension");
@ -128,7 +128,9 @@ namespace OpenTK.Convert
{ {
var api = (e.Attribute("api") ?? new XAttribute("api", "default")).Value; var api = (e.Attribute("api") ?? new XAttribute("api", "default")).Value;
if (!enums.ContainsKey(api)) if (!enums.ContainsKey(api))
{
enums.Add(api, new SortedDictionary<string, string>()); enums.Add(api, new SortedDictionary<string, string>());
}
enums[api].Add( enums[api].Add(
TrimName(e.Attribute("name").Value), TrimName(e.Attribute("name").Value),
@ -155,12 +157,14 @@ namespace OpenTK.Convert
{ {
var key = apiname + version; var key = apiname + version;
if (!APIs.ContainsKey(key)) if (!APIs.ContainsKey(key))
{
APIs.Add( APIs.Add(
key, key,
new XElement( new XElement(
"api", "api",
new XAttribute("name", apiname), new XAttribute("name", apiname),
String.IsNullOrEmpty(version) ? null : new XAttribute("version", version))); String.IsNullOrEmpty(version) ? null : new XAttribute("version", version)));
}
var api = APIs[key]; var api = APIs[key];
var enum_name = TrimName(feature.Attribute("name").Value); var enum_name = TrimName(feature.Attribute("name").Value);
@ -228,7 +232,7 @@ namespace OpenTK.Convert
return APIs.Values; return APIs.Values;
} }
IEnumerable<XElement> ParseFunctions(XDocument input) private IEnumerable<XElement> ParseFunctions(XDocument input)
{ {
// Go through the list of commands and build OpenTK functions out of those. // Go through the list of commands and build OpenTK functions out of those.
// Every function has a number of attributes that define which API version and // Every function has a number of attributes that define which API version and
@ -271,12 +275,14 @@ namespace OpenTK.Convert
var key = apiname + cmd_version; var key = apiname + cmd_version;
if (!APIs.ContainsKey(key)) if (!APIs.ContainsKey(key))
{
APIs.Add( APIs.Add(
key, key,
new XElement( new XElement(
"api", "api",
new XAttribute("name", apiname), new XAttribute("name", apiname),
new XAttribute("version", cmd_version))); new XAttribute("version", cmd_version)));
}
var api = APIs[key]; var api = APIs[key];
foreach (var command in feature.Elements("require").Elements("command")) foreach (var command in feature.Elements("require").Elements("command"))
@ -286,13 +292,17 @@ namespace OpenTK.Convert
ExtensionRegex.Match(cmd_name).Value ?? ExtensionRegex.Match(cmd_name).Value ??
(feature.Name == "extension" ? category.Substring(0, category.IndexOf("_")) : "Core"); (feature.Name == "extension" ? category.Substring(0, category.IndexOf("_")) : "Core");
if (String.IsNullOrEmpty(cmd_extension)) if (String.IsNullOrEmpty(cmd_extension))
{
cmd_extension = "Core"; cmd_extension = "Core";
}
XElement function = TranslateCommand(commands[cmd_name]); XElement function = TranslateCommand(commands[cmd_name]);
function.Add(new XAttribute("category", cmd_category)); function.Add(new XAttribute("category", cmd_category));
function.Add(new XAttribute("extension", cmd_extension)); function.Add(new XAttribute("extension", cmd_extension));
if (!String.IsNullOrEmpty(cmd_version)) if (!String.IsNullOrEmpty(cmd_version))
{
function.Add(new XAttribute("version", cmd_version)); function.Add(new XAttribute("version", cmd_version));
}
Merge(api, function); Merge(api, function);
} }
@ -349,8 +359,9 @@ namespace OpenTK.Convert
// Sanity check: one function cannot belong to two different extensions // Sanity check: one function cannot belong to two different extensions
if (f.Attribute("extension").Value != function.Attribute("extension").Value) if (f.Attribute("extension").Value != function.Attribute("extension").Value)
{
throw new InvalidOperationException("Different extensions for the same function"); throw new InvalidOperationException("Different extensions for the same function");
}
} }
else else
{ {
@ -408,12 +419,12 @@ namespace OpenTK.Convert
return function; return function;
} }
string FunctionName(XElement e) private string FunctionName(XElement e)
{ {
return TrimName(e.Element("proto").Element("name").Value); return TrimName(e.Element("proto").Element("name").Value);
} }
string FunctionParameterType(XElement e) private string FunctionParameterType(XElement e)
{ {
// Parse the C-like <proto> element. Possible instances: // Parse the C-like <proto> element. Possible instances:
// Return types: // Return types:
@ -438,9 +449,13 @@ namespace OpenTK.Convert
{ {
var words = ret.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); var words = ret.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
if (words[0] == "struct" || words[0] == "const") if (words[0] == "struct" || words[0] == "const")
{
words[1] = group.Value; words[1] = group.Value;
}
else else
{
words[0] = group.Value; words[0] = group.Value;
}
ret = String.Join(" ", words); ret = String.Join(" ", words);
} }
@ -448,29 +463,27 @@ namespace OpenTK.Convert
return ret; return ret;
} }
string TrimName(string name) private static string Join(string left, string right)
{
if (name.StartsWith(EnumPrefix))
return name.Remove(0, EnumPrefix.Length);
else if (name.StartsWith(FuncPrefix))
return name.Remove(0, FuncPrefix.Length);
else
return name;
}
static string Join(string left, string right)
{ {
if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right)) if (!String.IsNullOrEmpty(left) && !String.IsNullOrEmpty(right))
{
return left + "|" + right; return left + "|" + right;
}
else if (!String.IsNullOrEmpty(left)) else if (!String.IsNullOrEmpty(left))
{
return left; return left;
}
else if (!String.IsNullOrEmpty(right)) else if (!String.IsNullOrEmpty(right))
{
return right; return right;
}
else else
{
return String.Empty; return String.Empty;
} }
}
static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute) private static XAttribute Lookup(IDictionary<string, XElement> categories, string cmd_name, string attribute)
{ {
if (categories.ContainsKey(cmd_name)) if (categories.ContainsKey(cmd_name))
{ {

View file

@ -14,7 +14,7 @@
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout> <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema> <DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign> <DelaySign>false</DelaySign>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AppDesignerFolder> <AppDesignerFolder>
</AppDesignerFolder> </AppDesignerFolder>
@ -39,12 +39,16 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<Deterministic>true</Deterministic>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants> <DefineConstants>DEBUG;TRACE;</DefineConstants>
<DocumentationFile>bin\Debug\Convert.xml</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>False</Optimize> <Optimize>False</Optimize>
@ -52,7 +56,6 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Commandlineparameters>-p:gl -v:4.5 -t:xml -o:../../../Source/Bind/Specifications/GL2/signatures.xml https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml</Commandlineparameters> <Commandlineparameters>-p:gl -v:4.5 -t:xml -o:../../../Source/Bind/Specifications/GL2/signatures.xml https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml</Commandlineparameters>
</PropertyGroup> </PropertyGroup>
@ -61,13 +64,13 @@
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants> <DefineConstants>TRACE;</DefineConstants>
<DocumentationFile>bin\Release\Convert.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>none</DebugType> <DebugType>none</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -94,10 +97,8 @@
<Compile Include="Main.cs"> <Compile Include="Main.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Options.cs"> <Compile Include="Options.cs" />
<SubType>Code</SubType> <Compile Include="XmlParser.cs">
</Compile>
<Compile Include="Parser.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Properties\AssemblyInfo.cs"> <Compile Include="Properties\AssemblyInfo.cs">
@ -109,10 +110,17 @@
<None Include="paket.references" /> <None Include="paket.references" />
<None Include="XML schema notes.txt"> <None Include="XML schema notes.txt">
</None> </None>
<None Include="Readme.txt"> <Content Include="README.md" />
</None>
<Compile Include="GLXmlParser.cs" /> <Compile Include="GLXmlParser.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<AdditionalFiles Include="$(SolutionDir)\stylecop.ruleset">
<Link>stylecop.ruleset</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent> <PreBuildEvent>
@ -120,4 +128,600 @@
<PostBuildEvent> <PostBuildEvent>
</PostBuildEvent> </PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3')">
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\packages\CommandLineParser\lib\net40\CommandLine.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\packages\CommandLineParser\lib\net45\CommandLine.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1')) Or ($(TargetFrameworkIdentifier) == 'MonoTouch') Or ($(TargetFrameworkIdentifier) == 'Xamarin.tvOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.watchOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.iOS') Or ($(TargetFrameworkIdentifier) == 'Xamarin.Mac')">
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\packages\CommandLineParser\lib\netstandard1.5\CommandLine.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll">
<Paket>True</Paket>
</Analyzer>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll">
<Paket>True</Paket>
</Analyzer>
</ItemGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Collections">
<HintPath>..\..\packages\System.Collections\ref\netstandard1.0\System.Collections.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Collections">
<HintPath>..\..\packages\System.Collections\ref\netstandard1.3\System.Collections.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="mscorlib">
<Paket>True</Paket>
</Reference>
<Reference Include="System.Console">
<HintPath>..\..\packages\System.Console\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Console">
<HintPath>..\..\packages\System.Console\ref\netstandard1.3\System.Console.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Diagnostics.Debug">
<HintPath>..\..\packages\System.Diagnostics.Debug\ref\netstandard1.0\System.Diagnostics.Debug.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Diagnostics.Debug">
<HintPath>..\..\packages\System.Diagnostics.Debug\ref\netstandard1.3\System.Diagnostics.Debug.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Globalization">
<HintPath>..\..\packages\System.Globalization\ref\netstandard1.0\System.Globalization.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Globalization">
<HintPath>..\..\packages\System.Globalization\ref\netstandard1.3\System.Globalization.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.IO">
<HintPath>..\..\packages\System.IO\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.IO">
<HintPath>..\..\packages\System.IO\ref\netstandard1.0\System.IO.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4')">
<ItemGroup>
<Reference Include="System.IO">
<HintPath>..\..\packages\System.IO\ref\netstandard1.3\System.IO.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.IO">
<HintPath>..\..\packages\System.IO\ref\netstandard1.5\System.IO.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.Linq">
<HintPath>..\..\packages\System.Linq\lib\net463\System.Linq.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5')">
<ItemGroup>
<Reference Include="System.Linq">
<HintPath>..\..\packages\System.Linq\ref\netstandard1.0\System.Linq.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Linq">
<HintPath>..\..\packages\System.Linq\lib\netstandard1.6\System.Linq.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Linq">
<HintPath>..\..\packages\System.Linq\ref\netstandard1.6\System.Linq.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\packages\System.Linq.Expressions\lib\net463\System.Linq.Expressions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.0\System.Linq.Expressions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5')">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.3\System.Linq.Expressions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\packages\System.Linq.Expressions\lib\netstandard1.6\System.Linq.Expressions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Linq.Expressions">
<HintPath>..\..\packages\System.Linq.Expressions\ref\netstandard1.6\System.Linq.Expressions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.ObjectModel">
<HintPath>..\..\packages\System.ObjectModel\ref\netstandard1.0\System.ObjectModel.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.ObjectModel">
<HintPath>..\..\packages\System.ObjectModel\lib\netstandard1.3\System.ObjectModel.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.ObjectModel">
<HintPath>..\..\packages\System.ObjectModel\ref\netstandard1.3\System.ObjectModel.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.Reflection">
<HintPath>..\..\packages\System.Reflection\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Reflection">
<HintPath>..\..\packages\System.Reflection\ref\netstandard1.0\System.Reflection.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4')">
<ItemGroup>
<Reference Include="System.Reflection">
<HintPath>..\..\packages\System.Reflection\ref\netstandard1.3\System.Reflection.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection">
<HintPath>..\..\packages\System.Reflection\ref\netstandard1.5\System.Reflection.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit">
<HintPath>..\..\packages\System.Reflection.Emit\ref\netstandard1.1\System.Reflection.Emit.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit">
<HintPath>..\..\packages\System.Reflection.Emit\lib\netstandard1.3\System.Reflection.Emit.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit.ILGeneration">
<HintPath>..\..\packages\System.Reflection.Emit.ILGeneration\ref\netstandard1.0\System.Reflection.Emit.ILGeneration.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit.ILGeneration">
<HintPath>..\..\packages\System.Reflection.Emit.ILGeneration\lib\netstandard1.3\System.Reflection.Emit.ILGeneration.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit.Lightweight">
<HintPath>..\..\packages\System.Reflection.Emit.Lightweight\ref\netstandard1.0\System.Reflection.Emit.Lightweight.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Reflection.Emit.Lightweight">
<HintPath>..\..\packages\System.Reflection.Emit.Lightweight\lib\netstandard1.3\System.Reflection.Emit.Lightweight.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.Extensions">
<HintPath>..\..\packages\System.Reflection.Extensions\ref\netstandard1.0\System.Reflection.Extensions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.Primitives">
<HintPath>..\..\packages\System.Reflection.Primitives\ref\netstandard1.0\System.Reflection.Primitives.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.Reflection.TypeExtensions">
<HintPath>..\..\packages\System.Reflection.TypeExtensions\lib\net462\System.Reflection.TypeExtensions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Reflection.TypeExtensions">
<HintPath>..\..\packages\System.Reflection.TypeExtensions\lib\netstandard1.5\System.Reflection.TypeExtensions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Reflection.TypeExtensions">
<HintPath>..\..\packages\System.Reflection.TypeExtensions\ref\netstandard1.5\System.Reflection.TypeExtensions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2' Or $(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Resources.ResourceManager">
<HintPath>..\..\packages\System.Resources.ResourceManager\ref\netstandard1.0\System.Resources.ResourceManager.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1')">
<ItemGroup>
<Reference Include="System.ComponentModel.Composition">
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.ComponentModel.Composition">
<Paket>True</Paket>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.1'">
<ItemGroup>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\ref\netstandard1.0\System.Runtime.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And $(TargetFrameworkVersion) == 'v1.2'">
<ItemGroup>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\ref\netstandard1.2\System.Runtime.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4')">
<ItemGroup>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\ref\netstandard1.3\System.Runtime.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Runtime">
<HintPath>..\..\packages\System.Runtime\ref\netstandard1.5\System.Runtime.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7')">
<ItemGroup>
<Reference Include="System.Runtime.Extensions">
<HintPath>..\..\packages\System.Runtime.Extensions\lib\net462\System.Runtime.Extensions.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Runtime.Extensions">
<HintPath>..\..\packages\System.Runtime.Extensions\ref\netstandard1.0\System.Runtime.Extensions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4')">
<ItemGroup>
<Reference Include="System.Runtime.Extensions">
<HintPath>..\..\packages\System.Runtime.Extensions\ref\netstandard1.3\System.Runtime.Extensions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Runtime.Extensions">
<HintPath>..\..\packages\System.Runtime.Extensions\ref\netstandard1.5\System.Runtime.Extensions.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Text.Encoding">
<HintPath>..\..\packages\System.Text.Encoding\ref\netstandard1.0\System.Text.Encoding.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Text.Encoding">
<HintPath>..\..\packages\System.Text.Encoding\ref\netstandard1.3\System.Text.Encoding.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Threading">
<HintPath>..\..\packages\System.Threading\ref\netstandard1.0\System.Threading.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == 'MonoAndroid' And ($(TargetFrameworkVersion) == 'v7.0' Or $(TargetFrameworkVersion) == 'v7.1'))">
<ItemGroup>
<Reference Include="System.Threading">
<HintPath>..\..\packages\System.Threading\lib\netstandard1.3\System.Threading.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Threading">
<HintPath>..\..\packages\System.Threading\ref\netstandard1.3\System.Threading.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v1.2')">
<ItemGroup>
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\packages\System.Threading.Tasks\ref\netstandard1.0\System.Threading.Tasks.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
<When Condition="($(TargetFrameworkIdentifier) == '.NETStandard' And ($(TargetFrameworkVersion) == 'v1.3' Or $(TargetFrameworkVersion) == 'v1.4' Or $(TargetFrameworkVersion) == 'v1.5' Or $(TargetFrameworkVersion) == 'v1.6' Or $(TargetFrameworkVersion) == 'v2.0')) Or ($(TargetFrameworkIdentifier) == '.NETCoreApp' And ($(TargetFrameworkVersion) == 'v1.0' Or $(TargetFrameworkVersion) == 'v1.1' Or $(TargetFrameworkVersion) == 'v2.0'))">
<ItemGroup>
<Reference Include="System.Threading.Tasks">
<HintPath>..\..\packages\System.Threading.Tasks\ref\netstandard1.3\System.Threading.Tasks.dll</HintPath>
<Private>False</Private>
<Paket>True</Paket>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project> </Project>

View file

@ -28,11 +28,11 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using Mono.Options; using CommandLine;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
class EnumTokenComparer : IEqualityComparer<XNode> internal class EnumTokenComparer : IEqualityComparer<XNode>
{ {
public bool Equals(XNode a, XNode b) public bool Equals(XNode a, XNode b)
{ {
@ -60,50 +60,21 @@ namespace OpenTK.Convert
} }
} }
class EntryPoint internal class EntryPoint
{ {
static void Main(string[] args) private static Options CLIOptions;
private static void Main(string[] args)
{ {
Parser.Default.ParseArguments<Options>(args)
.WithParsed(result => CLIOptions = result)
.WithNotParsed(error => Environment.Exit(-1));
try try
{ {
bool showHelp = false; XmlParser xmlParser = new GLXmlParser { Prefix = CLIOptions.Prefix };
string prefix = "gl";
string version = null;
string path = null;
OptionSet opts = new OptionSet
{
{ "p=", "The {PREFIX} to remove from parsed functions and constants. " +
"Defaults to \"" + prefix + "\".",
v => prefix = v },
{ "v:", "The {VERSION} of the specification being parsed.",
v => version = v },
{ "o:", "The {PATH} to the output file.",
v => path = v },
{ "?|h|help", "Show this message and exit.",
v => showHelp = v != null },
};
var headers = opts.Parse(args);
var app = Path.GetFileName(Environment.GetCommandLineArgs()[0]);
if (showHelp)
{
Console.WriteLine("usage: {0} -p:PREFIX -v:VERSION SPECIFICATIONS", app);
Console.WriteLine();
Console.WriteLine("Options:");
opts.WriteOptionDescriptions(Console.Out);
Console.WriteLine();
Console.WriteLine("SPECIFICATIONS are the Khronos XML files to parse into OpenTK XML.");
return;
}
if (prefix == null)
{
Console.WriteLine("{0}: missing required parameter -p.", app);
Console.WriteLine("Use '{0} --help' for usage.", app);
return;
}
Parser parser = new GLXmlParser { Prefix = prefix, Version = version }; var sigs = CLIOptions.InputFiles.Select(h => xmlParser.Parse(h)).ToList();
var sigs = headers.Select(h => parser.Parse(h)).ToList();
// Merge any duplicate enum entries (in case an enum is declared // Merge any duplicate enum entries (in case an enum is declared
// in multiple files with different entries in each file). // in multiple files with different entries in each file).
@ -115,14 +86,14 @@ namespace OpenTK.Convert
settings.Encoding = System.Text.Encoding.UTF8; settings.Encoding = System.Text.Encoding.UTF8;
TextWriter out_stream = null; TextWriter out_stream = null;
if (path == null) if (CLIOptions.OutputFile == null)
{ {
out_stream = Console.Out; out_stream = Console.Out;
Console.OutputEncoding = System.Text.Encoding.UTF8; Console.OutputEncoding = System.Text.Encoding.UTF8;
} }
else else
{ {
out_stream = new StreamWriter(path, false); out_stream = new StreamWriter(CLIOptions.OutputFile, false);
} }
using (var writer = XmlWriter.Create(out_stream, settings)) using (var writer = XmlWriter.Create(out_stream, settings))
@ -165,7 +136,9 @@ namespace OpenTK.Convert
foreach (var e in entries) foreach (var e in entries)
{ {
if (e.Value.Name.LocalName != "enum") if (e.Value.Name.LocalName != "enum")
{
continue; continue;
}
var tokens = e.Value.Elements() var tokens = e.Value.Elements()
.OrderBy(t => (string)t.Attribute("name")) .OrderBy(t => (string)t.Attribute("name"))
.ToList(); .ToList();

File diff suppressed because it is too large Load diff

View file

@ -5,13 +5,18 @@ using System.Reflection;
[assembly: AssemblyTitleAttribute("Generator.Convert")] [assembly: AssemblyTitleAttribute("Generator.Convert")]
[assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")]
[assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")]
[assembly: AssemblyVersionAttribute("2.0.0")] [assembly: AssemblyVersionAttribute("3.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0")] [assembly: AssemblyFileVersionAttribute("3.0.0")]
[assembly: CLSCompliantAttribute(true)] [assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")]
namespace System { namespace System {
internal static class AssemblyVersionInformation { internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0"; internal const System.String AssemblyTitle = "Generator.Convert";
internal const string InformationalVersion = "2.0.0"; internal const System.String AssemblyProduct = "OpenTK";
internal const System.String AssemblyDescription = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.";
internal const System.String AssemblyVersion = "3.0.0";
internal const System.String AssemblyFileVersion = "3.0.0";
internal const System.Boolean CLSCompliant = true;
internal const System.String AssemblyCopyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.";
} }
} }

View file

@ -0,0 +1,24 @@
### Introduction
This is a simple tool to convert Khronos XML to OpenTK XML files.
### Usage
```
Converting local files:
Convert.exe --input-files gl.xml --output-file signatures.xml --prefix gl
Converting latest remote specification:
Convert.exe --input-files https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml --output-file signatures.xml --prefix gl
-p, --prefix Required. (Default: gl) The prefix to remove from parsed functions and constants.
-o, --output-file The path to the output file. Defaults to stdout if no path is provided.
-i, --input-files Required. A list of the Khronos XML files to parse into OpenTK XML. Remote resources in the form of URLs are supported.
--help Display this help screen.
--version Display version information.
```
### Support
If you encounter a bug, please file an issue report at the OpenTK [issue tracker](http://github.com/opentk/opentk/issues).

View file

@ -1,24 +0,0 @@
[Introduction]
This is a simple tool to convert Khronos XML to OpenTK XML files.
[Examples]
To download and convert the XML API registry from Khronos:
Convert.exe -p:gl -o:../../../Source/Bind/Specifications/GL2/signatures.xml https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml
The line above will download the latest .xml files from the public Khronos repository and update signatures.xml for the binding generator.
[Usage]
Convert.exe -p:{PREFIX} -v:{VERSION} -t:{TYPE} -o:{OUT} {INPUT1} ... {INPUTn}
{PREFIX} is a simple string that defines the a common prefix for functions and constants in this header. This prefix will be removed from the generated XML file.
{VERSION} is a string that defines that version that will be used for functions in the generated XML file. Specific input files may override this setting.
{OUT} is the output filename (optional). If no output file is specified, output will be directed to the console.
{INPUT1..n} is a space-separated list of input files.
Despite what the help says, prefix and version parameters are necessary at the moment.
[Support]
If you encounter a bug, please file an issue report at http://github.com/opentk/opentk/issues

View file

@ -29,13 +29,12 @@ using System.Xml.Linq;
namespace OpenTK.Convert namespace OpenTK.Convert
{ {
// The base class for a parser. // The base class for a parser.
abstract class Parser internal abstract class XmlParser
{ {
// Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc. // Defines a prefix that should be removed from methods and tokens in the XML files, e.g. "gl", "cl", etc.
public string Prefix { get; set; } public string Prefix { get; set; }
public string EnumPrefix { get { return Prefix.ToUpper() + "_"; } }
// Defines the version of the spec files (optional). public string FuncPrefix { get { return Prefix; } }
public string Version { get; set; }
// Implements the parsing logic for a specific input file. // Implements the parsing logic for a specific input file.
public abstract IEnumerable<XElement> Parse(string[] lines); public abstract IEnumerable<XElement> Parse(string[] lines);
@ -82,5 +81,21 @@ namespace OpenTK.Convert
return Parse(contents); return Parse(contents);
} }
public string TrimName(string name)
{
if (name.StartsWith(EnumPrefix))
{
return name.Remove(0, EnumPrefix.Length);
}
else if (name.StartsWith(FuncPrefix))
{
return name.Remove(0, FuncPrefix.Length);
}
else
{
return name;
}
}
} }
} }

View file

@ -0,0 +1,2 @@
CommandLineParser
StyleCop.Analyzers

View file

@ -0,0 +1,10 @@

namespace OpenTK.Rewrite
{
internal class CountAttribute
{
public int Count;
public string Parameter;
public string Computed;
}
}

View file

@ -0,0 +1,56 @@
using System;
using Mono.Cecil.Cil;
namespace OpenTK.Rewrite
{
/// <summary>
/// Acts as a unique identifier for a generated named variable that can be passed between methods. Replaces uses of
/// variable names from Mono.Cecil.
/// </summary>
internal sealed class GeneratedVariableIdentifier
{
/// <summary>
/// The <see cref="MethodBody"/> which the variable is in.
/// </summary>
public MethodBody Body { get; }
/// <summary>
/// The <see cref="VariableDefinition"/> which the variable idetifier maps to.
/// </summary>
public VariableDefinition Definition { get; }
/// <summary>
/// The name of the generated variable.
/// </summary>
public string Name { get; }
/// <summary>
/// Initializes a new instance of the <see cref="GeneratedVariableIdentifier"/> class.
/// </summary>
/// <param name="body">The method body which the variable is in.</param>
/// <param name="definition">The definition of the generated variable.</param>
/// <param name="name">The name of the generated variable.</param>
/// <exception cref="ArgumentException"></exception>
public GeneratedVariableIdentifier(MethodBody body, VariableDefinition definition, string name)
{
if (body == null)
{
throw new ArgumentException("The body argument cannot be null.", nameof(body));
}
if (definition == null)
{
throw new ArgumentException("The definition argument cannot be null.", nameof(definition));
}
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException("The name argument cannot be null or empty", nameof(name));
}
this.Body = body;
this.Definition = definition;
this.Name = name;
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,39 @@
using CommandLine;
using CommandLine.Text;
namespace OpenTK.Rewrite
{
/// <summary>
/// A container class used by <see cref="CommandLine.Parser"/> to parse command line arguments.
/// </summary>
public class Options
{
/// <summary>
/// Gets or sets the path to the target assembly that should be rewritten.
/// </summary>
[Option('a', "assembly", Required = true,
HelpText = "The path to the target assembly that should be rewritten.")]
public string TargetAssembly { get; set; }
/// <summary>
/// Get or sets the path to the strong name key which should be used to sign or resign the assembly.
/// </summary>
[Option('k', "signing-key",
HelpText = "The path to the strong name key which should be used to sign or resign the assembly.")]
public string StrongNameKey { get; set; }
/// <summary>
/// Gets or sets a value indicating whether calls to GL.GetError() are wrapped around each native call.
/// </summary>
[Option('d', "debug", Default = false,
HelpText = "Enable calls to GL.GetError(), wrapped around each native call.")]
public bool EnableDebugCalls { get; set; }
/// <summary>
/// Gets or sets a value indicating whether native calls are forced to use DllImport instead of GetProcAddress.
/// </summary>
[Option("dllimport", Default = false,
HelpText = "Force native calls to use DllImport instead of GetProcAddress.")]
public bool UseDLLImport { get; set; }
}
}

View file

@ -18,8 +18,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using CommandLine;
using Mono.Cecil; using Mono.Cecil;
using Mono.Cecil.Cil; using Mono.Cecil.Cil;
using Mono.Cecil.Rocks; using Mono.Cecil.Rocks;
@ -28,77 +27,75 @@ namespace OpenTK.Rewrite
{ {
// Replaces OpenTK.InteropHelper method instances // Replaces OpenTK.InteropHelper method instances
// with the s IL instructions. // with the s IL instructions.
class Program internal class Program
{ {
static void Main(string[] args) private static Options Options;
private static void Main(string[] args)
{ {
if (args.Length == 0) Parser.Default.ParseArguments<Options>(args)
.WithParsed(result => Options = result)
.WithNotParsed(error => Environment.Exit(-1));
// Argument error checking
if (!File.Exists(Options.TargetAssembly))
{ {
Console.WriteLine("Usage: rewrite [file.dll] [file.snk] [options]"); Console.Error.WriteLine($"Target assembly not found. \n" +
Console.WriteLine("[options] is:"); $"Please check the given path ({Options.TargetAssembly}).");
Console.WriteLine(" -debug (enable calls to GL.GetError())"); }
Console.WriteLine(" -dllimport (force calls to use DllImport instead of GetProcAddress)");
return; if (!File.Exists(Path.ChangeExtension(Options.TargetAssembly, "pdb")))
{
Console.Error.WriteLine("Debugging symbols for target assembly not found. \n" +
"Please make sure that debugging symbols are being generated.");
} }
var program = new Program(); var program = new Program();
var file = args[0]; program.Rewrite();
var key = args[1];
var options = args.Where(a => a.StartsWith("-") || a.StartsWith("/"));
program.Rewrite(file, key, options);
} }
// mscorlib types // mscorlib types
static AssemblyDefinition mscorlib; private static AssemblyDefinition mscorlib;
static TypeDefinition TypeMarshal;
static TypeDefinition TypeStringBuilder; private static TypeDefinition TypeMarshal;
static TypeDefinition TypeVoid; private static TypeDefinition TypeVoid;
static TypeDefinition TypeIntPtr; private static TypeDefinition TypeIntPtr;
static TypeDefinition TypeInt32; private static TypeDefinition TypeInt32;
// OpenTK.BindingsBase // OpenTK.BindingsBase
static TypeDefinition TypeBindingsBase; private static TypeDefinition TypeBindingsBase;
static bool dllimport; private void Rewrite()
void Rewrite(string file, string keyfile, IEnumerable<string> options)
{ {
dllimport = options.Contains("-dllimport");
// Specify assembly read and write parameters // Specify assembly read and write parameters
// We want to keep a valid symbols file (pdb or mdb) // We want to keep a valid symbols file (pdb or mdb)
var read_params = new ReaderParameters(); var read_params = new ReaderParameters();
var write_params = new WriterParameters(); var write_params = new WriterParameters();
var pdb = Path.ChangeExtension(file, "pdb");
var mdb = file + ".mdb";
ISymbolReaderProvider provider = null;
if (File.Exists(pdb))
{
provider = new Mono.Cecil.Pdb.PdbReaderProvider();
}
else if (File.Exists(mdb))
{
provider = new Mono.Cecil.Mdb.MdbReaderProvider();
}
read_params.SymbolReaderProvider = provider;
read_params.ReadSymbols = true; read_params.ReadSymbols = true;
read_params.ReadWrite = true;
write_params.WriteSymbols = true; write_params.WriteSymbols = true;
if (!String.IsNullOrEmpty(keyfile) && File.Exists(keyfile)) if (!String.IsNullOrEmpty(Options.StrongNameKey) && File.Exists(Options.StrongNameKey))
{
string absoluteKeyFilePath = Path.GetFullPath(Options.StrongNameKey);
using (var fs = new FileStream(absoluteKeyFilePath, FileMode.Open, FileAccess.Read))
{ {
keyfile = Path.GetFullPath(keyfile);
var fs = new FileStream(keyfile, FileMode.Open, FileAccess.Read);
var keypair = new System.Reflection.StrongNameKeyPair(fs); var keypair = new System.Reflection.StrongNameKeyPair(fs);
fs.Close();
write_params.StrongNameKeyPair = keypair; write_params.StrongNameKeyPair = keypair;
} }
}
else else
{ {
Console.Error.WriteLine("No keyfile specified or keyfile missing."); Console.Error.WriteLine("No keyfile specified or keyfile missing.");
} }
// Load assembly and process all modules // Load assembly and process all modules
var assembly = AssemblyDefinition.ReadAssembly(file, read_params); try
{
using (AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(Options.TargetAssembly, read_params))
{
var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute"); var rewritten = assembly.CustomAttributes.FirstOrDefault(a => a.AttributeType.Name == "RewrittenAttribute");
if (rewritten == null) if (rewritten == null)
{ {
@ -127,7 +124,6 @@ namespace OpenTK.Rewrite
return; return;
} }
TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal"); TypeMarshal = mscorlib.MainModule.GetType("System.Runtime.InteropServices.Marshal");
TypeStringBuilder = mscorlib.MainModule.GetType("System.Text.StringBuilder");
TypeVoid = mscorlib.MainModule.GetType("System.Void"); TypeVoid = mscorlib.MainModule.GetType("System.Void");
TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr"); TypeIntPtr = mscorlib.MainModule.GetType("System.IntPtr");
TypeInt32 = mscorlib.MainModule.GetType("System.Int32"); TypeInt32 = mscorlib.MainModule.GetType("System.Int32");
@ -138,7 +134,7 @@ namespace OpenTK.Rewrite
{ {
foreach (var type in module.Types) foreach (var type in module.Types)
{ {
Rewrite(type, options); Rewrite(type);
} }
} }
} }
@ -148,10 +144,17 @@ namespace OpenTK.Rewrite
} }
// Save rewritten assembly // Save rewritten assembly
assembly.Write(file, write_params); assembly.Write(write_params);
}
}
catch (InvalidOperationException inex)
{
Console.WriteLine("Failed to load the assembly. It may already have been rewritten, and the debug symbols no longer match.");
Console.WriteLine(inex);
}
} }
void Rewrite(TypeDefinition type, IEnumerable<string> options) private void Rewrite(TypeDefinition type)
{ {
var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints"); var entry_points = type.Fields.FirstOrDefault(f => f.Name == "EntryPoints");
if (entry_points != null) if (entry_points != null)
@ -161,7 +164,7 @@ namespace OpenTK.Rewrite
entry_signatures.AddRange(type.Methods entry_signatures.AddRange(type.Methods
.Where(t => t.CustomAttributes.Any(a => a.AttributeType.Name == "SlotAttribute"))); .Where(t => t.CustomAttributes.Any(a => a.AttributeType.Name == "SlotAttribute")));
Rewrite(type, entry_points, entry_signatures, options); Rewrite(type, entry_points, entry_signatures);
RemoveNativeSignatures(type, entry_signatures); RemoveNativeSignatures(type, entry_signatures);
} }
@ -171,16 +174,18 @@ namespace OpenTK.Rewrite
var rewritten_constructor = type.GetConstructors().First(); var rewritten_constructor = type.GetConstructors().First();
var rewritten = new CustomAttribute(rewritten_constructor); var rewritten = new CustomAttribute(rewritten_constructor);
rewritten.ConstructorArguments.Add(new CustomAttributeArgument( rewritten.ConstructorArguments.Add(new CustomAttributeArgument(
type.Module.Import(mscorlib.MainModule.GetType("System.Boolean")), true)); type.Module.ImportReference(mscorlib.MainModule.GetType("System.Boolean")), true));
type.Module.Assembly.CustomAttributes.Add(rewritten); type.Module.Assembly.CustomAttributes.Add(rewritten);
} }
} }
int GetSlot(MethodDefinition signature) private static int GetSlot(MethodDefinition signature)
{ {
// Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS) // Pretend there is no slots if we want to force everything to work through DllImport (Android & iOS)
if (dllimport) if (Options.UseDLLImport)
{
return -1; return -1;
}
var slot_attribute = signature.CustomAttributes var slot_attribute = signature.CustomAttributes
.FirstOrDefault(a => a.AttributeType.Name == "SlotAttribute"); .FirstOrDefault(a => a.AttributeType.Name == "SlotAttribute");
@ -192,8 +197,8 @@ namespace OpenTK.Rewrite
return slot; return slot;
} }
void Rewrite(TypeDefinition type, FieldDefinition entry_points, private void Rewrite(TypeDefinition type, FieldDefinition entry_points,
List<MethodDefinition> entry_signatures, IEnumerable<string> options) List<MethodDefinition> entry_signatures)
{ {
// Rewrite all wrapper methods // Rewrite all wrapper methods
var wrapper_signatures = new List<MethodDefinition>(); var wrapper_signatures = new List<MethodDefinition>();
@ -203,15 +208,15 @@ namespace OpenTK.Rewrite
foreach (var wrapper in wrapper_signatures) foreach (var wrapper in wrapper_signatures)
{ {
var autogenerated = wrapper.CustomAttributes var autogenerated = wrapper.CustomAttributes
.Where(a => a.AttributeType.Name == "AutoGeneratedAttribute"); .Where(a => a.AttributeType.Name == "AutoGeneratedAttribute").ToList();
if (autogenerated.Count() > 0) if (autogenerated.Any())
{ {
var signature_name = (string)autogenerated.First() var signature_name = (string)autogenerated.First()
.Fields.First(f => f.Name == "EntryPoint").Argument.Value; .Fields.First(f => f.Name == "EntryPoint").Argument.Value;
var signature = entry_signatures.FirstOrDefault(s => s.Name == signature_name); var signature = entry_signatures.FirstOrDefault(s => s.Name == signature_name);
int slot = GetSlot(signature); int slot = GetSlot(signature);
ProcessMethod(wrapper, signature, slot, entry_points, options); ProcessMethod(wrapper, signature, slot, entry_points);
} }
} }
@ -221,12 +226,12 @@ namespace OpenTK.Rewrite
{ {
foreach (var nested_type in type.NestedTypes) foreach (var nested_type in type.NestedTypes)
{ {
Rewrite(nested_type, entry_points, entry_signatures, options); Rewrite(nested_type, entry_points, entry_signatures);
} }
} }
} }
void RemoveNativeSignatures(TypeDefinition type, List<MethodDefinition> methods) private static void RemoveNativeSignatures(TypeDefinition type, IEnumerable<MethodDefinition> methods)
{ {
// Remove all DllImports for functions called through calli, since // Remove all DllImports for functions called through calli, since
// their signatures are embedded directly into the calli callsite. // their signatures are embedded directly into the calli callsite.
@ -237,7 +242,7 @@ namespace OpenTK.Rewrite
} }
} }
void RemoveSupportingAttributes(TypeDefinition type) private static void RemoveSupportingAttributes(TypeDefinition type)
{ {
foreach (var method in type.Methods) foreach (var method in type.Methods)
{ {
@ -250,12 +255,25 @@ namespace OpenTK.Rewrite
i--; i--;
} }
} }
foreach (var parameter in method.Parameters)
{
var pattr = parameter.CustomAttributes;
for (int i = 0; i < pattr.Count; i++)
{
if (pattr[i].AttributeType.Name == "CountAttribute")
{
pattr.RemoveAt(i);
i--;
}
}
}
} }
} }
// Create body for method // Create body for method
static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot, private static void ProcessMethod(MethodDefinition wrapper, MethodDefinition native, int slot,
FieldDefinition entry_points, IEnumerable<string> options) FieldDefinition entry_points)
{ {
var body = wrapper.Body; var body = wrapper.Body;
var il = body.GetILProcessor(); var il = body.GetILProcessor();
@ -266,23 +284,29 @@ namespace OpenTK.Rewrite
// and push each parameter on the stack // and push each parameter on the stack
DebugVariables vars = null; DebugVariables vars = null;
if (options.Contains("-debug")) if (Options.EnableDebugCalls)
{ {
vars = EmitDebugPrologue(wrapper, il); vars = EmitDebugPrologue(wrapper, il);
} }
// Patch convenience wrappers // Patch convenience wrappers
List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>();
if (wrapper.Parameters.Count == native.Parameters.Count) if (wrapper.Parameters.Count == native.Parameters.Count)
{ {
EmitParameters(wrapper, native, body, il); generatedVariables = EmitParameters(wrapper, native, body, il);
} }
else else
{ {
int difference = native.Parameters.Count - wrapper.Parameters.Count; int difference = native.Parameters.Count - wrapper.Parameters.Count;
EmitConvenienceWrapper(wrapper, native, difference, body, il); generatedVariables = EmitConvenienceWrapper(wrapper, native, difference, body, il);
} }
if (slot != -1) if (slot == -1 || Options.UseDLLImport)
{
// issue DllImport call
EmitCall(il, native);
}
else
{ {
// push the entry point address on the stack // push the entry point address on the stack
EmitEntryPoint(entry_points, il, slot); EmitEntryPoint(entry_points, il, slot);
@ -290,20 +314,15 @@ namespace OpenTK.Rewrite
// issue calli // issue calli
EmitCalli(il, native); EmitCalli(il, native);
} }
else
{
// issue DllImport call
EmitCall(il, native);
}
if (wrapper.ReturnType.Name != "Void") if (wrapper.ReturnType.Name != "Void")
{ {
EmitReturnTypeWrapper(wrapper, native, body, il); EmitReturnTypeWrapper(wrapper, native, body, il);
} }
EmitParameterEpilogues(wrapper, native, body, il); EmitParameterEpilogues(wrapper, native, body, il, generatedVariables);
if (options.Contains("-debug")) if (Options.EnableDebugCalls)
{ {
EmitDebugEpilogue(wrapper, il, vars); EmitDebugEpilogue(wrapper, il, vars);
} }
@ -320,7 +339,7 @@ namespace OpenTK.Rewrite
body.OptimizeMacros(); body.OptimizeMacros();
} }
class DebugVariables private class DebugVariables
{ {
public TypeDefinition ErrorHelperType; public TypeDefinition ErrorHelperType;
public VariableDefinition ErrorHelperLocal; public VariableDefinition ErrorHelperLocal;
@ -329,7 +348,7 @@ namespace OpenTK.Rewrite
public Instruction BeginTry; public Instruction BeginTry;
} }
static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il) private static DebugVariables EmitDebugPrologue(MethodDefinition wrapper, ILProcessor il)
{ {
DebugVariables vars = null; DebugVariables vars = null;
@ -339,7 +358,7 @@ namespace OpenTK.Rewrite
// something like "type namespace.class::method(type arg)" // something like "type namespace.class::method(type arg)"
var module = il.Body.Method.FullName; var module = il.Body.Method.FullName;
module = module.Substring(module.IndexOf(' ') + 1); module = module.Substring(module.IndexOf(' ') + 1);
module = module.Substring(0, module.IndexOf("::")); module = module.Substring(0, module.IndexOf("::", StringComparison.Ordinal));
module = module.Substring(0, module.LastIndexOf('.')); module = module.Substring(0, module.LastIndexOf('.'));
// Only works for Graphics modules due to hardcoded use of // Only works for Graphics modules due to hardcoded use of
@ -413,7 +432,7 @@ namespace OpenTK.Rewrite
return vars; return vars;
} }
static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars) private static void EmitDebugEpilogue(MethodDefinition wrapper, ILProcessor il, DebugVariables vars)
{ {
if (vars != null) if (vars != null)
{ {
@ -479,7 +498,7 @@ namespace OpenTK.Rewrite
// String return-type wrapper // String return-type wrapper
// return new string((sbyte*)((void*)GetString())); // return new string((sbyte*)((void*)GetString()));
var intptr_to_voidpointer = wrapper.Module.Import(mscorlib.MainModule.GetType("System.IntPtr").GetMethods() var intptr_to_voidpointer = wrapper.Module.ImportReference(mscorlib.MainModule.GetType("System.IntPtr").GetMethods()
.First(m => .First(m =>
{ {
return return
@ -487,7 +506,7 @@ namespace OpenTK.Rewrite
m.ReturnType.Name == "Void*"; m.ReturnType.Name == "Void*";
})); }));
var string_constructor = wrapper.Module.Import(mscorlib.MainModule.GetType("System.String").GetConstructors() var string_constructor = wrapper.Module.ImportReference(mscorlib.MainModule.GetType("System.String").GetConstructors()
.First(m => .First(m =>
{ {
var p = m.Parameters; var p = m.Parameters;
@ -521,169 +540,233 @@ namespace OpenTK.Rewrite
} }
} }
static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il) private static void EmitParameterEpilogues(MethodDefinition wrapper, MethodDefinition native, MethodBody body, ILProcessor il,
List<GeneratedVariableIdentifier> generatedVariables)
{ {
foreach (var p in wrapper.Parameters) foreach (var p in wrapper.Parameters)
{ {
if (p.ParameterType.Name == "StringBuilder") if (!p.ParameterType.IsArray && p.ParameterType.Name == "String&")
{ {
EmitStringBuilderEpilogue(wrapper, native, p, body, il); EmitStringOutEpilogue(wrapper, native, p, body, il, GetGeneratedVariable(generatedVariables, p.Name + "_string_ptr", body));
} }
if (!p.ParameterType.IsArray && p.ParameterType.Name == "String") if (!p.ParameterType.IsArray && p.ParameterType.Name == "String")
{ {
EmitStringEpilogue(wrapper, p, body, il); EmitStringEpilogue(wrapper, p, body, il, GetGeneratedVariable(generatedVariables, p.Name + "_string_ptr", body));
} }
if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String") if (p.ParameterType.IsArray && p.ParameterType.GetElementType().Name == "String")
{ {
EmitStringArrayEpilogue(wrapper, p, body, il); EmitStringArrayEpilogue(wrapper, p, body, il, GetGeneratedVariable(generatedVariables, p.Name + "_string_array_ptr", body));
} }
} }
} }
static void EmitStringBuilderParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il) /// <summary>
/// Retrieves a generated variable by searching the given list by the variable's name and associated method body.
/// </summary>
/// <param name="variableIdentifiers"></param>
/// <param name="name"></param>
/// <param name="body"></param>
/// <returns></returns>
private static GeneratedVariableIdentifier GetGeneratedVariable(IEnumerable<GeneratedVariableIdentifier> variableIdentifiers, string name, MethodBody body)
{ {
var p = parameter.ParameterType; return variableIdentifiers.FirstOrDefault(v => v.Name == name && v.Body == body &&
body.Variables.Contains(v.Definition));
}
// void GetShaderInfoLog(..., StringBuilder foo) private static GeneratedVariableIdentifier EmitStringOutParameter(MethodDefinition method, ParameterDefinition parameter, MethodBody body, ILProcessor il)
// IntPtr foo_sb_ptr; {
// void GetShaderInfoLog(..., out String foo)
// IntPtr foo_string_ptr;
// try { // try {
// foo_sb_ptr = Marshal.AllocHGlobal(sb.Capacity + 1); // foo_string_ptr = Marshal.AllocHGlobal(count + 1);
// glGetShaderInfoLog(..., foo_sb_ptr); // glGetShaderInfoLog(..., foo_string_ptr);
// MarshalPtrToStringBuilder(foo_sb_ptr, sb); // foo = MarshalPtrToString(foo_string_ptr);
// } // }
// finally { // finally {
// Marshal.FreeHGlobal(sb_ptr); // Marshal.FreeHGlobal(foo_string_ptr);
// } // }
// Make sure we have imported StringBuilder::Capacity and Marshal::AllocHGlobal
var sb_get_capacity = method.Module.Import(TypeStringBuilder.Methods.First(m => m.Name == "get_Capacity")); // Pop off the string parameter that would of just been loaded
var alloc_hglobal = method.Module.Import(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal")); il.Emit(OpCodes.Pop);
// Make sure we have imported Marshal::AllocHGlobal
var alloc_hglobal = method.Module.ImportReference(TypeMarshal.Methods.First(m => m.Name == "AllocHGlobal"));
// IntPtr ptr; // IntPtr ptr;
var variable_name = parameter.Name + " _sb_ptr"; var variableDefinition = new VariableDefinition(TypeIntPtr);
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); body.Variables.Add(variableDefinition);
int index = body.Variables.Count - 1; int stringPtrIndex = body.Variables.Count - 1;
// ptr = Marshal.AllocHGlobal(sb.Capacity + 1); GeneratedVariableIdentifier stringPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_string_ptr");
il.Emit(OpCodes.Callvirt, sb_get_capacity);
// ptr = Marshal.AllocHGlobal(count + 1);
var count = GetCountAttribute(parameter);
if (count == null)
{
// We need a count attribute so we know what size to make the
// string buffer. Currently every string out parameter has a
// count attribute but this check is in place to make things
// clearer if this case is ever hit.
throw new InvalidOperationException(string.Format("{0}({1}) doesn't have a count attribute", method.Name, parameter.Name));
}
if (count.Count != 0)
{
// Fixed size
il.Emit(OpCodes.Ldc_I4, count.Count);
}
else if (count.Parameter != null)
{
// Parameter sized
var countVariable = EmitCountVariable(method, body, il, count.Parameter);
il.Emit(OpCodes.Ldloc, countVariable.Index);
}
else if (count.Computed != null)
{
if (method.Name == "GetActiveVarying")
{
// GetActiveVaryingNV's name parameter has a count of "COMPSIZE(program,index,bufSize)" but really it should be bufSize.
var countVariable = EmitCountVariable(method, body, il, "bufSize");
il.Emit(OpCodes.Ldloc, countVariable.Index);
}
else
{
// Computed counts are hard and require manual reading of the specification for each one.
throw new NotSupportedException(string.Format("{0}({1}) requires a computed count: {2}", method.Name, parameter.Name, count.Computed));
}
}
il.Emit(OpCodes.Ldc_I4, 1);
il.Emit(OpCodes.Add);
il.Emit(OpCodes.Call, alloc_hglobal); il.Emit(OpCodes.Call, alloc_hglobal);
il.Emit(OpCodes.Stloc, index); il.Emit(OpCodes.Stloc, stringPtrIndex);
il.Emit(OpCodes.Ldloc, index); il.Emit(OpCodes.Ldloc, stringPtrIndex);
// We'll emit the try-finally block in the epilogue implementation, // We'll emit the try-finally block in the epilogue implementation,
// because we haven't yet emitted all necessary instructions here. // because we haven't yet emitted all necessary instructions here.
return stringPtrVar;
} }
static void EmitStringBuilderEpilogue(MethodDefinition wrapper, MethodDefinition native, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static void EmitStringOutEpilogue(MethodDefinition wrapper, MethodDefinition native,
ParameterDefinition parameter, MethodBody body, ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
var p = parameter.ParameterType; if (generatedPtrVar == null)
if (p.Name == "StringBuilder")
{ {
// void GetShaderInfoLog(..., StringBuilder foo) throw new ArgumentNullException(nameof(generatedPtrVar));
}
// void GetShaderInfoLog(..., out String foo)
// IntPtr foo_string_ptr;
// try { // try {
// foo_sb_ptr = Marshal.AllocHGlobal(sb.Capacity + 1); -- already emitted // foo_string_ptr = Marshal.AllocHGlobal(count + 1);
// glGetShaderInfoLog(..., foo_sb_ptr); -- already emitted // glGetShaderInfoLog(..., foo_string_ptr);
// MarshalPtrToStringBuilder(foo_sb_ptr, foo); // foo = MarshalPtrToString(foo_string_ptr);
// } // }
// finally { // finally {
// Marshal.FreeHGlobal(foo_sb_ptr); // Marshal.FreeHGlobal(foo_string_ptr);
// } // }
// Make sure we have imported BindingsBase::MasrhalPtrToStringBuilder and Marshal::FreeHGlobal // Make sure we have imported BindingsBase::MasrhalPtrToString and Marshal::FreeHGlobal
var ptr_to_sb = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalPtrToStringBuilder")); var ptr_to_str = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalPtrToString"));
var free_hglobal = wrapper.Module.Import(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal")); var free_hglobal = wrapper.Module.ImportReference(TypeMarshal.Methods.First(m => m.Name == "FreeHGlobal"));
var block = new ExceptionHandler(ExceptionHandlerType.Finally); var block = new ExceptionHandler(ExceptionHandlerType.Finally);
block.TryStart = body.Instructions[0]; block.TryStart = body.Instructions[0];
var variable_name = parameter.Name + " _sb_ptr";
var v = body.Variables.First(m => m.Name == variable_name);
il.Emit(OpCodes.Ldloc, v.Index);
il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Ldarg, parameter.Index);
il.Emit(OpCodes.Call, ptr_to_sb); il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index);
il.Emit(OpCodes.Call, ptr_to_str);
il.Emit(OpCodes.Stind_Ref);
block.TryEnd = body.Instructions.Last(); block.TryEnd = body.Instructions.Last();
block.HandlerStart = body.Instructions.Last(); block.HandlerStart = body.Instructions.Last();
il.Emit(OpCodes.Ldloc, v.Index); il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index);
il.Emit(OpCodes.Call, free_hglobal); il.Emit(OpCodes.Call, free_hglobal);
block.HandlerEnd = body.Instructions.Last(); block.HandlerEnd = body.Instructions.Last();
} }
}
static void EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static GeneratedVariableIdentifier EmitStringParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il)
{ {
var p = parameter.ParameterType;
// string marshaling: // string marshaling:
// IntPtr ptr = MarshalStringToPtr(str); // IntPtr ptr = MarshalStringToPtr(str);
// try { calli } // try { calli }
// finally { Marshal.FreeHGlobal(ptr); } // finally { Marshal.FreeHGlobal(ptr); }
var marshal_str_to_ptr = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringToPtr")); var marshal_str_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringToPtr"));
// IntPtr ptr; // IntPtr ptr;
var variable_name = parameter.Name + "_string_ptr"; var variableDefinition = new VariableDefinition(TypeIntPtr);
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); body.Variables.Add(variableDefinition);
int index = body.Variables.Count - 1; int generatedPointerVarIndex = body.Variables.Count - 1;
GeneratedVariableIdentifier stringPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_string_ptr");
// ptr = Marshal.StringToHGlobalAnsi(str); // ptr = Marshal.StringToHGlobalAnsi(str);
il.Emit(OpCodes.Call, marshal_str_to_ptr); il.Emit(OpCodes.Call, marshal_str_to_ptr);
il.Emit(OpCodes.Stloc, index); il.Emit(OpCodes.Stloc, generatedPointerVarIndex);
il.Emit(OpCodes.Ldloc, index); il.Emit(OpCodes.Ldloc, generatedPointerVarIndex);
// The finally block will be emitted in the function epilogue // The finally block will be emitted in the function epilogue
return stringPtrVar;
} }
static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static void EmitStringEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
var p = parameter.ParameterType; var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr"));
var free = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringPtr"));
// FreeStringPtr(ptr) // FreeStringPtr(ptr)
var variable_name = parameter.Name + "_string_ptr"; il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index);
var v = body.Variables.First(m => m.Name == variable_name);
il.Emit(OpCodes.Ldloc, v.Index);
il.Emit(OpCodes.Call, free); il.Emit(OpCodes.Call, free);
} }
static void EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static GeneratedVariableIdentifier EmitStringArrayParameter(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il)
{ {
var p = parameter.ParameterType;
// string[] masrhaling: // string[] masrhaling:
// IntPtr ptr = MarshalStringArrayToPtr(strings); // IntPtr ptr = MarshalStringArrayToPtr(strings);
// try { calli } // try { calli }
// finally { FreeStringArrayPtr(ptr); } // finally { FreeStringArrayPtr(ptr); }
var marshal_str_array_to_ptr = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr")); var marshal_str_array_to_ptr = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "MarshalStringArrayToPtr"));
// IntPtr ptr; // IntPtr ptr;
var variable_name = parameter.Name + "_string_array_ptr"; var variableDefinition = new VariableDefinition(TypeIntPtr);
body.Variables.Add(new VariableDefinition(variable_name, TypeIntPtr)); body.Variables.Add(variableDefinition);
int index = body.Variables.Count - 1; int generatedPointerVarIndex = body.Variables.Count - 1;
GeneratedVariableIdentifier stringArrayPtrVar = new GeneratedVariableIdentifier(body, variableDefinition, parameter.Name + "_string_array_ptr");
// ptr = MarshalStringArrayToPtr(strings); // ptr = MarshalStringArrayToPtr(strings);
il.Emit(OpCodes.Call, marshal_str_array_to_ptr); il.Emit(OpCodes.Call, marshal_str_array_to_ptr);
il.Emit(OpCodes.Stloc, index); il.Emit(OpCodes.Stloc, generatedPointerVarIndex);
il.Emit(OpCodes.Ldloc, index); il.Emit(OpCodes.Ldloc, generatedPointerVarIndex);
// The finally block will be emitted in the function epilogue // The finally block will be emitted in the function epilogue
return stringArrayPtrVar;
} }
static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body, ILProcessor il) private static void EmitStringArrayEpilogue(MethodDefinition wrapper, ParameterDefinition parameter, MethodBody body,
ILProcessor il, GeneratedVariableIdentifier generatedPtrVar)
{ {
if (generatedPtrVar == null)
{
throw new ArgumentNullException(nameof(generatedPtrVar));
}
// Note: only works for string vectors (1d arrays). // Note: only works for string vectors (1d arrays).
// We do not (and will probably never) support 2d or higher string arrays // We do not (and will probably never) support 2d or higher string arrays
var p = parameter.ParameterType; var free = wrapper.Module.ImportReference(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringArrayPtr"));
var free = wrapper.Module.Import(TypeBindingsBase.Methods.First(m => m.Name == "FreeStringArrayPtr"));
// FreeStringArrayPtr(string_array_ptr, string_array.Length) // FreeStringArrayPtr(string_array_ptr, string_array.Length)
var variable_name = parameter.Name + "_string_array_ptr";
var v = body.Variables.First(m => m.Name == variable_name);
// load string_array_ptr // load string_array_ptr
il.Emit(OpCodes.Ldloc, v.Index); il.Emit(OpCodes.Ldloc, generatedPtrVar.Definition.Index);
// load string_array.Length // load string_array.Length
il.Emit(OpCodes.Ldarg, parameter.Index); il.Emit(OpCodes.Ldarg, parameter.Index);
@ -694,7 +777,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Call, free); il.Emit(OpCodes.Call, free);
} }
static void EmitConvenienceWrapper(MethodDefinition wrapper, private static List<GeneratedVariableIdentifier> EmitConvenienceWrapper(MethodDefinition wrapper,
MethodDefinition native, int difference, MethodBody body, ILProcessor il) MethodDefinition native, int difference, MethodBody body, ILProcessor il)
{ {
if (wrapper.Parameters.Count > 2) if (wrapper.Parameters.Count > 2)
@ -703,6 +786,8 @@ namespace OpenTK.Rewrite
throw new NotImplementedException(); throw new NotImplementedException();
} }
List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>();
if (wrapper.ReturnType.Name != "Void") if (wrapper.ReturnType.Name != "Void")
{ {
if (difference == 2) if (difference == 2)
@ -729,7 +814,8 @@ namespace OpenTK.Rewrite
// return result; // return result;
// } // }
body.Variables.Add(new VariableDefinition(wrapper.ReturnType)); body.Variables.Add(new VariableDefinition(wrapper.ReturnType));
EmitParameters(wrapper, native, body, il);
generatedVariables = EmitParameters(wrapper, native, body, il);
il.Emit(OpCodes.Ldloca, body.Variables.Count - 1); il.Emit(OpCodes.Ldloca, body.Variables.Count - 1);
} }
else else
@ -755,15 +841,84 @@ namespace OpenTK.Rewrite
Console.Error.WriteLine("Unknown wrapper type for ({0})", native.Name); Console.Error.WriteLine("Unknown wrapper type for ({0})", native.Name);
} }
} }
return generatedVariables;
} }
static int EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il) private static object GetAttributeField(CustomAttribute attribute, string name)
{ {
int i; try
for (i = 0; i < method.Parameters.Count; i++) {
var field = attribute.Fields.First(f => f.Name == name);
return field.Argument.Value;
}
catch (InvalidOperationException)
{
return null;
}
}
private static CountAttribute GetCountAttribute(ParameterDefinition parameter)
{
var attribute = parameter.CustomAttributes
.FirstOrDefault(a => a.AttributeType.Name == "CountAttribute");
CountAttribute count = null;
if (attribute != null)
{
count = new CountAttribute();
count.Count = (int)(GetAttributeField(attribute, "Count") ?? 0);
count.Parameter = (string)(GetAttributeField(attribute, "Parameter"));
count.Computed = (string)(GetAttributeField(attribute, "Computed"));
}
return count;
}
private static VariableDefinition EmitCountVariable(MethodDefinition method, MethodBody body, ILProcessor il, string countParameter)
{
var countVariable = new VariableDefinition(TypeInt32);
body.Variables.Add(countVariable);
// Parameter will either by a simple name, a dereference of a name
// like "*name" or an expression like "name*5"
var parameter = method.Parameters.FirstOrDefault(
param => param.Name == countParameter);
if (parameter != null)
{
il.Emit(OpCodes.Ldarg, parameter.Index);
il.Emit(OpCodes.Stloc, countVariable.Index);
}
else if (countParameter[0] == '*')
{
var pointerParam = method.Parameters.FirstOrDefault(
param => param.Name == countParameter.Substring(1));
il.Emit(OpCodes.Ldarg, pointerParam.Index);
il.Emit(OpCodes.Ldind_I4);
}
else
{
var operands = countParameter.Split('*');
parameter = method.Parameters.FirstOrDefault(
param => param.Name == operands[0]);
var scale = int.Parse(operands[1]);
il.Emit(OpCodes.Ldarg, parameter.Index);
il.Emit(OpCodes.Ldc_I4, scale);
il.Emit(OpCodes.Mul);
il.Emit(OpCodes.Stloc, countVariable.Index);
}
return countVariable;
}
private static List<GeneratedVariableIdentifier> EmitParameters(MethodDefinition method, MethodDefinition native, MethodBody body, ILProcessor il)
{
List<GeneratedVariableIdentifier> generatedVariables = new List<GeneratedVariableIdentifier>();
for (int i = 0; i < method.Parameters.Count; i++)
{ {
var parameter = method.Parameters[i]; var parameter = method.Parameters[i];
var p = method.Module.Import(method.Parameters[i].ParameterType); var p = method.Module.ImportReference(method.Parameters[i].ParameterType);
il.Emit(OpCodes.Ldarg, i); il.Emit(OpCodes.Ldarg, i);
if (p.Name.Contains("Int32") && native.Parameters[i].ParameterType.Name.Contains("IntPtr")) if (p.Name.Contains("Int32") && native.Parameters[i].ParameterType.Name.Contains("IntPtr"))
@ -772,13 +927,13 @@ namespace OpenTK.Rewrite
// We need to convert the loaded argument to IntPtr. // We need to convert the loaded argument to IntPtr.
il.Emit(OpCodes.Conv_I); il.Emit(OpCodes.Conv_I);
} }
else if (p.Name == "StringBuilder") else if (p.Name == "String&" && !p.IsArray)
{ {
EmitStringBuilderParameter(method, parameter, body, il); generatedVariables.Add(EmitStringOutParameter(method, parameter, body, il));
} }
else if (p.Name == "String" && !p.IsArray) else if (p.Name == "String" && !p.IsArray)
{ {
EmitStringParameter(method, parameter, body, il); generatedVariables.Add(EmitStringParameter(method, parameter, body, il));
} }
else if (p.IsByReference) else if (p.IsByReference)
{ {
@ -790,7 +945,7 @@ namespace OpenTK.Rewrite
} }
else if (p.IsArray) else if (p.IsArray)
{ {
if (p.Name != method.Module.Import(typeof(string[])).Name) if (p.Name != "String[]")
{ {
// .Net treats 1d arrays differently than higher rank arrays. // .Net treats 1d arrays differently than higher rank arrays.
// 1d arrays are directly supported by instructions such as ldlen and ldelema. // 1d arrays are directly supported by instructions such as ldlen and ldelema.
@ -834,7 +989,7 @@ namespace OpenTK.Rewrite
} }
else else
{ {
var get_length = method.Module.Import( var get_length = method.Module.ImportReference(
mscorlib.MainModule.GetType("System.Array").Methods.First(m => m.Name == "get_Length")); mscorlib.MainModule.GetType("System.Array").Methods.First(m => m.Name == "get_Length"));
il.Emit(OpCodes.Callvirt, get_length); il.Emit(OpCodes.Callvirt, get_length);
} }
@ -880,21 +1035,22 @@ namespace OpenTK.Rewrite
} }
else else
{ {
EmitStringArrayParameter(method, parameter, body, il); generatedVariables.Add(EmitStringArrayParameter(method, parameter, body, il));
} }
} }
} }
return i;
}
static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot) return generatedVariables;
}
private static void EmitEntryPoint(FieldDefinition entry_points, ILProcessor il, int slot)
{ {
il.Emit(OpCodes.Ldsfld, entry_points); il.Emit(OpCodes.Ldsfld, entry_points);
il.Emit(OpCodes.Ldc_I4, slot); il.Emit(OpCodes.Ldc_I4, slot);
il.Emit(OpCodes.Ldelem_I); il.Emit(OpCodes.Ldelem_I);
} }
static void EmitCalli(ILProcessor il, MethodReference reference) private static void EmitCalli(ILProcessor il, MethodReference reference)
{ {
var signature = new CallSite(reference.ReturnType) var signature = new CallSite(reference.ReturnType)
{ {
@ -911,7 +1067,7 @@ namespace OpenTK.Rewrite
il.Emit(OpCodes.Calli, signature); il.Emit(OpCodes.Calli, signature);
} }
static void EmitCall(ILProcessor il, MethodReference reference) private static void EmitCall(ILProcessor il, MethodReference reference)
{ {
il.Emit(OpCodes.Call, reference); il.Emit(OpCodes.Call, reference);
} }

View file

@ -5,13 +5,18 @@ using System.Reflection;
[assembly: AssemblyTitleAttribute("Generator.Rewrite")] [assembly: AssemblyTitleAttribute("Generator.Rewrite")]
[assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")]
[assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")]
[assembly: AssemblyVersionAttribute("2.0.0")] [assembly: AssemblyVersionAttribute("3.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0")] [assembly: AssemblyFileVersionAttribute("3.0.0")]
[assembly: CLSCompliantAttribute(true)] [assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")]
namespace System { namespace System {
internal static class AssemblyVersionInformation { internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0"; internal const System.String AssemblyTitle = "Generator.Rewrite";
internal const string InformationalVersion = "2.0.0"; internal const System.String AssemblyProduct = "OpenTK";
internal const System.String AssemblyDescription = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.";
internal const System.String AssemblyVersion = "3.0.0";
internal const System.String AssemblyFileVersion = "3.0.0";
internal const System.Boolean CLSCompliant = true;
internal const System.String AssemblyCopyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.";
} }
} }

View file

@ -1 +1,3 @@
Mono.Cecil Mono.Cecil
StyleCop.Analyzers
CommandLineParser

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
// Created by Erik Ylvisaker on 3/17/08. // Created by Erik Ylvisaker on 3/17/08.
@ -56,15 +54,14 @@ namespace OpenTK.Platform.MacOS
using GLenum = UInt32; using GLenum = UInt32;
unsafe static partial class Agl internal unsafe static partial class Agl
{ {
private const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
const string agl = "/System/Library/Frameworks/AGL.framework/Versions/Current/AGL";
/* /*
** AGL API version. ** AGL API version.
*/ */
const int AGL_VERSION_2_0 = 1; private const int AGL_VERSION_2_0 = 1;
/************************************************************************/ /************************************************************************/
@ -319,47 +316,53 @@ namespace OpenTK.Platform.MacOS
[DllImport(agl)] internal static extern void aglDestroyPixelFormat(AGLPixelFormat pix); [DllImport(agl)] internal static extern void aglDestroyPixelFormat(AGLPixelFormat pix);
[DllImport(agl)] internal static extern AGLPixelFormat aglNextPixelFormat(AGLPixelFormat pix); [DllImport(agl)] internal static extern AGLPixelFormat aglNextPixelFormat(AGLPixelFormat pix);
[DllImport(agl)] internal static extern bool aglDescribePixelFormat(AGLPixelFormat pix, PixelFormatAttribute attrib, out int value); [DllImport(agl)] internal static extern bool aglDescribePixelFormat(AGLPixelFormat pix, PixelFormatAttribute attrib, out int value);
[Obsolete("Use aglDisplaysOfPixelFormat instead.")]
[DllImport(agl)] static extern AGLDevice *aglDevicesOfPixelFormat(AGLPixelFormat pix, int *ndevs);
/* /*
** Renderer information functions ** Renderer information functions
*/ */
[DllImport(agl)] static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev); [DllImport(agl)]
[DllImport(agl)] static extern void aglDestroyRendererInfo(AGLRendererInfo rend); private static extern AGLRendererInfo aglQueryRendererInfo(AGLDevice[] gdevs, int ndev);
[DllImport(agl)] static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend); [DllImport(agl)]
[DllImport(agl)] static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value); private static extern void aglDestroyRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern AGLRendererInfo aglNextRendererInfo(AGLRendererInfo rend);
[DllImport(agl)]
private static extern byte aglDescribeRenderer(AGLRendererInfo rend, int prop, out int value);
/* /*
** Context functions ** Context functions
*/ */
[DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share); [DllImport(agl)] internal static extern AGLContext aglCreateContext(AGLPixelFormat pix, AGLContext share);
[DllImport(agl,EntryPoint="aglDestroyContext")] static extern byte _aglDestroyContext(AGLContext ctx); [DllImport(agl,EntryPoint="aglDestroyContext")]
private static extern byte _aglDestroyContext(AGLContext ctx);
internal static bool aglDestroyContext(AGLContext context) internal static bool aglDestroyContext(AGLContext context)
{ {
return (_aglDestroyContext(context) != 0) ? true : false; return (_aglDestroyContext(context) != 0) ? true : false;
} }
[DllImport(agl)] static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask); [DllImport(agl)]
private static extern byte aglCopyContext(AGLContext src, AGLContext dst, uint mask);
[DllImport(agl)] internal static extern byte aglUpdateContext(AGLContext ctx); [DllImport(agl)] internal static extern byte aglUpdateContext(AGLContext ctx);
/* /*
** Current state functions ** Current state functions
*/ */
#region --- aglSetCurrentContext ---
[DllImport(agl,EntryPoint="aglSetCurrentContext")] static extern byte _aglSetCurrentContext(AGLContext ctx); [DllImport(agl,EntryPoint="aglSetCurrentContext")]
private static extern byte _aglSetCurrentContext(AGLContext ctx);
internal static bool aglSetCurrentContext(IntPtr context) internal static bool aglSetCurrentContext(IntPtr context)
{ {
byte retval = _aglSetCurrentContext(context); byte retval = _aglSetCurrentContext(context);
if (retval != 0) if (retval != 0)
{
return true; return true;
}
else else
{
return false; return false;
} }
}
#endregion
[DllImport(agl)] internal static extern AGLContext aglGetCurrentContext(); [DllImport(agl)] internal static extern AGLContext aglGetCurrentContext();
@ -368,7 +371,7 @@ namespace OpenTK.Platform.MacOS
** Drawable Functions ** Drawable Functions
*/ */
[DllImport(agl,EntryPoint="aglSetDrawable")] [DllImport(agl,EntryPoint="aglSetDrawable")]
static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw); private static extern byte _aglSetDrawable(AGLContext ctx, AGLDrawable draw);
internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw) internal static void aglSetDrawable(AGLContext ctx, AGLDrawable draw)
{ {
@ -380,11 +383,13 @@ namespace OpenTK.Platform.MacOS
throw new Exception(ErrorString(err)); throw new Exception(ErrorString(err));
} }
} }
[DllImport(agl)] static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr); [DllImport(agl)]
[DllImport(agl)] static extern AGLDrawable aglGetDrawable(AGLContext ctx); private static extern byte aglSetOffScreen(AGLContext ctx, int width, int height, int rowbytes, IntPtr baseaddr);
[DllImport(agl)]
private static extern AGLDrawable aglGetDrawable(AGLContext ctx);
[DllImport(agl, EntryPoint = "aglSetFullScreen")] [DllImport(agl, EntryPoint = "aglSetFullScreen")]
static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device); private static extern byte _aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device);
internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device) internal static void aglSetFullScreen(AGLContext ctx, int width, int height, int freq, int device)
{ {
byte retval = _aglSetFullScreen(ctx, width, height, freq, device); byte retval = _aglSetFullScreen(ctx, width, height, freq, device);
@ -403,18 +408,22 @@ namespace OpenTK.Platform.MacOS
/* /*
** Virtual screen functions ** Virtual screen functions
*/ */
[DllImport(agl)] static extern byte aglSetVirtualScreen(AGLContext ctx, int screen); [DllImport(agl)]
[DllImport(agl)] static extern int aglGetVirtualScreen(AGLContext ctx); private static extern byte aglSetVirtualScreen(AGLContext ctx, int screen);
[DllImport(agl)]
private static extern int aglGetVirtualScreen(AGLContext ctx);
/* /*
** Obtain version numbers ** Obtain version numbers
*/ */
[DllImport(agl)] static extern void aglGetVersion(int *major, int *minor); [DllImport(agl)]
private static extern void aglGetVersion(int *major, int *minor);
/* /*
** Global library options ** Global library options
*/ */
[DllImport(agl)] static extern byte aglConfigure(GLenum pname, uint param); [DllImport(agl)]
private static extern byte aglConfigure(GLenum pname, uint param);
/* /*
** Swap functions ** Swap functions
@ -429,7 +438,7 @@ namespace OpenTK.Platform.MacOS
[DllImport(agl)] [DllImport(agl)]
internal static extern bool aglDisable(AGLContext ctx, ParameterNames pname); internal static extern bool aglDisable(AGLContext ctx, ParameterNames pname);
[DllImport(agl)] [DllImport(agl)]
static extern bool aglIsEnabled(AGLContext ctx, GLenum pname); private static extern bool aglIsEnabled(AGLContext ctx, GLenum pname);
[DllImport(agl)] [DllImport(agl)]
internal static extern bool aglSetInteger(AGLContext ctx, ParameterNames pname, ref int param); internal static extern bool aglSetInteger(AGLContext ctx, ParameterNames pname, ref int param);
[DllImport(agl)] [DllImport(agl)]
@ -443,13 +452,15 @@ namespace OpenTK.Platform.MacOS
** Font function ** Font function
*/ */
// TODO: face parameter should be of type StyleParameter in QuickDraw. // TODO: face parameter should be of type StyleParameter in QuickDraw.
[DllImport(agl)] static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base); [DllImport(agl)]
private static extern byte aglUseFont(AGLContext ctx, int fontID, int face, int size, int first, int count, int @base);
/* /*
** Error functions ** Error functions
*/ */
[DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError(); [DllImport(agl,EntryPoint="aglGetError")] internal static extern AglError GetError();
[DllImport(agl,EntryPoint="aglErrorString")] static extern IntPtr _aglErrorString(AglError code); [DllImport(agl,EntryPoint="aglErrorString")]
private static extern IntPtr _aglErrorString(AglError code);
internal static string ErrorString(AglError code) internal static string ErrorString(AglError code)
{ {
return Marshal.PtrToStringAnsi(_aglErrorString(code)); return Marshal.PtrToStringAnsi(_aglErrorString(code));
@ -458,32 +469,42 @@ namespace OpenTK.Platform.MacOS
/* /*
** Soft reset function ** Soft reset function
*/ */
[DllImport(agl)] static extern void aglResetLibrary(); [DllImport(agl)]
private static extern void aglResetLibrary();
/* /*
** Surface texture function ** Surface texture function
*/ */
[DllImport(agl)] static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ; [DllImport(agl)]
private static extern void aglSurfaceTexture (AGLContext context, GLenum target, GLenum internalformat, AGLContext surfacecontext) ;
/* /*
** PBuffer functions ** PBuffer functions
*/ */
[DllImport(agl)] static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer); [DllImport(agl)]
[DllImport(agl)] static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer); private static extern byte aglCreatePBuffer (int width, int height, GLenum target, GLenum internalFormat, long max_level, AGLPbuffer *pbuffer);
[DllImport(agl)] static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level); [DllImport(agl)]
[DllImport(agl)] static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source); private static extern byte aglDestroyPBuffer (AGLPbuffer pbuffer);
[DllImport(agl)]
private static extern byte aglDescribePBuffer (AGLPbuffer pbuffer, int *width, int *height, GLenum *target, GLenum *internalFormat, int *max_level);
[DllImport(agl)]
private static extern byte aglTexImagePBuffer (AGLContext ctx, AGLPbuffer pbuffer, int source);
/* /*
** Pbuffer Drawable Functions ** Pbuffer Drawable Functions
*/ */
[DllImport(agl)] static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ; [DllImport(agl)]
[DllImport(agl)] static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ; private static extern byte aglSetPBuffer (AGLContext ctx, AGLPbuffer pbuffer, int face, int level, int screen) ;
[DllImport(agl)]
private static extern byte aglGetPBuffer (AGLContext ctx, AGLPbuffer *pbuffer, int *face, int *level, int *screen) ;
/* /*
** CGL functions ** CGL functions
*/ */
[DllImport(agl)] static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ; [DllImport(agl)]
[DllImport(agl)] static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix); private static extern byte aglGetCGLContext(AGLContext ctx, void **cgl_ctx) ;
[DllImport(agl)]
private static extern byte aglGetCGLPixelFormat(AGLPixelFormat pix, void **cgl_pix);
#pragma warning restore 0169 #pragma warning restore 0169
} }

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,14 +22,12 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
// Created by Erik Ylvisaker on 3/17/08. // Created by Erik Ylvisaker on 3/17/08.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices;
namespace OpenTK.Platform.MacOS namespace OpenTK.Platform.MacOS
{ {
@ -45,17 +42,13 @@ namespace OpenTK.Platform.MacOS
/// <summary> /// <summary>
/// AGL context implementation for WinForms compatibility. /// AGL context implementation for WinForms compatibility.
/// </summary> /// </summary>
class AglContext : IGraphicsContext, IGraphicsContextInternal internal class AglContext : IGraphicsContext, IGraphicsContextInternal
{ {
ContextHandle Handle; private IWindowInfo carbonWindow;
GraphicsMode mode; private IGraphicsContext dummyContext; // for extension loading
IWindowInfo carbonWindow;
IGraphicsContext dummyContext; // for extension loading
bool disposed;
bool error_checking;
readonly GetInt XOffset; private readonly GetInt XOffset;
readonly GetInt YOffset; private readonly GetInt YOffset;
public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, public AglContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext,
GetInt xoffset, GetInt yoffset) GetInt xoffset, GetInt yoffset)
@ -71,7 +64,7 @@ namespace OpenTK.Platform.MacOS
if (shareContext is AglContext) if (shareContext is AglContext)
{ {
shareContextRef = ((AglContext)shareContext).Handle.Handle; shareContextRef = ((AglContext)shareContext).Context.Handle;
} }
else if (shareContext is GraphicsContext) else if (shareContext is GraphicsContext)
{ {
@ -102,7 +95,7 @@ namespace OpenTK.Platform.MacOS
aglAttributes.Add(value); aglAttributes.Add(value);
} }
void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen) private void CreateContext(GraphicsMode mode, IWindowInfo carbonWindow, IntPtr shareContextRef, bool fullscreen)
{ {
Debug.Print("AGL pixel format attributes:"); Debug.Print("AGL pixel format attributes:");
@ -118,7 +111,7 @@ namespace OpenTK.Platform.MacOS
Debug.Print("Creating AGL context. Sharing with {0}", shareContextRef); Debug.Print("Creating AGL context. Sharing with {0}", shareContextRef);
// create the context and share it with the share reference. // create the context and share it with the share reference.
Handle = new ContextHandle(Agl.aglCreateContext(pixelformat, shareContextRef)); Context = new ContextHandle(Agl.aglCreateContext(pixelformat, shareContextRef));
MyAGLReportError("aglCreateContext"); MyAGLReportError("aglCreateContext");
// Free the pixel format from memory. // Free the pixel format from memory.
@ -130,9 +123,9 @@ namespace OpenTK.Platform.MacOS
Update(carbonWindow); Update(carbonWindow);
MakeCurrent(carbonWindow); MakeCurrent(carbonWindow);
Debug.Print("context: {0}", Handle.Handle); Debug.Print("context: {0}", Context.Handle);
dummyContext = new GraphicsContext(Handle, dummyContext = new GraphicsContext(Context,
GetAddress, GetAddress,
delegate() delegate()
{ {
@ -140,7 +133,7 @@ namespace OpenTK.Platform.MacOS
}); });
} }
void SetBufferRect(IWindowInfo carbonWindow) private void SetBufferRect(IWindowInfo carbonWindow)
{ {
Rect rect = API.GetControlBounds(carbonWindow.Handle); Rect rect = API.GetControlBounds(carbonWindow.Handle);
@ -149,28 +142,36 @@ namespace OpenTK.Platform.MacOS
int[] glrect = new int[4]; int[] glrect = new int[4];
if (XOffset != null) if (XOffset != null)
{
glrect[0] = rect.X + XOffset(); glrect[0] = rect.X + XOffset();
}
else else
{
glrect[0] = rect.X; glrect[0] = rect.X;
}
if (YOffset != null) if (YOffset != null)
{
glrect[1] = rect.Y + YOffset(); glrect[1] = rect.Y + YOffset();
}
else else
{
glrect[1] = rect.Y; glrect[1] = rect.Y;
}
glrect[2] = rect.Width; glrect[2] = rect.Width;
glrect[3] = rect.Height; glrect[3] = rect.Height;
Agl.aglSetInteger(Handle.Handle, Agl.ParameterNames.AGL_BUFFER_RECT, glrect); Agl.aglSetInteger(Context.Handle, Agl.ParameterNames.AGL_BUFFER_RECT, glrect);
MyAGLReportError("aglSetInteger"); MyAGLReportError("aglSetInteger");
Agl.aglEnable(Handle.Handle, Agl.ParameterNames.AGL_BUFFER_RECT); Agl.aglEnable(Context.Handle, Agl.ParameterNames.AGL_BUFFER_RECT);
MyAGLReportError("aglEnable"); MyAGLReportError("aglEnable");
} }
void SetDrawable(IWindowInfo carbonWindow) private void SetDrawable(IWindowInfo carbonWindow)
{ {
IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow); IntPtr windowPort = GetWindowPortForWindowInfo(carbonWindow);
//Debug.Print("Setting drawable for context {0} to window port: {1}", Handle.Handle, windowPort); //Debug.Print("Setting drawable for context {0} to window port: {1}", Handle.Handle, windowPort);
Agl.aglSetDrawable(Handle.Handle, windowPort); Agl.aglSetDrawable(Context.Handle, windowPort);
MyAGLReportError("aglSetDrawable"); MyAGLReportError("aglSetDrawable");
} }
@ -188,22 +189,22 @@ namespace OpenTK.Platform.MacOS
SetDrawable(window); SetDrawable(window);
SetBufferRect(window); SetBufferRect(window);
Agl.aglUpdateContext(Handle.Handle); Agl.aglUpdateContext(Context.Handle);
} }
void MyAGLReportError(string function) private void MyAGLReportError(string function)
{ {
Agl.AglError err = Agl.GetError(); Agl.AglError err = Agl.GetError();
if (err != Agl.AglError.NoError) if (err != Agl.AglError.NoError)
{
throw new Exception(String.Format( throw new Exception(String.Format(
"AGL Error from function {0}: {1} {2}", "AGL Error from function {0}: {1} {2}",
function, err, Agl.ErrorString(err))); function, err, Agl.ErrorString(err)));
} }
}
#region IGraphicsContext Members private bool firstSwap = true;
bool firstSwap = true;
public void SwapBuffers() public void SwapBuffers()
{ {
// this is part of the hack to avoid dropping the first frame when // this is part of the hack to avoid dropping the first frame when
@ -216,19 +217,21 @@ namespace OpenTK.Platform.MacOS
Update(carbonWindow); Update(carbonWindow);
} }
Agl.aglSwapBuffers(Handle.Handle); Agl.aglSwapBuffers(Context.Handle);
MyAGLReportError("aglSwapBuffers"); MyAGLReportError("aglSwapBuffers");
} }
public void MakeCurrent(IWindowInfo window) public void MakeCurrent(IWindowInfo window)
{ {
if (Agl.aglSetCurrentContext(Handle.Handle) == false) if (Agl.aglSetCurrentContext(Context.Handle) == false)
{
MyAGLReportError("aglSetCurrentContext"); MyAGLReportError("aglSetCurrentContext");
} }
}
public bool IsCurrent public bool IsCurrent
{ {
get { return (Handle.Handle == Agl.aglGetCurrentContext()); } get { return (Context.Handle == Agl.aglGetCurrentContext()); }
} }
public int SwapInterval public int SwapInterval
@ -236,7 +239,7 @@ namespace OpenTK.Platform.MacOS
get get
{ {
int swap_interval = 0; int swap_interval = 0;
if (Agl.aglGetInteger(Handle.Handle, Agl.ParameterNames.AGL_SWAP_INTERVAL, out swap_interval)) if (Agl.aglGetInteger(Context.Handle, Agl.ParameterNames.AGL_SWAP_INTERVAL, out swap_interval))
{ {
return swap_interval; return swap_interval;
} }
@ -248,36 +251,21 @@ namespace OpenTK.Platform.MacOS
} }
set set
{ {
if (!Agl.aglSetInteger(Handle.Handle, Agl.ParameterNames.AGL_SWAP_INTERVAL, ref value)) if (!Agl.aglSetInteger(Context.Handle, Agl.ParameterNames.AGL_SWAP_INTERVAL, ref value))
{
MyAGLReportError("aglSetInteger"); MyAGLReportError("aglSetInteger");
} }
} }
public GraphicsMode Mode
{
get
{
return mode;
}
set
{
mode = value;
} }
} public GraphicsMode Mode { get; set; }
public void LoadAll() public void LoadAll()
{ {
dummyContext.LoadAll(); dummyContext.LoadAll();
} }
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get
{
return disposed;
}
}
public bool VSync public bool VSync
{ {
@ -295,25 +283,11 @@ namespace OpenTK.Platform.MacOS
{ {
get get
{ {
return mode; return Mode;
} }
} }
public bool ErrorChecking public bool ErrorChecking { get; set; }
{
get
{
return error_checking;
}
set
{
error_checking = value;
}
}
#endregion
#region IDisposable Members
~AglContext() ~AglContext()
{ {
@ -325,10 +299,12 @@ namespace OpenTK.Platform.MacOS
Dispose(true); Dispose(true);
} }
void Dispose(bool disposing) private void Dispose(bool disposing)
{
if (IsDisposed || Context.Handle == IntPtr.Zero)
{ {
if (IsDisposed || Handle.Handle == IntPtr.Zero)
return; return;
}
Debug.Print("Disposing of AGL context."); Debug.Print("Disposing of AGL context.");
Agl.aglSetCurrentContext(IntPtr.Zero); Agl.aglSetCurrentContext(IntPtr.Zero);
@ -343,10 +319,10 @@ namespace OpenTK.Platform.MacOS
// Actually, it seems to crash the mono runtime. -AMK 2013 // Actually, it seems to crash the mono runtime. -AMK 2013
Debug.Print("Destroying context"); Debug.Print("Destroying context");
if (Agl.aglDestroyContext(Handle.Handle) == true) if (Agl.aglDestroyContext(Context.Handle) == true)
{ {
Debug.Print("Context destruction completed successfully."); Debug.Print("Context destruction completed successfully.");
Handle = ContextHandle.Zero; Context = ContextHandle.Zero;
return; return;
} }
@ -360,13 +336,9 @@ namespace OpenTK.Platform.MacOS
throw new Exception(Agl.ErrorString(Agl.GetError())); throw new Exception(Agl.ErrorString(Agl.GetError()));
} }
disposed = true; IsDisposed = true;
} }
#endregion
#region IGraphicsContextInternal Members
public IntPtr GetAddress(string function) public IntPtr GetAddress(string function)
{ {
return NS.GetAddress(function); return NS.GetAddress(function);
@ -385,14 +357,6 @@ namespace OpenTK.Platform.MacOS
} }
} }
public ContextHandle Context public ContextHandle Context { get; private set; }
{
get
{
return Handle;
}
}
#endregion
} }
} }

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,17 +22,15 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Text;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace OpenTK.Platform.MacOS namespace OpenTK.Platform.MacOS
{ {
class AglGraphicsMode internal class AglGraphicsMode
{ {
public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil, public GraphicsMode SelectGraphicsMode(ColorFormat color, int depth, int stencil,
int samples, ColorFormat accum, int buffers, bool stereo, out IntPtr pixelformat) int samples, ColorFormat accum, int buffers, bool stereo, out IntPtr pixelformat)
@ -58,9 +55,7 @@ namespace OpenTK.Platform.MacOS
return GetGraphicsModeFromPixelFormat(pixelformat); return GetGraphicsModeFromPixelFormat(pixelformat);
} }
#region Internal Members private static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo)
static bool RelaxGraphicsMode(ref ColorFormat color, ref int depth, ref int stencil, ref int samples, ref ColorFormat accum, ref int buffers, ref bool stereo)
{ {
// Parameters are relaxed in order of importance. // Parameters are relaxed in order of importance.
// - Accumulator buffers are way outdated as a concept, // - Accumulator buffers are way outdated as a concept,
@ -128,7 +123,7 @@ namespace OpenTK.Platform.MacOS
return false; return false;
} }
GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat) private GraphicsMode GetGraphicsModeFromPixelFormat(IntPtr pixelformat)
{ {
int r, g, b, a; int r, g, b, a;
Agl.aglDescribePixelFormat(pixelformat, Agl.PixelFormatAttribute.AGL_RED_SIZE, out r); Agl.aglDescribePixelFormat(pixelformat, Agl.PixelFormatAttribute.AGL_RED_SIZE, out r);
@ -151,7 +146,7 @@ namespace OpenTK.Platform.MacOS
depth, stencil, samples, new ColorFormat(ar, ag, ab, aa), buffers + 1, stereo != 0); depth, stencil, samples, new ColorFormat(ar, ag, ab, aa), buffers + 1, stereo != 0);
} }
IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples, private IntPtr SelectPixelFormat(ColorFormat color, int depth, int stencil, int samples,
ColorFormat accum, int buffers, bool stereo) ColorFormat accum, int buffers, bool stereo)
{ {
List<int> attribs = new List<int>(); List<int> attribs = new List<int>();
@ -224,7 +219,5 @@ namespace OpenTK.Platform.MacOS
IntPtr pixelformat = Agl.aglChoosePixelFormat(IntPtr.Zero, 0, attribs.ToArray()); IntPtr pixelformat = Agl.aglChoosePixelFormat(IntPtr.Zero, 0, attribs.ToArray());
return pixelformat; return pixelformat;
} }
#endregion
} }
} }

View file

@ -68,10 +68,10 @@ namespace OpenTK.Platform.MacOS.Carbon
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct Rect internal struct Rect
{ {
short top; private short top;
short left; private short left;
short bottom; private short bottom;
short right; private short right;
internal Rect(int left, int top, int width, int height) internal Rect(int left, int top, int width, int height)
: this((short)left, (short)top, (short)width, (short)height) : this((short)left, (short)top, (short)width, (short)height)
@ -132,16 +132,16 @@ namespace OpenTK.Platform.MacOS.Carbon
} }
} }
class API internal class API
{ {
const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon"; private const string carbon = "/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon";
[DllImport(carbon)] [DllImport(carbon)]
internal unsafe static extern OSStatus DMGetGDeviceByDisplayID( internal unsafe static extern OSStatus DMGetGDeviceByDisplayID(
IntPtr displayID, out IntPtr displayDevice, Boolean failToMain); IntPtr displayID, out IntPtr displayDevice, Boolean failToMain);
[DllImport(carbon)] [DllImport(carbon)]
static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds); private static extern IntPtr GetControlBounds(IntPtr control, out Rect bounds);
internal static Rect GetControlBounds(IntPtr control) internal static Rect GetControlBounds(IntPtr control)
{ {

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,11 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -36,18 +31,17 @@ using OpenTK.Platform.MacOS;
namespace OpenTK namespace OpenTK
{ {
class CarbonGLControl : IGLControl internal class CarbonGLControl : IGLControl
{ {
GraphicsMode mode; private GraphicsMode mode;
Control control; private Control control;
IWindowInfo window_info;
internal CarbonGLControl(GraphicsMode mode, Control owner) internal CarbonGLControl(GraphicsMode mode, Control owner)
{ {
this.mode = mode; this.mode = mode;
this.control = owner; this.control = owner;
window_info = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true); WindowInfo = Utilities.CreateMacOSCarbonWindowInfo(control.Handle, false, true);
} }
private int GetXOffset() private int GetXOffset()
@ -67,8 +61,6 @@ namespace OpenTK
return control.Location.Y; return control.Location.Y;
} }
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{ {
// AGL does not support OpenGL profiles // AGL does not support OpenGL profiles
@ -76,7 +68,7 @@ namespace OpenTK
} }
// TODO: Fix this // TODO: Fix this
bool lastIsIdle = false; private bool lastIsIdle = false;
public bool IsIdle public bool IsIdle
{ {
get get
@ -86,14 +78,6 @@ namespace OpenTK
} }
} }
public IWindowInfo WindowInfo public IWindowInfo WindowInfo { get; }
{
get
{
return window_info;
}
}
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -31,10 +29,8 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class DummyGLControl : IGLControl internal class DummyGLControl : IGLControl
{ {
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{ {
return new DummyContext(); return new DummyContext();
@ -50,22 +46,11 @@ namespace OpenTK
get { return Utilities.CreateDummyWindowInfo(); } get { return Utilities.CreateDummyWindowInfo(); }
} }
#endregion private class DummyContext : IGraphicsContext, IGraphicsContextInternal
#region class DummyContext
class DummyContext : IGraphicsContext, IGraphicsContextInternal
{ {
static int instance_count; private static int instance_count;
readonly ContextHandle handle = new ContextHandle(new IntPtr( private IWindowInfo current_window;
System.Threading.Interlocked.Increment(ref instance_count)));
IWindowInfo current_window;
bool is_disposed;
int swap_interval;
#region IGraphicsContext Members
public void SwapBuffers() public void SwapBuffers()
{ {
@ -81,10 +66,7 @@ namespace OpenTK
get { return current_window != null; } get { return current_window != null; }
} }
public bool IsDisposed public bool IsDisposed { get; private set; }
{
get { return is_disposed; }
}
public bool VSync public bool VSync
{ {
@ -98,17 +80,7 @@ namespace OpenTK
} }
} }
public int SwapInterval public int SwapInterval { get; set; }
{
get
{
return swap_interval;
}
set
{
swap_interval = value;
}
}
public void Update(IWindowInfo window) public void Update(IWindowInfo window)
{ {
@ -136,17 +108,11 @@ namespace OpenTK
public void Dispose() public void Dispose()
{ {
is_disposed = true; IsDisposed = true;
} }
#endregion public ContextHandle Context { get; } = new ContextHandle(new IntPtr(
System.Threading.Interlocked.Increment(ref instance_count)));
#region IGraphicsContextInternal
public ContextHandle Context
{
get { return handle; }
}
public IntPtr GetAddress(IntPtr function) public IntPtr GetAddress(IntPtr function)
{ {
@ -162,10 +128,6 @@ namespace OpenTK
{ {
get { return this; } get { return this; }
} }
}
#endregion
}
#endregion
} }
} }

View file

@ -20,8 +20,6 @@
base.Dispose(disposing); base.Dispose(disposing);
} }
#region Component Designer generated code
/// <summary> /// <summary>
/// Required method for Designer support - do not modify /// Required method for Designer support - do not modify
/// the contents of this method with the code editor. /// the contents of this method with the code editor.
@ -39,7 +37,5 @@
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
@ -23,20 +22,14 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK.Platform; using OpenTK.Platform;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
namespace OpenTK namespace OpenTK
{ {
@ -48,23 +41,22 @@ namespace OpenTK
/// </summary> /// </summary>
public partial class GLControl : UserControl public partial class GLControl : UserControl
{ {
IGraphicsContext context; private IGraphicsContext context;
IGLControl implementation; private IGLControl implementation;
GraphicsMode format; private GraphicsMode format;
int major, minor; private int major, minor;
GraphicsContextFlags flags; private GraphicsContextFlags flags;
bool? initial_vsync_value;
private bool? initial_vsync_value;
// Indicates that OnResize was called before OnHandleCreated. // Indicates that OnResize was called before OnHandleCreated.
// To avoid issues with missing OpenGL contexts, we suppress // To avoid issues with missing OpenGL contexts, we suppress
// the premature Resize event and raise it as soon as the handle // the premature Resize event and raise it as soon as the handle
// is ready. // is ready.
bool resize_event_suppressed; private bool resize_event_suppressed;
// Indicates whether the control is in design mode. Due to issues // Indicates whether the control is in design mode. Due to issues
// wiith the DesignMode property and nested controls,we need to // wiith the DesignMode property and nested controls,we need to
// evaluate this in the constructor. // evaluate this in the constructor.
readonly bool design_mode; private readonly bool design_mode;
#region --- Constructors ---
/// <summary> /// <summary>
/// Constructs a new instance. /// Constructs a new instance.
@ -91,7 +83,9 @@ namespace OpenTK
public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags) public GLControl(GraphicsMode mode, int major, int minor, GraphicsContextFlags flags)
{ {
if (mode == null) if (mode == null)
{
throw new ArgumentNullException("mode"); throw new ArgumentNullException("mode");
}
// SDL does not currently support embedding // SDL does not currently support embedding
// on external windows. If Open.Toolkit is not yet // on external windows. If Open.Toolkit is not yet
@ -125,11 +119,7 @@ namespace OpenTK
InitializeComponent(); InitializeComponent();
} }
#endregion private IGLControl Implementation
#region --- Private Methods ---
IGLControl Implementation
{ {
get get
{ {
@ -140,7 +130,7 @@ namespace OpenTK
} }
[Conditional("DEBUG")] [Conditional("DEBUG")]
void ValidateContext(string message) private void ValidateContext(string message)
{ {
if (!Context.IsCurrent) if (!Context.IsCurrent)
{ {
@ -148,21 +138,23 @@ namespace OpenTK
} }
} }
void ValidateState() private void ValidateState()
{ {
if (IsDisposed) if (IsDisposed)
{
throw new ObjectDisposedException(GetType().Name); throw new ObjectDisposedException(GetType().Name);
if (!IsHandleCreated)
CreateControl();
if (implementation == null || context == null || context.IsDisposed)
RecreateHandle();
} }
#endregion if (!IsHandleCreated)
{
CreateControl();
}
#region --- Protected Methods --- if (implementation == null || context == null || context.IsDisposed)
{
RecreateHandle();
}
}
/// <summary> /// <summary>
/// Gets the <c>CreateParams</c> instance for this <c>GLControl</c> /// Gets the <c>CreateParams</c> instance for this <c>GLControl</c>
@ -190,21 +182,31 @@ namespace OpenTK
protected override void OnHandleCreated(EventArgs e) protected override void OnHandleCreated(EventArgs e)
{ {
if (context != null) if (context != null)
{
context.Dispose(); context.Dispose();
}
if (implementation != null) if (implementation != null)
{
implementation.WindowInfo.Dispose(); implementation.WindowInfo.Dispose();
}
if (design_mode) if (design_mode)
{
implementation = new DummyGLControl(); implementation = new DummyGLControl();
}
else else
{
implementation = new GLControlFactory().CreateGLControl(format, this); implementation = new GLControlFactory().CreateGLControl(format, this);
}
context = implementation.CreateContext(major, minor, flags); context = implementation.CreateContext(major, minor, flags);
MakeCurrent(); MakeCurrent();
if (!design_mode) if (!design_mode)
{
((IGraphicsContextInternal)Context).LoadAll(); ((IGraphicsContextInternal)Context).LoadAll();
}
// Deferred setting of vsync mode. See VSync property for more information. // Deferred setting of vsync mode. See VSync property for more information.
if (initial_vsync_value.HasValue) if (initial_vsync_value.HasValue)
@ -253,7 +255,9 @@ namespace OpenTK
ValidateState(); ValidateState();
if (design_mode) if (design_mode)
{
e.Graphics.Clear(BackColor); e.Graphics.Clear(BackColor);
}
base.OnPaint(e); base.OnPaint(e);
} }
@ -279,7 +283,9 @@ namespace OpenTK
BeginInvoke(delay); //Need the native window to resize first otherwise our control will be in the wrong place. BeginInvoke(delay); //Need the native window to resize first otherwise our control will be in the wrong place.
} }
else if (context != null) else if (context != null)
{
context.Update (Implementation.WindowInfo); context.Update (Implementation.WindowInfo);
}
base.OnResize(e); base.OnResize(e);
} }
@ -294,8 +300,10 @@ namespace OpenTK
public void PerformContextUpdate() public void PerformContextUpdate()
{ {
if (context != null) if (context != null)
{
context.Update (Implementation.WindowInfo); context.Update (Implementation.WindowInfo);
} }
}
/// <summary> /// <summary>
/// Raises the ParentChanged event. /// Raises the ParentChanged event.
@ -304,17 +312,13 @@ namespace OpenTK
protected override void OnParentChanged(EventArgs e) protected override void OnParentChanged(EventArgs e)
{ {
if (context != null) if (context != null)
{
context.Update(Implementation.WindowInfo); context.Update(Implementation.WindowInfo);
}
base.OnParentChanged(e); base.OnParentChanged(e);
} }
#endregion
#region --- Public Methods ---
#region public void SwapBuffers()
/// <summary> /// <summary>
/// Swaps the front and back buffers, presenting the rendered scene to the screen. /// Swaps the front and back buffers, presenting the rendered scene to the screen.
/// This method will have no effect on a single-buffered <c>GraphicsMode</c>. /// This method will have no effect on a single-buffered <c>GraphicsMode</c>.
@ -325,10 +329,6 @@ namespace OpenTK
Context.SwapBuffers(); Context.SwapBuffers();
} }
#endregion
#region public void MakeCurrent()
/// <summary> /// <summary>
/// <para> /// <para>
/// Makes <see cref="GLControl.Context"/> current in the calling thread. /// Makes <see cref="GLControl.Context"/> current in the calling thread.
@ -350,10 +350,6 @@ namespace OpenTK
Context.MakeCurrent(Implementation.WindowInfo); Context.MakeCurrent(Implementation.WindowInfo);
} }
#endregion
#region public bool IsIdle
/// <summary> /// <summary>
/// Gets a value indicating whether the current thread contains pending system messages. /// Gets a value indicating whether the current thread contains pending system messages.
/// </summary> /// </summary>
@ -367,10 +363,6 @@ namespace OpenTK
} }
} }
#endregion
#region public IGraphicsContext Context
/// <summary> /// <summary>
/// Gets the <c>IGraphicsContext</c> instance that is associated with the <c>GLControl</c>. /// Gets the <c>IGraphicsContext</c> instance that is associated with the <c>GLControl</c>.
/// The associated <c>IGraphicsContext</c> is updated whenever the <c>GLControl</c> /// The associated <c>IGraphicsContext</c> is updated whenever the <c>GLControl</c>
@ -390,10 +382,6 @@ namespace OpenTK
private set { context = value; } private set { context = value; }
} }
#endregion
#region public float AspectRatio
/// <summary> /// <summary>
/// Gets the aspect ratio of this GLControl. /// Gets the aspect ratio of this GLControl.
/// </summary> /// </summary>
@ -407,10 +395,6 @@ namespace OpenTK
} }
} }
#endregion
#region public bool VSync
/// <summary> /// <summary>
/// Gets or sets a value indicating whether vsync is active for this <c>GLControl</c>. /// Gets or sets a value indicating whether vsync is active for this <c>GLControl</c>.
/// When using multiple <c>GLControl</c>s, ensure that <see cref="Context"/> /// When using multiple <c>GLControl</c>s, ensure that <see cref="Context"/>
@ -451,10 +435,6 @@ namespace OpenTK
} }
} }
#endregion
#region public GraphicsMode GraphicsMode
/// <summary> /// <summary>
/// Gets the <c>GraphicsMode</c> of the <c>IGraphicsContext</c> associated with /// Gets the <c>GraphicsMode</c> of the <c>IGraphicsContext</c> associated with
/// this <c>GLControl</c>. If you wish to change <c>GraphicsMode</c>, you must /// this <c>GLControl</c>. If you wish to change <c>GraphicsMode</c>, you must
@ -469,10 +449,6 @@ namespace OpenTK
} }
} }
#endregion
#region WindowInfo
/// <summary> /// <summary>
/// Gets the <see cref="OpenTK.Platform.IWindowInfo"/> for this instance. /// Gets the <see cref="OpenTK.Platform.IWindowInfo"/> for this instance.
/// </summary> /// </summary>
@ -480,41 +456,5 @@ namespace OpenTK
{ {
get { return implementation.WindowInfo; } get { return implementation.WindowInfo; }
} }
#endregion
#region public Bitmap GrabScreenshot()
/// <summary>
/// Grabs a screenshot of the frontbuffer contents.
/// When using multiple <c>GLControl</c>s, ensure that <see cref="Context"/>
/// is current before accessing this property.
/// <seealso cref="Context"/>
/// <seealso cref="MakeCurrent"/>
/// </summary>
/// <returns>A System.Drawing.Bitmap, containing the contents of the frontbuffer.</returns>
/// <exception cref="OpenTK.Graphics.GraphicsContextException">
/// Occurs when no OpenTK.Graphics.GraphicsContext is current in the calling thread.
/// </exception>
[Obsolete("This method will not work correctly with OpenGL|ES. Please use GL.ReadPixels to capture the contents of the framebuffer (refer to http://www.opentk.com/doc/graphics/save-opengl-rendering-to-disk for more information).")]
public Bitmap GrabScreenshot()
{
ValidateState();
ValidateContext("GrabScreenshot()");
Bitmap bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
System.Drawing.Imaging.BitmapData data =
bmp.LockBits(this.ClientRectangle, System.Drawing.Imaging.ImageLockMode.WriteOnly,
System.Drawing.Imaging.PixelFormat.Format24bppRgb);
GL.ReadPixels(0, 0, this.ClientSize.Width, this.ClientSize.Height, PixelFormat.Bgr, PixelType.UnsignedByte,
data.Scan0);
bmp.UnlockBits(data);
bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
return bmp;
}
#endregion
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
@ -23,31 +22,47 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace OpenTK namespace OpenTK
{ {
// Constructs GLControls. // Constructs GLControls.
class GLControlFactory internal class GLControlFactory
{ {
public IGLControl CreateGLControl(GraphicsMode mode, Control control) public IGLControl CreateGLControl(GraphicsMode mode, Control control)
{ {
if (mode == null) if (mode == null)
{
throw new ArgumentNullException("mode"); throw new ArgumentNullException("mode");
}
if (control == null) if (control == null)
{
throw new ArgumentNullException("control"); throw new ArgumentNullException("control");
}
if (Configuration.RunningOnSdl2) return new Sdl2GLControl(mode, control); if (Configuration.RunningOnSdl2)
else if (Configuration.RunningOnWindows) return new WinGLControl(mode, control); {
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control); return new Sdl2GLControl(mode, control);
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control); }
else throw new PlatformNotSupportedException(); else if (Configuration.RunningOnWindows)
{
return new WinGLControl(mode, control);
}
else if (Configuration.RunningOnMacOS)
{
return new CarbonGLControl(mode, control);
}
else if (Configuration.RunningOnX11)
{
return new X11GLControl(mode, control);
}
else
{
throw new PlatformNotSupportedException();
}
} }
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
@ -23,11 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Platform; using OpenTK.Platform;

View file

@ -1,4 +1,3 @@
#region License
// //
// NS.cs // NS.cs
// //
@ -26,8 +25,6 @@
// THE SOFTWARE. // THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -35,18 +32,18 @@ namespace OpenTK.Platform.MacOS
{ {
internal class NS internal class NS
{ {
const string Library = "libdl.dylib"; private const string Library = "libdl.dylib";
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")] [DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(string s); private static extern bool NSIsSymbolNameDefined(string s);
[DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")] [DllImport(Library, EntryPoint = "NSIsSymbolNameDefined")]
static extern bool NSIsSymbolNameDefined(IntPtr s); private static extern bool NSIsSymbolNameDefined(IntPtr s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")] [DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(string s); private static extern IntPtr NSLookupAndBindSymbol(string s);
[DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")] [DllImport(Library, EntryPoint = "NSLookupAndBindSymbol")]
static extern IntPtr NSLookupAndBindSymbol(IntPtr s); private static extern IntPtr NSLookupAndBindSymbol(IntPtr s);
[DllImport(Library, EntryPoint = "NSAddressOfSymbol")] [DllImport(Library, EntryPoint = "NSAddressOfSymbol")]
static extern IntPtr NSAddressOfSymbol(IntPtr symbol); private static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
[DllImport(Library)] [DllImport(Library)]
private static extern IntPtr dlopen(String fileName, int flags); private static extern IntPtr dlopen(String fileName, int flags);
[DllImport(Library)] [DllImport(Library)]
@ -88,8 +85,10 @@ namespace OpenTK.Platform.MacOS
{ {
symbol = NSLookupAndBindSymbol(function); symbol = NSLookupAndBindSymbol(function);
if (symbol != IntPtr.Zero) if (symbol != IntPtr.Zero)
{
symbol = NSAddressOfSymbol(symbol); symbol = NSAddressOfSymbol(symbol);
} }
}
return symbol; return symbol;
} }

View file

@ -40,6 +40,8 @@
<IsWebBootstrapper>false</IsWebBootstrapper> <IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<Deterministic>true</Deterministic>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
@ -55,7 +57,7 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType> <DebugType>full</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@ -71,8 +73,8 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
<DebugType>none</DebugType> <DebugType>pdbonly</DebugType>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<SignAssembly>True</SignAssembly> <SignAssembly>True</SignAssembly>
@ -158,6 +160,14 @@
<None Include="paket.references" /> <None Include="paket.references" />
<None Include="paket.template" /> <None Include="paket.template" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<AdditionalFiles Include="$(SolutionDir)\stylecop.ruleset">
<Link>stylecop.ruleset</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent> <PreBuildEvent>

View file

@ -5,13 +5,18 @@ using System.Reflection;
[assembly: AssemblyTitleAttribute("OpenTK.GLControl")] [assembly: AssemblyTitleAttribute("OpenTK.GLControl")]
[assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")]
[assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")]
[assembly: AssemblyVersionAttribute("2.0.0")] [assembly: AssemblyVersionAttribute("3.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0")] [assembly: AssemblyFileVersionAttribute("3.0.0")]
[assembly: CLSCompliantAttribute(true)] [assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")]
namespace System { namespace System {
internal static class AssemblyVersionInformation { internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0"; internal const System.String AssemblyTitle = "OpenTK.GLControl";
internal const string InformationalVersion = "2.0.0"; internal const System.String AssemblyProduct = "OpenTK";
internal const System.String AssemblyDescription = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.";
internal const System.String AssemblyVersion = "3.0.0";
internal const System.String AssemblyFileVersion = "3.0.0";
internal const System.Boolean CLSCompliant = true;
internal const System.String AssemblyCopyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.";
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos // Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
@ -23,27 +22,22 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Platform; using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class Sdl2GLControl : IGLControl internal class Sdl2GLControl : IGLControl
{ {
IWindowInfo window_info; private GraphicsMode mode;
GraphicsMode mode;
public Sdl2GLControl(GraphicsMode mode, Control control) public Sdl2GLControl(GraphicsMode mode, Control control)
{ {
this.mode = mode; this.mode = mode;
window_info = Utilities.CreateSdl2WindowInfo(control.Handle); WindowInfo = Utilities.CreateSdl2WindowInfo(control.Handle);
// Fixme: SDL2 will refuse to create an OpenGL context on // Fixme: SDL2 will refuse to create an OpenGL context on
// a window with the SDL_WINDOW_FOREIGN flag (i.e. windows // a window with the SDL_WINDOW_FOREIGN flag (i.e. windows
// that are passed to SDL2 through SDL_CreateWindowFrom). // that are passed to SDL2 through SDL_CreateWindowFrom).
@ -52,7 +46,7 @@ namespace OpenTK
public Graphics.IGraphicsContext CreateContext(int major, int minor, Graphics.GraphicsContextFlags flags) public Graphics.IGraphicsContext CreateContext(int major, int minor, Graphics.GraphicsContextFlags flags)
{ {
return new GraphicsContext(mode, window_info, major, minor, flags); return new GraphicsContext(mode, WindowInfo, major, minor, flags);
} }
public bool IsIdle public bool IsIdle
@ -60,12 +54,9 @@ namespace OpenTK
get { return NativeMethods.SDL_HasEvents(0, 0xffff); } get { return NativeMethods.SDL_HasEvents(0, 0xffff); }
} }
public Platform.IWindowInfo WindowInfo public Platform.IWindowInfo WindowInfo { get; }
{
get { return window_info; }
}
static class NativeMethods private static class NativeMethods
{ {
[DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)] [DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern bool SDL_HasEvents(int minType, int maxType); public static extern bool SDL_HasEvents(int minType, int maxType);

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
@ -23,11 +22,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -35,13 +31,9 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class WinGLControl : IGLControl internal class WinGLControl : IGLControl
{ {
#region P/Invoke declarations private struct MSG
#region Message
struct MSG
{ {
public IntPtr HWnd; public IntPtr HWnd;
public uint Message; public uint Message;
@ -57,11 +49,7 @@ namespace OpenTK
} }
} }
#endregion private struct POINT
#region Point
struct POINT
{ {
public int X; public int X;
public int Y; public int Y;
@ -83,46 +71,23 @@ namespace OpenTK
} }
} }
#endregion
#region PeekMessage
[System.Security.SuppressUnmanagedCodeSecurity] [System.Security.SuppressUnmanagedCodeSecurity]
[System.Runtime.InteropServices.DllImport("User32.dll")] [System.Runtime.InteropServices.DllImport("User32.dll")]
static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags); private static extern bool PeekMessage(ref MSG msg, IntPtr hWnd, int messageFilterMin, int messageFilterMax, int flags);
#endregion private MSG msg = new MSG();
private GraphicsMode mode;
#region
#endregion
#endregion
#region Fields
MSG msg = new MSG();
IWindowInfo window_info;
GraphicsMode mode;
#endregion
#region Constructors
public WinGLControl(GraphicsMode mode, Control control) public WinGLControl(GraphicsMode mode, Control control)
{ {
this.mode = mode; this.mode = mode;
window_info = Utilities.CreateWindowsWindowInfo(control.Handle); WindowInfo = Utilities.CreateWindowsWindowInfo(control.Handle);
} }
#endregion
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{ {
return new GraphicsContext(mode, window_info, major, minor, flags); return new GraphicsContext(mode, WindowInfo, major, minor, flags);
} }
public bool IsIdle public bool IsIdle
@ -130,15 +95,6 @@ namespace OpenTK
get { return !PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0); } get { return !PeekMessage(ref msg, IntPtr.Zero, 0, 0, 0); }
} }
public IWindowInfo WindowInfo public IWindowInfo WindowInfo { get; }
{
get
{
// This method forces the creation of the control. Beware of this side-effect!
return window_info;
}
}
#endregion
} }
} }

View file

@ -1,14 +1,10 @@
#region --- License --- /* Licensed under the MIT/X11 license.
/* Licensed under the MIT/X11 license.
* Copyright (c) 2006-2008 the OpenTK Team. * Copyright (c) 2006-2008 the OpenTK Team.
* This notice may not be removed from any source distribution. * This notice may not be removed from any source distribution.
* See license.txt for licensing detailed licensing details. * See license.txt for licensing detailed licensing details.
*/ */
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
@ -17,26 +13,24 @@ using OpenTK.Platform;
namespace OpenTK namespace OpenTK
{ {
class X11GLControl : IGLControl internal class X11GLControl : IGLControl
{ {
#region P/Invokes
[DllImport("libX11")] [DllImport("libX11")]
static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc); private static extern IntPtr XCreateColormap(IntPtr display, IntPtr window, IntPtr visual, int alloc);
[DllImport("libX11", EntryPoint = "XGetVisualInfo")] [DllImport("libX11", EntryPoint = "XGetVisualInfo")]
static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems); private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems) private static IntPtr XGetVisualInfo(IntPtr display, int vinfo_mask, ref XVisualInfo template, out int nitems)
{ {
return XGetVisualInfoInternal(display, (IntPtr)vinfo_mask, ref template, out nitems); return XGetVisualInfoInternal(display, (IntPtr)vinfo_mask, ref template, out nitems);
} }
[DllImport("libX11")] [DllImport("libX11")]
extern static int XPending(IntPtr diplay); private extern static int XPending(IntPtr diplay);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
struct XVisualInfo private struct XVisualInfo
{ {
public IntPtr Visual; public IntPtr Visual;
public IntPtr VisualID; public IntPtr VisualID;
@ -56,26 +50,23 @@ namespace OpenTK
} }
} }
#endregion private GraphicsMode mode;
private IntPtr display;
#region Fields private IntPtr rootWindow;
GraphicsMode mode;
IWindowInfo window_info;
IntPtr display;
IntPtr rootWindow;
// Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation. // Use reflection to retrieve the necessary values from Mono's Windows.Forms implementation.
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms"); private Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
#endregion
internal X11GLControl(GraphicsMode mode, Control control) internal X11GLControl(GraphicsMode mode, Control control)
{ {
if (mode == null) if (mode == null)
{
throw new ArgumentNullException("mode"); throw new ArgumentNullException("mode");
}
if (control == null) if (control == null)
{
throw new ArgumentNullException("control"); throw new ArgumentNullException("control");
}
// Note: the X11 window is created with a default XVisualInfo, // Note: the X11 window is created with a default XVisualInfo,
// that is not necessarily compatible with the desired GraphicsMode. // that is not necessarily compatible with the desired GraphicsMode.
@ -94,19 +85,20 @@ namespace OpenTK
mode.Buffers, mode.Buffers,
mode.Stereo); mode.Stereo);
if (xplatui == null) throw new PlatformNotSupportedException( if (xplatui == null)
{
throw new PlatformNotSupportedException(
"System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting."); "System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting.");
}
// get the required handles from the X11 API. // get the required handles from the X11 API.
display = (IntPtr)GetStaticFieldValue(xplatui, "DisplayHandle"); display = (IntPtr)GetStaticFieldValue(xplatui, "DisplayHandle");
rootWindow = (IntPtr)GetStaticFieldValue(xplatui, "RootWindow"); rootWindow = (IntPtr)GetStaticFieldValue(xplatui, "RootWindow");
int screen = (int)GetStaticFieldValue(xplatui, "ScreenNo"); int screen = (int)GetStaticFieldValue(xplatui, "ScreenNo");
window_info = Utilities.CreateX11WindowInfo(display, screen, control.Handle, rootWindow, IntPtr.Zero); WindowInfo = Utilities.CreateX11WindowInfo(display, screen, control.Handle, rootWindow, IntPtr.Zero);
} }
#region IGLControl Members
public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags) public IGraphicsContext CreateContext(int major, int minor, GraphicsContextFlags flags)
{ {
GraphicsContext context = new GraphicsContext(mode, this.WindowInfo, major, minor, flags); GraphicsContext context = new GraphicsContext(mode, this.WindowInfo, major, minor, flags);
@ -133,30 +125,18 @@ namespace OpenTK
get { return XPending(display) == 0; } get { return XPending(display) == 0; }
} }
public IWindowInfo WindowInfo public IWindowInfo WindowInfo { get; }
{
get
{
return window_info;
}
}
#endregion private static object GetStaticFieldValue(Type type, string fieldName)
#region Private Members
static object GetStaticFieldValue(Type type, string fieldName)
{ {
return type.GetField(fieldName, return type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null); System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
} }
static void SetStaticFieldValue(Type type, string fieldName, object value) private static void SetStaticFieldValue(Type type, string fieldName, object value)
{ {
type.GetField(fieldName, type.GetField(fieldName,
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value); System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).SetValue(null, value);
} }
#endregion
} }
} }

View file

@ -21,3 +21,6 @@ summary
description description
The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research. The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research.
OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling. OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling.
include-pdbs true
excludeddependencies
StyleCop.Analyzers

View file

@ -1,112 +1,43 @@
#region License using System;
//
// The Open Toolkit Library License
//
// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Security;
using System.Threading; using System.Threading;
using System.ComponentModel; using System.ComponentModel;
using Gdk;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Platform;
using OpenTK;
using Gtk; using Gtk;
namespace OpenTK namespace OpenTK
{ {
/// <summary>
/// The <see cref="GLWidget"/> is a GTK widget for which an OpenGL context can be used to draw arbitrary graphics.
/// </summary>
[CLSCompliant(false)]
[ToolboxItem(true)] [ToolboxItem(true)]
public class GLWidget: DrawingArea, IDisposable public class GLWidget : GLArea
{ {
private static int _GraphicsContextCount;
private static bool _SharedContextInitialized = false;
#region Static attrs. private IGraphicsContext _GraphicsContext;
private bool _Initialized = false;
static int _GraphicsContextCount; /// <summary>
static bool _SharedContextInitialized = false; /// The previous frame time reported by GTK.
/// </summary>
private double? _PreviousFrameTime;
#endregion /// <summary>
/// Gets the time taken to render the last frame (in seconds).
/// </summary>
public double DeltaTime { get; private set; }
#region Attributes /// <summary>
/// The set <see cref="ContextFlags"/> for this widget.
/// </summary>
public GraphicsContextFlags ContextFlags { get; }
IGraphicsContext _GraphicsContext; /// <summary>
IWindowInfo _WindowInfo; /// Initializes a new instance of the <see cref="GLWidget"/> class.
GraphicsContextFlags _GraphicsContextFlags; /// </summary>
bool _Initialized = false;
#endregion
#region Properties
/// <summary>Use a single buffer versus a double buffer.</summary>
[Browsable(true)]
public bool SingleBuffer { get; set; }
/// <summary>Color Buffer Bits-Per-Pixel</summary>
public int ColorBPP { get; set; }
/// <summary>Accumulation Buffer Bits-Per-Pixel</summary>
public int AccumulatorBPP { get; set; }
/// <summary>Depth Buffer Bits-Per-Pixel</summary>
public int DepthBPP { get; set; }
/// <summary>Stencil Buffer Bits-Per-Pixel</summary>
public int StencilBPP { get; set; }
/// <summary>Number of samples</summary>
public int Samples { get; set; }
/// <summary>Indicates if steropic renderering is enabled</summary>
public bool Stereo { get; set; }
/// <summary>The major version of OpenGL to use.</summary>
public int GlVersionMajor { get; set; }
/// <summary>The minor version of OpenGL to use.</summary>
public int GlVersionMinor { get; set; }
public GraphicsContextFlags GraphicsContextFlags
{
get
{
return _GraphicsContextFlags;
}
set
{
_GraphicsContextFlags = value;
}
}
#endregion
#region Construction/Destruction
/// <summary>Constructs a new GLWidget.</summary>
public GLWidget() public GLWidget()
: this(GraphicsMode.Default) : this(GraphicsMode.Default)
{ {
@ -118,49 +49,107 @@ namespace OpenTK
{ {
} }
/// <summary>Constructs a new GLWidget</summary> /// <summary>
public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags graphicsContextFlags) /// Initializes a new instance of the <see cref="GLWidget"/> class.
/// </summary>
/// <param name="graphicsMode">The <see cref="GraphicsMode"/> which the widget should be constructed with.</param>
/// <param name="glVersionMajor">The major OpenGL version to attempt to initialize.</param>
/// <param name="glVersionMinor">The minor OpenGL version to attempt to initialize.</param>
/// <param name="contextFlags">
/// Any flags which should be used during initialization of the <see cref="GraphicsContext"/>.
/// </param>
public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags contextFlags)
{ {
this.DoubleBuffered = false; ContextFlags = contextFlags;
SingleBuffer = graphicsMode.Buffers == 1; AddTickCallback(UpdateFrameTime);
ColorBPP = graphicsMode.ColorFormat.BitsPerPixel; SetRequiredVersion(glVersionMajor, glVersionMinor);
AccumulatorBPP = graphicsMode.AccumulatorFormat.BitsPerPixel;
DepthBPP = graphicsMode.Depth;
StencilBPP = graphicsMode.Stencil;
Samples = graphicsMode.Samples;
Stereo = graphicsMode.Stereo;
GlVersionMajor = glVersionMajor; if (graphicsMode.Depth > 0)
GlVersionMinor = glVersionMinor; {
GraphicsContextFlags = graphicsContextFlags; HasDepthBuffer = true;
} }
if (graphicsMode.Stencil > 0)
{
HasStencilBuffer = true;
}
if (graphicsMode.ColorFormat.Alpha > 0)
{
HasAlpha = true;
}
}
/// <summary>
/// Updates the time delta with a new value from the last frame.
/// </summary>
/// <param name="widget">The sending widget.</param>
/// <param name="frameClock">The relevant frame clock.</param>
/// <returns>true if the callback should be called again; otherwise, false.</returns>
private bool UpdateFrameTime(Widget widget, FrameClock frameClock)
{
var frameTimeµSeconds = frameClock.FrameTime;
if (!_PreviousFrameTime.HasValue)
{
_PreviousFrameTime = frameTimeµSeconds;
return true;
}
var frameTimeSeconds = (frameTimeµSeconds - _PreviousFrameTime) / 10e6;
DeltaTime = (float)frameTimeSeconds;
_PreviousFrameTime = frameTimeµSeconds;
return true;
}
/// <inheritdoc />
protected override GLContext OnCreateContext()
{
var gdkGLContext = Window.CreateGlContext();
GetRequiredVersion(out var major, out var minor);
gdkGLContext.SetRequiredVersion(major, minor);
gdkGLContext.DebugEnabled = ContextFlags.HasFlag(GraphicsContextFlags.Debug);
gdkGLContext.ForwardCompatible = ContextFlags.HasFlag(GraphicsContextFlags.ForwardCompatible);
gdkGLContext.Realize();
return gdkGLContext;
}
/// <summary>
/// Destructs this object.
/// </summary>
~GLWidget() ~GLWidget()
{ {
Dispose(false); Dispose(false);
} }
#if GTK3 /// <summary>
public override void Destroy() { /// Destroys this <see cref="Widget"/>, disposing it and destroying it in the context of GTK.
#else /// </summary>
public override void Dispose() public override void Destroy()
{ {
#endif
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
Dispose(true); Dispose(true);
#if GTK3
base.Destroy(); base.Destroy();
#else
base.Dispose();
#endif
} }
public virtual void Dispose(bool disposing) /// <summary>
/// Disposes the current object, releasing any native resources it was using.
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{ {
if (disposing) if (disposing)
{ {
_GraphicsContext.MakeCurrent(_WindowInfo); MakeCurrent();
OnShuttingDown(); OnShuttingDown();
if (GraphicsContext.ShareContexts && (Interlocked.Decrement(ref _GraphicsContextCount) == 0)) if (GraphicsContext.ShareContexts && (Interlocked.Decrement(ref _GraphicsContextCount) == 0))
{ {
@ -171,142 +160,107 @@ namespace OpenTK
} }
} }
#endregion /// <summary>
/// Called when the first <see cref="GraphicsContext"/> is created in the case where
#region New Events /// GraphicsContext.ShareContexts == true;
/// </summary>
// Called when the first GraphicsContext is created in the case of GraphicsContext.ShareContexts == True;
public static event EventHandler GraphicsContextInitialized; public static event EventHandler GraphicsContextInitialized;
static void OnGraphicsContextInitialized() /// <summary>
/// Invokes the <see cref="GraphicsContextInitialized"/> event.
/// </summary>
private static void OnGraphicsContextInitialized()
{ {
if (GraphicsContextInitialized != null) if (GraphicsContextInitialized != null)
{
GraphicsContextInitialized(null, EventArgs.Empty); GraphicsContextInitialized(null, EventArgs.Empty);
} }
// Called when the first GraphicsContext is being destroyed in the case of GraphicsContext.ShareContexts == True;
public static event EventHandler GraphicsContextShuttingDown;
static void OnGraphicsContextShuttingDown()
{
if (GraphicsContextShuttingDown != null)
GraphicsContextShuttingDown(null, EventArgs.Empty);
} }
// Called when this GLWidget has a valid GraphicsContext /// <summary>
/// Called when the first <see cref="GraphicsContext"/> is being destroyed in the case where
/// GraphicsContext.ShareContext == true;
/// </summary>
public static event EventHandler GraphicsContextShuttingDown;
/// <summary>
/// Invokes the <see cref="GraphicsContextShuttingDown"/> event.
/// </summary>
private static void OnGraphicsContextShuttingDown()
{
if (GraphicsContextShuttingDown != null)
{
GraphicsContextShuttingDown(null, EventArgs.Empty);
}
}
/// <summary>
/// Called when this <see cref="GLWidget"/> has finished initializing and has a valid
/// <see cref="GraphicsContext"/>.
/// </summary>
public event EventHandler Initialized; public event EventHandler Initialized;
/// <summary>
/// Invokes the <see cref="Initialized"/> event.
/// </summary>
protected virtual void OnInitialized() protected virtual void OnInitialized()
{ {
if (Initialized != null) if (Initialized != null)
{
Initialized(this, EventArgs.Empty); Initialized(this, EventArgs.Empty);
} }
// Called when this GLWidget needs to render a frame
public event EventHandler RenderFrame;
protected virtual void OnRenderFrame()
{
if (RenderFrame != null)
RenderFrame(this, EventArgs.Empty);
} }
// Called when this GLWidget is being Disposed /// <summary>
/// Called when this <see cref="GLWidget"/> is being disposed.
/// </summary>
public event EventHandler ShuttingDown; public event EventHandler ShuttingDown;
/// <summary>
/// Invokes the <see cref="ShuttingDown"/> event.
/// </summary>
protected virtual void OnShuttingDown() protected virtual void OnShuttingDown()
{ {
if (ShuttingDown != null) if (ShuttingDown != null)
{
ShuttingDown(this, EventArgs.Empty); ShuttingDown(this, EventArgs.Empty);
} }
}
#endregion /// <summary>
/// Called when the widget needs to be (fully or partially) redrawn.
// Called when a widget is realized. (window handles and such are valid) /// </summary>
// protected override void OnRealized() { base.OnRealized(); } /// <param name="cr"></param>
/// <returns></returns>
// Called when the widget needs to be (fully or partially) redrawn.
#if GTK3
protected override bool OnDrawn(Cairo.Context cr) protected override bool OnDrawn(Cairo.Context cr)
#else
protected override bool OnExposeEvent(Gdk.EventExpose evnt)
#endif
{ {
if (!_Initialized) if (!_Initialized)
Initialize();
else
_GraphicsContext.MakeCurrent(_WindowInfo);
#if GTK3
var result = base.OnDrawn(cr);
#else
bool result = base.OnExposeEvent(evnt);
#endif
OnRenderFrame();
#if !GTK3
evnt.Window.Display.Sync(); // Add Sync call to fix resize rendering problem (Jay L. T. Cornwall) - How does this affect VSync?
#endif
_GraphicsContext.SwapBuffers();
return result;
}
// Called on Resize
protected override bool OnConfigureEvent(Gdk.EventConfigure evnt)
{ {
bool result = base.OnConfigureEvent(evnt); Initialize();
}
if (_GraphicsContext != null)
_GraphicsContext.Update(_WindowInfo);
var result = base.OnDrawn(cr);
return result; return result;
} }
void Initialize() /// <summary>
/// Initializes the <see cref="GLWidget"/> with its given values and creates a <see cref="GraphicsContext"/>.
/// </summary>
private void Initialize()
{ {
_Initialized = true; _Initialized = true;
// If this looks uninitialized... initialize. // Make the GDK GL context current
if (ColorBPP == 0) MakeCurrent();
// Create a dummy context that will grab the GdkGLContext that is current on the thread
_GraphicsContext = new GraphicsContext(ContextHandle.Zero, null);
if (ContextFlags.HasFlag(GraphicsContextFlags.Debug))
{ {
ColorBPP = 32; _GraphicsContext.ErrorChecking = true;
if (DepthBPP == 0)
DepthBPP = 16;
} }
ColorFormat colorBufferColorFormat = new ColorFormat(ColorBPP);
ColorFormat accumulationColorFormat = new ColorFormat(AccumulatorBPP);
int buffers = 2;
if (SingleBuffer)
buffers--;
GraphicsMode graphicsMode = new GraphicsMode(colorBufferColorFormat, DepthBPP, StencilBPP, Samples, accumulationColorFormat, buffers, Stereo);
if (Configuration.RunningOnWindows)
Console.WriteLine("OpenTK running on windows");
else if (Configuration.RunningOnMacOS)
Console.WriteLine("OpenTK running on OSX");
else
Console.WriteLine("OpenTK running on X11");
// IWindowInfo
if (Configuration.RunningOnWindows)
_WindowInfo = InitializeWindows();
else if (Configuration.RunningOnMacOS)
_WindowInfo = InitializeOSX();
else
_WindowInfo = InitializeX(graphicsMode);
// GraphicsContext
_GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags);
_GraphicsContext.MakeCurrent(_WindowInfo);
if (GraphicsContext.ShareContexts) if (GraphicsContext.ShareContexts)
{ {
Interlocked.Increment(ref _GraphicsContextCount); Interlocked.Increment(ref _GraphicsContextCount);
@ -326,250 +280,5 @@ namespace OpenTK
OnInitialized(); OnInitialized();
} }
#region Windows Specific initalization
IWindowInfo InitializeWindows()
{
IntPtr windowHandle = gdk_win32_drawable_get_handle(GdkWindow.Handle);
return Utilities.CreateWindowsWindowInfo(windowHandle);
}
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-win32-2.0-0.dll")]
public static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);
#endregion
#region OSX Specific Initialization
IWindowInfo InitializeOSX()
{
IntPtr windowHandle = gdk_quartz_window_get_nswindow(this.GdkWindow.Handle);
IntPtr viewHandle = gdk_quartz_window_get_nsview(this.GdkWindow.Handle);
return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle);
}
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-quartz-2.0.0.dylib")]
static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle);
[SuppressUnmanagedCodeSecurity, DllImport("libgdk-quartz-2.0.0.dylib")]
static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle);
#endregion
#region X Specific Initialization
#if GTK3
const string UnixLibGdkName = "libgdk-3.so.0";
#else
const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
#endif
const string UnixLibX11Name = "libX11.so.6";
const string UnixLibGLName = "libGL.so.1";
const int GLX_NONE = 0;
const int GLX_USE_GL = 1;
const int GLX_BUFFER_SIZE = 2;
const int GLX_LEVEL = 3;
const int GLX_RGBA = 4;
const int GLX_DOUBLEBUFFER = 5;
const int GLX_STEREO = 6;
const int GLX_AUX_BUFFERS = 7;
const int GLX_RED_SIZE = 8;
const int GLX_GREEN_SIZE = 9;
const int GLX_BLUE_SIZE = 10;
const int GLX_ALPHA_SIZE = 11;
const int GLX_DEPTH_SIZE = 12;
const int GLX_STENCIL_SIZE = 13;
const int GLX_ACCUM_RED_SIZE = 14;
const int GLX_ACCUM_GREEN_SIZE = 15;
const int GLX_ACCUM_BLUE_SIZE = 16;
const int GLX_ACCUM_ALPHA_SIZE = 17;
public enum XVisualClass
{
StaticGray = 0,
GrayScale = 1,
StaticColor = 2,
PseudoColor = 3,
TrueColor = 4,
DirectColor = 5,
}
[StructLayout(LayoutKind.Sequential)]
struct XVisualInfo
{
public IntPtr Visual;
public IntPtr VisualID;
public int Screen;
public int Depth;
public XVisualClass Class;
public long RedMask;
public long GreenMask;
public long blueMask;
public int ColormapSize;
public int BitsPerRgb;
public override string ToString()
{
return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
VisualID, Screen, Depth, Class);
} }
} }
[Flags]
internal enum XVisualInfoMask
{
No = 0x0,
ID = 0x1,
Screen = 0x2,
Depth = 0x4,
Class = 0x8,
Red = 0x10,
Green = 0x20,
Blue = 0x40,
ColormapSize = 0x80,
BitsPerRGB = 0x100,
All = 0x1FF,
}
IWindowInfo InitializeX(GraphicsMode mode)
{
IntPtr display = gdk_x11_display_get_xdisplay(Display.Handle);
int screen = Screen.Number;
#if GTK3
IntPtr windowHandle = gdk_x11_window_get_xid(GdkWindow.Handle);
IntPtr rootWindow = gdk_x11_window_get_xid(RootWindow.Handle);
#else
IntPtr windowHandle = gdk_x11_drawable_get_xid(GdkWindow.Handle);
IntPtr rootWindow = gdk_x11_drawable_get_xid(RootWindow.Handle);
#endif
IWindowInfo retval;
IntPtr visualInfo;
if (mode.Index.HasValue)
{
XVisualInfo info = new XVisualInfo();
info.VisualID = mode.Index.Value;
int dummy;
visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy);
}
else
visualInfo = GetVisualInfo(display);
retval = Utilities.CreateX11WindowInfo(display, screen, windowHandle, rootWindow, visualInfo);
XFree(visualInfo);
return retval;
}
static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask vinfo_mask, ref XVisualInfo template, out int nitems)
{
return XGetVisualInfoInternal(display, (IntPtr)(int)vinfo_mask, ref template, out nitems);
}
IntPtr GetVisualInfo(IntPtr display)
{
try
{
int[] attributes = AttributeList.ToArray();
return glXChooseVisual(display, Screen.Number, attributes);
}
catch (DllNotFoundException e)
{
throw new DllNotFoundException("OpenGL dll not found!", e);
}
catch (EntryPointNotFoundException enf)
{
throw new EntryPointNotFoundException("Glx entry point not found!", enf);
}
}
List<int> AttributeList
{
get
{
List<int> attributeList = new List<int>(24);
attributeList.Add(GLX_RGBA);
if (!SingleBuffer)
attributeList.Add(GLX_DOUBLEBUFFER);
if (Stereo)
attributeList.Add(GLX_STEREO);
attributeList.Add(GLX_RED_SIZE);
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
attributeList.Add(GLX_GREEN_SIZE);
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
attributeList.Add(GLX_BLUE_SIZE);
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
attributeList.Add(GLX_ALPHA_SIZE);
attributeList.Add(ColorBPP / 4); // TODO support 16-bit
attributeList.Add(GLX_DEPTH_SIZE);
attributeList.Add(DepthBPP);
attributeList.Add(GLX_STENCIL_SIZE);
attributeList.Add(StencilBPP);
//attributeList.Add(GLX_AUX_BUFFERS);
//attributeList.Add(Buffers);
attributeList.Add(GLX_ACCUM_RED_SIZE);
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
attributeList.Add(GLX_ACCUM_GREEN_SIZE);
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
attributeList.Add(GLX_ACCUM_BLUE_SIZE);
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
attributeList.Add(GLX_ACCUM_ALPHA_SIZE);
attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
attributeList.Add(GLX_NONE);
return attributeList;
}
}
[DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")]
static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)]
static extern void XFree(IntPtr handle);
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
/// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
/// <param name="gdkDisplay"> The GdkDrawable. </param>
/// <returns> The ID of drawable's X resource. </returns>
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay);
/// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
/// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
/// <param name="gdkDisplay"> The GdkDrawable. </param>
/// <returns> The ID of drawable's X resource. </returns>
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay);
/// <summary> Returns the X display of a GdkDisplay. </summary>
/// <remarks> Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); </remarks>
/// <param name="gdkDisplay"> The GdkDrawable. </param>
/// <returns> The X Display of the GdkDisplay. </returns>
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
[SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)]
static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr);
#endregion
}
}

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
<PropertyGroup> <PropertyGroup>
<ProjectType>Local</ProjectType> <ProjectType>Local</ProjectType>
<ProductVersion>8.0.30703</ProductVersion> <ProductVersion>8.0.30703</ProductVersion>
@ -41,13 +41,17 @@
<BootstrapperEnabled>true</BootstrapperEnabled> <BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile /> <TargetFrameworkProfile />
<Deterministic>true</Deterministic>
<LangVersion>7</LangVersion>
<RunCodeAnalysis>true</RunCodeAnalysis>
<CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<AllowUnsafeBlocks>True</AllowUnsafeBlocks> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE;</DefineConstants> <DefineConstants>DEBUG;TRACE;GTK3;</DefineConstants>
<DocumentationFile>bin\Debug\OpenTK.GLWidget.xml</DocumentationFile> <DocumentationFile>bin\Debug\OpenTK.GLWidget.xml</DocumentationFile>
<DebugSymbols>True</DebugSymbols> <DebugSymbols>True</DebugSymbols>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
@ -56,7 +60,6 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
@ -65,7 +68,7 @@
<BaseAddress>285212672</BaseAddress> <BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile> <ConfigurationOverrideFile>
</ConfigurationOverrideFile> </ConfigurationOverrideFile>
<DefineConstants>TRACE;</DefineConstants> <DefineConstants>TRACE;GTK3;</DefineConstants>
<DocumentationFile>bin\Release\OpenTK.GLWidget.xml</DocumentationFile> <DocumentationFile>bin\Release\OpenTK.GLWidget.xml</DocumentationFile>
<FileAlignment>4096</FileAlignment> <FileAlignment>4096</FileAlignment>
<Optimize>True</Optimize> <Optimize>True</Optimize>
@ -73,8 +76,7 @@
<RegisterForComInterop>False</RegisterForComInterop> <RegisterForComInterop>False</RegisterForComInterop>
<RemoveIntegerChecks>False</RemoveIntegerChecks> <RemoveIntegerChecks>False</RemoveIntegerChecks>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> <DebugType>pdbonly</DebugType>
<DebugType>none</DebugType>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
@ -87,12 +89,6 @@
<Reference Include="System"> <Reference Include="System">
<Name>System</Name> <Name>System</Name>
</Reference> </Reference>
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\OpenTK\OpenTK.csproj"> <ProjectReference Include="..\OpenTK\OpenTK.csproj">
@ -111,35 +107,78 @@
<None Include="paket.references" /> <None Include="paket.references" />
<None Include="paket.template" /> <None Include="paket.template" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<AdditionalFiles Include="$(SolutionDir)\stylecop.json">
<Link>stylecop.json</Link>
</AdditionalFiles>
<AdditionalFiles Include="$(SolutionDir)\stylecop.ruleset">
<Link>stylecop.ruleset</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Choose> <Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')"> <When Condition="($(DefineConstants.Contains('GTK3')) And ($(TargetFrameworkVersion) == 'v4.0' Or $(TargetFrameworkVersion) == 'v4.0.3' Or $(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3' Or $(TargetFrameworkVersion) == 'v4.7'))">
<PropertyGroup>
<__paket__GtkSharp_targets>net45\GtkSharp</__paket__GtkSharp_targets>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Choose>
<When Condition="$(TargetFrameworkIdentifier) == '.NETFramework' And ($(TargetFrameworkVersion) == 'v4.5' Or $(TargetFrameworkVersion) == 'v4.5.1' Or $(TargetFrameworkVersion) == 'v4.5.2' Or $(TargetFrameworkVersion) == 'v4.5.3' Or $(TargetFrameworkVersion) == 'v4.6' Or $(TargetFrameworkVersion) == 'v4.6.1' Or $(TargetFrameworkVersion) == 'v4.6.2' Or $(TargetFrameworkVersion) == 'v4.6.3')">
<ItemGroup> <ItemGroup>
<Reference Include="cairo-sharp"> <Reference Include="cairo-sharp">
<HintPath>..\..\packages\GtkSharp\lib\net45\cairo-sharp.dll</HintPath> <HintPath>..\..\packages\gtk-sharp3\lib\net40\cairo-sharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
<Paket>True</Paket> <Paket>True</Paket>
</Reference> </Reference>
<Reference Include="gio-sharp"> <Reference Include="gio-sharp">
<HintPath>..\..\packages\GtkSharp\lib\net45\gio-sharp.dll</HintPath> <HintPath>..\..\packages\gtk-sharp3\lib\net40\gio-sharp.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="gtk-dotnet">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gtk-dotnet.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="atk-sharp">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\atk-sharp.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="gdk-sharp">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gdk-sharp.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="glib-sharp">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\glib-sharp.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="gtk-sharp">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\gtk-sharp.dll</HintPath>
<Private>True</Private>
<Paket>True</Paket>
</Reference>
<Reference Include="pango-sharp">
<HintPath>..\..\packages\gtk-sharp3\lib\net40\pango-sharp.dll</HintPath>
<Private>True</Private> <Private>True</Private>
<Paket>True</Paket> <Paket>True</Paket>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
</When> </When>
<Otherwise>
<ItemGroup>
<Reference Include="atk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glib-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="glade-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
</ItemGroup>
</Otherwise>
</Choose> </Choose>
<Import Project="..\..\packages\GtkSharp\build\$(__paket__GtkSharp_targets).targets" Condition="Exists('..\..\packages\GtkSharp\build\$(__paket__GtkSharp_targets).targets')" Label="Paket" /> <Import Project="..\..\packages\gtk-sharp3\build\gtk-sharp3.targets" Condition="Exists('..\..\packages\gtk-sharp3\build\gtk-sharp3.targets')" Label="Paket" />
<ItemGroup>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll">
<Paket>True</Paket>
</Analyzer>
<Analyzer Include="..\..\packages\StyleCop.Analyzers\analyzers\dotnet\cs\StyleCop.Analyzers.dll">
<Paket>True</Paket>
</Analyzer>
</ItemGroup>
</Project> </Project>

View file

@ -5,13 +5,18 @@ using System.Reflection;
[assembly: AssemblyTitleAttribute("OpenTK.GLWidget")] [assembly: AssemblyTitleAttribute("OpenTK.GLWidget")]
[assembly: AssemblyProductAttribute("OpenTK")] [assembly: AssemblyProductAttribute("OpenTK")]
[assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")] [assembly: AssemblyDescriptionAttribute("A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.")]
[assembly: AssemblyVersionAttribute("2.0.0")] [assembly: AssemblyVersionAttribute("3.0.0")]
[assembly: AssemblyFileVersionAttribute("2.0.0")] [assembly: AssemblyFileVersionAttribute("3.0.0")]
[assembly: CLSCompliantAttribute(true)] [assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")] [assembly: AssemblyCopyrightAttribute("Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.")]
namespace System { namespace System {
internal static class AssemblyVersionInformation { internal static class AssemblyVersionInformation {
internal const string Version = "2.0.0"; internal const System.String AssemblyTitle = "OpenTK.GLWidget";
internal const string InformationalVersion = "2.0.0"; internal const System.String AssemblyProduct = "OpenTK";
internal const System.String AssemblyDescription = "A set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL.";
internal const System.String AssemblyVersion = "3.0.0";
internal const System.String AssemblyFileVersion = "3.0.0";
internal const System.Boolean CLSCompliant = true;
internal const System.String AssemblyCopyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos <stapostol@gmail.com> for the Open Toolkit library.";
} }
} }

View file

@ -1 +1,2 @@
GtkSharp gtk-sharp3
StyleCop.Analyzers

View file

@ -21,3 +21,6 @@ summary
description description
The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research. The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research.
OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling. OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling.
include-pdbs true
excludeddependencies
StyleCop.Analyzers

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,7 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -41,20 +39,11 @@ namespace OpenTK.Audio
/// </summary> /// </summary>
public sealed class AudioCapture : IDisposable public sealed class AudioCapture : IDisposable
{ {
#region Fields
// This must stay private info so the end-user cannot call any Alc commands for the recording device. // This must stay private info so the end-user cannot call any Alc commands for the recording device.
IntPtr Handle; private IntPtr Handle;
// Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls. // Alc.CaptureStop should be called prior to device shutdown, this keeps track of Alc.CaptureStart/Stop calls.
bool _isrecording = false;
ALFormat sample_format;
int sample_frequency;
#endregion
#region Constructors
static AudioCapture() static AudioCapture()
{ {
@ -80,27 +69,33 @@ namespace OpenTK.Audio
public AudioCapture(string deviceName, int frequency, ALFormat sampleFormat, int bufferSize) public AudioCapture(string deviceName, int frequency, ALFormat sampleFormat, int bufferSize)
{ {
if (!AudioDeviceEnumerator.IsOpenALSupported) if (!AudioDeviceEnumerator.IsOpenALSupported)
{
throw new DllNotFoundException("openal32.dll"); throw new DllNotFoundException("openal32.dll");
}
if (frequency <= 0) if (frequency <= 0)
{
throw new ArgumentOutOfRangeException("frequency"); throw new ArgumentOutOfRangeException("frequency");
}
if (bufferSize <= 0) if (bufferSize <= 0)
{
throw new ArgumentOutOfRangeException("bufferSize"); throw new ArgumentOutOfRangeException("bufferSize");
}
// Try to open specified device. If it fails, try to open default device. // Try to open specified device. If it fails, try to open default device.
device_name = deviceName; CurrentDevice = deviceName;
Handle = Alc.CaptureOpenDevice(deviceName, frequency, sampleFormat, bufferSize); Handle = Alc.CaptureOpenDevice(deviceName, frequency, sampleFormat, bufferSize);
if (Handle == IntPtr.Zero) if (Handle == IntPtr.Zero)
{ {
Debug.WriteLine(ErrorMessage(deviceName, frequency, sampleFormat, bufferSize)); Debug.WriteLine(ErrorMessage(deviceName, frequency, sampleFormat, bufferSize));
device_name = "IntPtr.Zero"; CurrentDevice = "IntPtr.Zero";
Handle = Alc.CaptureOpenDevice(null, frequency, sampleFormat, bufferSize); Handle = Alc.CaptureOpenDevice(null, frequency, sampleFormat, bufferSize);
} }
if (Handle == IntPtr.Zero) if (Handle == IntPtr.Zero)
{ {
Debug.WriteLine(ErrorMessage("IntPtr.Zero", frequency, sampleFormat, bufferSize)); Debug.WriteLine(ErrorMessage("IntPtr.Zero", frequency, sampleFormat, bufferSize));
device_name = AudioDeviceEnumerator.DefaultRecordingDevice; CurrentDevice = AudioDeviceEnumerator.DefaultRecordingDevice;
Handle = Alc.CaptureOpenDevice(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize); Handle = Alc.CaptureOpenDevice(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize);
} }
@ -108,7 +103,7 @@ namespace OpenTK.Audio
{ {
// Everything we tried failed. Capture may not be supported, bail out. // Everything we tried failed. Capture may not be supported, bail out.
Debug.WriteLine(ErrorMessage(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize)); Debug.WriteLine(ErrorMessage(AudioDeviceEnumerator.DefaultRecordingDevice, frequency, sampleFormat, bufferSize));
device_name = "None"; CurrentDevice = "None";
throw new AudioDeviceException("All attempts to open capture devices returned IntPtr.Zero. See debug log for verbose list."); throw new AudioDeviceException("All attempts to open capture devices returned IntPtr.Zero. See debug log for verbose list.");
} }
@ -120,28 +115,10 @@ namespace OpenTK.Audio
SampleFrequency = frequency; SampleFrequency = frequency;
} }
#endregion Constructor
#region Public Members
#region CurrentDevice
private string device_name;
/// <summary> /// <summary>
/// The name of the device associated with this instance. /// The name of the device associated with this instance.
/// </summary> /// </summary>
public string CurrentDevice public string CurrentDevice { get; }
{
get
{
return device_name;
}
}
#endregion
#region AvailableDevices
/// <summary> /// <summary>
/// Returns a list of strings containing all known recording devices. /// Returns a list of strings containing all known recording devices.
@ -154,10 +131,6 @@ namespace OpenTK.Audio
} }
} }
#endregion
#region DefaultDevice
/// <summary> /// <summary>
/// Returns the name of the device that will be used as recording default. /// Returns the name of the device that will be used as recording default.
/// </summary> /// </summary>
@ -169,10 +142,6 @@ namespace OpenTK.Audio
} }
} }
#endregion
#region CheckErrors
/// <summary> /// <summary>
/// Checks for ALC error conditions. /// Checks for ALC error conditions.
/// </summary> /// </summary>
@ -185,10 +154,6 @@ namespace OpenTK.Audio
new AudioDeviceErrorChecker(Handle).Dispose(); new AudioDeviceErrorChecker(Handle).Dispose();
} }
#endregion
#region CurrentError
/// <summary>Returns the ALC error code for this device.</summary> /// <summary>Returns the ALC error code for this device.</summary>
public AlcError CurrentError public AlcError CurrentError
{ {
@ -198,10 +163,6 @@ namespace OpenTK.Audio
} }
} }
#endregion
#region Start & Stop
/// <summary> /// <summary>
/// Start recording samples. /// Start recording samples.
/// The number of available samples can be obtained through the <see cref="AvailableSamples"/> property. /// The number of available samples can be obtained through the <see cref="AvailableSamples"/> property.
@ -210,20 +171,16 @@ namespace OpenTK.Audio
public void Start() public void Start()
{ {
Alc.CaptureStart(Handle); Alc.CaptureStart(Handle);
_isrecording = true; IsRunning = true;
} }
/// <summary>Stop recording samples. This will not clear previously recorded samples.</summary> /// <summary>Stop recording samples. This will not clear previously recorded samples.</summary>
public void Stop() public void Stop()
{ {
Alc.CaptureStop(Handle); Alc.CaptureStop(Handle);
_isrecording = false; IsRunning = false;
} }
#endregion Start & Stop Capture
#region AvailableSamples
/// <summary>Returns the number of available samples for capture.</summary> /// <summary>Returns the number of available samples for capture.</summary>
public int AvailableSamples public int AvailableSamples
{ {
@ -237,10 +194,6 @@ namespace OpenTK.Audio
} }
} }
#endregion Available samples property
#region ReadSamples
/// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary> /// <summary>Fills the specified buffer with samples from the internal capture ring-buffer. This method does not block: it is an error to specify a sampleCount larger than AvailableSamples.</summary>
/// <param name="buffer">A pointer to a previously initialized and pinned array.</param> /// <param name="buffer">A pointer to a previously initialized and pinned array.</param>
/// <param name="sampleCount">The number of samples to be written to the buffer.</param> /// <param name="sampleCount">The number of samples to be written to the buffer.</param>
@ -258,7 +211,9 @@ namespace OpenTK.Audio
where TBuffer : struct where TBuffer : struct
{ {
if (buffer == null) if (buffer == null)
{
throw new ArgumentNullException("buffer"); throw new ArgumentNullException("buffer");
}
int buffer_size = BlittableValueType<TBuffer>.Stride * buffer.Length; int buffer_size = BlittableValueType<TBuffer>.Stride * buffer.Length;
// This is more of a heuristic than a 100% valid check. However, it will work // This is more of a heuristic than a 100% valid check. However, it will work
@ -267,56 +222,33 @@ namespace OpenTK.Audio
// be produced with compressed sample formats (which are very rare). // be produced with compressed sample formats (which are very rare).
// Still, this is better than no check at all. // Still, this is better than no check at all.
if (sampleCount * GetSampleSize(SampleFormat) > buffer_size) if (sampleCount * GetSampleSize(SampleFormat) > buffer_size)
{
throw new ArgumentOutOfRangeException("sampleCount"); throw new ArgumentOutOfRangeException("sampleCount");
}
GCHandle buffer_ptr = GCHandle.Alloc(buffer, GCHandleType.Pinned); GCHandle buffer_ptr = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try { ReadSamples(buffer_ptr.AddrOfPinnedObject(), sampleCount); } try { ReadSamples(buffer_ptr.AddrOfPinnedObject(), sampleCount); }
finally { buffer_ptr.Free(); } finally { buffer_ptr.Free(); }
} }
#endregion
#region SampleFormat & SampleFrequency
/// <summary> /// <summary>
/// Gets the OpenTK.Audio.ALFormat for this instance. /// Gets the OpenTK.Audio.ALFormat for this instance.
/// </summary> /// </summary>
public ALFormat SampleFormat public ALFormat SampleFormat { get; private set; }
{
get { return sample_format; }
private set { sample_format = value; }
}
/// <summary> /// <summary>
/// Gets the sampling rate for this instance. /// Gets the sampling rate for this instance.
/// </summary> /// </summary>
public int SampleFrequency public int SampleFrequency { get; private set; }
{
get { return sample_frequency; }
private set { sample_frequency = value; }
}
#endregion
#region IsRunning
/// <summary> /// <summary>
/// Gets a value indicating whether this instance is currently capturing samples. /// Gets a value indicating whether this instance is currently capturing samples.
/// </summary> /// </summary>
public bool IsRunning public bool IsRunning { get; private set; } = false;
{
get { return _isrecording; }
}
#endregion
#endregion
#region Private Members
// Retrieves the sample size in bytes for various ALFormats. // Retrieves the sample size in bytes for various ALFormats.
// Compressed formats always return 1. // Compressed formats always return 1.
static int GetSampleSize(ALFormat format) private static int GetSampleSize(ALFormat format)
{ {
switch (format) switch (format)
{ {
@ -350,7 +282,7 @@ namespace OpenTK.Audio
} }
// Converts an error code to an error string with additional information. // Converts an error code to an error string with additional information.
string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize) private string ErrorMessage(string devicename, int frequency, ALFormat bufferformat, int buffersize)
{ {
string alcerrmsg; string alcerrmsg;
AlcError alcerrcode = CurrentError; AlcError alcerrcode = CurrentError;
@ -374,10 +306,6 @@ namespace OpenTK.Audio
"\nBuffer Size: " + buffersize; "\nBuffer Size: " + buffersize;
} }
#endregion
#region IDisposable Members
/// <summary> /// <summary>
/// Finalizes this instance. /// Finalizes this instance.
/// </summary> /// </summary>
@ -401,15 +329,15 @@ namespace OpenTK.Audio
{ {
if (this.Handle != IntPtr.Zero) if (this.Handle != IntPtr.Zero)
{ {
if (this._isrecording) if (this.IsRunning)
{
this.Stop(); this.Stop();
}
Alc.CaptureCloseDevice(this.Handle); Alc.CaptureCloseDevice(this.Handle);
} }
this.IsDisposed = true; this.IsDisposed = true;
} }
} }
#endregion Destructor
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,14 +22,10 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using OpenTK.Audio.OpenAL; using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio namespace OpenTK.Audio
@ -41,23 +36,14 @@ namespace OpenTK.Audio
/// </summary> /// </summary>
public sealed class AudioContext : IDisposable public sealed class AudioContext : IDisposable
{ {
#region --- Fields --- private bool disposed;
private bool is_processing, is_synchronized;
private ContextHandle context_handle;
private bool context_exists;
bool disposed; private string device_name;
bool is_processing, is_synchronized; private static object audio_context_lock = new object();
IntPtr device_handle; private static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
ContextHandle context_handle;
bool context_exists;
string device_name;
static object audio_context_lock = new object();
static Dictionary<ContextHandle, AudioContext> available_contexts = new Dictionary<ContextHandle, AudioContext>();
#endregion
#region --- Constructors ---
#region static AudioContext()
/// \internal /// \internal
/// <summary> /// <summary>
@ -69,28 +55,16 @@ namespace OpenTK.Audio
{ } { }
} }
#endregion static AudioContext()
#region public AudioContext()
/// <summary>Constructs a new AudioContext, using the default audio device.</summary> /// <summary>Constructs a new AudioContext, using the default audio device.</summary>
public AudioContext() public AudioContext()
: this(null, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { } : this(null, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion
#region public AudioContext(string device)
/// <summary> /// <summary>
/// Constructs a new AudioContext instance. /// Constructs a new AudioContext instance.
/// </summary> /// </summary>
/// <param name="device">The device name that will host this instance.</param> /// <param name="device">The device name that will host this instance.</param>
public AudioContext(string device) : this(device, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { } public AudioContext(string device) : this(device, 0, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion
#region public AudioContext(string device, int freq)
/// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary> /// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary>
/// <param name="device">The name of the audio device to use.</param> /// <param name="device">The name of the audio device to use.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
@ -100,10 +74,6 @@ namespace OpenTK.Audio
/// </remarks> /// </remarks>
public AudioContext(string device, int freq) : this(device, freq, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { } public AudioContext(string device, int freq) : this(device, freq, 0, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion
#region public AudioContext(string device, int freq, int refresh)
/// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary> /// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary>
/// <param name="device">The name of the audio device to use.</param> /// <param name="device">The name of the audio device to use.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
@ -115,10 +85,6 @@ namespace OpenTK.Audio
public AudioContext(string device, int freq, int refresh) public AudioContext(string device, int freq, int refresh)
: this(device, freq, refresh, false, true, MaxAuxiliarySends.UseDriverDefault) { } : this(device, freq, refresh, false, true, MaxAuxiliarySends.UseDriverDefault) { }
#endregion
#region public AudioContext(string device, int freq, int refresh, bool sync)
/// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary> /// <summary>Constructs a new AudioContext, using the specified audio device and device parameters.</summary>
/// <param name="device">The name of the audio device to use.</param> /// <param name="device">The name of the audio device to use.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
@ -131,10 +97,6 @@ namespace OpenTK.Audio
public AudioContext(string device, int freq, int refresh, bool sync) public AudioContext(string device, int freq, int refresh, bool sync)
: this(AudioDeviceEnumerator.AvailablePlaybackDevices[0], freq, refresh, sync, true) { } : this(AudioDeviceEnumerator.AvailablePlaybackDevices[0], freq, refresh, sync, true) { }
#endregion
#region public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx)
/// <summary>Creates the audio context using the specified device and device parameters.</summary> /// <summary>Creates the audio context using the specified device and device parameters.</summary>
/// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices.</param> /// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
@ -165,10 +127,6 @@ namespace OpenTK.Audio
CreateContext(device, freq, refresh, sync, enableEfx, MaxAuxiliarySends.UseDriverDefault); CreateContext(device, freq, refresh, sync, enableEfx, MaxAuxiliarySends.UseDriverDefault);
} }
#endregion
#region public AudioContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxMaxAuxSends)
/// <summary>Creates the audio context using the specified device and device parameters.</summary> /// <summary>Creates the audio context using the specified device and device parameters.</summary>
/// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices.</param> /// <param name="device">The device descriptor obtained through AudioContext.AvailableDevices.</param>
/// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param> /// <param name="freq">Frequency for mixing output buffer, in units of Hz. Pass 0 for driver default.</param>
@ -200,14 +158,6 @@ namespace OpenTK.Audio
CreateContext(device, freq, refresh, sync, enableEfx, efxMaxAuxSends); CreateContext(device, freq, refresh, sync, enableEfx, efxMaxAuxSends);
} }
#endregion
#endregion --- Constructors ---
#region --- Private Methods ---
#region CreateContext
/// <summary>May be passed at context construction time to indicate the number of desired auxiliary effect slot sends per source.</summary> /// <summary>May be passed at context construction time to indicate the number of desired auxiliary effect slot sends per source.</summary>
public enum MaxAuxiliarySends:int public enum MaxAuxiliarySends:int
{ {
@ -249,34 +199,47 @@ namespace OpenTK.Audio
/// Values higher than supported will be clamped by the driver. /// Values higher than supported will be clamped by the driver.
/// </para> /// </para>
/// </remarks> /// </remarks>
void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends) private void CreateContext(string device, int freq, int refresh, bool sync, bool enableEfx, MaxAuxiliarySends efxAuxiliarySends)
{ {
if (!AudioDeviceEnumerator.IsOpenALSupported) if (!AudioDeviceEnumerator.IsOpenALSupported)
{
throw new DllNotFoundException("openal32.dll"); throw new DllNotFoundException("openal32.dll");
}
if (AudioDeviceEnumerator.Version == AudioDeviceEnumerator.AlcVersion.Alc1_1 && AudioDeviceEnumerator.AvailablePlaybackDevices.Count == 0) // Alc 1.0 does not support device enumeration. if (AudioDeviceEnumerator.Version == AudioDeviceEnumerator.AlcVersion.Alc1_1 && AudioDeviceEnumerator.AvailablePlaybackDevices.Count == 0) // Alc 1.0 does not support device enumeration.
{
throw new NotSupportedException("No audio hardware is available."); throw new NotSupportedException("No audio hardware is available.");
if (context_exists) throw new NotSupportedException("Multiple AudioContexts are not supported."); }
if (freq < 0) throw new ArgumentOutOfRangeException("freq", freq, "Should be greater than zero."); if (context_exists)
if (refresh < 0) throw new ArgumentOutOfRangeException("refresh", refresh, "Should be greater than zero."); {
throw new NotSupportedException("Multiple AudioContexts are not supported.");
}
if (freq < 0)
{
throw new ArgumentOutOfRangeException("freq", freq, "Should be greater than zero.");
}
if (refresh < 0)
{
throw new ArgumentOutOfRangeException("refresh", refresh, "Should be greater than zero.");
}
if (!String.IsNullOrEmpty(device)) if (!String.IsNullOrEmpty(device))
{ {
device_name = device; device_name = device;
device_handle = Alc.OpenDevice(device); // try to open device by name Device = Alc.OpenDevice(device); // try to open device by name
} }
if (device_handle == IntPtr.Zero) if (Device == IntPtr.Zero)
{ {
device_name = "IntPtr.Zero (null string)"; device_name = "IntPtr.Zero (null string)";
device_handle = Alc.OpenDevice(null); // try to open unnamed default device Device = Alc.OpenDevice(null); // try to open unnamed default device
} }
if (device_handle == IntPtr.Zero) if (Device == IntPtr.Zero)
{ {
device_name = AudioContext.DefaultDevice; device_name = AudioContext.DefaultDevice;
device_handle = Alc.OpenDevice(AudioContext.DefaultDevice); // try to open named default device Device = Alc.OpenDevice(AudioContext.DefaultDevice); // try to open named default device
} }
if (device_handle == IntPtr.Zero) if (Device == IntPtr.Zero)
{ {
device_name = "None"; device_name = "None";
throw new AudioDeviceException(String.Format("Audio device '{0}' does not exist or is tied up by another application.", throw new AudioDeviceException(String.Format("Audio device '{0}' does not exist or is tied up by another application.",
@ -303,7 +266,7 @@ namespace OpenTK.Audio
attributes.Add((int)AlcContextAttributes.Sync); attributes.Add((int)AlcContextAttributes.Sync);
attributes.Add(sync ? 1 : 0); attributes.Add(sync ? 1 : 0);
if (enableEfx && Alc.IsExtensionPresent(device_handle, "ALC_EXT_EFX")) if (enableEfx && Alc.IsExtensionPresent(Device, "ALC_EXT_EFX"))
{ {
int num_slots; int num_slots;
switch (efxAuxiliarySends) switch (efxAuxiliarySends)
@ -316,7 +279,7 @@ namespace OpenTK.Audio
break; break;
default: default:
case MaxAuxiliarySends.UseDriverDefault: case MaxAuxiliarySends.UseDriverDefault:
Alc.GetInteger(device_handle, AlcGetInteger.EfxMaxAuxiliarySends, 1, out num_slots); Alc.GetInteger(Device, AlcGetInteger.EfxMaxAuxiliarySends, 1, out num_slots);
break; break;
} }
@ -325,11 +288,11 @@ namespace OpenTK.Audio
} }
attributes.Add(0); attributes.Add(0);
context_handle = Alc.CreateContext(device_handle, attributes.ToArray()); context_handle = Alc.CreateContext(Device, attributes.ToArray());
if (context_handle == ContextHandle.Zero) if (context_handle == ContextHandle.Zero)
{ {
Alc.CloseDevice(device_handle); Alc.CloseDevice(Device);
throw new AudioContextException("The audio context could not be created with the specified parameters."); throw new AudioContextException("The audio context could not be created with the specified parameters.");
} }
@ -339,11 +302,13 @@ namespace OpenTK.Audio
// an old OpenAL version is detect - it may affect outdated OpenAL versions different than OpenAL SI, // an old OpenAL version is detect - it may affect outdated OpenAL versions different than OpenAL SI,
// but it looks like a good compromise for now. // but it looks like a good compromise for now.
if (AudioDeviceEnumerator.AvailablePlaybackDevices.Count > 0) if (AudioDeviceEnumerator.AvailablePlaybackDevices.Count > 0)
{
MakeCurrent(); MakeCurrent();
}
CheckErrors(); CheckErrors();
device_name = Alc.GetString(device_handle, AlcGetString.DeviceSpecifier); device_name = Alc.GetString(Device, AlcGetString.DeviceSpecifier);
lock (audio_context_lock) lock (audio_context_lock)
@ -353,10 +318,6 @@ namespace OpenTK.Audio
} }
} }
#endregion --- Private Methods ---
#region static void MakeCurrent(AudioContext context)
/// \internal /// \internal
/// <summary>Makes the specified AudioContext current in the calling thread.</summary> /// <summary>Makes the specified AudioContext current in the calling thread.</summary>
/// <param name="context">The OpenTK.Audio.AudioContext to make current, or null.</param> /// <param name="context">The OpenTK.Audio.AudioContext to make current, or null.</param>
@ -366,20 +327,18 @@ namespace OpenTK.Audio
/// <exception cref="AudioContextException"> /// <exception cref="AudioContextException">
/// Occurs when the AudioContext could not be made current. /// Occurs when the AudioContext could not be made current.
/// </exception> /// </exception>
static void MakeCurrent(AudioContext context) private static void MakeCurrent(AudioContext context)
{ {
lock (audio_context_lock) lock (audio_context_lock)
{ {
if (!Alc.MakeContextCurrent(context != null ? context.context_handle : ContextHandle.Zero)) if (!Alc.MakeContextCurrent(context != null ? context.context_handle : ContextHandle.Zero))
{
throw new AudioContextException(String.Format("ALC {0} error detected at {1}.", throw new AudioContextException(String.Format("ALC {0} error detected at {1}.",
Alc.GetError(context != null ? (IntPtr)context.context_handle : IntPtr.Zero).ToString(), Alc.GetError(context != null ? (IntPtr)context.context_handle : IntPtr.Zero).ToString(),
context != null ? context.ToString() : "null")); context != null ? context.ToString() : "null"));
} }
} }
}
#endregion
#region internal bool IsCurrent
/// <summary> /// <summary>
/// Gets or sets a System.Boolean indicating whether the AudioContext /// Gets or sets a System.Boolean indicating whether the AudioContext
@ -396,7 +355,9 @@ namespace OpenTK.Audio
lock (audio_context_lock) lock (audio_context_lock)
{ {
if (available_contexts.Count == 0) if (available_contexts.Count == 0)
{
return false; return false;
}
else else
{ {
return AudioContext.CurrentContext == this; return AudioContext.CurrentContext == this;
@ -405,24 +366,18 @@ namespace OpenTK.Audio
} }
set set
{ {
if (value) AudioContext.MakeCurrent(this); if (value)
else AudioContext.MakeCurrent(null); {
AudioContext.MakeCurrent(this);
}
else
{
AudioContext.MakeCurrent(null);
}
} }
} }
#endregion private IntPtr Device { get; set; }
#region IntPtr Device
IntPtr Device { get { return device_handle; } }
#endregion
#endregion
#region --- Public Members ---
#region CheckErrors
/// <summary> /// <summary>
/// Checks for ALC error conditions. /// Checks for ALC error conditions.
@ -434,14 +389,12 @@ namespace OpenTK.Audio
public void CheckErrors() public void CheckErrors()
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
new AudioDeviceErrorChecker(device_handle).Dispose();
} }
#endregion new AudioDeviceErrorChecker(Device).Dispose();
}
#region CurrentError
/// <summary> /// <summary>
/// Returns the ALC error code for this instance. /// Returns the ALC error code for this instance.
@ -451,15 +404,13 @@ namespace OpenTK.Audio
get get
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
return Alc.GetError(device_handle);
}
} }
#endregion return Alc.GetError(Device);
}
#region MakeCurrent }
/// <summary>Makes the AudioContext current in the calling thread.</summary> /// <summary>Makes the AudioContext current in the calling thread.</summary>
/// <exception cref="ObjectDisposedException"> /// <exception cref="ObjectDisposedException">
@ -475,15 +426,13 @@ namespace OpenTK.Audio
public void MakeCurrent() public void MakeCurrent()
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
AudioContext.MakeCurrent(this); AudioContext.MakeCurrent(this);
} }
#endregion
#region IsProcessing
/// <summary> /// <summary>
/// Gets a System.Boolean indicating whether the AudioContext is /// Gets a System.Boolean indicating whether the AudioContext is
/// currently processing audio events. /// currently processing audio events.
@ -495,17 +444,15 @@ namespace OpenTK.Audio
get get
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
return is_processing; return is_processing;
} }
private set { is_processing = value; } private set { is_processing = value; }
} }
#endregion
#region IsSynchronized
/// <summary> /// <summary>
/// Gets a System.Boolean indicating whether the AudioContext is /// Gets a System.Boolean indicating whether the AudioContext is
/// synchronized. /// synchronized.
@ -516,17 +463,15 @@ namespace OpenTK.Audio
get get
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
return is_synchronized; return is_synchronized;
} }
private set { is_synchronized = value; } private set { is_synchronized = value; }
} }
#endregion
#region public void Process
/// <summary> /// <summary>
/// Processes queued audio events. /// Processes queued audio events.
/// </summary> /// </summary>
@ -548,16 +493,14 @@ namespace OpenTK.Audio
public void Process() public void Process()
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
Alc.ProcessContext(this.context_handle); Alc.ProcessContext(this.context_handle);
IsProcessing = true; IsProcessing = true;
} }
#endregion
#region public void Suspend
/// <summary> /// <summary>
/// Suspends processing of audio events. /// Suspends processing of audio events.
/// </summary> /// </summary>
@ -581,16 +524,14 @@ namespace OpenTK.Audio
public void Suspend() public void Suspend()
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
Alc.SuspendContext(this.context_handle); Alc.SuspendContext(this.context_handle);
IsProcessing = false; IsProcessing = false;
} }
#endregion
#region public bool SupportsExtension(string extension)
/// <summary> /// <summary>
/// Checks whether the specified OpenAL extension is supported. /// Checks whether the specified OpenAL extension is supported.
/// </summary> /// </summary>
@ -599,15 +540,13 @@ namespace OpenTK.Audio
public bool SupportsExtension(string extension) public bool SupportsExtension(string extension)
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
return Alc.IsExtensionPresent(this.Device, extension); return Alc.IsExtensionPresent(this.Device, extension);
} }
#endregion
#region CurrentDevice
/// <summary> /// <summary>
/// Gets a System.String with the name of the device used in this context. /// Gets a System.String with the name of the device used in this context.
/// </summary> /// </summary>
@ -616,20 +555,14 @@ namespace OpenTK.Audio
get get
{ {
if (disposed) if (disposed)
{
throw new ObjectDisposedException(this.GetType().FullName); throw new ObjectDisposedException(this.GetType().FullName);
}
return device_name; return device_name;
} }
} }
#endregion
#endregion --- Public Members ---
#region --- Static Members ---
#region public static AudioContext CurrentContext
/// <summary> /// <summary>
/// Gets the OpenTK.Audio.AudioContext which is current in the application. /// Gets the OpenTK.Audio.AudioContext which is current in the application.
/// </summary> /// </summary>
@ -644,7 +577,9 @@ namespace OpenTK.Audio
lock (audio_context_lock) lock (audio_context_lock)
{ {
if (available_contexts.Count == 0) if (available_contexts.Count == 0)
{
return null; return null;
}
else else
{ {
AudioContext context; AudioContext context;
@ -657,10 +592,6 @@ namespace OpenTK.Audio
} }
} }
#endregion
#region AvailableDevices
/// <summary> /// <summary>
/// Returns a list of strings containing all known playback devices. /// Returns a list of strings containing all known playback devices.
/// </summary> /// </summary>
@ -671,10 +602,6 @@ namespace OpenTK.Audio
return AudioDeviceEnumerator.AvailablePlaybackDevices; return AudioDeviceEnumerator.AvailablePlaybackDevices;
} }
} }
#endregion public static IList<string> AvailablePlaybackDevices
#region DefaultDevice
/// <summary> /// <summary>
/// Returns the name of the device that will be used as playback default. /// Returns the name of the device that will be used as playback default.
/// </summary> /// </summary>
@ -686,12 +613,6 @@ namespace OpenTK.Audio
} }
} }
#endregion
#endregion
#region --- IDisposable Members ---
/// <summary> /// <summary>
/// Disposes of the AudioContext, cleaning up all resources consumed by it. /// Disposes of the AudioContext, cleaning up all resources consumed by it.
/// </summary> /// </summary>
@ -701,12 +622,14 @@ namespace OpenTK.Audio
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
void Dispose(bool manual) private void Dispose(bool manual)
{ {
if (!disposed) if (!disposed)
{ {
if (this.IsCurrent) if (this.IsCurrent)
{
this.IsCurrent = false; this.IsCurrent = false;
}
if (context_handle != ContextHandle.Zero) if (context_handle != ContextHandle.Zero)
{ {
@ -714,8 +637,10 @@ namespace OpenTK.Audio
Alc.DestroyContext(context_handle); Alc.DestroyContext(context_handle);
} }
if (device_handle != IntPtr.Zero) if (Device != IntPtr.Zero)
Alc.CloseDevice(device_handle); {
Alc.CloseDevice(Device);
}
if (manual) if (manual)
{ {
@ -732,10 +657,6 @@ namespace OpenTK.Audio
this.Dispose(false); this.Dispose(false);
} }
#endregion
#region --- Overrides ---
/// <summary> /// <summary>
/// Calculates the hash code for this instance. /// Calculates the hash code for this instance.
/// </summary> /// </summary>
@ -762,9 +683,7 @@ namespace OpenTK.Audio
public override string ToString() public override string ToString()
{ {
return String.Format("{0} (handle: {1}, device: {2})", return String.Format("{0} (handle: {1}, device: {2})",
this.device_name, this.context_handle, this.device_handle); this.device_name, this.context_handle, this.Device);
} }
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,13 +22,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
/// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary> /// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary>

View file

@ -1,4 +1,3 @@
#region License
// //
// The Open Toolkit Library License // The Open Toolkit Library License
// //
@ -23,11 +22,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics; using System.Diagnostics;
using OpenTK.Audio.OpenAL; using OpenTK.Audio.OpenAL;
@ -36,8 +33,6 @@ namespace OpenTK.Audio
{ {
internal static class AudioDeviceEnumerator internal static class AudioDeviceEnumerator
{ {
#region All device strings
private static readonly List<string> available_playback_devices = new List<string>(); private static readonly List<string> available_playback_devices = new List<string>();
private static readonly List<string> available_recording_devices = new List<string>(); private static readonly List<string> available_recording_devices = new List<string>();
@ -56,44 +51,11 @@ namespace OpenTK.Audio
} }
} }
#endregion All device strings internal static string DefaultPlaybackDevice { get; }
#region Default device strings internal static string DefaultRecordingDevice { get; }
private static string default_playback_device; internal static bool IsOpenALSupported { get; } = true;
internal static string DefaultPlaybackDevice
{
get
{
return default_playback_device;
}
}
private static string default_recording_device;
internal static string DefaultRecordingDevice
{
get
{
return default_recording_device;
}
}
#endregion Default device strings
#region Is OpenAL supported?
private static bool openal_supported = true;
internal static bool IsOpenALSupported
{
get
{
return openal_supported;
}
}
#endregion Is OpenAL supported?
#region Alc Version number
internal enum AlcVersion internal enum AlcVersion
{ {
@ -101,18 +63,7 @@ namespace OpenTK.Audio
Alc1_1 Alc1_1
} }
private static AlcVersion version; internal static AlcVersion Version { get; }
internal static AlcVersion Version
{
get
{
return version;
}
}
#endregion Alc Version number
#region Constructors
// Loads all available audio devices into the available_*_devices lists. // Loads all available audio devices into the available_*_devices lists.
static AudioDeviceEnumerator() static AudioDeviceEnumerator()
@ -141,32 +92,34 @@ namespace OpenTK.Audio
// Get a list of all known playback devices, using best extension available // Get a list of all known playback devices, using best extension available
if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT")) if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT"))
{ {
version = AlcVersion.Alc1_1; Version = AlcVersion.Alc1_1;
if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT")) if (Alc.IsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT"))
{ {
available_playback_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.AllDevicesSpecifier)); available_playback_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.AllDevicesSpecifier));
default_playback_device = Alc.GetString(IntPtr.Zero, AlcGetString.DefaultAllDevicesSpecifier); DefaultPlaybackDevice = Alc.GetString(IntPtr.Zero, AlcGetString.DefaultAllDevicesSpecifier);
} }
else else
{ {
available_playback_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.DeviceSpecifier)); available_playback_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.DeviceSpecifier));
default_playback_device = Alc.GetString(IntPtr.Zero, AlcGetString.DefaultDeviceSpecifier); DefaultPlaybackDevice = Alc.GetString(IntPtr.Zero, AlcGetString.DefaultDeviceSpecifier);
} }
} }
else else
{ {
version = AlcVersion.Alc1_0; Version = AlcVersion.Alc1_0;
Debug.Print("Device enumeration extension not available. Failed to enumerate playback devices."); Debug.Print("Device enumeration extension not available. Failed to enumerate playback devices.");
} }
AlcError playback_err = Alc.GetError(dummy_device); AlcError playback_err = Alc.GetError(dummy_device);
if (playback_err != AlcError.NoError) if (playback_err != AlcError.NoError)
{
throw new AudioContextException("Alc Error occured when querying available playback devices. " + playback_err.ToString()); throw new AudioContextException("Alc Error occured when querying available playback devices. " + playback_err.ToString());
}
// Get a list of all known recording devices, at least ALC_ENUMERATION_EXT is needed too // Get a list of all known recording devices, at least ALC_ENUMERATION_EXT is needed too
if (version == AlcVersion.Alc1_1 && Alc.IsExtensionPresent(IntPtr.Zero, "ALC_EXT_CAPTURE")) if (Version == AlcVersion.Alc1_1 && Alc.IsExtensionPresent(IntPtr.Zero, "ALC_EXT_CAPTURE"))
{ {
available_recording_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.CaptureDeviceSpecifier)); available_recording_devices.AddRange(Alc.GetString(IntPtr.Zero, AlcGetStringList.CaptureDeviceSpecifier));
default_recording_device = Alc.GetString(IntPtr.Zero, AlcGetString.CaptureDefaultDeviceSpecifier); DefaultRecordingDevice = Alc.GetString(IntPtr.Zero, AlcGetString.CaptureDefaultDeviceSpecifier);
} }
else else
{ {
@ -174,55 +127,63 @@ namespace OpenTK.Audio
} }
AlcError record_err = Alc.GetError(dummy_device); AlcError record_err = Alc.GetError(dummy_device);
if (record_err != AlcError.NoError) if (record_err != AlcError.NoError)
{
throw new AudioContextException("Alc Error occured when querying available recording devices. " + record_err.ToString()); throw new AudioContextException("Alc Error occured when querying available recording devices. " + record_err.ToString());
}
#if DEBUG #if DEBUG
Debug.WriteLine("Found playback devices:"); Debug.WriteLine("Found playback devices:");
foreach (string s in available_playback_devices) foreach (string s in available_playback_devices)
{
Debug.WriteLine(s); Debug.WriteLine(s);
}
Debug.WriteLine("Default playback device: " + default_playback_device); Debug.WriteLine("Default playback device: " + DefaultPlaybackDevice);
Debug.WriteLine("Found recording devices:"); Debug.WriteLine("Found recording devices:");
foreach (string s in available_recording_devices) foreach (string s in available_recording_devices)
{
Debug.WriteLine(s); Debug.WriteLine(s);
}
Debug.WriteLine("Default recording device: " + default_recording_device); Debug.WriteLine("Default recording device: " + DefaultRecordingDevice);
#endif #endif
} }
catch (DllNotFoundException e) catch (DllNotFoundException e)
{ {
Trace.WriteLine(e.ToString()); Trace.WriteLine(e.ToString());
openal_supported = false; IsOpenALSupported = false;
} }
catch (AudioContextException ace) catch (AudioContextException ace)
{ {
Trace.WriteLine(ace.ToString()); Trace.WriteLine(ace.ToString());
openal_supported = false; IsOpenALSupported = false;
} }
finally finally
{ {
Debug.Unindent(); Debug.Unindent();
if (openal_supported) if (IsOpenALSupported)
{ {
try try
{ {
// clean up the dummy context // clean up the dummy context
Alc.MakeContextCurrent(ContextHandle.Zero); Alc.MakeContextCurrent(ContextHandle.Zero);
if (dummy_context != ContextHandle.Zero && dummy_context.Handle != IntPtr.Zero) if (dummy_context != ContextHandle.Zero && dummy_context.Handle != IntPtr.Zero)
{
Alc.DestroyContext(dummy_context); Alc.DestroyContext(dummy_context);
}
if (dummy_device != IntPtr.Zero) if (dummy_device != IntPtr.Zero)
{
Alc.CloseDevice(dummy_device); Alc.CloseDevice(dummy_device);
} }
}
catch catch
{ {
openal_supported = false; IsOpenALSupported = false;
} }
} }
} }
} }
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,39 +22,27 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
using OpenTK.Audio.OpenAL; using OpenTK.Audio.OpenAL;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
struct AudioDeviceErrorChecker : IDisposable internal struct AudioDeviceErrorChecker : IDisposable
{ {
#region Fields private readonly IntPtr Device;
private static readonly string ErrorString = "Device {0} reported {1}.";
readonly IntPtr Device;
static readonly string ErrorString = "Device {0} reported {1}.";
#endregion
#region Constructors
public AudioDeviceErrorChecker(IntPtr device) public AudioDeviceErrorChecker(IntPtr device)
{ {
if (device == IntPtr.Zero) if (device == IntPtr.Zero)
{
throw new AudioDeviceException(); throw new AudioDeviceException();
}
Device = device; Device = device;
} }
#endregion
#region IDisposable Members
public void Dispose() public void Dispose()
{ {
AlcError err = Alc.GetError(Device); AlcError err = Alc.GetError(Device);
@ -79,7 +66,5 @@ namespace OpenTK.Audio
break; break;
} }
} }
#endregion
} }
} }

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,13 +22,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {
/// <summary>Represents exceptions related to an OpenTK.Audio device.</summary> /// <summary>Represents exceptions related to an OpenTK.Audio device.</summary>

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,12 +22,9 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2009 the Open Toolkit library. // Copyright (c) 2006 - 2009 the Open Toolkit library.
@ -23,11 +22,6 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK.Audio namespace OpenTK.Audio
{ {

View file

@ -1,18 +1,14 @@
#region --- OpenTK.OpenAL License --- /* AlFunctions.cs
/* AlFunctions.cs
* C header: \OpenAL 1.1 SDK\include\Al.h * C header: \OpenAL 1.1 SDK\include\Al.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf * Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Security; using System.Security;
using OpenTK;
/* Type Mapping /* Type Mapping
// 8-bit boolean // 8-bit boolean
typedef char ALboolean; typedef char ALboolean;
@ -71,15 +67,9 @@ namespace OpenTK.Audio.OpenAL
public static partial class AL public static partial class AL
{ {
#region Constants
internal const string Lib = "openal32.dll"; internal const string Lib = "openal32.dll";
private const CallingConvention Style = CallingConvention.Cdecl; private const CallingConvention Style = CallingConvention.Cdecl;
#endregion Constants
#region Renderer State management
/// <summary>This function enables a feature of the OpenAL driver. There are no capabilities defined in OpenAL 1.1 to be used with this function, but it may be used by an extension.</summary> /// <summary>This function enables a feature of the OpenAL driver. There are no capabilities defined in OpenAL 1.1 to be used with this function, but it may be used by an extension.</summary>
/// <param name="capability">The name of a capability to enable.</param> /// <param name="capability">The name of a capability to enable.</param>
[DllImport(AL.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [DllImport(AL.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -99,10 +89,6 @@ namespace OpenTK.Audio.OpenAL
public static extern bool IsEnabled(ALCapability capability); public static extern bool IsEnabled(ALCapability capability);
// AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability ); // AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
#endregion Renderer State management
#region State retrieval
[DllImport(AL.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] [DllImport(AL.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr GetStringPrivate(ALGetString param); // accepts the enums AlError, AlContextString private static extern IntPtr GetStringPrivate(ALGetString param); // accepts the enums AlError, AlContextString
// AL_API const ALchar* AL_APIENTRY alGetString( ALenum param ); // AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
@ -168,10 +154,6 @@ namespace OpenTK.Audio.OpenAL
public static extern ALError GetError(); public static extern ALError GetError();
// AL_API ALenum AL_APIENTRY alGetError( void ); // AL_API ALenum AL_APIENTRY alGetError( void );
#endregion State retrieval
#region Extension support.
///<summary>This function tests if a specific Extension is available for the OpenAL driver.</summary> ///<summary>This function tests if a specific Extension is available for the OpenAL driver.</summary>
/// <param name="extname">A string naming the desired extension. Example: "EAX-RAM"</param> /// <param name="extname">A string naming the desired extension. Example: "EAX-RAM"</param>
/// <returns>Returns True if the Extension is available or False if not available.</returns> /// <returns>Returns True if the Extension is available or False if not available.</returns>
@ -193,8 +175,6 @@ namespace OpenTK.Audio.OpenAL
public static extern int GetEnumValue([In] string ename); public static extern int GetEnumValue([In] string ename);
// AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename ); // AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename );
#endregion Extension support.
/* Listener /* Listener
* Listener represents the location and orientation of the * Listener represents the location and orientation of the
* 'user' in 3D-space. * 'user' in 3D-space.
@ -207,8 +187,6 @@ namespace OpenTK.Audio.OpenAL
* Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors) * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
*/ */
#region Set Listener parameters
/// <summary>This function sets a floating-point property for the listener.</summary> /// <summary>This function sets a floating-point property for the listener.</summary>
/// <param name="param">The name of the attribute to be set: ALListenerf.Gain</param> /// <param name="param">The name of the attribute to be set: ALListenerf.Gain</param>
/// <param name="value">The float value to set the attribute to.</param> /// <param name="value">The float value to set the attribute to.</param>
@ -281,10 +259,6 @@ namespace OpenTK.Audio.OpenAL
// AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 ); // AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
// AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values ); // AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values );
#endregion Set Listener parameters
#region Get Listener parameters
/// <summary>This function retrieves a floating-point property of the listener.</summary> /// <summary>This function retrieves a floating-point property of the listener.</summary>
/// <param name="param">the name of the attribute to be retrieved: ALListenerf.Gain</param> /// <param name="param">the name of the attribute to be retrieved: ALListenerf.Gain</param>
/// <param name="value">a pointer to the floating-point value being retrieved.</param> /// <param name="value">a pointer to the floating-point value being retrieved.</param>
@ -345,8 +319,6 @@ namespace OpenTK.Audio.OpenAL
// AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); // AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
// AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values ); // AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values );
#endregion Get Listener parameters
/* Source /* Source
* Sources represent individual sound objects in 3D-space. * Sources represent individual sound objects in 3D-space.
* Sources take the PCM buffer provided in the specified Buffer, * Sources take the PCM buffer provided in the specified Buffer,
@ -384,10 +356,6 @@ namespace OpenTK.Audio.OpenAL
* Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint * Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
*/ */
#region Create Source objects
#region GenSources()
[DllImport(AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [DllImport(AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
unsafe private static extern void GenSourcesPrivate(int n, [Out] uint* sources); unsafe private static extern void GenSourcesPrivate(int n, [Out] uint* sources);
// AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* Sources ); // AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* Sources );
@ -465,10 +433,6 @@ namespace OpenTK.Audio.OpenAL
GenSources(1, out source); GenSources(1, out source);
} }
#endregion GenSources()
#region DeleteSources()
/// <summary>This function deletes one or more sources.</summary> /// <summary>This function deletes one or more sources.</summary>
/// <param name="n">The number of sources to be deleted.</param> /// <param name="n">The number of sources to be deleted.</param>
/// <param name="sources">Pointer to an array of source names identifying the sources to be deleted.</param> /// <param name="sources">Pointer to an array of source names identifying the sources to be deleted.</param>
@ -495,8 +459,14 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(false)] [CLSCompliant(false)]
public static void DeleteSources(uint[] sources) public static void DeleteSources(uint[] sources)
{ {
if (sources == null) throw new ArgumentNullException(); if (sources == null)
if (sources.Length == 0) throw new ArgumentOutOfRangeException(); {
throw new ArgumentNullException();
}
if (sources.Length == 0)
{
throw new ArgumentOutOfRangeException();
}
DeleteBuffers(sources.Length, ref sources[0]); DeleteBuffers(sources.Length, ref sources[0]);
} }
@ -504,8 +474,14 @@ namespace OpenTK.Audio.OpenAL
/// <param name="sources">An array of source names identifying the sources to be deleted.</param> /// <param name="sources">An array of source names identifying the sources to be deleted.</param>
public static void DeleteSources(int[] sources) public static void DeleteSources(int[] sources)
{ {
if (sources == null) throw new ArgumentNullException(); if (sources == null)
if (sources.Length == 0) throw new ArgumentOutOfRangeException(); {
throw new ArgumentNullException();
}
if (sources.Length == 0)
{
throw new ArgumentOutOfRangeException();
}
DeleteBuffers(sources.Length, ref sources[0]); DeleteBuffers(sources.Length, ref sources[0]);
} }
@ -524,10 +500,6 @@ namespace OpenTK.Audio.OpenAL
DeleteSources(1, ref source); DeleteSources(1, ref source);
} }
#endregion DeleteSources()
#region IsSource()
/// <summary>This function tests if a source name is valid, returning True if valid and False if not.</summary> /// <summary>This function tests if a source name is valid, returning True if valid and False if not.</summary>
/// <param name="sid">A source name to be tested for validity</param> /// <param name="sid">A source name to be tested for validity</param>
/// <returns>Success.</returns> /// <returns>Success.</returns>
@ -543,14 +515,6 @@ namespace OpenTK.Audio.OpenAL
return IsSource((uint)sid); return IsSource((uint)sid);
} }
#endregion IsSource()
#endregion Create Source objects
#region Set Source parameters
#region Sourcef
/// <summary>This function sets a floating-point property of a source.</summary> /// <summary>This function sets a floating-point property of a source.</summary>
/// <param name="sid">Source name whose attribute is being set</param> /// <param name="sid">Source name whose attribute is being set</param>
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param> /// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
@ -568,10 +532,6 @@ namespace OpenTK.Audio.OpenAL
Source((uint)sid, param, value); Source((uint)sid, param, value);
} }
#endregion Sourcef
#region Source3f
/// <summary>This function sets a source property requiring three floating-point values.</summary> /// <summary>This function sets a source property requiring three floating-point values.</summary>
/// <param name="sid">Source name whose attribute is being set.</param> /// <param name="sid">Source name whose attribute is being set.</param>
/// <param name="param">The name of the attribute to set: ALSource3f.Position, Velocity, Direction.</param> /// <param name="param">The name of the attribute to set: ALSource3f.Position, Velocity, Direction.</param>
@ -612,10 +572,6 @@ namespace OpenTK.Audio.OpenAL
Source((uint)sid, param, values.X, values.Y, values.Z); Source((uint)sid, param, values.X, values.Y, values.Z);
} }
#endregion Source3f
#region Sourcei
/// <summary>This function sets an integer property of a source.</summary> /// <summary>This function sets an integer property of a source.</summary>
/// <param name="sid">Source name whose attribute is being set.</param> /// <param name="sid">Source name whose attribute is being set.</param>
/// <param name="param">The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState.</param> /// <param name="param">The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState.</param>
@ -669,10 +625,6 @@ namespace OpenTK.Audio.OpenAL
Source((uint)source, ALSourcei.Buffer, buffer); Source((uint)source, ALSourcei.Buffer, buffer);
} }
#endregion Sourcei
#region Source3i
/// <summary>This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots.</summary> /// <summary>This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots.</summary>
/// <param name="sid">Source name whose attribute is being set.</param> /// <param name="sid">Source name whose attribute is being set.</param>
/// <param name="param">The name of the attribute to set: EfxAuxiliarySendFilter</param> /// <param name="param">The name of the attribute to set: EfxAuxiliarySendFilter</param>
@ -694,18 +646,10 @@ namespace OpenTK.Audio.OpenAL
Source((uint)sid, param, value1, value2, value3); Source((uint)sid, param, value1, value2, value3);
} }
#endregion Source3i
// Not used by any Enum: // Not used by any Enum:
// AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values ); // AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
// AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values ); // AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
#endregion Set Source parameters
#region Get Source parameters
#region GetSourcef
/// <summary>This function retrieves a floating-point property of a source.</summary> /// <summary>This function retrieves a floating-point property of a source.</summary>
/// <param name="sid">Source name whose attribute is being retrieved.</param> /// <param name="sid">Source name whose attribute is being retrieved.</param>
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param> /// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
@ -723,10 +667,6 @@ namespace OpenTK.Audio.OpenAL
GetSource((uint)sid, param, out value); GetSource((uint)sid, param, out value);
} }
#endregion GetSourcef
#region GetSource3f
/// <summary>This function retrieves three floating-point values representing a property of a source.</summary> /// <summary>This function retrieves three floating-point values representing a property of a source.</summary>
/// <param name="sid">Source name whose attribute is being retrieved.</param> /// <param name="sid">Source name whose attribute is being retrieved.</param>
/// <param name="param">the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction.</param> /// <param name="param">the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction.</param>
@ -767,10 +707,6 @@ namespace OpenTK.Audio.OpenAL
GetSource((uint)sid, param, out values.X, out values.Y, out values.Z); GetSource((uint)sid, param, out values.X, out values.Y, out values.Z);
} }
#endregion GetSource3f
#region GetSourcei
/// <summary>This function retrieves an integer property of a source.</summary> /// <summary>This function retrieves an integer property of a source.</summary>
/// <param name="sid">Source name whose attribute is being retrieved.</param> /// <param name="sid">Source name whose attribute is being retrieved.</param>
/// <param name="param">The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed.</param> /// <param name="param">The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed.</param>
@ -811,19 +747,11 @@ namespace OpenTK.Audio.OpenAL
value = result != 0; value = result != 0;
} }
#endregion GetSourcei
// Not used by any Enum: // Not used by any Enum:
// AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); // AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
// AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values ); // AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
// AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values ); // AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
#endregion Get Source parameters
#region Source vector based playback calls
#region SourcePlay
/// <summary>This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary> /// <summary>This function plays a set of sources. The playing sources will have their state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
/// <param name="ns">The number of sources to be played.</param> /// <param name="ns">The number of sources to be played.</param>
/// <param name="sids">A pointer to an array of sources to be played.</param> /// <param name="sids">A pointer to an array of sources to be played.</param>
@ -874,10 +802,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion SourcePlay
#region SourceStop
/// <summary>This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped.</summary> /// <summary>This function stops a set of sources. The stopped sources will have their state changed to ALSourceState.Stopped.</summary>
/// <param name="ns">The number of sources to stop.</param> /// <param name="ns">The number of sources to stop.</param>
/// <param name="sids">A pointer to an array of sources to be stopped.</param> /// <param name="sids">A pointer to an array of sources to be stopped.</param>
@ -928,10 +852,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion SourceStop
#region SourceRewind
/// <summary>This function stops a set of sources and sets all their states to ALSourceState.Initial.</summary> /// <summary>This function stops a set of sources and sets all their states to ALSourceState.Initial.</summary>
/// <param name="ns">The number of sources to be rewound.</param> /// <param name="ns">The number of sources to be rewound.</param>
/// <param name="sids">A pointer to an array of sources to be rewound.</param> /// <param name="sids">A pointer to an array of sources to be rewound.</param>
@ -982,10 +902,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion SourceRewind
#region SourcePause
/// <summary>This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused.</summary> /// <summary>This function pauses a set of sources. The paused sources will have their state changed to ALSourceState.Paused.</summary>
/// <param name="ns">The number of sources to be paused.</param> /// <param name="ns">The number of sources to be paused.</param>
/// <param name="sids">A pointer to an array of sources to be paused.</param> /// <param name="sids">A pointer to an array of sources to be paused.</param>
@ -1035,14 +951,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion SourcePause
#endregion Source vector based playback calls
#region Source based playback calls
#region SourcePlay
/// <summary>This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary> /// <summary>This function plays, replays or resumes a source. The playing source will have it's state changed to ALSourceState.Playing. When called on a source which is already playing, the source will restart at the beginning. When the attached buffer(s) are done playing, the source will progress to the ALSourceState.Stopped state.</summary>
/// <param name="sid">The name of the source to be played.</param> /// <param name="sid">The name of the source to be played.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePlay", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -1056,10 +964,6 @@ namespace OpenTK.Audio.OpenAL
SourcePlay((uint)sid); SourcePlay((uint)sid);
} }
#endregion SourcePlay
#region SourceStop
/// <summary>This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped.</summary> /// <summary>This function stops a source. The stopped source will have it's state changed to ALSourceState.Stopped.</summary>
/// <param name="sid">The name of the source to be stopped.</param> /// <param name="sid">The name of the source to be stopped.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceStop", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceStop", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -1073,10 +977,6 @@ namespace OpenTK.Audio.OpenAL
SourceStop((uint)sid); SourceStop((uint)sid);
} }
#endregion SourceStop
#region SourceRewind
/// <summary>This function stops the source and sets its state to ALSourceState.Initial.</summary> /// <summary>This function stops the source and sets its state to ALSourceState.Initial.</summary>
/// <param name="sid">The name of the source to be rewound.</param> /// <param name="sid">The name of the source to be rewound.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceRewind", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceRewind", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -1090,10 +990,6 @@ namespace OpenTK.Audio.OpenAL
SourceRewind((uint)sid); SourceRewind((uint)sid);
} }
#endregion SourceRewind
#region SourcePause
/// <summary>This function pauses a source. The paused source will have its state changed to ALSourceState.Paused.</summary> /// <summary>This function pauses a source. The paused source will have its state changed to ALSourceState.Paused.</summary>
/// <param name="sid">The name of the source to be paused.</param> /// <param name="sid">The name of the source to be paused.</param>
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePause", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourcePause", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -1107,14 +1003,6 @@ namespace OpenTK.Audio.OpenAL
SourcePause((uint)sid); SourcePause((uint)sid);
} }
#endregion SourcePause
#endregion Source based playback calls
#region Source Queuing
#region SourceQueueBuffers
/// <summary>This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming.</summary> /// <summary>This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming.</summary>
/// <param name="sid">The name of the source to queue buffers onto.</param> /// <param name="sid">The name of the source to queue buffers onto.</param>
/// <param name="numEntries">The number of buffers to be queued.</param> /// <param name="numEntries">The number of buffers to be queued.</param>
@ -1177,10 +1065,6 @@ namespace OpenTK.Audio.OpenAL
unsafe { AL.SourceQueueBuffers((uint)source, 1, (uint*)&buffer); } unsafe { AL.SourceQueueBuffers((uint)source, 1, (uint*)&buffer); }
} }
#endregion SourceQueueBuffers
#region SourceUnqueueBuffers
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary> /// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
/// <param name="sid">The name of the source to unqueue buffers from.</param> /// <param name="sid">The name of the source to unqueue buffers from.</param>
/// <param name="numEntries">The number of buffers to be unqueued.</param> /// <param name="numEntries">The number of buffers to be unqueued.</param>
@ -1233,16 +1117,15 @@ namespace OpenTK.Audio.OpenAL
/// <param name="numEntries">The number of buffers to be unqueued.</param> /// <param name="numEntries">The number of buffers to be unqueued.</param>
public static int[] SourceUnqueueBuffers(int sid, int numEntries) public static int[] SourceUnqueueBuffers(int sid, int numEntries)
{ {
if (numEntries <= 0) throw new ArgumentOutOfRangeException("numEntries", "Must be greater than zero."); if (numEntries <= 0)
{
throw new ArgumentOutOfRangeException("numEntries", "Must be greater than zero.");
}
int[] buf = new int[numEntries]; int[] buf = new int[numEntries];
SourceUnqueueBuffers(sid, numEntries, buf); SourceUnqueueBuffers(sid, numEntries, buf);
return buf; return buf;
} }
#endregion SourceUnqueueBuffers
#endregion Source Queuing
/* /*
* Buffer * Buffer
* Buffer objects are storage space for sample buffer. * Buffer objects are storage space for sample buffer.
@ -1257,10 +1140,6 @@ namespace OpenTK.Audio.OpenAL
* Channels (Query only) AL_CHANNELS ALint * Channels (Query only) AL_CHANNELS ALint
*/ */
#region Buffer objects
#region GenBuffers
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary> /// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
/// <param name="n">The number of buffers to be generated.</param> /// <param name="n">The number of buffers to be generated.</param>
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param> /// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
@ -1332,10 +1211,6 @@ namespace OpenTK.Audio.OpenAL
GenBuffers(1, out buffer); GenBuffers(1, out buffer);
} }
#endregion GenBuffers
#region DeleteBuffers
/// <summary>This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary> /// <summary>This function deletes one or more buffers, freeing the resources used by the buffer. Buffers which are attached to a source can not be deleted. See AL.Source (ALSourcei) and AL.SourceUnqueueBuffers for information on how to detach a buffer from a source.</summary>
/// <param name="n">The number of buffers to be deleted.</param> /// <param name="n">The number of buffers to be deleted.</param>
/// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param> /// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param>
@ -1385,8 +1260,14 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(false)] [CLSCompliant(false)]
public static void DeleteBuffers(uint[] buffers) public static void DeleteBuffers(uint[] buffers)
{ {
if (buffers == null) throw new ArgumentNullException(); if (buffers == null)
if (buffers.Length == 0) throw new ArgumentOutOfRangeException(); {
throw new ArgumentNullException();
}
if (buffers.Length == 0)
{
throw new ArgumentOutOfRangeException();
}
DeleteBuffers(buffers.Length, ref buffers[0]); DeleteBuffers(buffers.Length, ref buffers[0]);
} }
@ -1394,8 +1275,14 @@ namespace OpenTK.Audio.OpenAL
/// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param> /// <param name="buffers">Pointer to an array of buffer names identifying the buffers to be deleted.</param>
public static void DeleteBuffers(int[] buffers) public static void DeleteBuffers(int[] buffers)
{ {
if (buffers == null) throw new ArgumentNullException(); if (buffers == null)
if (buffers.Length == 0) throw new ArgumentOutOfRangeException(); {
throw new ArgumentNullException();
}
if (buffers.Length == 0)
{
throw new ArgumentOutOfRangeException();
}
DeleteBuffers(buffers.Length, ref buffers[0]); DeleteBuffers(buffers.Length, ref buffers[0]);
} }
@ -1414,10 +1301,6 @@ namespace OpenTK.Audio.OpenAL
DeleteBuffers(1, ref buffer); DeleteBuffers(1, ref buffer);
} }
#endregion DeleteBuffers
#region IsBuffer
/// <summary>This function tests if a buffer name is valid, returning True if valid, False if not.</summary> /// <summary>This function tests if a buffer name is valid, returning True if valid, False if not.</summary>
/// <param name="bid">A buffer Handle previously allocated with <see cref="GenBuffers(int)"/>.</param> /// <param name="bid">A buffer Handle previously allocated with <see cref="GenBuffers(int)"/>.</param>
/// <returns>Success.</returns> /// <returns>Success.</returns>
@ -1434,10 +1317,6 @@ namespace OpenTK.Audio.OpenAL
return IsBuffer(temp); return IsBuffer(temp);
} }
#endregion IsBuffer
#region BufferData
/// <summary>This function fills a buffer with audio buffer. All the pre-defined formats are PCM buffer, but this function may be used by extensions to load other buffer types as well.</summary> /// <summary>This function fills a buffer with audio buffer. All the pre-defined formats are PCM buffer, but this function may be used by extensions to load other buffer types as well.</summary>
/// <param name="bid">buffer Handle/Name to be filled with buffer.</param> /// <param name="bid">buffer Handle/Name to be filled with buffer.</param>
/// <param name="format">Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16.</param> /// <param name="format">Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16.</param>
@ -1469,19 +1348,15 @@ namespace OpenTK.Audio.OpenAL
where TBuffer : struct where TBuffer : struct
{ {
if (!BlittableValueType.Check(buffer)) if (!BlittableValueType.Check(buffer))
{
throw new ArgumentException("buffer"); throw new ArgumentException("buffer");
}
GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
try { BufferData(bid, format, handle.AddrOfPinnedObject(), size, freq); } try { BufferData(bid, format, handle.AddrOfPinnedObject(), size, freq); }
finally { handle.Free(); } finally { handle.Free(); }
} }
#endregion BufferData
#endregion Buffer objects
#region Set Buffer parameters (currently parameters can only be read)
/* /*
Remarks (from Manual) Remarks (from Manual)
* There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by this call, * There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by this call,
@ -1504,12 +1379,6 @@ namespace OpenTK.Audio.OpenAL
Buffer3f( bid, param, values.X, values.Y, values.Z ); Buffer3f( bid, param, values.X, values.Y, values.Z );
}*/ }*/
#endregion Set Buffer parameters
#region Get Buffer parameters
#region GetBufferi
/// <summary>This function retrieves an integer property of a buffer.</summary> /// <summary>This function retrieves an integer property of a buffer.</summary>
/// <param name="bid">Buffer name whose attribute is being retrieved</param> /// <param name="bid">Buffer name whose attribute is being retrieved</param>
/// <param name="param">The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous).</param> /// <param name="param">The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous).</param>
@ -1527,18 +1396,12 @@ namespace OpenTK.Audio.OpenAL
GetBuffer((uint)bid, param, out value); GetBuffer((uint)bid, param, out value);
} }
#endregion GetBufferi
// AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value ); // AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
// AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); // AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
// AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values ); // AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
// AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); // AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
// AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values ); // AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
#endregion Get Buffer parameters
#region Global Parameters
/// <summary>AL.DopplerFactor is a simple scaling of source and listener velocities to exaggerate or deemphasize the Doppler (pitch) shift resulting from the calculation.</summary> /// <summary>AL.DopplerFactor is a simple scaling of source and listener velocities to exaggerate or deemphasize the Doppler (pitch) shift resulting from the calculation.</summary>
/// <param name="value">A negative value will result in an error, the command is then ignored. The default value is 1f. The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound.</param> /// <param name="value">A negative value will result in an error, the command is then ignored. The default value is 1f. The current setting can be queried using AL.Get with parameter ALGetFloat.SpeedOfSound.</param>
[DllImport(AL.Lib, EntryPoint = "alDopplerFactor", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()] [DllImport(AL.Lib, EntryPoint = "alDopplerFactor", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
@ -1592,10 +1455,6 @@ namespace OpenTK.Audio.OpenAL
public static extern void DistanceModel(ALDistanceModel distancemodel); public static extern void DistanceModel(ALDistanceModel distancemodel);
// AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel ); // AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
#endregion Global Parameters
#region Helpers
/// <summary>(Helper) Returns Source state information.</summary> /// <summary>(Helper) Returns Source state information.</summary>
/// <param name="sid">The source to be queried.</param> /// <param name="sid">The source to be queried.</param>
/// <returns>state information from OpenAL.</returns> /// <returns>state information from OpenAL.</returns>
@ -1646,7 +1505,5 @@ namespace OpenTK.Audio.OpenAL
{ {
return (ALDistanceModel)AL.Get(ALGetInteger.DistanceModel); return (ALDistanceModel)AL.Get(ALGetInteger.DistanceModel);
} }
#endregion Helpers
} }
} }

View file

@ -1,13 +1,9 @@
#region --- OpenTK.OpenAL License --- /* AlTokens.cs
/* AlTokens.cs
* C header: \OpenAL 1.1 SDK\include\Al.h * C header: \OpenAL 1.1 SDK\include\Al.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf * Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System;
namespace OpenTK.Audio.OpenAL namespace OpenTK.Audio.OpenAL
{ {

View file

@ -1,11 +1,9 @@
#region --- OpenTK.OpenAL License --- /* EfxFunctions.cs
/* EfxFunctions.cs
* C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h" * C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h"
* Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK) * Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK)
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -19,10 +17,6 @@ namespace OpenTK.Audio.OpenAL
/// </summary> /// </summary>
public partial class EffectsExtension public partial class EffectsExtension
{ {
#region Helpers
#region BindEffect
/// <summary>(Helper) Selects the Effect type used by this Effect handle.</summary> /// <summary>(Helper) Selects the Effect type used by this Effect handle.</summary>
/// <param name="eid">Effect id returned from a successful call to GenEffects.</param> /// <param name="eid">Effect id returned from a successful call to GenEffects.</param>
/// <param name="type">Effect type.</param> /// <param name="type">Effect type.</param>
@ -41,10 +35,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alEffecti((uint)eid, EfxEffecti.EffectType, (int)type); Imported_alEffecti((uint)eid, EfxEffecti.EffectType, (int)type);
} }
#endregion BindEffect
#region BindFilterToSource
/// <summary>(Helper) reroutes the output of a Source through a Filter.</summary> /// <summary>(Helper) reroutes the output of a Source through a Filter.</summary>
/// <param name="source">A valid Source handle.</param> /// <param name="source">A valid Source handle.</param>
/// <param name="filter">A valid Filter handle.</param> /// <param name="filter">A valid Filter handle.</param>
@ -63,10 +53,6 @@ namespace OpenTK.Audio.OpenAL
AL.Source((uint)source, ALSourcei.EfxDirectFilter, (int)filter); AL.Source((uint)source, ALSourcei.EfxDirectFilter, (int)filter);
} }
#endregion BindFilterToSource
#region BindEffectToAuxiliarySlot
/// <summary>(Helper) Attaches an Effect to an Auxiliary Effect Slot.</summary> /// <summary>(Helper) Attaches an Effect to an Auxiliary Effect Slot.</summary>
/// <param name="auxiliaryeffectslot">The slot handle to attach the Effect to.</param> /// <param name="auxiliaryeffectslot">The slot handle to attach the Effect to.</param>
/// <param name="effect">The Effect handle that is being attached.</param> /// <param name="effect">The Effect handle that is being attached.</param>
@ -85,10 +71,6 @@ namespace OpenTK.Audio.OpenAL
AuxiliaryEffectSlot((uint)auxiliaryeffectslot, EfxAuxiliaryi.EffectslotEffect, (int)effect); AuxiliaryEffectSlot((uint)auxiliaryeffectslot, EfxAuxiliaryi.EffectslotEffect, (int)effect);
} }
#endregion BindEffectToAuxiliarySlot
#region BindSourceToAuxiliarySlot
/// <summary>(Helper) Reroutes a Source's output into an Auxiliary Effect Slot.</summary> /// <summary>(Helper) Reroutes a Source's output into an Auxiliary Effect Slot.</summary>
/// <param name="source">The Source handle who's output is forwarded.</param> /// <param name="source">The Source handle who's output is forwarded.</param>
/// <param name="slot">The Auxiliary Effect Slot handle that receives input from the Source.</param> /// <param name="slot">The Auxiliary Effect Slot handle that receives input from the Source.</param>
@ -111,14 +93,6 @@ namespace OpenTK.Audio.OpenAL
AL.Source((uint)source, ALSource3i.EfxAuxiliarySendFilter, (int)slot, (int)slotnumber, (int)filter); AL.Source((uint)source, ALSource3i.EfxAuxiliarySendFilter, (int)slot, (int)slotnumber, (int)filter);
} }
#endregion BindSourceToAuxiliarySlot
#endregion Helpers
#region Effect Object
#region alGenEffects
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGenEffects(int n, [Out] uint* effects); unsafe private delegate void Delegate_alGenEffects(int n, [Out] uint* effects);
// typedef void (__cdecl *LPALGENEFFECTS)( ALsizei n, ALuint* effects ); // typedef void (__cdecl *LPALGENEFFECTS)( ALsizei n, ALuint* effects );
@ -167,7 +141,10 @@ namespace OpenTK.Audio.OpenAL
/// </remarks> /// </remarks>
public int[] GenEffects(int n) public int[] GenEffects(int n)
{ {
if (n <= 0) throw new ArgumentOutOfRangeException("n", "Must be higher than 0."); if (n <= 0)
{
throw new ArgumentOutOfRangeException("n", "Must be higher than 0.");
}
int[] effects = new int[n]; int[] effects = new int[n];
GenEffects(n, out effects[0]); GenEffects(n, out effects[0]);
return effects; return effects;
@ -202,10 +179,6 @@ namespace OpenTK.Audio.OpenAL
} }
#endregion alGenEffects
#region alDeleteEffects
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alDeleteEffects(int n, [In] uint* effects); unsafe private delegate void Delegate_alDeleteEffects(int n, [In] uint* effects);
// typedef void (__cdecl *LPALDELETEEFFECTS)( ALsizei n, ALuint* effects ); // typedef void (__cdecl *LPALDELETEEFFECTS)( ALsizei n, ALuint* effects );
@ -246,7 +219,10 @@ namespace OpenTK.Audio.OpenAL
/// <param name="effects">Pointer to n Effect object identifiers.</param> /// <param name="effects">Pointer to n Effect object identifiers.</param>
public void DeleteEffects(int[] effects) public void DeleteEffects(int[] effects)
{ {
if (effects == null) throw new ArgumentNullException("effects"); if (effects == null)
{
throw new ArgumentNullException("effects");
}
DeleteEffects(effects.Length, ref effects[0]); DeleteEffects(effects.Length, ref effects[0]);
} }
@ -255,7 +231,10 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(false)] [CLSCompliant(false)]
public void DeleteEffects(uint[] effects) public void DeleteEffects(uint[] effects)
{ {
if (effects == null) throw new ArgumentNullException("effects"); if (effects == null)
{
throw new ArgumentNullException("effects");
}
DeleteEffects(effects.Length, ref effects[0]); DeleteEffects(effects.Length, ref effects[0]);
} }
@ -280,10 +259,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion alDeleteEffects
#region alIsEffect
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate bool Delegate_alIsEffect(uint eid); private delegate bool Delegate_alIsEffect(uint eid);
// typedef ALboolean (__cdecl *LPALISEFFECT)( ALuint eid ); // typedef ALboolean (__cdecl *LPALISEFFECT)( ALuint eid );
@ -309,10 +284,6 @@ namespace OpenTK.Audio.OpenAL
return Imported_alIsEffect((uint)eid); return Imported_alIsEffect((uint)eid);
} }
#endregion alIsEffect
#region alEffecti
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alEffecti(uint eid, EfxEffecti param, int value); private delegate void Delegate_alEffecti(uint eid, EfxEffecti param, int value);
// typedef void (__cdecl *LPALEFFECTI)( ALuint eid, ALenum param, ALint value); // typedef void (__cdecl *LPALEFFECTI)( ALuint eid, ALenum param, ALint value);
@ -340,10 +311,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alEffecti((uint)eid, param, value); Imported_alEffecti((uint)eid, param, value);
} }
#endregion alEffecti
#region alEffectf
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alEffectf(uint eid, EfxEffectf param, float value); private delegate void Delegate_alEffectf(uint eid, EfxEffectf param, float value);
// typedef void (__cdecl *LPALEFFECTF)( ALuint eid, ALenum param, ALfloat value); // typedef void (__cdecl *LPALEFFECTF)( ALuint eid, ALenum param, ALfloat value);
@ -371,10 +338,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alEffectf((uint)eid, param, value); Imported_alEffectf((uint)eid, param, value);
} }
#endregion alEffectf
#region alEffectfv
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alEffectfv(uint eid, EfxEffect3f param, [In] float* values); unsafe private delegate void Delegate_alEffectfv(uint eid, EfxEffect3f param, [In] float* values);
// typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values ); // typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values );
@ -408,10 +371,6 @@ namespace OpenTK.Audio.OpenAL
Effect((uint)eid, param, ref values); Effect((uint)eid, param, ref values);
} }
#endregion alEffectfv
#region alGetEffecti
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetEffecti(uint eid, EfxEffecti pname, [Out] int* value); unsafe private delegate void Delegate_alGetEffecti(uint eid, EfxEffecti pname, [Out] int* value);
// typedef void (__cdecl *LPALGETEFFECTI)( ALuint eid, ALenum pname, ALint* value ); // typedef void (__cdecl *LPALGETEFFECTI)( ALuint eid, ALenum pname, ALint* value );
@ -445,10 +404,6 @@ namespace OpenTK.Audio.OpenAL
GetEffect((uint)eid, pname, out value); GetEffect((uint)eid, pname, out value);
} }
#endregion alGetEffecti
#region alGetEffectf
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetEffectf(uint eid, EfxEffectf pname, [Out]float* value); unsafe private delegate void Delegate_alGetEffectf(uint eid, EfxEffectf pname, [Out]float* value);
// typedef void (__cdecl *LPALGETEFFECTF)( ALuint eid, ALenum pname, ALfloat* value ); // typedef void (__cdecl *LPALGETEFFECTF)( ALuint eid, ALenum pname, ALfloat* value );
@ -482,10 +437,6 @@ namespace OpenTK.Audio.OpenAL
GetEffect((uint)eid, pname, out value); GetEffect((uint)eid, pname, out value);
} }
#endregion alGetEffectf
#region alGetEffectfv
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetEffectfv(uint eid, EfxEffect3f param, [Out] float* values); unsafe private delegate void Delegate_alGetEffectfv(uint eid, EfxEffect3f param, [Out] float* values);
// typedef void (__cdecl *LPALGETEFFECTFV)( ALuint eid, ALenum pname, ALfloat* values ); // typedef void (__cdecl *LPALGETEFFECTFV)( ALuint eid, ALenum pname, ALfloat* values );
@ -522,18 +473,10 @@ namespace OpenTK.Audio.OpenAL
GetEffect((uint)eid, param, out values); GetEffect((uint)eid, param, out values);
} }
#endregion alGetEffectfv
// Not used: // Not used:
// typedef void (__cdecl *LPALEFFECTIV)( ALuint eid, ALenum param, ALint* values ); // typedef void (__cdecl *LPALEFFECTIV)( ALuint eid, ALenum param, ALint* values );
// typedef void (__cdecl *LPALGETEFFECTIV)( ALuint eid, ALenum pname, ALint* values ); // typedef void (__cdecl *LPALGETEFFECTIV)( ALuint eid, ALenum pname, ALint* values );
#endregion Effect Object
#region Filter Object
#region alGenFilters
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGenFilters(int n, [Out] uint* filters); unsafe private delegate void Delegate_alGenFilters(int n, [Out] uint* filters);
// typedef void (__cdecl *LPALGENFILTERS)( ALsizei n, ALuint* filters ); // typedef void (__cdecl *LPALGENFILTERS)( ALsizei n, ALuint* filters );
@ -582,7 +525,10 @@ namespace OpenTK.Audio.OpenAL
public int[] GenFilters(int n) public int[] GenFilters(int n)
{ {
if (n <= 0) throw new ArgumentOutOfRangeException("n", "Must be higher than 0."); if (n <= 0)
{
throw new ArgumentOutOfRangeException("n", "Must be higher than 0.");
}
int[] filters = new int[n]; int[] filters = new int[n];
GenFilters(filters.Length, out filters[0]); GenFilters(filters.Length, out filters[0]);
return filters; return filters;
@ -612,10 +558,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion alGenFilters
#region alDeleteFilters
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alDeleteFilters(int n, [In] uint* filters); unsafe private delegate void Delegate_alDeleteFilters(int n, [In] uint* filters);
// typedef void (__cdecl *LPALDELETEFILTERS)( ALsizei n, ALuint* filters ); // typedef void (__cdecl *LPALDELETEFILTERS)( ALsizei n, ALuint* filters );
@ -657,7 +599,10 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(false)] [CLSCompliant(false)]
public void DeleteFilters(uint[] filters) public void DeleteFilters(uint[] filters)
{ {
if (filters == null) throw new ArgumentNullException("filters"); if (filters == null)
{
throw new ArgumentNullException("filters");
}
DeleteFilters(filters.Length, ref filters[0]); DeleteFilters(filters.Length, ref filters[0]);
} }
@ -665,7 +610,10 @@ namespace OpenTK.Audio.OpenAL
/// <param name="filters">Pointer to an filter name/handle identifying the Filter Object to be deleted.</param> /// <param name="filters">Pointer to an filter name/handle identifying the Filter Object to be deleted.</param>
public void DeleteFilters(int[] filters) public void DeleteFilters(int[] filters)
{ {
if (filters == null) throw new ArgumentNullException("filters"); if (filters == null)
{
throw new ArgumentNullException("filters");
}
DeleteFilters(filters.Length, ref filters[0]); DeleteFilters(filters.Length, ref filters[0]);
} }
@ -690,10 +638,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion alDeleteFilters
#region alIsFilter
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate bool Delegate_alIsFilter(uint fid); private delegate bool Delegate_alIsFilter(uint fid);
// typedef ALboolean (__cdecl *LPALISFILTER)( ALuint fid ); // typedef ALboolean (__cdecl *LPALISFILTER)( ALuint fid );
@ -719,10 +663,6 @@ namespace OpenTK.Audio.OpenAL
return Imported_alIsFilter((uint)fid); return Imported_alIsFilter((uint)fid);
} }
#endregion alIsFilter
#region alFilteri
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alFilteri(uint fid, EfxFilteri param, int value); private delegate void Delegate_alFilteri(uint fid, EfxFilteri param, int value);
// typedef void (__cdecl *LPALFILTERI)( ALuint fid, ALenum param, ALint value ); // typedef void (__cdecl *LPALFILTERI)( ALuint fid, ALenum param, ALint value );
@ -750,10 +690,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alFilteri((uint)fid, param, value); Imported_alFilteri((uint)fid, param, value);
} }
#endregion alFilteri
#region alFilterf
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alFilterf(uint fid, EfxFilterf param, float value); private delegate void Delegate_alFilterf(uint fid, EfxFilterf param, float value);
// typedef void (__cdecl *LPALFILTERF)( ALuint fid, ALenum param, ALfloat value); // typedef void (__cdecl *LPALFILTERF)( ALuint fid, ALenum param, ALfloat value);
@ -781,10 +717,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alFilterf((uint)fid, param, value); Imported_alFilterf((uint)fid, param, value);
} }
#endregion alFilterf
#region alGetFilteri
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetFilteri(uint fid, EfxFilteri pname, [Out] int* value); unsafe private delegate void Delegate_alGetFilteri(uint fid, EfxFilteri pname, [Out] int* value);
// typedef void (__cdecl *LPALGETFILTERI)( ALuint fid, ALenum pname, ALint* value ); // typedef void (__cdecl *LPALGETFILTERI)( ALuint fid, ALenum pname, ALint* value );
@ -818,10 +750,6 @@ namespace OpenTK.Audio.OpenAL
GetFilter((uint)fid, pname, out value); GetFilter((uint)fid, pname, out value);
} }
#endregion alGetFilteri
#region alGetFilterf
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetFilterf(uint fid, EfxFilterf pname, [Out] float* value); unsafe private delegate void Delegate_alGetFilterf(uint fid, EfxFilterf pname, [Out] float* value);
// typedef void (__cdecl *LPALGETFILTERF)( ALuint fid, ALenum pname, ALfloat* value ); // typedef void (__cdecl *LPALGETFILTERF)( ALuint fid, ALenum pname, ALfloat* value );
@ -855,20 +783,12 @@ namespace OpenTK.Audio.OpenAL
GetFilter((uint)fid, pname, out value); GetFilter((uint)fid, pname, out value);
} }
#endregion alGetFilterf
// Not used: // Not used:
// typedef void (__cdecl *LPALFILTERIV)( ALuint fid, ALenum param, ALint* values ); // typedef void (__cdecl *LPALFILTERIV)( ALuint fid, ALenum param, ALint* values );
// typedef void (__cdecl *LPALFILTERFV)( ALuint fid, ALenum param, ALfloat* values ); // typedef void (__cdecl *LPALFILTERFV)( ALuint fid, ALenum param, ALfloat* values );
// typedef void (__cdecl *LPALGETFILTERIV)( ALuint fid, ALenum pname, ALint* values ); // typedef void (__cdecl *LPALGETFILTERIV)( ALuint fid, ALenum pname, ALint* values );
// typedef void (__cdecl *LPALGETFILTERFV)( ALuint fid, ALenum pname, ALfloat* values ); // typedef void (__cdecl *LPALGETFILTERFV)( ALuint fid, ALenum pname, ALfloat* values );
#endregion Filter Object
#region Auxiliary Effect Slot Object
#region alGenAuxiliaryEffectSlots
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGenAuxiliaryEffectSlots(int n, [Out] uint* slots); unsafe private delegate void Delegate_alGenAuxiliaryEffectSlots(int n, [Out] uint* slots);
// typedef void (__cdecl *LPALGENAUXILIARYEFFECTSLOTS)( ALsizei n, ALuint* slots ); // typedef void (__cdecl *LPALGENAUXILIARYEFFECTSLOTS)( ALsizei n, ALuint* slots );
@ -915,7 +835,10 @@ namespace OpenTK.Audio.OpenAL
/// <returns>Pointer addressing sufficient memory to store n Effect Slot object identifiers.</returns> /// <returns>Pointer addressing sufficient memory to store n Effect Slot object identifiers.</returns>
public int[] GenAuxiliaryEffectSlots(int n) public int[] GenAuxiliaryEffectSlots(int n)
{ {
if (n <= 0) throw new ArgumentOutOfRangeException("n", "Must be higher than 0."); if (n <= 0)
{
throw new ArgumentOutOfRangeException("n", "Must be higher than 0.");
}
int[] slots = new int[n]; int[] slots = new int[n];
GenAuxiliaryEffectSlots(slots.Length, out slots[0]); GenAuxiliaryEffectSlots(slots.Length, out slots[0]);
return slots; return slots;
@ -945,10 +868,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion alGenAuxiliaryEffectSlots
#region DeleteAuxiliaryEffectSlots
unsafe private delegate void Delegate_alDeleteAuxiliaryEffectSlots(int n, [In] uint* slots); unsafe private delegate void Delegate_alDeleteAuxiliaryEffectSlots(int n, [In] uint* slots);
// typedef void (__cdecl *LPALDELETEAUXILIARYEFFECTSLOTS)( ALsizei n, ALuint* slots ); // typedef void (__cdecl *LPALDELETEAUXILIARYEFFECTSLOTS)( ALsizei n, ALuint* slots );
@ -987,7 +906,10 @@ namespace OpenTK.Audio.OpenAL
/// <param name="slots">Pointer to n Effect Slot object identifiers.</param> /// <param name="slots">Pointer to n Effect Slot object identifiers.</param>
public void DeleteAuxiliaryEffectSlots(int[] slots) public void DeleteAuxiliaryEffectSlots(int[] slots)
{ {
if (slots == null) throw new ArgumentNullException("slots"); if (slots == null)
{
throw new ArgumentNullException("slots");
}
DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]); DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]);
} }
@ -996,7 +918,10 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(false)] [CLSCompliant(false)]
public void DeleteAuxiliaryEffectSlots(uint[] slots) public void DeleteAuxiliaryEffectSlots(uint[] slots)
{ {
if (slots == null) throw new ArgumentNullException("slots"); if (slots == null)
{
throw new ArgumentNullException("slots");
}
DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]); DeleteAuxiliaryEffectSlots(slots.Length, ref slots[0]);
} }
@ -1021,10 +946,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion alDeleteAuxiliaryEffectSlots
#region alIsAuxiliaryEffectSlot
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate bool Delegate_alIsAuxiliaryEffectSlot(uint slot); private delegate bool Delegate_alIsAuxiliaryEffectSlot(uint slot);
// typedef ALboolean (__cdecl *LPALISAUXILIARYEFFECTSLOT)( ALuint slot ); // typedef ALboolean (__cdecl *LPALISAUXILIARYEFFECTSLOT)( ALuint slot );
@ -1050,10 +971,6 @@ namespace OpenTK.Audio.OpenAL
return Imported_alIsAuxiliaryEffectSlot((uint)slot); return Imported_alIsAuxiliaryEffectSlot((uint)slot);
} }
#endregion alIsAuxiliaryEffectSlot
#region alAuxiliaryEffectSloti
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alAuxiliaryEffectSloti(uint asid, EfxAuxiliaryi param, int value); private delegate void Delegate_alAuxiliaryEffectSloti(uint asid, EfxAuxiliaryi param, int value);
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum param, ALint value ); // typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum param, ALint value );
@ -1081,10 +998,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alAuxiliaryEffectSloti((uint)asid, param, value); Imported_alAuxiliaryEffectSloti((uint)asid, param, value);
} }
#endregion alAuxiliaryEffectSloti
#region alAuxiliaryEffectSlotf
//[CLSCompliant(false)] //[CLSCompliant(false)]
private delegate void Delegate_alAuxiliaryEffectSlotf(uint asid, EfxAuxiliaryf param, float value); private delegate void Delegate_alAuxiliaryEffectSlotf(uint asid, EfxAuxiliaryf param, float value);
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum param, ALfloat value ); // typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum param, ALfloat value );
@ -1112,10 +1025,6 @@ namespace OpenTK.Audio.OpenAL
Imported_alAuxiliaryEffectSlotf((uint)asid, param, value); Imported_alAuxiliaryEffectSlotf((uint)asid, param, value);
} }
#endregion alAuxiliaryEffectSlotf
#region alGetAuxiliaryEffectSloti
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetAuxiliaryEffectSloti(uint asid, EfxAuxiliaryi pname, [Out] int* value); unsafe private delegate void Delegate_alGetAuxiliaryEffectSloti(uint asid, EfxAuxiliaryi pname, [Out] int* value);
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum pname, ALint* value ); // typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum pname, ALint* value );
@ -1149,10 +1058,6 @@ namespace OpenTK.Audio.OpenAL
GetAuxiliaryEffectSlot((uint)asid, pname, out value); GetAuxiliaryEffectSlot((uint)asid, pname, out value);
} }
#endregion alGetAuxiliaryEffectSloti
#region alGetAuxiliaryEffectSlotf
//[CLSCompliant(false)] //[CLSCompliant(false)]
unsafe private delegate void Delegate_alGetAuxiliaryEffectSlotf(uint asid, EfxAuxiliaryf pname, [Out] float* value); unsafe private delegate void Delegate_alGetAuxiliaryEffectSlotf(uint asid, EfxAuxiliaryf pname, [Out] float* value);
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum pname, ALfloat* value ); // typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum pname, ALfloat* value );
@ -1186,38 +1091,26 @@ namespace OpenTK.Audio.OpenAL
GetAuxiliaryEffectSlot((uint)asid, pname, out value); GetAuxiliaryEffectSlot((uint)asid, pname, out value);
} }
#endregion alGetAuxiliaryEffectSlotf
// Not used: // Not used:
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTIV)( ALuint asid, ALenum param, ALint* values ); // typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTIV)( ALuint asid, ALenum param, ALint* values );
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTFV)( ALuint asid, ALenum param, ALfloat* values ); // typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTFV)( ALuint asid, ALenum param, ALfloat* values );
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTIV)( ALuint asid, ALenum pname, ALint* values ); // typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTIV)( ALuint asid, ALenum pname, ALint* values );
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTFV)( ALuint asid, ALenum pname, ALfloat* values ); // typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTFV)( ALuint asid, ALenum pname, ALfloat* values );
#endregion Auxiliary Effect Slot Object
#region Constructor / Extension Loading
private bool _valid;
/// <summary>Returns True if the EFX Extension has been found and could be initialized.</summary> /// <summary>Returns True if the EFX Extension has been found and could be initialized.</summary>
public bool IsInitialized public bool IsInitialized { get; }
{
get
{
return _valid;
}
}
/// <summary> /// <summary>
/// Constructs a new EffectsExtension instance. /// Constructs a new EffectsExtension instance.
/// </summary> /// </summary>
public EffectsExtension() public EffectsExtension()
{ {
_valid = false; IsInitialized = false;
if (AudioContext.CurrentContext == null) if (AudioContext.CurrentContext == null)
{
throw new InvalidOperationException("AL.LoadAll() needs a current AudioContext."); throw new InvalidOperationException("AL.LoadAll() needs a current AudioContext.");
}
if (!AudioContext.CurrentContext.SupportsExtension("ALC_EXT_EFX")) if (!AudioContext.CurrentContext.SupportsExtension("ALC_EXT_EFX"))
{ {
@ -1280,9 +1173,7 @@ namespace OpenTK.Audio.OpenAL
// Console.WriteLine("Auxiliary Effect Slot functions appear to be ok."); // Console.WriteLine("Auxiliary Effect Slot functions appear to be ok.");
// didn't return so far, everything went fine. // didn't return so far, everything went fine.
_valid = true; IsInitialized = true;
} }
#endregion Constructor / Extension Loading
} }
} }

View file

@ -1,18 +1,12 @@
#region --- OpenTK.OpenAL License --- /* EfxTokens.cs
/* EfxTokens.cs
* C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h" * C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h"
* Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK) * Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK)
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System;
namespace OpenTK.Audio.OpenAL namespace OpenTK.Audio.OpenAL
{ {
#region Effect
///<summary>A list of valid 32-bit Float Effect/GetEffect parameters</summary> ///<summary>A list of valid 32-bit Float Effect/GetEffect parameters</summary>
public enum EfxEffectf : int public enum EfxEffectf : int
{ {
@ -410,10 +404,6 @@ namespace OpenTK.Audio.OpenAL
EaxReverb = 0x8000, EaxReverb = 0x8000,
} }
#endregion Effect
#region Auxiliary Effect Slot
///<summary>A list of valid Int32 AuxiliaryEffectSlot/GetAuxiliaryEffectSlot parameters</summary> ///<summary>A list of valid Int32 AuxiliaryEffectSlot/GetAuxiliaryEffectSlot parameters</summary>
public enum EfxAuxiliaryi : int public enum EfxAuxiliaryi : int
{ {
@ -431,10 +421,6 @@ namespace OpenTK.Audio.OpenAL
EffectslotGain = 0x0002, EffectslotGain = 0x0002,
} }
#endregion Auxiliary Effect Slot
#region Filter Object
///<summary>A list of valid 32-bits Float Filter/GetFilter parameters</summary> ///<summary>A list of valid 32-bits Float Filter/GetFilter parameters</summary>
public enum EfxFilterf : int public enum EfxFilterf : int
{ {
@ -475,6 +461,4 @@ namespace OpenTK.Audio.OpenAL
///<summary>Currently not implemented. A band-pass filter is used to remove high and low frequency content from a signal.</summary> ///<summary>Currently not implemented. A band-pass filter is used to remove high and low frequency content from a signal.</summary>
Bandpass = 0x0003, Bandpass = 0x0003,
} }
#endregion Filter Object
} }

View file

@ -1,11 +1,9 @@
#region --- OpenTK.OpenAL License --- /* EfxPresets.cs
/* EfxPresets.cs
* C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h" * C headers: \OpenAL 1.1 SDK\include\ "efx.h", "efx-creative.h", "Efx-Util.h"
* Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK) * Spec: Effects Extension Guide.pdf (bundled with OpenAL SDK)
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;

View file

@ -1,11 +1,9 @@
#region --- OpenTK.OpenAL License --- /* XRamExtension.cs
/* XRamExtension.cs
* C header: \OpenAL 1.1 SDK\include\xram.h * C header: \OpenAL 1.1 SDK\include\xram.h
* Spec: ? * Spec: ?
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details (MIT) * See license.txt for license details (MIT)
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;
using System.Diagnostics; using System.Diagnostics;
@ -21,19 +19,8 @@ namespace OpenTK.Audio.OpenAL
[CLSCompliant(true)] [CLSCompliant(true)]
public sealed class XRamExtension public sealed class XRamExtension
{ {
#region Instance state
private bool _valid = false;
/// <summary>Returns True if the X-Ram Extension has been found and could be initialized.</summary> /// <summary>Returns True if the X-Ram Extension has been found and could be initialized.</summary>
public bool IsInitialized public bool IsInitialized { get; } = false;
{
get { return _valid; }
}
#endregion Instance state
#region X-RAM Function pointer definitions
// [CLSCompliant(false)] // [CLSCompliant(false)]
private delegate bool Delegate_SetBufferMode(int n, ref uint buffers, int value); private delegate bool Delegate_SetBufferMode(int n, ref uint buffers, int value);
@ -48,25 +35,19 @@ namespace OpenTK.Audio.OpenAL
//[CLSCompliant(false)] //[CLSCompliant(false)]
private Delegate_GetBufferMode Imported_GetBufferMode; private Delegate_GetBufferMode Imported_GetBufferMode;
#endregion X-RAM Function pointer definitions
#region X-RAM Tokens
private int AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE, private int AL_EAX_RAM_SIZE, AL_EAX_RAM_FREE,
AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE; AL_STORAGE_AUTOMATIC, AL_STORAGE_HARDWARE, AL_STORAGE_ACCESSIBLE;
#endregion X-RAM Tokens
#region Constructor / Extension Loading
/// <summary> /// <summary>
/// Constructs a new XRamExtension instance. /// Constructs a new XRamExtension instance.
/// </summary> /// </summary>
public XRamExtension() public XRamExtension()
{ // Query if Extension supported and retrieve Tokens/Pointers if it is. { // Query if Extension supported and retrieve Tokens/Pointers if it is.
_valid = false; IsInitialized = false;
if (AL.IsExtensionPresent("EAX-RAM") == false) if (AL.IsExtensionPresent("EAX-RAM") == false)
{
return; return;
}
AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE"); AL_EAX_RAM_SIZE = AL.GetEnumValue("AL_EAX_RAM_SIZE");
AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE"); AL_EAX_RAM_FREE = AL.GetEnumValue("AL_EAX_RAM_FREE");
@ -99,13 +80,9 @@ namespace OpenTK.Audio.OpenAL
return; return;
} }
_valid = true; IsInitialized = true;
} }
#endregion Constructor / Extension Loading
#region Public Methods
/// <summary>Query total amount of X-RAM in bytes.</summary> /// <summary>Query total amount of X-RAM in bytes.</summary>
public int GetRamSize public int GetRamSize
{ {
@ -175,9 +152,13 @@ namespace OpenTK.Audio.OpenAL
int tempresult = Imported_GetBufferMode(buffer, IntPtr.Zero); // IntPtr.Zero due to the parameter being unused/reserved atm int tempresult = Imported_GetBufferMode(buffer, IntPtr.Zero); // IntPtr.Zero due to the parameter being unused/reserved atm
if (tempresult == AL_STORAGE_ACCESSIBLE) if (tempresult == AL_STORAGE_ACCESSIBLE)
{
return XRamStorage.Accessible; return XRamStorage.Accessible;
}
if (tempresult == AL_STORAGE_HARDWARE) if (tempresult == AL_STORAGE_HARDWARE)
{
return XRamStorage.Hardware; return XRamStorage.Hardware;
}
// default: // default:
return XRamStorage.Automatic; return XRamStorage.Automatic;
} }
@ -191,8 +172,6 @@ namespace OpenTK.Audio.OpenAL
uint temp = (uint)buffer; uint temp = (uint)buffer;
return GetBufferMode(ref temp); return GetBufferMode(ref temp);
} }
#endregion Public Methods
} }
} }

View file

@ -1,11 +1,9 @@
#region --- OpenTK.OpenAL License --- /* AlcFunctions.cs
/* AlcFunctions.cs
* C header: \OpenAL 1.1 SDK\include\Alc.h * C header: \OpenAL 1.1 SDK\include\Alc.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf * Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -73,19 +71,11 @@ namespace OpenTK.Audio.OpenAL
/// <summary>Alc = Audio Library Context</summary> /// <summary>Alc = Audio Library Context</summary>
public static class Alc public static class Alc
{ {
#region Constants
private const string Lib = AL.Lib; private const string Lib = AL.Lib;
private const CallingConvention Style = CallingConvention.Cdecl; private const CallingConvention Style = CallingConvention.Cdecl;
#endregion Constants
#region Context Management
#region CreateContext
[DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity] [DllImport(Alc.Lib, EntryPoint = "alcCreateContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity]
unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist); private unsafe static extern IntPtr sys_CreateContext([In] IntPtr device, [In] int* attrlist);
/// <summary>This function creates a context using a specified device.</summary> /// <summary>This function creates a context using a specified device.</summary>
/// <param name="device">a pointer to a device</param> /// <param name="device">a pointer to a device</param>
@ -115,10 +105,8 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion
[DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcMakeContextCurrent", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern bool MakeContextCurrent(IntPtr context); private static extern bool MakeContextCurrent(IntPtr context);
/// <summary>This function makes a specified context the current context.</summary> /// <summary>This function makes a specified context the current context.</summary>
/// <param name="context">A pointer to the new context.</param> /// <param name="context">A pointer to the new context.</param>
@ -130,7 +118,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context ); // ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcProcessContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void ProcessContext(IntPtr context); private static extern void ProcessContext(IntPtr context);
/// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary> /// <summary>This function tells a context to begin processing. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. alcSuspendContext can be used to suspend a context, and then all the OpenAL state changes can be applied at once, followed by a call to alcProcessContext to apply all the state changes immediately. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the new context</param> /// <param name="context">a pointer to the new context</param>
@ -141,7 +129,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context ); // ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcSuspendContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void SuspendContext(IntPtr context); private static extern void SuspendContext(IntPtr context);
/// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary> /// <summary>This function suspends processing on a specified context. When a context is suspended, changes in OpenAL state will be accepted but will not be processed. A typical use of alcSuspendContext would be to suspend a context, apply all the OpenAL state changes at once, and then call alcProcessContext to apply all the state changes at once. In some cases, this procedure may be more efficient than application of properties in a non-suspended state. In some implementations, process and suspend calls are each a NOP.</summary>
/// <param name="context">a pointer to the context to be suspended.</param> /// <param name="context">a pointer to the context to be suspended.</param>
@ -152,7 +140,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context ); // ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context );
[DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcDestroyContext", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern void DestroyContext(IntPtr context); private static extern void DestroyContext(IntPtr context);
/// <summary>This function destroys a context.</summary> /// <summary>This function destroys a context.</summary>
/// <param name="context">a pointer to the new context.</param> /// <param name="context">a pointer to the new context.</param>
@ -174,7 +162,7 @@ namespace OpenTK.Audio.OpenAL
// ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void ); // ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( void );
[DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcGetContextsDevice", ExactSpelling = true, CallingConvention = Alc.Style), SuppressUnmanagedCodeSecurity()]
static extern IntPtr GetContextsDevice(IntPtr context); private static extern IntPtr GetContextsDevice(IntPtr context);
/// <summary>This function retrieves a context's device pointer.</summary> /// <summary>This function retrieves a context's device pointer.</summary>
/// <param name="context">a pointer to a context.</param> /// <param name="context">a pointer to a context.</param>
@ -185,10 +173,6 @@ namespace OpenTK.Audio.OpenAL
} }
// ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context ); // ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context );
#endregion Context Management
#region Device Management
/// <summary>This function opens a device by name.</summary> /// <summary>This function opens a device by name.</summary>
/// <param name="devicename">a null-terminated string describing a device.</param> /// <param name="devicename">a null-terminated string describing a device.</param>
/// <returns>Returns a pointer to the opened device. The return value will be NULL if there is an error.</returns> /// <returns>Returns a pointer to the opened device. The return value will be NULL if there is an error.</returns>
@ -203,10 +187,6 @@ namespace OpenTK.Audio.OpenAL
public static extern bool CloseDevice([In] IntPtr device); public static extern bool CloseDevice([In] IntPtr device);
// ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device ); // ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device );
#endregion Device Management
#region Error support.
/// <summary>This function retrieves the current context error state.</summary> /// <summary>This function retrieves the current context error state.</summary>
/// <param name="device">a pointer to the device to retrieve the error state from</param> /// <param name="device">a pointer to the device to retrieve the error state from</param>
/// <returns>Errorcode Int32.</returns> /// <returns>Errorcode Int32.</returns>
@ -214,10 +194,6 @@ namespace OpenTK.Audio.OpenAL
public static extern AlcError GetError([In] IntPtr device); public static extern AlcError GetError([In] IntPtr device);
// ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device ); // ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
#endregion Error support.
#region Extension support.
/// <summary>This function queries if a specified context extension is available.</summary> /// <summary>This function queries if a specified context extension is available.</summary>
/// <param name="device">a pointer to the device to be queried for an extension.</param> /// <param name="device">a pointer to the device to be queried for an extension.</param>
/// <param name="extname">a null-terminated string describing the extension.</param> /// <param name="extname">a null-terminated string describing the extension.</param>
@ -242,10 +218,6 @@ namespace OpenTK.Audio.OpenAL
public static extern int GetEnumValue([In] IntPtr device, [In] string enumname); public static extern int GetEnumValue([In] IntPtr device, [In] string enumname);
// ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname ); // ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
#endregion Extension support.
#region Query functions
[DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcGetString", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
private static extern IntPtr GetStringPrivate([In] IntPtr device, AlcGetString param); private static extern IntPtr GetStringPrivate([In] IntPtr device, AlcGetString param);
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param ); // ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
@ -335,7 +307,7 @@ namespace OpenTK.Audio.OpenAL
} }
[DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()] [DllImport(Alc.Lib, EntryPoint = "alcGetIntegerv", ExactSpelling = true, CallingConvention = Alc.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data); private unsafe static extern void GetInteger(IntPtr device, AlcGetInteger param, int size, int* data);
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer ); // ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer );
/// <summary>This function returns integers related to the context.</summary> /// <summary>This function returns integers related to the context.</summary>
@ -370,10 +342,6 @@ namespace OpenTK.Audio.OpenAL
} }
} }
#endregion Query functions
#region Capture functions
/// <summary>This function opens a capture device by name. </summary> /// <summary>This function opens a capture device by name. </summary>
/// <param name="devicename">a pointer to a device name string.</param> /// <param name="devicename">a pointer to a device name string.</param>
/// <param name="frequency">the frequency that the buffer should be captured at.</param> /// <param name="frequency">the frequency that the buffer should be captured at.</param>
@ -473,8 +441,6 @@ namespace OpenTK.Audio.OpenAL
CaptureSamples(device, ref buffer[0, 0, 0], samples); CaptureSamples(device, ref buffer[0, 0, 0], samples);
} }
#endregion Capture functions
} }
} }

View file

@ -1,11 +1,9 @@
#region --- OpenTK.OpenAL License --- /* AlcTokens.cs
/* AlcTokens.cs
* C header: \OpenAL 1.1 SDK\include\Alc.h * C header: \OpenAL 1.1 SDK\include\Alc.h
* Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf * Spec: http://www.openal.org/openal_webstf/specs/OpenAL11Specification.pdf
* Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos * Copyright (c) 2008 Christoph Brandtner and Stefanos Apostolopoulos
* See license.txt for license details * See license.txt for license details
* http://www.OpenTK.net */ * http://www.OpenTK.net */
#endregion
using System; using System;

View file

@ -1,5 +1,4 @@
#region License //
//
// The Open Toolkit Library License // The Open Toolkit Library License
// //
// Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted. // Copyright (c) 2006 - 2008 the Open Toolkit library, except where noted.
@ -23,11 +22,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
// //
#endregion
using System; using System;
using System.Collections.Generic;
using System.Text;
namespace OpenTK namespace OpenTK
{ {

Some files were not shown because too many files have changed in this diff Show more