[Pkg-cli-apps-commits] [SCM] pinta branch, master, updated. debian/0.7-1-9-g582f699
Iain Lane
laney at ubuntu.com
Mon Apr 25 18:48:19 UTC 2011
The following commit has been merged in the master branch:
commit cc8be66549c2b9b077a482a573166953b1009667
Author: Iain Lane <laney at ubuntu.com>
Date: Mon Apr 25 19:24:55 2011 +0100
Imported Upstream version 0.8+dfsg
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..85332aa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+*.pidb
+*.suo
+*.userprefs
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+bin
+config.log
+config.status
+configure
+install-sh
+missing
+obj
+pinta
diff --git a/Makefile.am b/Makefile.am
index 3725330..6065ed0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,8 +5,9 @@ BINFILES = \
$(BINDIR)/Pinta.Core.dll \
$(BINDIR)/Pinta.Gui.Widgets.dll \
$(BINDIR)/Pinta.Resources.dll \
- $(BINDIR)/Pinta.Effects.dll \
- $(BINDIR)/Pinta.Tools.dll
+ $(BINDIR)/System.ComponentModel.Composition.dll \
+ $(BINDIR)/Extensions/Pinta.Effects.dll \
+ $(BINDIR)/Extensions/Pinta.Tools.dll
RELEASE_FILE = $(PACKAGE)-$(VERSION)
@@ -87,7 +88,7 @@ releasetar: $(BINFILES)
releasezip: $(BINFILES)
cd $(BINDIR) && zip -r ../$(RELEASE_FILE).zip * -x "*.mdb"
-EXTRA_DIST = Pinta Pinta.Core Pinta.Effects Pinta.Gui.Widgets Pinta.Resources Pinta.Tools po Tarball xdg \
+EXTRA_DIST = Pinta Pinta.Core Pinta.Effects Pinta.Gui.Widgets Pinta.Resources Pinta.Tools po Tarball System.ComponentModel.Composition xdg \
license-mit.txt license-pdn.txt readme.txt todo.txt Pinta.sln Pinta.Install.proj
.PHONY: install uninstall cleanall cleanbin cleanobj release releasetar releasezip
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644
index 0c4ef11..0000000
--- a/Makefile.in
+++ /dev/null
@@ -1,537 +0,0 @@
-# Makefile.in generated by automake 1.11.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-subdir = .
-DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/pinta.in \
- $(top_srcdir)/configure install-sh missing
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
-mkinstalldirs = $(install_sh) -d
-CONFIG_CLEAN_FILES = pinta
-CONFIG_CLEAN_VPATH_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
- { test ! -d "$(distdir)" \
- || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -fr "$(distdir)"; }; }
-DIST_ARCHIVES = $(distdir).tar.gz
-GZIP_ENV = --best
-distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-GLIB_SHARP_20_CFLAGS = @GLIB_SHARP_20_CFLAGS@
-GLIB_SHARP_20_LIBS = @GLIB_SHARP_20_LIBS@
-GTK_SHARP_20_CFLAGS = @GTK_SHARP_20_CFLAGS@
-GTK_SHARP_20_LIBS = @GTK_SHARP_20_LIBS@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MONO = @MONO@
-MONO_CAIRO_CFLAGS = @MONO_CAIRO_CFLAGS@
-MONO_CAIRO_LIBS = @MONO_CAIRO_LIBS@
-MONO_CFLAGS = @MONO_CFLAGS@
-MONO_LIBS = @MONO_LIBS@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-XBUILD = @XBUILD@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build_alias = @build_alias@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host_alias = @host_alias@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-BINDIR = $(srcdir)/bin
-BINFILES = \
- $(BINDIR)/Pinta.exe \
- $(BINDIR)/Pinta.Core.dll \
- $(BINDIR)/Pinta.Gui.Widgets.dll \
- $(BINDIR)/Pinta.Resources.dll \
- $(BINDIR)/Pinta.Effects.dll \
- $(BINDIR)/Pinta.Tools.dll
-
-RELEASE_FILE = $(PACKAGE)-$(VERSION)
-EXTRA_DIST = Pinta Pinta.Core Pinta.Effects Pinta.Gui.Widgets Pinta.Resources Pinta.Tools po Tarball xdg \
- license-mit.txt license-pdn.txt readme.txt todo.txt Pinta.sln Pinta.Install.proj
-
-all: all-am
-
-.SUFFIXES:
-am--refresh:
- @:
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
- $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- echo ' $(SHELL) ./config.status'; \
- $(SHELL) ./config.status;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- $(SHELL) ./config.status --recheck
-
-$(top_srcdir)/configure: $(am__configure_deps)
- $(am__cd) $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): $(am__aclocal_m4_deps)
- $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-$(am__aclocal_m4_deps):
-pinta: $(top_builddir)/config.status $(srcdir)/pinta.in
- cd $(top_builddir) && $(SHELL) ./config.status $@
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-distdir: $(DISTFILES)
- $(am__remove_distdir)
- test -d "$(distdir)" || mkdir "$(distdir)"
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
- -test -n "$(am__skip_mode_fix)" \
- || find "$(distdir)" -type d ! -perm -755 \
- -exec chmod u+rwx,go+rx {} \; -o \
- ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r "$(distdir)"
-dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
-
-dist-bzip2: distdir
- tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
- $(am__remove_distdir)
-
-dist-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(am__remove_distdir)
-
-dist-xz: distdir
- tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
- $(am__remove_distdir)
-
-dist-tarZ: distdir
- tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
- $(am__remove_distdir)
-
-dist-shar: distdir
- shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
- $(am__remove_distdir)
-
-dist-zip: distdir
- -rm -f $(distdir).zip
- zip -rq $(distdir).zip $(distdir)
- $(am__remove_distdir)
-
-dist dist-all: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
- $(am__remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration. Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
- case '$(DIST_ARCHIVES)' in \
- *.tar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
- *.tar.bz2*) \
- bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lzma*) \
- lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
- *.tar.xz*) \
- xz -dc $(distdir).tar.xz | $(am__untar) ;;\
- *.tar.Z*) \
- uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
- *.shar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
- *.zip*) \
- unzip $(distdir).zip ;;\
- esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
- mkdir $(distdir)/_build
- mkdir $(distdir)/_inst
- chmod a-w $(distdir)
- test -d $(distdir)/_build || exit 0; \
- dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
- && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && am__cwd=`pwd` \
- && $(am__cd) $(distdir)/_build \
- && ../configure --srcdir=.. --prefix="$$dc_install_base" \
- $(DISTCHECK_CONFIGURE_FLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) \
- && $(MAKE) $(AM_MAKEFLAGS) dvi \
- && $(MAKE) $(AM_MAKEFLAGS) check \
- && $(MAKE) $(AM_MAKEFLAGS) install \
- && $(MAKE) $(AM_MAKEFLAGS) installcheck \
- && $(MAKE) $(AM_MAKEFLAGS) uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
- distuninstallcheck \
- && chmod -R a-w "$$dc_install_base" \
- && ({ \
- (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
- && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
- distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
- } || { rm -rf "$$dc_destdir"; exit 1; }) \
- && rm -rf "$$dc_destdir" \
- && $(MAKE) $(AM_MAKEFLAGS) dist \
- && rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
- && cd "$$am__cwd" \
- || exit 1
- $(am__remove_distdir)
- @(echo "$(distdir) archives ready for distribution: "; \
- list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
- sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
-distuninstallcheck:
- @$(am__cd) '$(distuninstallcheck_dir)' \
- && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
- || { echo "ERROR: files left after uninstall:" ; \
- if test -n "$(DESTDIR)"; then \
- echo " (check DESTDIR support)"; \
- fi ; \
- $(distuninstallcheck_listfiles) ; \
- exit 1; } >&2
-distcleancheck: distclean
- @if test '$(srcdir)' = . ; then \
- echo "ERROR: distcleancheck can only run from a VPATH build" ; \
- exit 1 ; \
- fi
- @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
- || { echo "ERROR: files left in build directory after distclean:" ; \
- $(distcleancheck_listfiles) ; \
- exit 1; } >&2
-check-am: all-am
-check: check-am
-all-am: Makefile
-installdirs:
-install-exec: install-exec-am
-install-data: install-data-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean-am: clean-generic mostlyclean-am
-
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f $(am__CONFIG_DISTCLEAN_FILES)
- -rm -rf $(top_srcdir)/autom4te.cache
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: all all-am am--refresh check check-am clean clean-generic dist \
- dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
- dist-xz dist-zip distcheck distclean distclean-generic \
- distcleancheck distdir distuninstallcheck dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
- pdf-am ps ps-am uninstall uninstall-am
-
-
-# target: all - Default target: build
-all: build
-
-# target: run - Launch the uninstalled copy
-run:
- $(MONO) bin/Pinta.exe
-
-# target: help - Display callable targets.
-help:
- egrep "^# target:" Makefile | sed 's/^# target:/make/'
-
-# target: build - Build Pinta.
-build: Pinta.sln
- cd $(srcdir) && $(XBUILD) Pinta.sln
- cd $(srcdir) && $(XBUILD) Pinta.Install.proj /target:CompileTranslations
-
-# target: list - List source files.
-list:
- if ! git status > /dev/null 2> /dev/null ;\
- then \
- find . -type f -name *.cs | sed 's|./||' ;\
- else \
- git ls-files | grep '\.cs' ;\
- fi
-
-#target: updatepot - update the messages.pot file
-updatepot: build
- find . -type f -name *.cs | sed 's|./||' > files.list
- grep -v System.ComponentModel.Composition files.list > files2.list
- xgettext --from-code=UTF-8 -f files2.list -o po/messages.pot
- cat po/messages.in >> po/messages.pot
- rm files.list
- rm files2.list
-
-# target: clean - Default clean command: cleanobj and cleanbin
-clean: cleanobj cleanbin
-
-# target: distclean - Removes configure files.
-distclean: clean
- rm -f Makefile pinta config.status config.cache config.log configure.lineno config.status.lineno
-
-# target: cleanall - Removes build files.
-cleanall: distclean
- rm -rf autom4te.cache
- rm -f configure aclocal.m4 missing install-sh Makefile.in
-
-# target: cleanbin - Removes built files.
-cleanbin:
- rm -rvf $(BINDIR)/*
-
-# target: cleanobj - Removes temporary build files.
-cleanobj:
- find $(srcdir)/ -type d -name obj | xargs rm -rvf
-
-# target: install - Installs Pinta.
-install: pinta $(BINFILES)
- cd $(srcdir) && $(XBUILD) /target:Install /property:InstallPrefix=$(DESTDIR)$(prefix) \
- /property:BinDir=$(DESTDIR)$(bindir) /property:LibDir=$(DESTDIR)$(libdir) \
- /property:DataRootDir=$(DESTDIR)$(datarootdir) /property:ManDir=$(DESTDIR)$(mandir) \
- /property:LocaleDir=$(DESTDIR)$(localedir) Pinta.Install.proj
- $(INSTALL_SCRIPT) pinta $(DESTDIR)$(bindir)/$(PACKAGE)
-
-# target: uninstall - Uninstalls Pinta.
-uninstall:
- $(XBUILD) /target:Uninstall /property:InstallPrefix=$(DESTDIR)$(prefix) Pinta.Install.proj
-
-# target: release - Default release type: releasetar
-release: releasetar
-
-# target: releasetar - Make a release tarball.
-releasetar: $(BINFILES)
- cd $(BINDIR) && tar -czf ../$(RELEASE_FILE).tgz --exclude=*mdb *
-
-# target: releasezip - Make a release zip file.
-releasezip: $(BINFILES)
- cd $(BINDIR) && zip -r ../$(RELEASE_FILE).zip * -x "*.mdb"
-
-.PHONY: install uninstall cleanall cleanbin cleanobj release releasetar releasezip
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/Pinta.Core/Effects/UnaryPixelOps.cs b/Pinta.Core/Effects/UnaryPixelOps.cs
index 46df5c4..6507c73 100644
--- a/Pinta.Core/Effects/UnaryPixelOps.cs
+++ b/Pinta.Core/Effects/UnaryPixelOps.cs
@@ -34,7 +34,11 @@ namespace Pinta.Core
public unsafe override void Apply(ColorBgra *dst, ColorBgra *src, int length)
{
- //Memory.Copy(dst, src, (ulong)length * (ulong)sizeof(ColorBgra));
+ for (int i = 0; i < length; i++) {
+ *dst = *src;
+ dst++;
+ src++;
+ }
}
public unsafe override void Apply(ColorBgra* ptr, int length)
diff --git a/Pinta.Core/Managers/SettingsManager.cs b/Pinta.Core/Managers/SettingsManager.cs
index 3ce3acf..751be07 100644
--- a/Pinta.Core/Managers/SettingsManager.cs
+++ b/Pinta.Core/Managers/SettingsManager.cs
@@ -92,6 +92,11 @@ namespace Pinta.Core
private static void Serialize (string filename, Dictionary<string, object> settings)
{
+ string path = Path.GetDirectoryName (filename);
+
+ if (!Directory.Exists (path))
+ Directory.CreateDirectory (path);
+
using (XmlTextWriter xw = new XmlTextWriter (filename, System.Text.Encoding.UTF8)) {
xw.Formatting = Formatting.Indented;
xw.WriteStartElement ("settings");
@@ -116,6 +121,7 @@ namespace Pinta.Core
settings = Deserialize (settings_file);
} catch (Exception) {
// Will load with default settings
+ settings = new Dictionary<string,object> ();
}
string palette_file = Path.Combine (GetUserSettingsDirectory (), "palette.txt");
diff --git a/Pinta.Core/Pinta.Core.csproj b/Pinta.Core/Pinta.Core.csproj
index 035dd10..9b7de4c 100644
--- a/Pinta.Core/Pinta.Core.csproj
+++ b/Pinta.Core/Pinta.Core.csproj
@@ -1,4 +1,4 @@
-<?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">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -54,10 +54,6 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
- <Reference Include="ICSharpCode.SharpZipLib, Version=0.84.0.0, Culture=neutral, PublicKeyToken=1b03e6acf1164f73">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\lib\ICSharpCode.SharpZipLib.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
</Reference>
@@ -73,6 +69,7 @@
<Reference Include="pango-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f">
</Reference>
<Reference Include="System.Data" />
+ <Reference Include="ICSharpCode.SharpZipLib" />
<Reference Include="System.Xml" />
<Reference Include="Mono.Cairo" />
</ItemGroup>
@@ -216,4 +213,4 @@
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/Pinta.Effects/Adjustments/AutoLevelEffect.cs b/Pinta.Effects/Adjustments/AutoLevelEffect.cs
index b3b8b5d..005aa22 100644
--- a/Pinta.Effects/Adjustments/AutoLevelEffect.cs
+++ b/Pinta.Effects/Adjustments/AutoLevelEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class AutoLevelEffect : BaseEffect
{
UnaryPixelOps.Level op;
diff --git a/Pinta.Effects/Adjustments/BlackAndWhiteEffect.cs b/Pinta.Effects/Adjustments/BlackAndWhiteEffect.cs
index 91d4deb..93d0719 100644
--- a/Pinta.Effects/Adjustments/BlackAndWhiteEffect.cs
+++ b/Pinta.Effects/Adjustments/BlackAndWhiteEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class BlackAndWhiteEffect : BaseEffect
{
UnaryPixelOp op = new UnaryPixelOps.Desaturate ();
diff --git a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
index 2bfc2b3..68af5ca 100644
--- a/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
+++ b/Pinta.Effects/Adjustments/BrightnessContrastEffect.cs
@@ -14,7 +14,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class BrightnessContrastEffect : BaseEffect
{
private int multiply;
diff --git a/Pinta.Effects/Adjustments/CurvesEffect.cs b/Pinta.Effects/Adjustments/CurvesEffect.cs
index 3e84f3f..c2f951d 100644
--- a/Pinta.Effects/Adjustments/CurvesEffect.cs
+++ b/Pinta.Effects/Adjustments/CurvesEffect.cs
@@ -15,7 +15,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class CurvesEffect : BaseEffect
{
UnaryPixelOp op = null;
diff --git a/Pinta.Effects/Adjustments/HueSaturationEffect.cs b/Pinta.Effects/Adjustments/HueSaturationEffect.cs
index f42d717..fb82669 100644
--- a/Pinta.Effects/Adjustments/HueSaturationEffect.cs
+++ b/Pinta.Effects/Adjustments/HueSaturationEffect.cs
@@ -14,7 +14,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class HueSaturationEffect : BaseEffect
{
UnaryPixelOp op;
diff --git a/Pinta.Effects/Adjustments/InvertColorsEffect.cs b/Pinta.Effects/Adjustments/InvertColorsEffect.cs
index 7c63a21..dc7157f 100644
--- a/Pinta.Effects/Adjustments/InvertColorsEffect.cs
+++ b/Pinta.Effects/Adjustments/InvertColorsEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class InvertColorsEffect : BaseEffect
{
UnaryPixelOp op = new UnaryPixelOps.Invert ();
diff --git a/Pinta.Effects/Adjustments/LevelsEffect.cs b/Pinta.Effects/Adjustments/LevelsEffect.cs
index 668a9ab..b0d31b7 100644
--- a/Pinta.Effects/Adjustments/LevelsEffect.cs
+++ b/Pinta.Effects/Adjustments/LevelsEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class LevelsEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Adjustments/PosterizeEffect.cs b/Pinta.Effects/Adjustments/PosterizeEffect.cs
index f71598f..ed063c0 100644
--- a/Pinta.Effects/Adjustments/PosterizeEffect.cs
+++ b/Pinta.Effects/Adjustments/PosterizeEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class PosterizeEffect : BaseEffect
{
UnaryPixelOps.PosterizePixel op = null;
diff --git a/Pinta.Effects/Adjustments/SepiaEffect.cs b/Pinta.Effects/Adjustments/SepiaEffect.cs
index 99f0320..e7849fe 100644
--- a/Pinta.Effects/Adjustments/SepiaEffect.cs
+++ b/Pinta.Effects/Adjustments/SepiaEffect.cs
@@ -13,7 +13,7 @@ using Pinta.Core;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class SepiaEffect : BaseEffect
{
UnaryPixelOp desat = new UnaryPixelOps.Desaturate ();
diff --git a/Pinta.Effects/Effects/AddNoiseEffect.cs b/Pinta.Effects/Effects/AddNoiseEffect.cs
index 7afd4d0..d644189 100644
--- a/Pinta.Effects/Effects/AddNoiseEffect.cs
+++ b/Pinta.Effects/Effects/AddNoiseEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class AddNoiseEffect : BaseEffect
{
private int intensity;
diff --git a/Pinta.Effects/Effects/BulgeEffect.cs b/Pinta.Effects/Effects/BulgeEffect.cs
index 6142ab6..62632c3 100644
--- a/Pinta.Effects/Effects/BulgeEffect.cs
+++ b/Pinta.Effects/Effects/BulgeEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class BulgeEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/CloudsEffect.cs b/Pinta.Effects/Effects/CloudsEffect.cs
index eb630a2..e9271ed 100644
--- a/Pinta.Effects/Effects/CloudsEffect.cs
+++ b/Pinta.Effects/Effects/CloudsEffect.cs
@@ -16,7 +16,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class CloudsEffect : BaseEffect
{
// This is so that repetition of the effect with CTRL+F actually shows up differently.
diff --git a/Pinta.Effects/Effects/EdgeDetectEffect.cs b/Pinta.Effects/Effects/EdgeDetectEffect.cs
index 3a2c16e..49f9368 100644
--- a/Pinta.Effects/Effects/EdgeDetectEffect.cs
+++ b/Pinta.Effects/Effects/EdgeDetectEffect.cs
@@ -16,7 +16,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class EdgeDetectEffect : ColorDifferenceEffect
{
private double[][] weights;
diff --git a/Pinta.Effects/Effects/EmbossEffect.cs b/Pinta.Effects/Effects/EmbossEffect.cs
index 20d0462..7812ec6 100644
--- a/Pinta.Effects/Effects/EmbossEffect.cs
+++ b/Pinta.Effects/Effects/EmbossEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class EmbossEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/FragmentEffect.cs b/Pinta.Effects/Effects/FragmentEffect.cs
index 88e02ac..c08a15d 100644
--- a/Pinta.Effects/Effects/FragmentEffect.cs
+++ b/Pinta.Effects/Effects/FragmentEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class FragmentEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/FrostedGlassEffect.cs b/Pinta.Effects/Effects/FrostedGlassEffect.cs
index c6a0a47..4acaabb 100644
--- a/Pinta.Effects/Effects/FrostedGlassEffect.cs
+++ b/Pinta.Effects/Effects/FrostedGlassEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class FrostedGlassEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/GaussianBlurEffect.cs b/Pinta.Effects/Effects/GaussianBlurEffect.cs
index 5b56ae6..1ece67e 100644
--- a/Pinta.Effects/Effects/GaussianBlurEffect.cs
+++ b/Pinta.Effects/Effects/GaussianBlurEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class GaussianBlurEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/GlowEffect.cs b/Pinta.Effects/Effects/GlowEffect.cs
index 4d4ead2..dd5c377 100644
--- a/Pinta.Effects/Effects/GlowEffect.cs
+++ b/Pinta.Effects/Effects/GlowEffect.cs
@@ -16,7 +16,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class GlowEffect : BaseEffect
{
private GaussianBlurEffect blurEffect;
diff --git a/Pinta.Effects/Effects/InkSketchEffect.cs b/Pinta.Effects/Effects/InkSketchEffect.cs
index 771ba8c..b9b7cc6 100644
--- a/Pinta.Effects/Effects/InkSketchEffect.cs
+++ b/Pinta.Effects/Effects/InkSketchEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class InkSketchEffect : BaseEffect
{
private static readonly int[][] conv;
diff --git a/Pinta.Effects/Effects/JuliaFractalEffect.cs b/Pinta.Effects/Effects/JuliaFractalEffect.cs
index a341bd0..824da60 100644
--- a/Pinta.Effects/Effects/JuliaFractalEffect.cs
+++ b/Pinta.Effects/Effects/JuliaFractalEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class JuliaFractalEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/MandelbrotFractalEffect.cs b/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
index f05c6dd..b5924c7 100644
--- a/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
+++ b/Pinta.Effects/Effects/MandelbrotFractalEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class MandelbrotFractalEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/MedianEffect.cs b/Pinta.Effects/Effects/MedianEffect.cs
index ef67fcd..011e592 100644
--- a/Pinta.Effects/Effects/MedianEffect.cs
+++ b/Pinta.Effects/Effects/MedianEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class MedianEffect : LocalHistogramEffect
{
private int radius;
diff --git a/Pinta.Effects/Effects/MotionBlurEffect.cs b/Pinta.Effects/Effects/MotionBlurEffect.cs
index 52ab6b2..684a54b 100644
--- a/Pinta.Effects/Effects/MotionBlurEffect.cs
+++ b/Pinta.Effects/Effects/MotionBlurEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class MotionBlurEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/OilPaintingEffect.cs b/Pinta.Effects/Effects/OilPaintingEffect.cs
index e908b6a..7d3728e 100644
--- a/Pinta.Effects/Effects/OilPaintingEffect.cs
+++ b/Pinta.Effects/Effects/OilPaintingEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class OilPaintingEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/OutlineEffect.cs b/Pinta.Effects/Effects/OutlineEffect.cs
index f7b8b94..04cfa37 100644
--- a/Pinta.Effects/Effects/OutlineEffect.cs
+++ b/Pinta.Effects/Effects/OutlineEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class OutlineEffect : LocalHistogramEffect
{
private int thickness;
diff --git a/Pinta.Effects/Effects/PencilSketchEffect.cs b/Pinta.Effects/Effects/PencilSketchEffect.cs
index a836709..791a726 100644
--- a/Pinta.Effects/Effects/PencilSketchEffect.cs
+++ b/Pinta.Effects/Effects/PencilSketchEffect.cs
@@ -16,7 +16,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class PencilSketchEffect : BaseEffect
{
private GaussianBlurEffect blurEffect;
diff --git a/Pinta.Effects/Effects/PixelateEffect.cs b/Pinta.Effects/Effects/PixelateEffect.cs
index 5d24b45..fc2718e 100644
--- a/Pinta.Effects/Effects/PixelateEffect.cs
+++ b/Pinta.Effects/Effects/PixelateEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class PixelateEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/PolarInversionEffect.cs b/Pinta.Effects/Effects/PolarInversionEffect.cs
index dc6a5fc..17ee2c0 100644
--- a/Pinta.Effects/Effects/PolarInversionEffect.cs
+++ b/Pinta.Effects/Effects/PolarInversionEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class PolarInversionEffect : WarpEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/RadialBlurEffect.cs b/Pinta.Effects/Effects/RadialBlurEffect.cs
index 8b8202a..5a2493c 100644
--- a/Pinta.Effects/Effects/RadialBlurEffect.cs
+++ b/Pinta.Effects/Effects/RadialBlurEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class RadialBlurEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/RedEyeRemoveEffect.cs b/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
index 46d9598..03cb3fc 100644
--- a/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
+++ b/Pinta.Effects/Effects/RedEyeRemoveEffect.cs
@@ -16,7 +16,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class RedEyeRemoveEffect : BaseEffect
{
private UnaryPixelOp op;
diff --git a/Pinta.Effects/Effects/ReduceNoiseEffect.cs b/Pinta.Effects/Effects/ReduceNoiseEffect.cs
index e6b4d15..67b44cf 100644
--- a/Pinta.Effects/Effects/ReduceNoiseEffect.cs
+++ b/Pinta.Effects/Effects/ReduceNoiseEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class ReduceNoiseEffect : LocalHistogramEffect
{
private int radius;
diff --git a/Pinta.Effects/Effects/ReliefEffect.cs b/Pinta.Effects/Effects/ReliefEffect.cs
index 8da3a25..cb4dffc 100644
--- a/Pinta.Effects/Effects/ReliefEffect.cs
+++ b/Pinta.Effects/Effects/ReliefEffect.cs
@@ -14,7 +14,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class ReliefEffect : ColorDifferenceEffect
{
public ReliefEffect () {
diff --git a/Pinta.Effects/Effects/SharpenEffect.cs b/Pinta.Effects/Effects/SharpenEffect.cs
index dee5764..a4a7d77 100644
--- a/Pinta.Effects/Effects/SharpenEffect.cs
+++ b/Pinta.Effects/Effects/SharpenEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class SharpenEffect : LocalHistogramEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/SoftenPortraitEffect.cs b/Pinta.Effects/Effects/SoftenPortraitEffect.cs
index 8812a00..7cd61d0 100644
--- a/Pinta.Effects/Effects/SoftenPortraitEffect.cs
+++ b/Pinta.Effects/Effects/SoftenPortraitEffect.cs
@@ -43,7 +43,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class SoftenPortraitEffect : BaseEffect
{
private GaussianBlurEffect blurEffect;
diff --git a/Pinta.Effects/Effects/TileEffect.cs b/Pinta.Effects/Effects/TileEffect.cs
index 113faeb..c9029a7 100644
--- a/Pinta.Effects/Effects/TileEffect.cs
+++ b/Pinta.Effects/Effects/TileEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class TileEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/TwistEffect.cs b/Pinta.Effects/Effects/TwistEffect.cs
index 2bb67ce..66955df 100644
--- a/Pinta.Effects/Effects/TwistEffect.cs
+++ b/Pinta.Effects/Effects/TwistEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class TwistEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Effects/UnfocusEffect.cs b/Pinta.Effects/Effects/UnfocusEffect.cs
index 60fe1bc..63e8801 100644
--- a/Pinta.Effects/Effects/UnfocusEffect.cs
+++ b/Pinta.Effects/Effects/UnfocusEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class UnfocusEffect : LocalHistogramEffect
{
private int radius;
diff --git a/Pinta.Effects/Effects/ZoomBlurEffect.cs b/Pinta.Effects/Effects/ZoomBlurEffect.cs
index 94a0f53..979f1ab 100644
--- a/Pinta.Effects/Effects/ZoomBlurEffect.cs
+++ b/Pinta.Effects/Effects/ZoomBlurEffect.cs
@@ -15,7 +15,7 @@ using Mono.Unix;
namespace Pinta.Effects
{
- //[System.ComponentModel.Composition (typeof (BaseEffect))]
+ [System.ComponentModel.Composition.Export (typeof (BaseEffect))]
public class ZoomBlurEffect : BaseEffect
{
public override string Icon {
diff --git a/Pinta.Effects/Pinta.Effects.csproj b/Pinta.Effects/Pinta.Effects.csproj
index fc96523..77581fd 100644
--- a/Pinta.Effects/Pinta.Effects.csproj
+++ b/Pinta.Effects/Pinta.Effects.csproj
@@ -36,7 +36,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>..\bin\</OutputPath>
+ <OutputPath>..\bin\Extensions\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -46,7 +46,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>..\bin\</OutputPath>
+ <OutputPath>..\bin\Extensions\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -129,6 +129,11 @@
<Name>Pinta.Gui.Widgets</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\System.ComponentModel.Composition\System.ComponentModel.Composition.csproj">
+ <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
+ <Name>System.ComponentModel.Composition</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
diff --git a/Pinta.Tools/Brushes/CircleBrush.cs b/Pinta.Tools/Brushes/CircleBrush.cs
index 39ec3f7..eb8cb0c 100644
--- a/Pinta.Tools/Brushes/CircleBrush.cs
+++ b/Pinta.Tools/Brushes/CircleBrush.cs
@@ -31,7 +31,7 @@ using Pinta.Core;
namespace Pinta.Tools.Brushes
{
- //[System.ComponentModel.Composition (typeof (BasePaintBrush))]
+ [System.ComponentModel.Composition.Export (typeof (BasePaintBrush))]
public class CircleBrush : PaintBrush
{
public override string Name {
diff --git a/Pinta.Tools/Brushes/GridBrush.cs b/Pinta.Tools/Brushes/GridBrush.cs
index 1369a98..23a994d 100644
--- a/Pinta.Tools/Brushes/GridBrush.cs
+++ b/Pinta.Tools/Brushes/GridBrush.cs
@@ -31,7 +31,7 @@ using Pinta.Core;
namespace Pinta.Tools.Brushes
{
- //[System.ComponentModel.Composition (typeof (BasePaintBrush))]
+ [System.ComponentModel.Composition.Export (typeof (BasePaintBrush))]
public class GridBrush : PaintBrush
{
public override string Name {
diff --git a/Pinta.Tools/Brushes/PlainBrush.cs b/Pinta.Tools/Brushes/PlainBrush.cs
index f46368f..8e4cc56 100644
--- a/Pinta.Tools/Brushes/PlainBrush.cs
+++ b/Pinta.Tools/Brushes/PlainBrush.cs
@@ -31,7 +31,7 @@ using Pinta.Core;
namespace Pinta.Tools.Brushes
{
- //[System.ComponentModel.Composition (typeof (BasePaintBrush))]
+ [System.ComponentModel.Composition.Export (typeof (BasePaintBrush))]
public class PlainBrush : PaintBrush
{
public override string Name {
diff --git a/Pinta.Tools/Brushes/SplatterBrush.cs b/Pinta.Tools/Brushes/SplatterBrush.cs
index 23f3ff6..df50dd0 100644
--- a/Pinta.Tools/Brushes/SplatterBrush.cs
+++ b/Pinta.Tools/Brushes/SplatterBrush.cs
@@ -31,7 +31,7 @@ using Pinta.Core;
namespace Pinta.Tools.Brushes
{
- //[System.ComponentModel.Composition (typeof (BasePaintBrush))]
+ [System.ComponentModel.Composition.Export (typeof (BasePaintBrush))]
public class SplatterBrush : PaintBrush
{
public override string Name {
diff --git a/Pinta.Tools/Brushes/SquaresBrush.cs b/Pinta.Tools/Brushes/SquaresBrush.cs
index 8e6ab1e..66fb3c8 100644
--- a/Pinta.Tools/Brushes/SquaresBrush.cs
+++ b/Pinta.Tools/Brushes/SquaresBrush.cs
@@ -31,7 +31,7 @@ using Pinta.Core;
namespace Pinta.Tools.Brushes
{
- //[System.ComponentModel.Composition (typeof (BasePaintBrush))]
+ [System.ComponentModel.Composition.Export (typeof (BasePaintBrush))]
public class SquaresBrush : PaintBrush
{
private static double theta = Math.PI / 2;
diff --git a/Pinta.Tools/CloneStampTool.cs b/Pinta.Tools/CloneStampTool.cs
index 203991c..83d1ead 100644
--- a/Pinta.Tools/CloneStampTool.cs
+++ b/Pinta.Tools/CloneStampTool.cs
@@ -31,7 +31,7 @@ using Gdk;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class CloneStampTool : BaseBrushTool
{
private bool painting;
diff --git a/Pinta.Tools/ColorPickerTool.cs b/Pinta.Tools/ColorPickerTool.cs
index 76629be..214cccf 100644
--- a/Pinta.Tools/ColorPickerTool.cs
+++ b/Pinta.Tools/ColorPickerTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class ColorPickerTool : BaseTool
{
private int button_down = 0;
diff --git a/Pinta.Tools/EllipseSelectTool.cs b/Pinta.Tools/EllipseSelectTool.cs
index 6a3d149..abf4b0e 100644
--- a/Pinta.Tools/EllipseSelectTool.cs
+++ b/Pinta.Tools/EllipseSelectTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class EllipseSelectTool : SelectTool
{
public override string Name {
diff --git a/Pinta.Tools/EllipseTool.cs b/Pinta.Tools/EllipseTool.cs
index a9e6c11..c371657 100644
--- a/Pinta.Tools/EllipseTool.cs
+++ b/Pinta.Tools/EllipseTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class EllipseTool : ShapeTool
{
public override string Name {
diff --git a/Pinta.Tools/EraserTool.cs b/Pinta.Tools/EraserTool.cs
index cbc5eac..ac308bf 100644
--- a/Pinta.Tools/EraserTool.cs
+++ b/Pinta.Tools/EraserTool.cs
@@ -32,7 +32,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class EraserTool : BaseBrushTool
{
private Point last_point = point_empty;
diff --git a/Pinta.Tools/FreeformShapeTool.cs b/Pinta.Tools/FreeformShapeTool.cs
index f90ef44..8f44762 100644
--- a/Pinta.Tools/FreeformShapeTool.cs
+++ b/Pinta.Tools/FreeformShapeTool.cs
@@ -32,7 +32,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class FreeformShapeTool : BaseBrushTool
{
private Point last_point = point_empty;
diff --git a/Pinta.Tools/GradientTool.cs b/Pinta.Tools/GradientTool.cs
index 0e01e85..9129aa1 100644
--- a/Pinta.Tools/GradientTool.cs
+++ b/Pinta.Tools/GradientTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class GradientTool : BaseTool
{
Cairo.PointD startpoint;
diff --git a/Pinta.Tools/LassoSelectTool.cs b/Pinta.Tools/LassoSelectTool.cs
index e6abf97..a47c38d 100644
--- a/Pinta.Tools/LassoSelectTool.cs
+++ b/Pinta.Tools/LassoSelectTool.cs
@@ -32,7 +32,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class LassoSelectTool : SelectTool
{
private Path path;
diff --git a/Pinta.Tools/LineCurveTool.cs b/Pinta.Tools/LineCurveTool.cs
index 4ba6901..dc91623 100644
--- a/Pinta.Tools/LineCurveTool.cs
+++ b/Pinta.Tools/LineCurveTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class LineCurveTool : ShapeTool
{
public override string Name {
diff --git a/Pinta.Tools/MagicWandTool.cs b/Pinta.Tools/MagicWandTool.cs
index a7e0dcd..d201484 100644
--- a/Pinta.Tools/MagicWandTool.cs
+++ b/Pinta.Tools/MagicWandTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class MagicWandTool : FloodTool
{
private CombineMode combineMode;
diff --git a/Pinta.Tools/MoveSelectedTool.cs b/Pinta.Tools/MoveSelectedTool.cs
index b432e9a..18ec733 100644
--- a/Pinta.Tools/MoveSelectedTool.cs
+++ b/Pinta.Tools/MoveSelectedTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class MoveSelectedTool : BaseTool
{
private PointD origin_offset;
diff --git a/Pinta.Tools/MoveSelectionTool.cs b/Pinta.Tools/MoveSelectionTool.cs
index d897ab5..a2a6bf4 100644
--- a/Pinta.Tools/MoveSelectionTool.cs
+++ b/Pinta.Tools/MoveSelectionTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class MoveSelectionTool : BaseTool
{
private PointD origin_offset;
diff --git a/Pinta.Tools/PaintBrushTool.cs b/Pinta.Tools/PaintBrushTool.cs
index 72ebc15..a1e05f0 100644
--- a/Pinta.Tools/PaintBrushTool.cs
+++ b/Pinta.Tools/PaintBrushTool.cs
@@ -34,7 +34,7 @@ using Pinta.Tools.Brushes;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class PaintBrushTool : BaseBrushTool
{
#region Properties
diff --git a/Pinta.Tools/PaintBucketTool.cs b/Pinta.Tools/PaintBucketTool.cs
index 1650e06..007d38a 100644
--- a/Pinta.Tools/PaintBucketTool.cs
+++ b/Pinta.Tools/PaintBucketTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class PaintBucketTool : FloodTool
{
private Color fill_color;
diff --git a/Pinta.Tools/PanTool.cs b/Pinta.Tools/PanTool.cs
index fa45a1d..788b00a 100644
--- a/Pinta.Tools/PanTool.cs
+++ b/Pinta.Tools/PanTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class PanTool : BaseTool
{
public override string Name {
diff --git a/Pinta.Tools/PencilTool.cs b/Pinta.Tools/PencilTool.cs
index ec03a36..8fc38f2 100644
--- a/Pinta.Tools/PencilTool.cs
+++ b/Pinta.Tools/PencilTool.cs
@@ -32,7 +32,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class PencilTool : BaseTool
{
private Point last_point = point_empty;
diff --git a/Pinta.Tools/Pinta.Tools.csproj b/Pinta.Tools/Pinta.Tools.csproj
index 571c0f2..dd3644b 100644
--- a/Pinta.Tools/Pinta.Tools.csproj
+++ b/Pinta.Tools/Pinta.Tools.csproj
@@ -36,7 +36,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>..\bin\</OutputPath>
+ <OutputPath>..\bin\Extensions\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -46,7 +46,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
- <OutputPath>..\bin\</OutputPath>
+ <OutputPath>..\bin\Extensions\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -112,6 +112,11 @@
<Name>Pinta.Core</Name>
<Private>False</Private>
</ProjectReference>
+ <ProjectReference Include="..\System.ComponentModel.Composition\System.ComponentModel.Composition.csproj">
+ <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
+ <Name>System.ComponentModel.Composition</Name>
+ <Private>False</Private>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
diff --git a/Pinta.Tools/RecolorTool.cs b/Pinta.Tools/RecolorTool.cs
index 3af66e5..eca9dbe 100644
--- a/Pinta.Tools/RecolorTool.cs
+++ b/Pinta.Tools/RecolorTool.cs
@@ -41,7 +41,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class RecolorTool : BaseBrushTool
{
protected ToolBarLabel tolerance_label;
diff --git a/Pinta.Tools/RectangleSelectTool.cs b/Pinta.Tools/RectangleSelectTool.cs
index bdee07f..6357897 100644
--- a/Pinta.Tools/RectangleSelectTool.cs
+++ b/Pinta.Tools/RectangleSelectTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class RectangleSelectTool : SelectTool
{
public override string Name {
diff --git a/Pinta.Tools/RectangleTool.cs b/Pinta.Tools/RectangleTool.cs
index ae1eee1..20d32e0 100644
--- a/Pinta.Tools/RectangleTool.cs
+++ b/Pinta.Tools/RectangleTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class RectangleTool : ShapeTool
{
public override string Name {
diff --git a/Pinta.Tools/RoundedRectangleTool.cs b/Pinta.Tools/RoundedRectangleTool.cs
index 1771707..a98c24a 100644
--- a/Pinta.Tools/RoundedRectangleTool.cs
+++ b/Pinta.Tools/RoundedRectangleTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class RoundedRectangleTool : ShapeTool
{
protected ToolBarComboBox radius;
diff --git a/Pinta.Tools/TextTool/TextTool.cs b/Pinta.Tools/TextTool/TextTool.cs
index 8885036..a390a91 100644
--- a/Pinta.Tools/TextTool/TextTool.cs
+++ b/Pinta.Tools/TextTool/TextTool.cs
@@ -17,7 +17,7 @@ using Pinta.Core;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class TextTool : BaseTool
{
// Variables for dragging
diff --git a/Pinta.Tools/ZoomTool.cs b/Pinta.Tools/ZoomTool.cs
index 94c92f6..1ad5668 100644
--- a/Pinta.Tools/ZoomTool.cs
+++ b/Pinta.Tools/ZoomTool.cs
@@ -31,7 +31,7 @@ using Mono.Unix;
namespace Pinta.Tools
{
- //[System.ComponentModel.Composition (typeof (BaseTool))]
+ [System.ComponentModel.Composition.Export (typeof (BaseTool))]
public class ZoomTool : BaseTool
{
private Gdk.Cursor cursorZoomIn;
diff --git a/Pinta.sln b/Pinta.sln
index 025f31b..d3ad5ac 100644
--- a/Pinta.sln
+++ b/Pinta.sln
@@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pinta.Tools", "Pinta.Tools\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pinta.Effects", "Pinta.Effects\Pinta.Effects.csproj", "{71A1C3E0-7343-48FE-BD9A-508929136E92}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.ComponentModel.Composition", "System.ComponentModel.Composition\System.ComponentModel.Composition.csproj", "{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -46,6 +48,10 @@ Global
{71A1C3E0-7343-48FE-BD9A-508929136E92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{71A1C3E0-7343-48FE-BD9A-508929136E92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{71A1C3E0-7343-48FE-BD9A-508929136E92}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Pinta/ExtensionPoints.cs b/Pinta/ExtensionPoints.cs
index e56d70c..87b3673 100644
--- a/Pinta/ExtensionPoints.cs
+++ b/Pinta/ExtensionPoints.cs
@@ -26,99 +26,20 @@
using System;
using System.Collections.Generic;
-//using System.ComponentModel.Composition;
+using System.ComponentModel.Composition;
using Pinta.Core;
-using Pinta.Tools;
-using Pinta.Effects;
-using Pinta.Tools.Brushes;
namespace Pinta
{
class ExtensionPoints
{
- //[ImportMany]
+ [ImportMany]
+ public IEnumerable<BaseExtension> Extensions { get; set; }
+ [ImportMany]
public IEnumerable<BaseTool> Tools { get; set; }
- //[ImportMany]
+ [ImportMany]
public IEnumerable<BaseEffect> Effects { get; set; }
- //[ImportMany]
+ [ImportMany]
public IEnumerable<BasePaintBrush> PaintBrushes { get; set; }
-
- public ExtensionPoints ()
- {
- Tools = new List<BaseTool> {
- new RectangleSelectTool (),
- new MoveSelectedTool (),
- new LassoSelectTool (),
- new MoveSelectionTool (),
- new EllipseSelectTool (),
- new ZoomTool (),
- new MagicWandTool (),
- new PanTool (),
- new PaintBucketTool (),
- new GradientTool (),
- new PaintBrushTool (),
- new EraserTool (),
- new PencilTool (),
- new ColorPickerTool (),
- new CloneStampTool (),
- new RecolorTool (),
- new TextTool (),
- new LineCurveTool (),
- new RectangleTool (),
- new RoundedRectangleTool (),
- new EllipseTool (),
- new FreeformShapeTool ()
- };
-
- Effects = new List<BaseEffect> () {
- new AutoLevelEffect (),
- new BlackAndWhiteEffect (),
- new BrightnessContrastEffect (),
- new CurvesEffect (),
- new HueSaturationEffect (),
- new InvertColorsEffect (),
- new LevelsEffect (),
- new PosterizeEffect (),
- new SepiaEffect (),
- new AddNoiseEffect (),
- new BulgeEffect (),
- new CloudsEffect (),
- new EdgeDetectEffect (),
- new EmbossEffect (),
- new FragmentEffect (),
- new FrostedGlassEffect (),
- new GaussianBlurEffect (),
- new GlowEffect (),
- new InkSketchEffect (),
- new JuliaFractalEffect (),
- new MandelbrotFractalEffect (),
- new MedianEffect (),
- new MotionBlurEffect (),
- new OilPaintingEffect (),
- new OutlineEffect (),
- new PencilSketchEffect (),
- new PixelateEffect (),
- new PolarInversionEffect (),
- new RadialBlurEffect (),
- new RedEyeRemoveEffect (),
- new ReduceNoiseEffect (),
- new ReliefEffect (),
- new SharpenEffect (),
- new SoftenPortraitEffect (),
- new TileEffect (),
- new TwistEffect (),
- new UnfocusEffect (),
- new ZoomBlurEffect ()
- };
-
- PaintBrushes = new List<BasePaintBrush> {
- new CircleBrush (),
- new GridBrush (),
- new PlainBrush (),
- new SplatterBrush (),
- new SquaresBrush ()
- };
- }
-
}
}
diff --git a/Pinta/MainWindow.cs b/Pinta/MainWindow.cs
index 2eaee6a..3d06564 100644
--- a/Pinta/MainWindow.cs
+++ b/Pinta/MainWindow.cs
@@ -25,8 +25,8 @@
// THE SOFTWARE.
using System;
-//using System.ComponentModel.Composition;
-//using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition;
+using System.ComponentModel.Composition.Hosting;
using System.Linq;
using Gtk;
using MonoDevelop.Components.Docking;
@@ -41,7 +41,7 @@ namespace Pinta
DialogHandlers dialog_handler;
ProgressDialog progress_dialog;
- ExtensionPoints extensions;
+ ExtensionPoints extensions = new ExtensionPoints ();
Toolbar main_toolbar;
Toolbar tool_toolbar;
@@ -333,16 +333,15 @@ namespace Pinta
#region Extension Handlers
private void Compose ()
{
- extensions = new ExtensionPoints ();
- //string ext_dir = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetEntryAssembly ().Location), "Extensions");
+ string ext_dir = System.IO.Path.Combine (System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetEntryAssembly ().Location), "Extensions");
- //var catalog = new DirectoryCatalog (ext_dir, "*.dll");
- //var container = new CompositionContainer (catalog);
+ var catalog = new DirectoryCatalog (ext_dir, "*.dll");
+ var container = new CompositionContainer (catalog);
- //container.ComposeParts (extensions);
+ container.ComposeParts (extensions);
- //foreach (var extension in extensions.Extensions)
- // extension.Initialize ();
+ foreach (var extension in extensions.Extensions)
+ extension.Initialize ();
}
private void LoadPaintBrushes ()
diff --git a/Pinta/Pinta.csproj b/Pinta/Pinta.csproj
index 46b4144..4ed57e8 100644
--- a/Pinta/Pinta.csproj
+++ b/Pinta/Pinta.csproj
@@ -171,17 +171,13 @@
<Project>{30091528-6EC1-40F8-B4BF-8EB41CBE8A8B}</Project>
<Name>Pinta.Core</Name>
</ProjectReference>
- <ProjectReference Include="..\Pinta.Effects\Pinta.Effects.csproj">
- <Project>{71A1C3E0-7343-48FE-BD9A-508929136E92}</Project>
- <Name>Pinta.Effects</Name>
- </ProjectReference>
<ProjectReference Include="..\Pinta.Gui.Widgets\Pinta.Gui.Widgets.csproj">
<Project>{83F0C0AD-D587-457C-B72A-1A184D6D76B3}</Project>
<Name>Pinta.Gui.Widgets</Name>
</ProjectReference>
- <ProjectReference Include="..\Pinta.Tools\Pinta.Tools.csproj">
- <Project>{526152F2-2829-4AA6-B2F2-232579858A77}</Project>
- <Name>Pinta.Tools</Name>
+ <ProjectReference Include="..\System.ComponentModel.Composition\System.ComponentModel.Composition.csproj">
+ <Project>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</Project>
+ <Name>System.ComponentModel.Composition</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
diff --git a/System.ComponentModel.Composition/AssemblyInfo.cs b/System.ComponentModel.Composition/AssemblyInfo.cs
new file mode 100644
index 0000000..6bb2f4a
--- /dev/null
+++ b/System.ComponentModel.Composition/AssemblyInfo.cs
@@ -0,0 +1,9 @@
+//------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//------------------------------------------------------------
+[assembly: System.CLSCompliant(true)]
+[assembly: System.Reflection.AssemblyTitle("System.ComponentModel.Composition")]
+[assembly: System.Reflection.AssemblyCopyright("(c) Microsoft Corporation. All rights reserved.")]
+[assembly: System.Reflection.AssemblyVersion("2010.02.11")]
+[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.ComponentModel.Composition.UnitTests")]
+[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.ComponentModel.Composition.UnitTestFramework")]
diff --git a/System.ComponentModel.Composition/ComponentModel.csproj b/System.ComponentModel.Composition/ComponentModel.csproj
new file mode 100644
index 0000000..eaecf91
--- /dev/null
+++ b/System.ComponentModel.Composition/ComponentModel.csproj
@@ -0,0 +1,237 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
+ <CodeAnalysisRuleSet>Migrated rules for ComponentModel.ruleset</CodeAnalysisRuleSet>
+ <CodeAnalysisRules />
+ </PropertyGroup>
+ <PropertyGroup>
+ <OutputPath>..\..\bin</OutputPath>
+ <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
+ <NoWarn>1570;1572;1573;1591;1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ProductVersion>10.0.20729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</ProjectGuid>
+ <ProjectClrTypes>FULLCLR;SILVERLIGHT</ProjectClrTypes>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Microsoft.Internal</RootNamespace>
+ <AssemblyName>System.ComponentModel.Composition</AssemblyName>
+ <DocumentationFile>$(OutputPath)\System.ComponentModel.Composition.xml</DocumentationFile>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ <NoStdLib>true</NoStdLib>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(USE_CUSTOM_KEY)' != 'true'">
+ <CreateMetaAssembly>true</CreateMetaAssembly>
+ <CreateRefAssembly>true</CreateRefAssembly>
+ <PublishMetaAssemblyToSDK>true</PublishMetaAssemblyToSDK>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="Microsoft\Internal\Assumes.cs" />
+ <Compile Include="Microsoft\Internal\AttributeServices.cs" />
+ <Compile Include="Microsoft\Internal\Collections\CollectionServices.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
+ <Compile Include="Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
+ <Compile Include="Microsoft\Internal\Collections\EnumerableCardinality.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
+ <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
+ <Compile Include="Microsoft\Internal\ContractServices.cs" />
+ <Compile Include="Microsoft\Internal\Assumes.InternalErrorException.cs" />
+ <Compile Include="Microsoft\Internal\SilverlightReflectionInvoke.cs" />
+ <Compile Include="Microsoft\Internal\GenerationServices.cs" />
+ <Compile Include="Microsoft\Internal\LazyServices.cs" />
+ <Compile Include="Microsoft\Internal\Lock.cs" />
+ <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
+ <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
+ <Compile Include="Microsoft\Internal\Requires.cs" />
+ <Compile Include="Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
+ <Compile Include="Microsoft\Internal\StringComparers.cs" />
+ <Compile Include="Microsoft\Internal\ReflectionServices.cs" />
+ <Compile Include="Strings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Strings.resx</DependentUpon>
+ <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
+ </Compile>
+ <Compile Include="SuppressMessages.cs" />
+ <Compile Include="SuppressMessagesBaselined.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModelServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
+ <Compile Include="System\ComponentModel\Composition\ConstraintServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionError.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionResultOfT.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\InheritedExportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\IAttributedImport.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportManyAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ErrorBuilder.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExceptionBuilder.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\ICompositionError.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\Export.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
+ <Compile Include="Microsoft\Internal\ReflectionInvoke.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataViewProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartMetadataAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataViewGenerator.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
+ <Compile Include="System\ComponentModel\Composition\ChangeRejectedException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionErrorId.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionResult.cs" />
+ <Compile Include="System\ComponentModel\Composition\ContractNameServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\CreationPolicy.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ICompositionService.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
+ <Compile Include="System\Lazy.cs" />
+ <Compile Include="System\LazyOfTTMetadata.cs" />
+ <Compile Include="System\Tuple.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(IsSilverLight)' != 'true'">
+ <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(IsSilverLight)' == 'true'">
+ <Compile Include="SilverlightAdditions.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Strings.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Strings.Designer.cs</LastGenOutput>
+ <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
+</Project>
diff --git a/System.ComponentModel.Composition/Makefile.am b/System.ComponentModel.Composition/Makefile.am
new file mode 100644
index 0000000..ef55508
--- /dev/null
+++ b/System.ComponentModel.Composition/Makefile.am
@@ -0,0 +1,165 @@
+include $(top_srcdir)/Makefile.include
+
+ASSEMBLY = System.Composition.ComponentModel
+TARGET = library
+
+REFERENCES = \
+ -r:mscorlib \
+ -r:System \
+ -r:System.Core
+
+SOURCES = \
+ AssemblyInfo.cs \
+ Microsoft/Internal/Assumes.cs \
+ Microsoft/Internal/AttributeServices.cs \
+ Microsoft/Internal/Collections/CollectionServices.cs \
+ Microsoft/Internal/Collections/ConditionalWeakTable.cs \
+ Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs \
+ Microsoft/Internal/Collections/EnumerableCardinality.cs \
+ Microsoft/Internal/Collections/ReadOnlyDictionary.cs \
+ Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs \
+ Microsoft/Internal/Collections/WeakReferenceCollection.cs \
+ Microsoft/Internal/ContractServices.cs \
+ Microsoft/Internal/Assumes.InternalErrorException.cs \
+ Microsoft/Internal/SilverlightReflectionInvoke.cs \
+ Microsoft/Internal/GenerationServices.cs \
+ Microsoft/Internal/LazyServices.cs \
+ Microsoft/Internal/Lock.cs \
+ Microsoft/Internal/Lock.Reader.cs \
+ Microsoft/Internal/Lock.Writer.cs \
+ Microsoft/Internal/Requires.cs \
+ Microsoft/Internal/Runtime/Serialization/SerializationServices.cs \
+ Microsoft/Internal/StringComparers.cs \
+ Microsoft/Internal/ReflectionServices.cs \
+ Strings.Designer.cs \
+ SuppressMessages.cs \
+ SuppressMessagesBaselined.cs \
+ System/ComponentModel/Composition/AttributedModelServices.cs \
+ System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs \
+ System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs \
+ System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs \
+ System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs \
+ System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs \
+ System/ComponentModel/Composition/ConstraintServices.cs \
+ System/ComponentModel/Composition/CompositionContractMismatchException.cs \
+ System/ComponentModel/Composition/CompositionError.cs \
+ System/ComponentModel/Composition/CompositionResultOfT.cs \
+ System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs \
+ System/ComponentModel/Composition/Hosting/CompositionLock.cs \
+ System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs \
+ System/ComponentModel/Composition/Diagnostics/TraceWriter.cs \
+ System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs \
+ System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs \
+ System/ComponentModel/Composition/InheritedExportAttribute.cs \
+ System/ComponentModel/Composition/ExportServices.DisposableLazy.cs \
+ System/ComponentModel/Composition/Hosting/AtomicComposition.cs \
+ System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs \
+ System/ComponentModel/Composition/Hosting/CompositionConstants.cs \
+ System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs \
+ System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs \
+ System/ComponentModel/Composition/IAttributedImport.cs \
+ System/ComponentModel/Composition/ImportCardinalityMismatchException.cs \
+ System/ComponentModel/Composition/ImportManyAttribute.cs \
+ System/ComponentModel/Composition/ErrorBuilder.cs \
+ System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs \
+ System/ComponentModel/Composition/ExceptionBuilder.cs \
+ System/ComponentModel/Composition/ExportCardinalityCheckResult.cs \
+ System/ComponentModel/Composition/ExportServices.cs \
+ System/ComponentModel/Composition/Hosting/AggregateCatalog.cs \
+ System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs \
+ System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs \
+ System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs \
+ System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs \
+ System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs \
+ System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs \
+ System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs \
+ System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs \
+ System/ComponentModel/Composition/Hosting/CompositionBatch.cs \
+ System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs \
+ System/ComponentModel/Composition/Hosting/CompositionContainer.cs \
+ System/ComponentModel/Composition/Hosting/CompositionServices.cs \
+ System/ComponentModel/Composition/Hosting/ExportProvider.cs \
+ System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs \
+ System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs \
+ System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs \
+ System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs \
+ System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs \
+ System/ComponentModel/Composition/Hosting/ImportEngine.cs \
+ System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs \
+ System/ComponentModel/Composition/Hosting/TypeCatalog.cs \
+ System/ComponentModel/Composition/ICompositionError.cs \
+ System/ComponentModel/Composition/ImportingConstructorAttribute.cs \
+ System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs \
+ System/ComponentModel/Composition/MetadataServices.cs \
+ System/ComponentModel/Composition/Primitives/ComposablePart.cs \
+ System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs \
+ System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs \
+ System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs \
+ System/ComponentModel/Composition/Primitives/ComposablePartException.cs \
+ System/ComponentModel/Composition/Primitives/CompositionElement.cs \
+ System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs \
+ System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs \
+ System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs \
+ System/ComponentModel/Composition/Primitives/Export.cs \
+ System/ComponentModel/Composition/Primitives/ExportDefinition.cs \
+ System/ComponentModel/Composition/Primitives/ExportedDelegate.cs \
+ System/ComponentModel/Composition/Primitives/ICompositionElement.cs \
+ System/ComponentModel/Composition/Primitives/ImportCardinality.cs \
+ System/ComponentModel/Composition/Primitives/ImportDefinition.cs \
+ System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs \
+ System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs \
+ System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs \
+ System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs \
+ Microsoft/Internal/ReflectionInvoke.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs \
+ System/ComponentModel/Composition/MetadataViewProvider.cs \
+ System/ComponentModel/Composition/PartCreationPolicyAttribute.cs \
+ System/ComponentModel/Composition/PartMetadataAttribute.cs \
+ System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs \
+ System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs \
+ System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs \
+ System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs \
+ System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs \
+ System/ComponentModel/Composition/ReflectionModel/ImportType.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs \
+ System/ComponentModel/Composition/MetadataViewGenerator.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs \
+ System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs \
+ System/ComponentModel/Composition/ChangeRejectedException.cs \
+ System/ComponentModel/Composition/CompositionException.cs \
+ System/ComponentModel/Composition/CompositionErrorId.cs \
+ System/ComponentModel/Composition/CompositionResult.cs \
+ System/ComponentModel/Composition/ContractNameServices.cs \
+ System/ComponentModel/Composition/CreationPolicy.cs \
+ System/ComponentModel/Composition/ExportAttribute.cs \
+ System/ComponentModel/Composition/ExportMetadataAttribute.cs \
+ System/ComponentModel/Composition/ICompositionService.cs \
+ System/ComponentModel/Composition/ImportAttribute.cs \
+ System/ComponentModel/Composition/MetadataAttributeAttribute.cs \
+ System/Lazy.cs \
+ System/LazyOfTTMetadata.cs \
+ System/Tuple.cs \
+ System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs \
+ System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs
+
+RESOURCES = \
+ Strings.resx
+
+# ,System.ComponentModel.Composition.Strings.resources
+
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Assumes.InternalErrorException.cs b/System.ComponentModel.Composition/Microsoft/Internal/Assumes.InternalErrorException.cs
new file mode 100644
index 0000000..3059b63
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Assumes.InternalErrorException.cs
@@ -0,0 +1,32 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Internal
+{
+ partial class Assumes
+ {
+ // The exception that is thrown when an internal assumption failed.
+ [Serializable]
+ [SuppressMessage("Microsoft.Design", "CA1064:ExceptionsShouldBePublic")]
+ private class InternalErrorException : Exception
+ {
+ public InternalErrorException(string message)
+ : base(string.Format(CultureInfo.CurrentCulture, Strings.InternalExceptionMessage, message))
+ {
+ }
+
+#if !SILVERLIGHT
+ [System.Security.SecuritySafeCritical]
+ protected InternalErrorException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+#endif
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Assumes.cs b/System.ComponentModel.Composition/Microsoft/Internal/Assumes.cs
new file mode 100644
index 0000000..2aa03cd
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Assumes.cs
@@ -0,0 +1,102 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Internal
+{
+ internal static partial class Assumes
+ {
+ [DebuggerStepThrough]
+ internal static void NotNull<T>(T value)
+ where T : class
+ {
+ IsTrue(value != null);
+ }
+
+ [DebuggerStepThrough]
+ internal static void NotNull<T1, T2>(T1 value1, T2 value2)
+ where T1 : class
+ where T2 : class
+ {
+ NotNull(value1);
+ NotNull(value2);
+ }
+
+ [DebuggerStepThrough]
+ internal static void NotNull<T1, T2, T3>(T1 value1, T2 value2, T3 value3)
+ where T1 : class
+ where T2 : class
+ where T3 : class
+ {
+ NotNull(value1);
+ NotNull(value2);
+ NotNull(value3);
+ }
+
+ [DebuggerStepThrough]
+ internal static void NotNullOrEmpty<T>(T[] values)
+ {
+ Assumes.NotNull(values);
+ Assumes.IsTrue(values.Length > 0);
+ }
+
+ [DebuggerStepThrough]
+ internal static void NotNullOrEmpty(string value)
+ {
+ NotNull(value);
+ IsTrue(value.Length > 0);
+ }
+
+ [DebuggerStepThrough]
+ internal static void Null<T>(T value)
+ where T : class
+ {
+ IsTrue(value == null);
+ }
+
+ [DebuggerStepThrough]
+ internal static void IsFalse(bool condition)
+ {
+ if (condition)
+ {
+ Fail(null);
+ }
+ }
+
+ [DebuggerStepThrough]
+ internal static void IsTrue(bool condition)
+ {
+ if (!condition)
+ {
+ Fail(null);
+ }
+ }
+
+ [DebuggerStepThrough]
+ internal static void IsTrue(bool condition, [Localizable(false)]string message)
+ {
+ if (!condition)
+ {
+ Fail(message);
+ }
+ }
+
+ [DebuggerStepThrough]
+ internal static void Fail([Localizable(false)]string message)
+ {
+ throw new InternalErrorException(message);
+ }
+
+ [DebuggerStepThrough]
+ internal static T NotReachable<T>()
+ {
+ throw new InternalErrorException("Code path should never be reached!");
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/AttributeServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/AttributeServices.cs
new file mode 100644
index 0000000..6b9f08b
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/AttributeServices.cs
@@ -0,0 +1,43 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace Microsoft.Internal
+{
+ internal static class AttributeServices
+ {
+ public static T[] GetAttributes<T>(this ICustomAttributeProvider attributeProvider) where T : class
+ {
+ return (T[])attributeProvider.GetCustomAttributes(typeof(T), false);
+ }
+
+ public static T[] GetAttributes<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
+ {
+ return (T[])attributeProvider.GetCustomAttributes(typeof(T), inherit);
+ }
+
+ public static T GetFirstAttribute<T>(this ICustomAttributeProvider attributeProvider) where T : class
+ {
+ return GetAttributes<T>(attributeProvider).FirstOrDefault();
+ }
+
+ public static T GetFirstAttribute<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
+ {
+ return GetAttributes<T>(attributeProvider, inherit).FirstOrDefault();
+ }
+
+ public static bool IsAttributeDefined<T>(this ICustomAttributeProvider attributeProvider) where T : class
+ {
+ return attributeProvider.IsDefined(typeof(T), false);
+ }
+
+ public static bool IsAttributeDefined<T>(this ICustomAttributeProvider attributeProvider, bool inherit) where T : class
+ {
+ return attributeProvider.IsDefined(typeof(T), inherit);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs
new file mode 100644
index 0000000..e0617a5
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.CollectionOfObject.cs
@@ -0,0 +1,145 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Reflection;
+
+namespace Microsoft.Internal.Collections
+{
+ internal static partial class CollectionServices
+ {
+ public static ICollection<object> GetCollectionWrapper(Type itemType, object collectionObject)
+ {
+ Assumes.NotNull(itemType, collectionObject);
+
+ if (itemType == typeof(object))
+ {
+ return (ICollection<object>)collectionObject;
+ }
+
+ // Most common .Net collections implement IList as well so for those
+ // cases we can optimize the wrapping instead of using reflection to create
+ // a generic type.
+ if (typeof(IList).IsAssignableFrom(collectionObject.GetType()))
+ {
+ return new CollectionOfObjectList((IList)collectionObject);
+ }
+
+ Type collectionType = typeof(CollectionOfObject<>).MakeGenericType(itemType);
+
+ return (ICollection<object>)Activator.CreateInstance(collectionType, collectionObject);
+ }
+
+ private class CollectionOfObjectList : ICollection<object>
+ {
+ private readonly IList _list;
+
+ public CollectionOfObjectList(IList list)
+ {
+ this._list = list;
+ }
+
+ public void Add(object item)
+ {
+ this._list.Add(item);
+ }
+
+ public void Clear()
+ {
+ this._list.Clear();
+ }
+
+ public bool Contains(object item)
+ {
+ return Assumes.NotReachable<bool>();
+ }
+
+ public void CopyTo(object[] array, int arrayIndex)
+ {
+ Assumes.NotReachable<object>();
+ }
+
+ public int Count
+ {
+ get { return Assumes.NotReachable<int>(); }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return this._list.IsReadOnly; }
+ }
+
+ public bool Remove(object item)
+ {
+ return Assumes.NotReachable<bool>();
+ }
+
+ public IEnumerator<object> GetEnumerator()
+ {
+ return Assumes.NotReachable<IEnumerator<object>>();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return Assumes.NotReachable<IEnumerator>();
+ }
+ }
+
+ private class CollectionOfObject<T> : ICollection<object>
+ {
+ private readonly ICollection<T> _collectionOfT;
+
+ public CollectionOfObject(object collectionOfT)
+ {
+ this._collectionOfT = (ICollection<T>)collectionOfT;
+ }
+
+ public void Add(object item)
+ {
+ this._collectionOfT.Add((T) item);
+ }
+
+ public void Clear()
+ {
+ this._collectionOfT.Clear();
+ }
+
+ public bool Contains(object item)
+ {
+ return Assumes.NotReachable<bool>();
+ }
+
+ public void CopyTo(object[] array, int arrayIndex)
+ {
+ Assumes.NotReachable<object>();
+ }
+
+ public int Count
+ {
+ get { return Assumes.NotReachable<int>(); }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return this._collectionOfT.IsReadOnly; }
+ }
+
+ public bool Remove(object item)
+ {
+ return Assumes.NotReachable<bool>();
+ }
+
+ public IEnumerator<object> GetEnumerator()
+ {
+ return Assumes.NotReachable<IEnumerator<object>>();
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return Assumes.NotReachable<IEnumerator>();
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.cs
new file mode 100644
index 0000000..714c333
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/CollectionServices.cs
@@ -0,0 +1,181 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+
+namespace Microsoft.Internal.Collections
+{
+ internal static partial class CollectionServices
+ {
+ private static readonly Type StringType = typeof(string);
+ private static readonly Type IEnumerableType = typeof(IEnumerable);
+ private static readonly Type IEnumerableOfTType = typeof(IEnumerable<>);
+ private static readonly Type ICollectionOfTType = typeof(ICollection<>);
+
+ public static bool IsEnumerableOfT(Type type)
+ {
+ if (type.IsGenericType)
+ {
+ Type genericType = type.GetGenericTypeDefinition();
+
+ if (genericType == IEnumerableOfTType)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static Type GetEnumerableElementType(Type type)
+ {
+ if (type == StringType || !IEnumerableType.IsAssignableFrom(type))
+ {
+ return null;
+ }
+
+ Type closedType;
+ if (ReflectionServices.TryGetGenericInterfaceType(type, IEnumerableOfTType, out closedType))
+ {
+ return closedType.GetGenericArguments()[0];
+ }
+
+ return null;
+ }
+
+ public static Type GetCollectionElementType(Type type)
+ {
+ Type closedType;
+ if (ReflectionServices.TryGetGenericInterfaceType(type, ICollectionOfTType, out closedType))
+ {
+ return closedType.GetGenericArguments()[0];
+ }
+
+ return null;
+ }
+
+ public static ReadOnlyCollection<T> ToReadOnlyCollection<T>(this IEnumerable<T> source)
+ {
+ Assumes.NotNull(source);
+
+ return new ReadOnlyCollection<T>(source.AsArray());
+ }
+
+ public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> source) where T : class
+ {
+ Assumes.NotNull(source);
+ return source.Where(NotNull); // Use non-generic NotNull for performance reasons
+ }
+
+ private static bool NotNull(object element)
+ {
+ return element != null;
+ }
+
+ public static IEnumerable<T> ConcatAllowingNull<T>(this IEnumerable<T> source, IEnumerable<T> second)
+ {
+ if (second == null || !second.FastAny())
+ {
+ return source;
+ }
+
+ if (source == null || !source.FastAny())
+ {
+ return second;
+ }
+
+ return source.Concat(second);
+ }
+
+ public static void ForEach<T>(this IEnumerable<T> source, Action<T> action)
+ {
+ foreach(T t in source)
+ {
+ action.Invoke(t);
+ }
+ }
+
+ public static EnumerableCardinality GetCardinality<T>(this IEnumerable<T> source)
+ {
+ Assumes.NotNull(source);
+
+ // Cast to ICollection instead of ICollection<T> for performance reasons.
+ ICollection collection = source as ICollection;
+ if (collection != null)
+ {
+ switch (collection.Count)
+ {
+ case 0:
+ return EnumerableCardinality.Zero;
+
+ case 1:
+ return EnumerableCardinality.One;
+
+ default:
+ return EnumerableCardinality.TwoOrMore;
+ }
+ }
+
+ using (var enumerator = source.GetEnumerator())
+ {
+ if (!enumerator.MoveNext())
+ {
+ return EnumerableCardinality.Zero;
+ }
+
+ if (!enumerator.MoveNext())
+ {
+ return EnumerableCardinality.One;
+ }
+
+ return EnumerableCardinality.TwoOrMore;
+ }
+ }
+
+ public static bool FastAny<T>(this IEnumerable<T> source)
+ {
+ // Enumerable.Any<T> underneath doesn't cast to ICollection,
+ // like it does with many of the other LINQ methods.
+ // Below is significantly (4x) when mainly working with ICollection
+ // sources and a little slower if working with mainly IEnumerable<T>
+ // sources.
+
+ // Cast to ICollection instead of ICollection<T> for performance reasons.
+ ICollection collection = source as ICollection;
+ if (collection != null)
+ {
+ return collection.Count > 0;
+ }
+
+ return source.Any();
+ }
+
+ public static Stack<T> Copy<T>(this Stack<T> stack)
+ {
+ Assumes.NotNull(stack);
+
+ // Stack<T>.GetEnumerator walks from top to bottom
+ // of the stack, whereas Stack<T>(IEnumerable<T>)
+ // pushes to bottom from top, so we need to reverse
+ // the stack to get them in the right order.
+ return new Stack<T>(stack.Reverse());
+ }
+
+ public static T[] AsArray<T>(this IEnumerable<T> enumerable)
+ {
+ T[] array = enumerable as T[];
+
+ if (array != null)
+ {
+ return array;
+ }
+
+ return enumerable.ToArray();
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/ConditionalWeakTable.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ConditionalWeakTable.cs
new file mode 100644
index 0000000..f383014
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ConditionalWeakTable.cs
@@ -0,0 +1,116 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !CLR40
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace Microsoft.Internal.Collections
+{
+ // This is a broken implementation of ConditionalWeakTable that allows us
+ // to compile and work on versions of .Net eariler then 4.0. This class is
+ // broken when there are circular dependencies between keys and values, which
+ // can only be fixed by using some specific CLR 4.0 features.
+ // For code samples of the broken behavior see ConditionalWeakTableTests.cs.
+ internal class ConditionalWeakTable<TKey, TValue>
+ where TKey : class
+ where TValue : class
+ {
+ private readonly Dictionary<object, TValue> _table;
+ private int _capacity = 4;
+
+ public ConditionalWeakTable()
+ {
+ this._table = new Dictionary<object, TValue>();
+ }
+
+ public void Add(TKey key, TValue value)
+ {
+ CleanupDeadReferences();
+ this._table.Add(CreateWeakKey(key), value);
+ }
+
+ public bool Remove(TKey key)
+ {
+ return this._table.Remove(key);
+ }
+
+ public bool TryGetValue(TKey key, out TValue value)
+ {
+ return this._table.TryGetValue(key, out value);
+ }
+
+ private void CleanupDeadReferences()
+ {
+ if (this._table.Count < _capacity)
+ {
+ return;
+ }
+
+ object[] deadKeys = this._table.Keys
+ .Where(weakRef => !((EquivalentWeakReference)weakRef).IsAlive).ToArray();
+
+ foreach (var deadKey in deadKeys)
+ {
+ this._table.Remove(deadKey);
+ }
+
+ if (this._table.Count >= _capacity)
+ {
+ _capacity *= 2;
+ }
+ }
+
+ private static object CreateWeakKey(TKey key)
+ {
+ return new EquivalentWeakReference(key);
+ }
+
+ private class EquivalentWeakReference
+ {
+ private readonly WeakReference _weakReference;
+ private readonly int _hashCode;
+
+ public EquivalentWeakReference(object obj)
+ {
+ this._hashCode = obj.GetHashCode();
+ this._weakReference = new WeakReference(obj);
+ }
+
+ public bool IsAlive
+ {
+ get
+ {
+ return this._weakReference.IsAlive;
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ EquivalentWeakReference weakRef = obj as EquivalentWeakReference;
+
+ if (weakRef != null)
+ {
+ obj = weakRef._weakReference.Target;
+ }
+
+ if (obj == null)
+ {
+ return base.Equals(weakRef);
+ }
+
+ return object.Equals(this._weakReference.Target, obj);
+ }
+
+ public override int GetHashCode()
+ {
+ return this._hashCode;
+ }
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/EnumerableCardinality.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/EnumerableCardinality.cs
new file mode 100644
index 0000000..b3be71c
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/EnumerableCardinality.cs
@@ -0,0 +1,14 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace Microsoft.Internal.Collections
+{
+ internal enum EnumerableCardinality : int
+ {
+ Zero = 0,
+ One = 1,
+ TwoOrMore = 2,
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionary.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionary.cs
new file mode 100644
index 0000000..8682565
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionary.cs
@@ -0,0 +1,103 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+
+namespace Microsoft.Internal.Collections
+{
+ [DebuggerDisplay("Count = {Count}")]
+ [DebuggerTypeProxy(typeof(ReadOnlyDictionaryDebuggerProxy<,>))]
+ internal sealed partial class ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>
+ {
+ private readonly IDictionary<TKey, TValue> _innerDictionary;
+
+ public ReadOnlyDictionary(IDictionary<TKey, TValue> dictionary)
+ {
+ this._innerDictionary = dictionary ?? new Dictionary<TKey, TValue>(0);
+ }
+
+ public int Count
+ {
+ get { return this._innerDictionary.Count; }
+ }
+
+ public bool IsReadOnly
+ {
+ get { return true; }
+ }
+
+ public ICollection<TKey> Keys
+ {
+ get { return this._innerDictionary.Keys; }
+ }
+
+ public TValue this[TKey key]
+ {
+ get { return this._innerDictionary[key]; }
+ set { throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary); }
+ }
+
+ public ICollection<TValue> Values
+ {
+ get { return this._innerDictionary.Values; }
+ }
+
+ public bool Contains(KeyValuePair<TKey, TValue> item)
+ {
+ return this._innerDictionary.Contains(item);
+ }
+
+ public bool ContainsKey(TKey key)
+ {
+ return this._innerDictionary.ContainsKey(key);
+ }
+
+ public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
+ {
+ this._innerDictionary.CopyTo(array, arrayIndex);
+ }
+
+ public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
+ {
+ return this._innerDictionary.GetEnumerator();
+ }
+
+ public bool TryGetValue(TKey key, out TValue value)
+ {
+ return this._innerDictionary.TryGetValue(key, out value);
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this._innerDictionary.GetEnumerator();
+ }
+
+ void IDictionary<TKey, TValue>.Add(TKey key, TValue value)
+ {
+ throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
+ }
+
+ void ICollection<KeyValuePair<TKey, TValue>>.Add(KeyValuePair<TKey, TValue> item)
+ {
+ throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
+ }
+
+ void ICollection<KeyValuePair<TKey, TValue>>.Clear()
+ {
+ throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
+ }
+
+ bool IDictionary<TKey, TValue>.Remove(TKey key)
+ {
+ throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
+ }
+
+ bool ICollection<KeyValuePair<TKey, TValue>>.Remove(KeyValuePair<TKey, TValue> item)
+ {
+ throw new NotSupportedException(Strings.NotSupportedReadOnlyDictionary);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs
new file mode 100644
index 0000000..60eefa1
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/ReadOnlyDictionaryDebuggerProxy.cs
@@ -0,0 +1,32 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+
+namespace Microsoft.Internal.Collections
+{
+ // NOTE: This type cannot be a nested proxy of ReadOnlyDictionary due to a bug
+ // in the Visual Studio Debugger which causes it to ignore nested generic proxies.
+ internal class ReadOnlyDictionaryDebuggerProxy<TKey, TValue>
+ {
+ private readonly ReadOnlyDictionary<TKey, TValue> _dictionary;
+
+ public ReadOnlyDictionaryDebuggerProxy(ReadOnlyDictionary<TKey, TValue> dictionary)
+ {
+ Requires.NotNull(dictionary, "dictionary");
+
+ _dictionary = dictionary;
+ }
+
+ [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
+ public KeyValuePair<TKey, TValue>[] Items
+ {
+ // NOTE: This shouldn't be cached, so that on every query of
+ // the current value of the underlying dictionary is respected.
+ get { return this._dictionary.ToArray(); }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Collections/WeakReferenceCollection.cs b/System.ComponentModel.Composition/Microsoft/Internal/Collections/WeakReferenceCollection.cs
new file mode 100644
index 0000000..6895a63
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Collections/WeakReferenceCollection.cs
@@ -0,0 +1,92 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace Microsoft.Internal.Collections
+{
+ internal class WeakReferenceCollection<T> where T : class
+ {
+ private readonly List<WeakReference> _items = new List<WeakReference>();
+
+ public void Add(T item)
+ {
+ // Only cleanup right before we need to reallocate space.
+ if (this._items.Capacity == this._items.Count)
+ {
+ this.CleanupDeadReferences();
+ }
+
+ this._items.Add(new WeakReference(item));
+ }
+
+ public void Remove(T item)
+ {
+ int index = IndexOf(item);
+
+ if (index != -1)
+ {
+ this._items.RemoveAt(index);
+ }
+ }
+
+ public bool Contains(T item)
+ {
+ return IndexOf(item) >= 0;
+ }
+
+ public void Clear()
+ {
+ this._items.Clear();
+ }
+
+ // Should be executed under at least a read lock.
+ private int IndexOf(T item)
+ {
+ int count = this._items.Count;
+ for (int i = 0; i < count; i++)
+ {
+ if (this._items[i].Target == item)
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ // Should be executed under a write lock
+ private void CleanupDeadReferences()
+ {
+ int count = this._items.Count;
+ for (int i = count - 1; i >= 0; i--)
+ {
+ if (this._items[i].Target == null)
+ {
+ this._items.RemoveAt(i);
+ }
+ }
+ }
+
+ public List<T> AliveItemsToList()
+ {
+ List<T> aliveItems = new List<T>();
+
+ foreach (var weakItem in this._items)
+ {
+ T item = weakItem.Target as T;
+
+ if (item != null)
+ {
+ aliveItems.Add(item);
+ }
+ }
+
+ return aliveItems;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/ContractServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/ContractServices.cs
new file mode 100644
index 0000000..7a731b4
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/ContractServices.cs
@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.ComponentModel.Composition.Primitives;
+
+namespace Microsoft.Internal
+{
+ internal class ContractServices
+ {
+ public static T Cast<T>(object o)
+ {
+ return (T)o;
+ }
+
+ public static bool TryCast(Type contractType, object value, out object result)
+ {
+ if (value == null)
+ {
+ result = null;
+ return true;
+ }
+ if (contractType.IsInstanceOfType(value))
+ {
+ result = value;
+ return true;
+ }
+
+ // We couldn't cast see if a delegate works for us.
+ if (typeof(Delegate).IsAssignableFrom(contractType))
+ {
+ ExportedDelegate exportedDelegate = value as ExportedDelegate;
+ if (exportedDelegate != null)
+ {
+ result = exportedDelegate.CreateDelegate(contractType);
+ return (result != null);
+ }
+ }
+
+ result = null;
+ return false;
+ }
+ }
+}
+
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/GenerationServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/GenerationServices.cs
new file mode 100644
index 0000000..455b7ce
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/GenerationServices.cs
@@ -0,0 +1,333 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Reflection;
+using System.Reflection.Emit;
+
+namespace Microsoft.Internal
+{
+ internal static class GenerationServices
+ {
+ // Type.GetTypeFromHandle
+ private static readonly MethodInfo _typeGetTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle");
+
+
+ // typeofs are pretty expensive, so we cache them statically
+ private static readonly Type TypeType = typeof(System.Type);
+ private static readonly Type StringType = typeof(System.String);
+ private static readonly Type CharType = typeof(System.Char);
+ private static readonly Type BooleanType = typeof(System.Boolean);
+ private static readonly Type ByteType = typeof(System.Byte);
+ private static readonly Type SByteType = typeof(System.SByte);
+ private static readonly Type Int16Type = typeof(System.Int16);
+ private static readonly Type UInt16Type = typeof(System.UInt16);
+ private static readonly Type Int32Type = typeof(System.Int32);
+ private static readonly Type UInt32Type = typeof(System.UInt32);
+ private static readonly Type Int64Type = typeof(System.Int64);
+ private static readonly Type UInt64Type = typeof(System.UInt64);
+ private static readonly Type DoubleType = typeof(System.Double);
+ private static readonly Type SingleType = typeof(System.Single);
+ private static readonly Type IEnumerableTypeofT = typeof(System.Collections.Generic.IEnumerable<>);
+ private static readonly Type IEnumerableType = typeof(System.Collections.IEnumerable);
+
+ private static readonly MethodInfo ExceptionGetData = typeof(Exception).GetProperty("Data").GetGetMethod();
+ private static readonly MethodInfo DictionaryAdd = typeof(IDictionary).GetMethod("Add");
+ private static readonly ConstructorInfo ObjectCtor = typeof(object).GetConstructor(Type.EmptyTypes);
+
+ public static ILGenerator CreateGeneratorForPublicConstructor(this TypeBuilder typeBuilder, Type[] ctrArgumentTypes)
+ {
+ ConstructorBuilder ctorBuilder = typeBuilder.DefineConstructor(
+ MethodAttributes.Public,
+ CallingConventions.Standard,
+ ctrArgumentTypes);
+
+ ILGenerator ctorIL = ctorBuilder.GetILGenerator();
+ ctorIL.Emit(OpCodes.Ldarg_0);
+ ctorIL.Emit(OpCodes.Call, ObjectCtor);
+
+ return ctorIL;
+ }
+
+ /// Generates the code that loads the supplied value on the stack
+ /// This is not as simple as it seems, as different instructions need to be generated depending
+ /// on its type.
+ /// We support:
+ /// 1. All primitive types
+ /// 2. Strings
+ /// 3. Enums
+ /// 4. typeofs
+ /// 5. nulls
+ /// 6. Enumerables
+ /// 7. Delegates on static functions or any of the above
+ /// Everything else cannot be represented as literals
+ /// <param name="ilGenerator"></param>
+ /// <param name="item"></param>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static void LoadValue(this ILGenerator ilGenerator, object value)
+ {
+ Assumes.NotNull(ilGenerator);
+
+ //
+ // Get nulls out of the way - they are basically typeless, so we just load null
+ //
+ if (value == null)
+ {
+ ilGenerator.LoadNull();
+ return;
+ }
+
+ //
+ // Prepare for literal loading - decide whether we should box, and handle enums properly
+ //
+ Type valueType = value.GetType();
+ object rawValue = value;
+ if (valueType.IsEnum)
+ {
+ // enums are special - we need to load the underlying constant on the stack
+ rawValue = Convert.ChangeType(value, Enum.GetUnderlyingType(valueType), null);
+ valueType = rawValue.GetType();
+ }
+
+ //
+ // Generate IL depending on the valueType - this is messier than it should ever be, but sadly necessary
+ //
+ if (valueType == GenerationServices.StringType)
+ {
+ // we need to check for strings before enumerables, because strings are IEnumerable<char>
+ ilGenerator.LoadString((string)rawValue);
+ }
+ else if (GenerationServices.TypeType.IsAssignableFrom(valueType))
+ {
+ ilGenerator.LoadTypeOf((Type)rawValue);
+ }
+ else if (GenerationServices.IEnumerableType.IsAssignableFrom(valueType))
+ {
+ // NOTE : strings and dictionaries are also enumerables, but we have already handled those
+ ilGenerator.LoadEnumerable((IEnumerable) rawValue);
+ }
+ else if (
+ (valueType == GenerationServices.CharType) ||
+ (valueType == GenerationServices.BooleanType) ||
+ (valueType == GenerationServices.ByteType) ||
+ (valueType == GenerationServices.SByteType) ||
+ (valueType == GenerationServices.Int16Type) ||
+ (valueType == GenerationServices.UInt16Type) ||
+ (valueType == GenerationServices.Int32Type)
+ )
+ {
+ // NOTE : Everything that is 32 bit or less uses ldc.i4. We need to pass int32, even if the actual types is shorter - this is IL memory model
+ // direct casting to (int) won't work, because the value is boxed, thus we need to use Convert.
+ // Sadly, this will not work for all cases - namely large uint32 - because they can't semantically fit into 32 signed bits
+ // We have a special case for that next
+ ilGenerator.LoadInt((int)Convert.ChangeType(rawValue, typeof(int), CultureInfo.InvariantCulture));
+ }
+ else if (valueType == GenerationServices.UInt32Type)
+ {
+ // NOTE : This one is a bit tricky. Ldc.I4 takes an Int32 as an argument, although it really treats it as a 32bit number
+ // That said, some UInt32 values are larger that Int32.MaxValue, so the Convert call above will fail, which is why
+ // we need to treat this case individually and cast to uint, and then - unchecked - to int.
+ ilGenerator.LoadInt(unchecked((int)((uint)rawValue)));
+ }
+ else if (valueType == GenerationServices.Int64Type)
+ {
+ ilGenerator.LoadLong((long)rawValue);
+ }
+ else if (valueType == GenerationServices.UInt64Type)
+ {
+ // NOTE : This one is a bit tricky. Ldc.I8 takes an Int64 as an argument, although it really treats it as a 64bit number
+ // That said, some UInt64 values are larger that Int64.MaxValue, so the direct case we use above (or Convert, for that matter)will fail, which is why
+ // we need to treat this case individually and cast to ulong, and then - unchecked - to long.
+ ilGenerator.LoadLong(unchecked((long)((ulong)rawValue)));
+ }
+ else if (valueType == GenerationServices.SingleType)
+ {
+ ilGenerator.LoadFloat((float)rawValue);
+ }
+ else if (valueType == GenerationServices.DoubleType)
+ {
+ ilGenerator.LoadDouble((double)rawValue);
+ }
+ else
+ {
+ throw new InvalidOperationException(
+ string.Format(CultureInfo.CurrentCulture, Strings.InvalidMetadataValue, value.GetType().FullName));
+ }
+ }
+
+ /// Generates the code that adds an object to a dictionary stored in a local variable
+ /// <param name="ilGenerator"></param>
+ /// <param name="dictionary"></param>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static void AddItemToLocalDictionary(this ILGenerator ilGenerator, LocalBuilder dictionary, object key, object value)
+ {
+ Assumes.NotNull(ilGenerator);
+ Assumes.NotNull(dictionary);
+ Assumes.NotNull(key);
+ Assumes.NotNull(value);
+
+ ilGenerator.Emit(OpCodes.Ldloc, dictionary);
+ ilGenerator.LoadValue(key);
+ ilGenerator.LoadValue(value);
+ ilGenerator.Emit(OpCodes.Callvirt, DictionaryAdd);
+ }
+
+ /// Generates the code that adds an object from a local variable to a dictionary also stored in a local
+ /// <param name="ilGenerator"></param>
+ /// <param name="dictionary"></param>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static void AddLocalToLocalDictionary(this ILGenerator ilGenerator, LocalBuilder dictionary, object key, LocalBuilder value)
+ {
+ Assumes.NotNull(ilGenerator);
+ Assumes.NotNull(dictionary);
+ Assumes.NotNull(key);
+ Assumes.NotNull(value);
+
+ ilGenerator.Emit(OpCodes.Ldloc, dictionary);
+ ilGenerator.LoadValue(key);
+ ilGenerator.Emit(OpCodes.Ldloc, value);
+ ilGenerator.Emit(OpCodes.Callvirt, DictionaryAdd);
+ }
+
+ /// Generates the code to get the type of an object and store it in a local
+ /// <param name="ilGenerator"></param>
+ /// <param name="dictionary"></param>
+ /// <param name="key"></param>
+ /// <param name="value"></param>
+ /// <returns></returns>
+ public static void GetExceptionDataAndStoreInLocal(this ILGenerator ilGenerator, LocalBuilder exception, LocalBuilder dataStore)
+ {
+ Assumes.NotNull(ilGenerator);
+ Assumes.NotNull(exception);
+ Assumes.NotNull(dataStore);
+
+ ilGenerator.Emit(OpCodes.Ldloc, exception);
+ ilGenerator.Emit(OpCodes.Callvirt, ExceptionGetData);
+ ilGenerator.Emit(OpCodes.Stloc, dataStore);
+ }
+
+ private static void LoadEnumerable(this ILGenerator ilGenerator, IEnumerable enumerable)
+ {
+ Assumes.NotNull(ilGenerator);
+ Assumes.NotNull(enumerable);
+
+ // We load enumerable as an array - this is the most compact and efficient way of representing it
+ Type elementType = null;
+ Type closedType = null;
+ if (ReflectionServices.TryGetGenericInterfaceType(enumerable.GetType(), GenerationServices.IEnumerableTypeofT, out closedType))
+ {
+ elementType = closedType.GetGenericArguments()[0];
+ }
+ else
+ {
+ elementType = typeof(object);
+ }
+
+ //
+ // elem[] array = new elem[<enumerable.Count()>]
+ //
+ Type generatedArrayType = elementType.MakeArrayType();
+ LocalBuilder generatedArrayLocal = ilGenerator.DeclareLocal(generatedArrayType);
+
+ ilGenerator.LoadInt(enumerable.Cast<object>().Count());
+ ilGenerator.Emit(OpCodes.Newarr, elementType);
+ ilGenerator.Emit(OpCodes.Stloc, generatedArrayLocal);
+
+ int index = 0;
+ foreach (object value in enumerable)
+ {
+ //
+ //array[<index>] = value;
+ //
+ ilGenerator.Emit(OpCodes.Ldloc, generatedArrayLocal);
+ ilGenerator.LoadInt(index);
+ ilGenerator.LoadValue(value);
+ if (GenerationServices.IsBoxingRequiredForValue(value) && !elementType.IsValueType)
+ {
+ ilGenerator.Emit(OpCodes.Box, value.GetType());
+ }
+ ilGenerator.Emit(OpCodes.Stelem, elementType);
+ index++;
+ }
+
+ ilGenerator.Emit(OpCodes.Ldloc, generatedArrayLocal);
+ }
+
+ private static bool IsBoxingRequiredForValue(object value)
+ {
+ if (value == null)
+ {
+ return false;
+ }
+ else
+ {
+ return value.GetType().IsValueType;
+ }
+ }
+
+
+ private static void LoadNull(this ILGenerator ilGenerator)
+ {
+ ilGenerator.Emit(OpCodes.Ldnull);
+ }
+
+ private static void LoadString(this ILGenerator ilGenerator, string s)
+ {
+ Assumes.NotNull(ilGenerator);
+ if (s == null)
+ {
+ ilGenerator.LoadNull();
+ }
+ else
+ {
+ ilGenerator.Emit(OpCodes.Ldstr, s);
+ }
+ }
+
+
+ private static void LoadInt(this ILGenerator ilGenerator, int value)
+ {
+ Assumes.NotNull(ilGenerator);
+ ilGenerator.Emit(OpCodes.Ldc_I4, value);
+ }
+
+ private static void LoadLong(this ILGenerator ilGenerator, long value)
+ {
+ Assumes.NotNull(ilGenerator);
+ ilGenerator.Emit(OpCodes.Ldc_I8, value);
+ }
+
+ private static void LoadFloat(this ILGenerator ilGenerator, float value)
+ {
+ Assumes.NotNull(ilGenerator);
+ ilGenerator.Emit(OpCodes.Ldc_R4, value);
+ }
+
+ private static void LoadDouble(this ILGenerator ilGenerator, double value)
+ {
+ Assumes.NotNull(ilGenerator);
+ ilGenerator.Emit(OpCodes.Ldc_R8, value);
+ }
+
+ private static void LoadTypeOf(this ILGenerator ilGenerator, Type type)
+ {
+ Assumes.NotNull(ilGenerator);
+ //typeofs() translate into ldtoken and Type::GetTypeFromHandle call
+ ilGenerator.Emit(OpCodes.Ldtoken, type);
+ ilGenerator.EmitCall(OpCodes.Call, GenerationServices._typeGetTypeFromHandleMethod, null);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/LazyServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/LazyServices.cs
new file mode 100644
index 0000000..baff505
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/LazyServices.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
+using System.Text;
+using System.Globalization;
+
+namespace Microsoft.Internal
+{
+ internal static class LazyServices
+ {
+ public static Lazy<T> AsLazy<T>(this T t)
+ where T : class
+ {
+ return new Lazy<T>(() => t, false);
+ }
+
+ public static T GetNotNullValue<T>(this Lazy<T> lazy, string argument)
+ where T : class
+ {
+ Assumes.NotNull(lazy);
+ T value = lazy.Value;
+ if (value == null)
+ {
+ throw new InvalidOperationException(
+ string.Format(CultureInfo.CurrentCulture, Strings.LazyServices_LazyResolvesToNull, typeof(T), argument));
+ }
+
+ return value;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Lock.Reader.cs b/System.ComponentModel.Composition/Microsoft/Internal/Lock.Reader.cs
new file mode 100644
index 0000000..1f62034
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Lock.Reader.cs
@@ -0,0 +1,32 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace Microsoft.Internal
+{
+ internal struct ReadLock : IDisposable
+ {
+ private readonly Lock _lock;
+ private int _isDisposed;
+
+ public ReadLock(Lock @lock)
+ {
+ this._isDisposed = 0;
+ this._lock = @lock;
+ this._lock.EnterReadLock();
+ }
+
+ public void Dispose()
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ this._lock.ExitReadLock();
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Lock.Writer.cs b/System.ComponentModel.Composition/Microsoft/Internal/Lock.Writer.cs
new file mode 100644
index 0000000..1e8aef0
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Lock.Writer.cs
@@ -0,0 +1,32 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace Microsoft.Internal
+{
+ internal struct WriteLock : IDisposable
+ {
+ private readonly Lock _lock;
+ private int _isDisposed;
+
+ public WriteLock(Lock @lock)
+ {
+ this._isDisposed = 0;
+ this._lock = @lock;
+ this._lock.EnterWriteLock();
+ }
+
+ public void Dispose()
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ this._lock.ExitWriteLock();
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Lock.cs b/System.ComponentModel.Composition/Microsoft/Internal/Lock.cs
new file mode 100644
index 0000000..7d2522d
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Lock.cs
@@ -0,0 +1,79 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+
+namespace Microsoft.Internal
+{
+ internal sealed class Lock : IDisposable
+ {
+#if (!SILVERLIGHT)
+ private ReaderWriterLockSlim _thisLock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
+ private int _isDisposed = 0;
+ public void EnterReadLock()
+ {
+ this._thisLock.EnterReadLock();
+ }
+
+ public void EnterWriteLock()
+ {
+ this._thisLock.EnterWriteLock();
+ }
+
+ public void ExitReadLock()
+ {
+ this._thisLock.ExitReadLock();
+ }
+
+ public void ExitWriteLock()
+ {
+ this._thisLock.ExitWriteLock();
+ }
+
+ public void Dispose()
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ this._thisLock.Dispose();
+ }
+ }
+
+#else
+ // ReaderWriterLockSlim is not yet implemented on SilverLight
+ // Satisfies our requirements until it is implemented
+ object _thisLock = new object();
+
+ public Lock()
+ {
+ }
+
+ public void EnterReadLock()
+ {
+ Monitor.Enter(this._thisLock);
+ }
+
+ public void EnterWriteLock()
+ {
+ Monitor.Enter(this._thisLock);
+ }
+
+ public void ExitReadLock()
+ {
+ Monitor.Exit(this._thisLock);
+ }
+
+ public void ExitWriteLock()
+ {
+ Monitor.Exit(this._thisLock);
+ }
+
+ public void Dispose()
+ {
+ }
+#endif
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/ReflectionInvoke.cs b/System.ComponentModel.Composition/Microsoft/Internal/ReflectionInvoke.cs
new file mode 100644
index 0000000..b6846ca
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/ReflectionInvoke.cs
@@ -0,0 +1,114 @@
+#if !SILVERLIGHT && CLR40
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Microsoft.Internal
+{
+ internal static class ReflectionInvoke
+ {
+ private static readonly ReflectionPermission _memberAccess = new ReflectionPermission(ReflectionPermissionFlag.MemberAccess);
+ private static readonly ReflectionPermission _restrictedMemberAccess = new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess);
+
+ public static object SafeCreateInstance(this Type type, params object[] arguments)
+ {
+ DemandMemberAccessIfNeeded(type);
+
+ return Activator.CreateInstance(type, arguments);
+ }
+
+ public static object SafeInvoke(this ConstructorInfo constructor, params object[] arguments)
+ {
+ DemandMemberAccessIfNeeded(constructor);
+
+ return constructor.Invoke(arguments);
+ }
+
+ public static object SafeInvoke(this MethodInfo method, object instance, params object[] arguments)
+ {
+ DemandMemberAccessIfNeeded(method);
+
+ return method.Invoke(instance, arguments);
+ }
+
+ public static object SafeGetValue(this FieldInfo field, object instance)
+ {
+ DemandMemberAccessIfNeeded(field);
+
+ return field.GetValue(instance);
+ }
+
+ public static void SafeSetValue(this FieldInfo field, object instance, object value)
+ {
+ DemandMemberAccessIfNeeded(field);
+
+ field.SetValue(instance, value);
+ }
+
+ public static void DemandMemberAccessIfNeeded(MethodInfo method)
+ {
+ if (!method.IsVisible())
+ {
+ DemandMemberAccess(method);
+ }
+ }
+
+ private static void DemandMemberAccessIfNeeded(FieldInfo field)
+ {
+ if (!field.IsVisible())
+ {
+ DemandMemberAccess(field);
+ }
+ }
+
+ public static void DemandMemberAccessIfNeeded(Type type)
+ {
+ // Consult UnderlyingSystemType this is the type that Activator.CreateInstance creates
+ if (!type.UnderlyingSystemType.IsVisible)
+ {
+ DemandMemberAccess(type);
+ }
+ }
+
+ private static void DemandMemberAccessIfNeeded(ConstructorInfo constructor)
+ {
+ if (!constructor.IsVisible())
+ {
+ DemandMemberAccess(constructor);
+ }
+ }
+
+ private static void DemandMemberAccess(MemberInfo target)
+ {
+ try
+ {
+ _memberAccess.Demand();
+ }
+ catch (SecurityException)
+ { // The caller doesn't have member access, but let's see whether they have access to
+ // members of assemblies with less or equal permissions (this mimics Reflection's behavior)
+
+ DemandRestrictedMemberAccess(target);
+ }
+ }
+
+ private static void DemandRestrictedMemberAccess(MemberInfo target)
+ {
+ Assembly targetAssembly = target.Assembly();
+
+ PermissionSet targetGrantSet = UnsafePermissionSet(targetAssembly);
+ targetGrantSet.AddPermission(_restrictedMemberAccess);
+ targetGrantSet.Demand();
+ }
+
+ [SecuritySafeCritical] // PermissionSet is [SecurityCritical]
+ private static PermissionSet UnsafePermissionSet(Assembly assembly)
+ {
+ return assembly.PermissionSet;
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/ReflectionServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/ReflectionServices.cs
new file mode 100644
index 0000000..d34d518
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/ReflectionServices.cs
@@ -0,0 +1,122 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace Microsoft.Internal
+{
+ internal static class ReflectionServices
+ {
+ public static Assembly Assembly(this MemberInfo member)
+ {
+ Type type = member as Type;
+ if (type != null)
+ {
+ return type.Assembly;
+ }
+
+ return member.DeclaringType.Assembly;
+ }
+
+ public static bool IsVisible(this ConstructorInfo constructor)
+ {
+ return constructor.DeclaringType.IsVisible && constructor.IsPublic;
+ }
+
+ public static bool IsVisible(this FieldInfo field)
+ {
+ return field.DeclaringType.IsVisible && field.IsPublic;
+ }
+
+ public static bool IsVisible(this MethodInfo method)
+ {
+ if (!method.DeclaringType.IsVisible)
+ return false;
+
+ if (!method.IsPublic)
+ return false;
+
+ if (method.IsGenericMethod)
+ {
+ // Check type arguments, for example if we're passed 'Activator.CreateInstance<SomeMefInternalType>()'
+ foreach (Type typeArgument in method.GetGenericArguments())
+ {
+ if (!typeArgument.IsVisible)
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public static string GetDisplayName(Type declaringType, string name)
+ {
+ Assumes.NotNull(declaringType);
+
+ return declaringType.GetDisplayName() + "." + name;
+ }
+
+ public static string GetDisplayName(this MemberInfo member)
+ {
+ Assumes.NotNull(member);
+
+ switch (member.MemberType)
+ {
+ case MemberTypes.TypeInfo:
+ case MemberTypes.NestedType:
+ return ((Type)member).FullName;
+ }
+
+ return GetDisplayName(member.DeclaringType, member.Name);
+ }
+
+ internal static bool TryGetGenericInterfaceType(Type instanceType, Type targetOpenInterfaceType, out Type targetClosedInterfaceType)
+ {
+ // The interface must be open
+ Assumes.IsTrue(targetOpenInterfaceType.IsInterface);
+ Assumes.IsTrue(targetOpenInterfaceType.IsGenericTypeDefinition);
+ Assumes.IsTrue(!instanceType.IsGenericTypeDefinition);
+
+ // if instanceType is an interface, we must first check it directly
+ if (instanceType.IsInterface &&
+ instanceType.IsGenericType &&
+ instanceType.GetGenericTypeDefinition() == targetOpenInterfaceType)
+ {
+ targetClosedInterfaceType = instanceType;
+ return true;
+ }
+
+ try
+ {
+ // Purposefully not using FullName here because it results in a significantly
+ // more expensive implementation of GetInterface, this does mean that we're
+ // takign the chance that there aren't too many types which implement multiple
+ // interfaces by the same name...
+ Type targetInterface = instanceType.GetInterface(targetOpenInterfaceType.Name, false);
+ if (targetInterface != null &&
+ targetInterface.GetGenericTypeDefinition() == targetOpenInterfaceType)
+ {
+ targetClosedInterfaceType = targetInterface;
+ return true;
+ }
+ }
+ catch (AmbiguousMatchException)
+ {
+ // If there are multiple with the same name we should not pick any
+ }
+
+ targetClosedInterfaceType = null;
+ return false;
+ }
+
+ internal static IEnumerable<PropertyInfo> GetAllProperties(this Type type)
+ {
+ return type.GetInterfaces().Concat(new Type[] { type }).SelectMany(itf => itf.GetProperties());
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Requires.cs b/System.ComponentModel.Composition/Microsoft/Internal/Requires.cs
new file mode 100644
index 0000000..1f9f7e6
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Requires.cs
@@ -0,0 +1,102 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Globalization;
+using System.Reflection;
+using System.ComponentModel.Composition;
+using System.Text;
+
+namespace Microsoft.Internal
+{
+ internal static class Requires
+ {
+ [DebuggerStepThrough]
+ public static void NotNull<T>(T value, string parameterName)
+ where T : class
+ {
+ if (value == null)
+ {
+ throw new ArgumentNullException(parameterName);
+ }
+ }
+
+ [DebuggerStepThrough]
+ public static void NotNullOrEmpty(string value, string parameterName)
+ {
+ NotNull(value, parameterName);
+
+ if (value.Length == 0)
+ {
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentException_EmptyString, parameterName), parameterName);
+ }
+ }
+
+ [DebuggerStepThrough]
+ public static void NotNullOrNullElements<T>(IEnumerable<T> values, string parameterName)
+ where T : class
+ {
+ NotNull(values, parameterName);
+ NotNullElements(values, parameterName);
+ }
+
+ [DebuggerStepThrough]
+ public static void NullOrNotNullElements<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> values, string parameterName)
+ where TKey : class
+ where TValue : class
+ {
+ if (values != null)
+ {
+ NotNullElements(values, parameterName);
+ }
+ }
+
+ [DebuggerStepThrough]
+ public static void NullOrNotNullElements<T>(IEnumerable<T> values, string parameterName)
+ where T : class
+ {
+ if (values != null)
+ {
+ NotNullElements(values, parameterName);
+ }
+ }
+
+ private static void NotNullElements<T>(IEnumerable<T> values, string parameterName)
+ where T : class
+ {
+ foreach (T value in values)
+ {
+ if (value == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement(parameterName);
+ }
+ }
+ }
+
+ private static void NotNullElements<TKey, TValue>(IEnumerable<KeyValuePair<TKey, TValue>> values, string parameterName)
+ where TKey : class
+ where TValue : class
+ {
+ foreach (KeyValuePair<TKey, TValue> value in values)
+ {
+ if ((value.Key == null) || (value.Value == null))
+ {
+ throw ExceptionBuilder.CreateContainsNullElement(parameterName);
+ }
+ }
+ }
+ [DebuggerStepThrough]
+ public static void IsInMembertypeSet(MemberTypes value, string parameterName, MemberTypes enumFlagSet)
+ {
+ if ((value & enumFlagSet) != value || // Ensure the member is in the set
+ (value & (value - 1)) != 0) // Ensure that there is only one flag in the value (i.e. value is a power of 2).
+ {
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentOutOfRange_InvalidEnumInSet, parameterName, value, enumFlagSet.ToString()), parameterName);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs b/System.ComponentModel.Composition/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs
new file mode 100644
index 0000000..f2745f5
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/Runtime/Serialization/SerializationServices.cs
@@ -0,0 +1,22 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !SILVERLIGHT
+
+using System;
+using System.Runtime.Serialization;
+
+namespace Microsoft.Internal.Runtime.Serialization
+{
+ internal static class SerializationServices
+ {
+ public static T GetValue<T>(this SerializationInfo info, string name)
+ {
+ Assumes.NotNull(info, name);
+
+ return (T)info.GetValue(name, typeof(T));
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/SilverlightReflectionInvoke.cs b/System.ComponentModel.Composition/Microsoft/Internal/SilverlightReflectionInvoke.cs
new file mode 100644
index 0000000..0e2f3dc
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/SilverlightReflectionInvoke.cs
@@ -0,0 +1,43 @@
+#if SILVERLIGHT || !CLR40
+
+using System;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+
+namespace Microsoft.Internal
+{
+ internal static class ReflectionInvoke
+ {
+ public static object SafeCreateInstance(this Type type, params object[] arguments)
+ {
+ return Activator.CreateInstance(type, arguments);
+ }
+
+ public static object SafeInvoke(this ConstructorInfo constructor, params object[] arguments)
+ {
+ return constructor.Invoke(arguments);
+ }
+
+ public static object SafeInvoke(this MethodInfo method, object instance, params object[] arguments)
+ {
+ return method.Invoke(instance, arguments);
+ }
+
+ public static object SafeGetValue(this FieldInfo field, object instance)
+ {
+ return field.GetValue(instance);
+ }
+
+ public static void SafeSetValue(this FieldInfo field, object instance, object value)
+ {
+ field.SetValue(instance, value);
+ }
+
+ public static void DemandMemberAccessIfNeeded(MethodInfo method)
+ {
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/Microsoft/Internal/StringComparers.cs b/System.ComponentModel.Composition/Microsoft/Internal/StringComparers.cs
new file mode 100644
index 0000000..5cb9747
--- /dev/null
+++ b/System.ComponentModel.Composition/Microsoft/Internal/StringComparers.cs
@@ -0,0 +1,20 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace Microsoft.Internal
+{
+ internal static class StringComparers
+ {
+ public static StringComparer ContractName
+ {
+ get { return StringComparer.Ordinal; }
+ }
+
+ public static StringComparer MetadataKeyNames
+ {
+ get { return StringComparer.Ordinal; }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Strings.Designer.cs b/System.ComponentModel.Composition/Strings.Designer.cs
new file mode 100644
index 0000000..ba48697
--- /dev/null
+++ b/System.ComponentModel.Composition/Strings.Designer.cs
@@ -0,0 +1,927 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.1
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Microsoft.Internal {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Strings {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Strings() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Internal.Strings", typeof(Strings).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' is a reflection-only assembly which is not supported..
+ /// </summary>
+ internal static string Argument_AssemblyReflectionOnly {
+ get {
+ return ResourceManager.GetString("Argument_AssemblyReflectionOnly", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' contains a reflection-only type which is not supported..
+ /// </summary>
+ internal static string Argument_ElementReflectionOnlyType {
+ get {
+ return ResourceManager.GetString("Argument_ElementReflectionOnlyType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 'exports' cannot be empty when ImportDefinition.ImportCardinality is ImportCardinality.ExactlyOne..
+ /// </summary>
+ internal static string Argument_ExportsEmpty {
+ get {
+ return ResourceManager.GetString("Argument_ExportsEmpty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 'exports' cannot contain more than one element when ImportDefinition.ImportCardinality is ImportCardinality.ZeroOrOne or ImportCardinality.ExactlyOne..
+ /// </summary>
+ internal static string Argument_ExportsTooMany {
+ get {
+ return ResourceManager.GetString("Argument_ExportsTooMany", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' cannot contain a null (Nothing in Visual Basic) element..
+ /// </summary>
+ internal static string Argument_NullElement {
+ get {
+ return ResourceManager.GetString("Argument_NullElement", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to '{0}' cannot be an empty string ("")..
+ /// </summary>
+ internal static string ArgumentException_EmptyString {
+ get {
+ return ResourceManager.GetString("ArgumentException_EmptyString", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The value of argument '{0}' ({1}) is invalid for Enum type '{2}'..
+ /// </summary>
+ internal static string ArgumentOutOfRange_InvalidEnum {
+ get {
+ return ResourceManager.GetString("ArgumentOutOfRange_InvalidEnum", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The value of argument '{0}' ({1}) is not supported. Allowed values are : '{2}'..
+ /// </summary>
+ internal static string ArgumentOutOfRange_InvalidEnumInSet {
+ get {
+ return ResourceManager.GetString("ArgumentOutOfRange_InvalidEnumInSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The argument was a value type which is not supported..
+ /// </summary>
+ internal static string ArgumentValueType {
+ get {
+ return ResourceManager.GetString("ArgumentValueType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Assembly file {0} is either not found or not a dll or exe file..
+ /// </summary>
+ internal static string AssemblyFileNotFoundOrWrongType {
+ get {
+ return ResourceManager.GetString("AssemblyFileNotFoundOrWrongType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The atomicComposition can no longer be changed because the atomicComposition has already been completed..
+ /// </summary>
+ internal static string AtomicComposition_AlreadyCompleted {
+ get {
+ return ResourceManager.GetString("AtomicComposition_AlreadyCompleted", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The atomicComposition is already contains an inner atomicComposition and cannot contain more than one atomicComposition at a time..
+ /// </summary>
+ internal static string AtomicComposition_AlreadyNested {
+ get {
+ return ResourceManager.GetString("AtomicComposition_AlreadyNested", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The atomicComposition contains another inner atomicComposition and cannot be changed until the that inner atomicComposition has been completed..
+ /// </summary>
+ internal static string AtomicComposition_PartOfAnotherAtomicComposition {
+ get {
+ return ResourceManager.GetString("AtomicComposition_PartOfAnotherAtomicComposition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to No valid exports were found that match the constraint '{0}', invalid exports may have been rejected..
+ /// </summary>
+ internal static string CardinalityMismatch_NoExports {
+ get {
+ return ResourceManager.GetString("CardinalityMismatch_NoExports", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to More than one export was found that matches the constraint '{0}'..
+ /// </summary>
+ internal static string CardinalityMismatch_TooManyExports {
+ get {
+ return ResourceManager.GetString("CardinalityMismatch_TooManyExports", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unknown Origin.
+ /// </summary>
+ internal static string CompositionElement_UnknownOrigin {
+ get {
+ return ResourceManager.GetString("CompositionElement_UnknownOrigin", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The composition remains unchanged. The changes were rejected because of the following error(s): {0}.
+ /// </summary>
+ internal static string CompositionException_ChangesRejected {
+ get {
+ return ResourceManager.GetString("CompositionException_ChangesRejected", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Element: {0}.
+ /// </summary>
+ internal static string CompositionException_ElementPrefix {
+ get {
+ return ResourceManager.GetString("CompositionException_ElementPrefix", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Resulting in:.
+ /// </summary>
+ internal static string CompositionException_ErrorPrefix {
+ get {
+ return ResourceManager.GetString("CompositionException_ErrorPrefix", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to create an instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>..
+ /// </summary>
+ internal static string CompositionException_MetadataViewInvalidConstructor {
+ get {
+ return ResourceManager.GetString("CompositionException_MetadataViewInvalidConstructor", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The composition produced multiple composition errors, with {0:N0} root causes. The root causes are provided below..
+ /// </summary>
+ internal static string CompositionException_MultipleErrorsWithMultiplePaths {
+ get {
+ return ResourceManager.GetString("CompositionException_MultipleErrorsWithMultiplePaths", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} {1}.
+ /// </summary>
+ internal static string CompositionException_OriginFormat {
+ get {
+ return ResourceManager.GetString("CompositionException_OriginFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to --> .
+ /// </summary>
+ internal static string CompositionException_OriginSeparator {
+ get {
+ return ResourceManager.GetString("CompositionException_OriginSeparator", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ).
+ /// </summary>
+ internal static string CompositionException_PathsCountSeparator {
+ get {
+ return ResourceManager.GetString("CompositionException_PathsCountSeparator", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Review the CompositionException.Errors property for more detailed information..
+ /// </summary>
+ internal static string CompositionException_ReviewErrorProperty {
+ get {
+ return ResourceManager.GetString("CompositionException_ReviewErrorProperty", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The composition produced a single composition error, with {0:N0} root causes. The root causes are provided below..
+ /// </summary>
+ internal static string CompositionException_SingleErrorWithMultiplePaths {
+ get {
+ return ResourceManager.GetString("CompositionException_SingleErrorWithMultiplePaths", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The composition produced a single composition error. The root cause is provided below..
+ /// </summary>
+ internal static string CompositionException_SingleErrorWithSinglePath {
+ get {
+ return ResourceManager.GetString("CompositionException_SingleErrorWithSinglePath", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The catalog '{0}' could not load assembly '{1}'. {2}.
+ /// </summary>
+ internal static string CompositionTrace_Discovery_AssemblyLoadFailed {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Discovery_AssemblyLoadFailed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it is an open generic type..
+ /// </summary>
+ internal static string CompositionTrace_Discovery_DefinitionContainsGenericParameters {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionContainsGenericParameters", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it contains no exports..
+ /// </summary>
+ internal static string CompositionTrace_Discovery_DefinitionContainsNoExports {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionContainsNoExports", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePartDefinition '{0}' was ignored because it was marked with PartNotDiscoverableAttribute..
+ /// </summary>
+ internal static string CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The member or parameter '{0}' is marked with multiple Import and ImportMany attributes. Only the first attribute encountered will be respected..
+ /// </summary>
+ internal static string CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePartDefinition '{0}' has been rejected. {1}.
+ /// </summary>
+ internal static string CompositionTrace_Rejection_DefinitionRejected {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Rejection_DefinitionRejected", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePartDefinition '{0}' that was previously rejected has been resurrected..
+ /// </summary>
+ internal static string CompositionTrace_Rejection_DefinitionResurrected {
+ get {
+ return ResourceManager.GetString("CompositionTrace_Rejection_DefinitionResurrected", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot cast the underlying exported value of type '{0}' to type '{1}'..
+ /// </summary>
+ internal static string ContractMismatch_ExportedValueCannotBeCastToT {
+ get {
+ return ResourceManager.GetString("ContractMismatch_ExportedValueCannotBeCastToT", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with the value '{2}' as type '{3}' but the view imports it as type '{4}'..
+ /// </summary>
+ internal static string ContractMismatch_InvalidCastOnMetadataField {
+ get {
+ return ResourceManager.GetString("ContractMismatch_InvalidCastOnMetadataField", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with a null value and null is not a valid value for type '{2}'..
+ /// </summary>
+ internal static string ContractMismatch_NullReferenceOnMetadataField {
+ get {
+ return ResourceManager.GetString("ContractMismatch_NullReferenceOnMetadataField", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Directory '{0}' could not be found..
+ /// </summary>
+ internal static string DirectoryNotFound {
+ get {
+ return ResourceManager.GetString("DirectoryNotFound", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Member or Type '{0}' contains multiple metadata entries with the name '{1}'. The metadata entries could be coming from the ExportMetadataAttribute or from a property of a custom metadata attribute. Either remove the duplicate entries or enable the metadata entry with name '{1}' to allow multiple entries via the IsMultiple property on ExportMetadataAttribute or AttributeUsage.AllowMultiple on custom metadata attributes..
+ /// </summary>
+ internal static string Discovery_DuplicateMetadataNameValues {
+ get {
+ return ResourceManager.GetString("Discovery_DuplicateMetadataNameValues", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Property '{0}' has type '{1}' which is an invalid metadata type. Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification..
+ /// </summary>
+ internal static string Discovery_MetadataContainsValueWithInvalidType {
+ get {
+ return ResourceManager.GetString("Discovery_MetadataContainsValueWithInvalidType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Member or Type '{0}' contains a metadata entry with the name '{1}', which is a reserved metadata key name. Either remove this metadata entry or change the name associated with the entry..
+ /// </summary>
+ internal static string Discovery_ReservedMetadataNameUsed {
+ get {
+ return ResourceManager.GetString("Discovery_ReservedMetadataNameUsed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} did not originate from the ExportDefinitions property on this ComposablePart or its ComposablePartDefinition..
+ /// </summary>
+ internal static string ExportDefinitionNotOnThisComposablePart {
+ get {
+ return ResourceManager.GetString("ExportDefinitionNotOnThisComposablePart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} did not originate from the ImportDefinitions property on this ComposablePart or its ComposablePartDefinition..
+ /// </summary>
+ internal static string ImportDefinitionNotOnThisComposablePart {
+ get {
+ return ResourceManager.GetString("ImportDefinitionNotOnThisComposablePart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The composition failed because it did not complete within '{0:N0}' iterations. This is most likely caused by a cycle in the dependency graph of a part which is marked with a non-shared creation policy..
+ /// </summary>
+ internal static string ImportEngine_ComposeTookTooManyIterations {
+ get {
+ return ResourceManager.GetString("ImportEngine_ComposeTookTooManyIterations", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The ComposablePart of type '{0}' cannot be recomposed because it is in an invalid state. It can only be recomposed if it has already been fully previewed or composed..
+ /// </summary>
+ internal static string ImportEngine_InvalidStateForRecomposition {
+ get {
+ return ResourceManager.GetString("ImportEngine_InvalidStateForRecomposition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot activate part '{0}'..
+ /// </summary>
+ internal static string ImportEngine_PartCannotActivate {
+ get {
+ return ResourceManager.GetString("ImportEngine_PartCannotActivate", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot get export '{0}' from part '{1}'..
+ /// </summary>
+ internal static string ImportEngine_PartCannotGetExportedValue {
+ get {
+ return ResourceManager.GetString("ImportEngine_PartCannotGetExportedValue", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot set import '{0}' on part '{1}'..
+ /// </summary>
+ internal static string ImportEngine_PartCannotSetImport {
+ get {
+ return ResourceManager.GetString("ImportEngine_PartCannotSetImport", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot compose part '{0}' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection..
+ /// </summary>
+ internal static string ImportEngine_PartCycle {
+ get {
+ return ResourceManager.GetString("ImportEngine_PartCycle", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Change in exports prevented by non-recomposable import '{0}' on part '{1}'..
+ /// </summary>
+ internal static string ImportEngine_PreventedByExistingImport {
+ get {
+ return ResourceManager.GetString("ImportEngine_PreventedByExistingImport", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Could not finishing composing object of type '{0}'. The import '{1}' was not satisfied..
+ /// </summary>
+ internal static string ImportNotSetOnPart {
+ get {
+ return ResourceManager.GetString("ImportNotSetOnPart", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Internal error occurred. Additional information: '{0}'..
+ /// </summary>
+ internal static string InternalExceptionMessage {
+ get {
+ return ResourceManager.GetString("InternalExceptionMessage", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification..
+ /// </summary>
+ internal static string InvalidMetadataValue {
+ get {
+ return ResourceManager.GetString("InvalidMetadataValue", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The Type '{0}' supplied is not a valid Metadata View..
+ /// </summary>
+ internal static string InvalidMetadataView {
+ get {
+ return ResourceManager.GetString("InvalidMetadataView", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to 'definition' cannot be set after Activate has been called because ImportDefinition.IsRecomposable is false..
+ /// </summary>
+ internal static string InvalidOperation_DefinitionCannotBeRecomposed {
+ get {
+ return ResourceManager.GetString("InvalidOperation_DefinitionCannotBeRecomposed", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to GetExportedValue cannot be called before prerequisite import '{0}' has been set..
+ /// </summary>
+ internal static string InvalidOperation_GetExportedValueBeforePrereqImportSet {
+ get {
+ return ResourceManager.GetString("InvalidOperation_GetExportedValueBeforePrereqImportSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A call to Compose occurred during a call to Compose on the same CompositionContainer object. Use the IsComposing property on CompositionContainer to ensure a composition is not already in progress before calling Compose..
+ /// </summary>
+ internal static string InvalidOperationReentrantCompose {
+ get {
+ return ResourceManager.GetString("InvalidOperationReentrantCompose", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The MetadataView '{0}' is invalid because property '{1}' has a property set method..
+ /// </summary>
+ internal static string InvalidSetterOnMetadataField {
+ get {
+ return ResourceManager.GetString("InvalidSetterOnMetadataField", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Accessors must not be null (Nothing in Visual Basic)..
+ /// </summary>
+ internal static string LazyMemberInfo_AccessorsNull {
+ get {
+ return ResourceManager.GetString("LazyMemberInfo_AccessorsNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A member of type '{0}' must have exactly a single accessor of type '{0}'.
+ /// </summary>
+ internal static string LazyMemberInfo_InvalidAccessorOnSimpleMember {
+ get {
+ return ResourceManager.GetString("LazyMemberInfo_InvalidAccessorOnSimpleMember", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to All event accessors must be methods..
+ /// </summary>
+ internal static string LazyMemberinfo_InvalidEventAccessors_AccessorType {
+ get {
+ return ResourceManager.GetString("LazyMemberinfo_InvalidEventAccessors_AccessorType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An event must have exactly three accessors..
+ /// </summary>
+ internal static string LazyMemberInfo_InvalidEventAccessors_Cardinality {
+ get {
+ return ResourceManager.GetString("LazyMemberInfo_InvalidEventAccessors_Cardinality", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to All property accessors must be methods..
+ /// </summary>
+ internal static string LazyMemberinfo_InvalidPropertyAccessors_AccessorType {
+ get {
+ return ResourceManager.GetString("LazyMemberinfo_InvalidPropertyAccessors_AccessorType", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A property must have exactly two accessors..
+ /// </summary>
+ internal static string LazyMemberInfo_InvalidPropertyAccessors_Cardinality {
+ get {
+ return ResourceManager.GetString("LazyMemberInfo_InvalidPropertyAccessors_Cardinality", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to A member must have at least one accessor..
+ /// </summary>
+ internal static string LazyMemberInfo_NoAccessors {
+ get {
+ return ResourceManager.GetString("LazyMemberInfo_NoAccessors", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The lazily evaluated value of type '{0}' passed to the ReflectionModelServices API as part of the argument '{1}' must not return null (Nothing in Visual Basic)..
+ /// </summary>
+ internal static string LazyServices_LazyResolvesToNull {
+ get {
+ return ResourceManager.GetString("LazyServices_LazyResolvesToNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This export does not support the metadata item '{0}'..
+ /// </summary>
+ internal static string MetadataItemNotSupported {
+ get {
+ return ResourceManager.GetString("MetadataItemNotSupported", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The {0} member must be overridden by a derived class..
+ /// </summary>
+ internal static string NotImplemented_NotOverriddenByDerived {
+ get {
+ return ResourceManager.GetString("NotImplemented_NotOverriddenByDerived", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Interface '{0}' is not a valid MetadataView; MetadataViews do not support non-public interfaces, and interfaces that contain members that are not properties..
+ /// </summary>
+ internal static string NotSupportedInterfaceMetadataView {
+ get {
+ return ResourceManager.GetString("NotSupportedInterfaceMetadataView", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The underlying dictionary is read-only..
+ /// </summary>
+ internal static string NotSupportedReadOnlyDictionary {
+ get {
+ return ResourceManager.GetString("NotSupportedReadOnlyDictionary", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This property cannot be set after the object's public surface has been accessed..
+ /// </summary>
+ internal static string ObjectAlreadyInitialized {
+ get {
+ return ResourceManager.GetString("ObjectAlreadyInitialized", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to This object has not been initialized - the property '{0}' must be set..
+ /// </summary>
+ internal static string ObjectMustBeInitialized {
+ get {
+ return ResourceManager.GetString("ObjectMustBeInitialized", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time..
+ /// </summary>
+ internal static string ReentrantCompose {
+ get {
+ return ResourceManager.GetString("ReentrantCompose", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot get the value of property '{0}', because the member is not readable. The property must have an accessible getter..
+ /// </summary>
+ internal static string ReflectionModel_ExportNotReadable {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ExportNotReadable", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An exception occurred while trying to get the value of property '{0}'..
+ /// </summary>
+ internal static string ReflectionModel_ExportThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ExportThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the Add method on the type '{1}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionAddThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionAddThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the Clear method on the type '{1}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionClearThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionClearThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while calling the default constructor on the type '{1}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionConstructionThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionConstructionThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while trying to access the collection value. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionGetThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionGetThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because an exception occurred while reading the IsReadOnly property on the type '{1}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionIsReadOnlyThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionIsReadOnlyThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the collection '{0}' because it does not implement ICollection<T> or is read-only. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionNotWritable {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionNotWritable", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot populate the value of enumerable member '{0}' because it is null (Nothing in Visual Basic). If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor..
+ /// </summary>
+ internal static string ReflectionModel_ImportCollectionNull {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportCollectionNull", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The importing constructor on type '{0}' is using ImportManyAttribute on parameter '{1}' with a non-assignable type. On constructor parameters the ImportManyAttribute only supports importing into types T[] or IEnumerable<T>..
+ /// </summary>
+ internal static string ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to The export '{0}' is not assignable to type '{1}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportNotAssignableFromExport {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportNotAssignableFromExport", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot set the value of '{0}' because the member is not writable. If the member is a property, it must have an accessible setter; otherwise, if it is a field, it must not be read-only..
+ /// </summary>
+ internal static string ReflectionModel_ImportNotWritable {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportNotWritable", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An exception occurred while trying to set the value of property '{0}'..
+ /// </summary>
+ internal static string ReflectionModel_ImportThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_ImportThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ExportDefinition of type '{0}' cannot be used in this context. Only export definitions produced by the ReflectionModelServices.CreateExportDefinition are supported..
+ /// </summary>
+ internal static string ReflectionModel_InvalidExportDefinition {
+ get {
+ return ResourceManager.GetString("ReflectionModel_InvalidExportDefinition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition are supported..
+ /// </summary>
+ internal static string ReflectionModel_InvalidImportDefinition {
+ get {
+ return ResourceManager.GetString("ReflectionModel_InvalidImportDefinition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on members are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter..
+ /// </summary>
+ internal static string ReflectionModel_InvalidMemberImportDefinition {
+ get {
+ return ResourceManager.GetString("ReflectionModel_InvalidMemberImportDefinition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on parameters are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter..
+ /// </summary>
+ internal static string ReflectionModel_InvalidParameterImportDefinition {
+ get {
+ return ResourceManager.GetString("ReflectionModel_InvalidParameterImportDefinition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to ComposablePartDefinition of type '{0}' cannot be used in this context. Only part definitions produced by the ReflectionModelServices.CreatePartDefinition are supported..
+ /// </summary>
+ internal static string ReflectionModel_InvalidPartDefinition {
+ get {
+ return ResourceManager.GetString("ReflectionModel_InvalidPartDefinition", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to Cannot create an instance of type '{0}' because a constructor could not be selected for construction. Ensure that the type either has a default constructor, or a single constructor marked with the 'System.ComponentModel.Composition.ImportingConstructorAttribute'..
+ /// </summary>
+ internal static string ReflectionModel_PartConstructorMissing {
+ get {
+ return ResourceManager.GetString("ReflectionModel_PartConstructorMissing", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An exception occurred while trying to create an instance of type '{0}'..
+ /// </summary>
+ internal static string ReflectionModel_PartConstructorThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_PartConstructorThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to An exception occurred while calling the 'OnImportsSatisfied' method on type '{0}'..
+ /// </summary>
+ internal static string ReflectionModel_PartOnImportsSatisfiedThrewException {
+ get {
+ return ResourceManager.GetString("ReflectionModel_PartOnImportsSatisfiedThrewException", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to {0} (Types='{1}')..
+ /// </summary>
+ internal static string TypeCatalog_DisplayNameFormat {
+ get {
+ return ResourceManager.GetString("TypeCatalog_DisplayNameFormat", resourceCulture);
+ }
+ }
+
+ /// <summary>
+ /// Looks up a localized string similar to <Empty>.
+ /// </summary>
+ internal static string TypeCatalog_Empty {
+ get {
+ return ResourceManager.GetString("TypeCatalog_Empty", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/Strings.resources b/System.ComponentModel.Composition/Strings.resources
new file mode 100644
index 0000000..a4fb52e
Binary files /dev/null and b/System.ComponentModel.Composition/Strings.resources differ
diff --git a/System.ComponentModel.Composition/Strings.resx b/System.ComponentModel.Composition/Strings.resx
new file mode 100644
index 0000000..4031dfb
--- /dev/null
+++ b/System.ComponentModel.Composition/Strings.resx
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="ArgumentException_EmptyString" xml:space="preserve">
+ <value>'{0}' cannot be an empty string ("").</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidEnum" xml:space="preserve">
+ <value>The value of argument '{0}' ({1}) is invalid for Enum type '{2}'.</value>
+ </data>
+ <data name="ArgumentValueType" xml:space="preserve">
+ <value>The argument was a value type which is not supported.</value>
+ </data>
+ <data name="Argument_AssemblyReflectionOnly" xml:space="preserve">
+ <value>'{0}' is a reflection-only assembly which is not supported.</value>
+ </data>
+ <data name="Argument_NullElement" xml:space="preserve">
+ <value>'{0}' cannot contain a null (Nothing in Visual Basic) element.</value>
+ </data>
+ <data name="AssemblyFileNotFoundOrWrongType" xml:space="preserve">
+ <value>Assembly file {0} is either not found or not a dll or exe file.</value>
+ </data>
+ <data name="CardinalityMismatch_NoExports" xml:space="preserve">
+ <value>No valid exports were found that match the constraint '{0}', invalid exports may have been rejected.</value>
+ </data>
+ <data name="CardinalityMismatch_TooManyExports" xml:space="preserve">
+ <value>More than one export was found that matches the constraint '{0}'.</value>
+ </data>
+ <data name="ImportEngine_ComposeTookTooManyIterations" xml:space="preserve">
+ <value>The composition failed because it did not complete within '{0:N0}' iterations. This is most likely caused by a cycle in the dependency graph of a part which is marked with a non-shared creation policy.</value>
+ </data>
+ <data name="ContractMismatch_ExportedValueCannotBeCastToT" xml:space="preserve">
+ <value>Cannot cast the underlying exported value of type '{0}' to type '{1}'.</value>
+ </data>
+ <data name="DirectoryNotFound" xml:space="preserve">
+ <value>Directory '{0}' could not be found.</value>
+ </data>
+ <data name="ReflectionModel_PartConstructorThrewException" xml:space="preserve">
+ <value>An exception occurred while trying to create an instance of type '{0}'.</value>
+ </data>
+ <data name="ReflectionModel_ExportThrewException" xml:space="preserve">
+ <value>An exception occurred while trying to get the value of property '{0}'.</value>
+ </data>
+ <data name="ReflectionModel_PartOnImportsSatisfiedThrewException" xml:space="preserve">
+ <value>An exception occurred while calling the 'OnImportsSatisfied' method on type '{0}'.</value>
+ </data>
+ <data name="ReflectionModel_ImportThrewException" xml:space="preserve">
+ <value>An exception occurred while trying to set the value of property '{0}'.</value>
+ </data>
+ <data name="ExportDefinitionNotOnThisComposablePart" xml:space="preserve">
+ <value>{0} did not originate from the ExportDefinitions property on this ComposablePart or its ComposablePartDefinition.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionNotWritable" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because it does not implement ICollection<T> or is read-only. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionNull" xml:space="preserve">
+ <value>Cannot populate the value of enumerable member '{0}' because it is null (Nothing in Visual Basic). If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
+ </data>
+ <data name="ImportEngine_PartCycle" xml:space="preserve">
+ <value>Cannot compose part '{0}' because a cycle exists in the dependencies between the exports being composed. To break this cycle, consider changing some imports from constructor to property injection.</value>
+ </data>
+ <data name="ImportDefinitionNotOnThisComposablePart" xml:space="preserve">
+ <value>{0} did not originate from the ImportDefinitions property on this ComposablePart or its ComposablePartDefinition.</value>
+ </data>
+ <data name="ImportNotSetOnPart" xml:space="preserve">
+ <value>Could not finishing composing object of type '{0}'. The import '{1}' was not satisfied.</value>
+ </data>
+ <data name="ReflectionModel_ImportNotWritable" xml:space="preserve">
+ <value>Cannot set the value of '{0}' because the member is not writable. If the member is a property, it must have an accessible setter; otherwise, if it is a field, it must not be read-only.</value>
+ </data>
+ <data name="InternalExceptionMessage" xml:space="preserve">
+ <value>Internal error occurred. Additional information: '{0}'.</value>
+ </data>
+ <data name="InvalidMetadataView" xml:space="preserve">
+ <value>The Type '{0}' supplied is not a valid Metadata View.</value>
+ </data>
+ <data name="InvalidOperationReentrantCompose" xml:space="preserve">
+ <value>A call to Compose occurred during a call to Compose on the same CompositionContainer object. Use the IsComposing property on CompositionContainer to ensure a composition is not already in progress before calling Compose.</value>
+ </data>
+ <data name="MetadataItemNotSupported" xml:space="preserve">
+ <value>This export does not support the metadata item '{0}'.</value>
+ </data>
+ <data name="NotSupportedInterfaceMetadataView" xml:space="preserve">
+ <value>Interface '{0}' is not a valid MetadataView; MetadataViews do not support non-public interfaces, and interfaces that contain members that are not properties.</value>
+ </data>
+ <data name="ReflectionModel_PartConstructorMissing" xml:space="preserve">
+ <value>Cannot create an instance of type '{0}' because a constructor could not be selected for construction. Ensure that the type either has a default constructor, or a single constructor marked with the 'System.ComponentModel.Composition.ImportingConstructorAttribute'.</value>
+ </data>
+ <data name="NotImplemented_NotOverriddenByDerived" xml:space="preserve">
+ <value>The {0} member must be overridden by a derived class.</value>
+ </data>
+ <data name="NotSupportedReadOnlyDictionary" xml:space="preserve">
+ <value>The underlying dictionary is read-only.</value>
+ </data>
+ <data name="ObjectAlreadyInitialized" xml:space="preserve">
+ <value>This property cannot be set after the object's public surface has been accessed.</value>
+ </data>
+ <data name="ObjectMustBeInitialized" xml:space="preserve">
+ <value>This object has not been initialized - the property '{0}' must be set.</value>
+ </data>
+ <data name="ReflectionModel_ImportNotAssignableFromExport" xml:space="preserve">
+ <value>The export '{0}' is not assignable to type '{1}'.</value>
+ </data>
+ <data name="ReflectionModel_ExportNotReadable" xml:space="preserve">
+ <value>Cannot get the value of property '{0}', because the member is not readable. The property must have an accessible getter.</value>
+ </data>
+ <data name="Argument_ElementReflectionOnlyType" xml:space="preserve">
+ <value>'{0}' contains a reflection-only type which is not supported.</value>
+ </data>
+ <data name="InvalidOperation_DefinitionCannotBeRecomposed" xml:space="preserve">
+ <value>'definition' cannot be set after Activate has been called because ImportDefinition.IsRecomposable is false.</value>
+ </data>
+ <data name="Argument_ExportsEmpty" xml:space="preserve">
+ <value>'exports' cannot be empty when ImportDefinition.ImportCardinality is ImportCardinality.ExactlyOne.</value>
+ </data>
+ <data name="Argument_ExportsTooMany" xml:space="preserve">
+ <value>'exports' cannot contain more than one element when ImportDefinition.ImportCardinality is ImportCardinality.ZeroOrOne or ImportCardinality.ExactlyOne.</value>
+ </data>
+ <data name="CompositionElement_UnknownOrigin" xml:space="preserve">
+ <value>Unknown Origin</value>
+ </data>
+ <data name="ImportEngine_PartCannotActivate" xml:space="preserve">
+ <value>Cannot activate part '{0}'.</value>
+ </data>
+ <data name="ImportEngine_PartCannotSetImport" xml:space="preserve">
+ <value>Cannot set import '{0}' on part '{1}'.</value>
+ </data>
+ <data name="ImportEngine_PartCannotGetExportedValue" xml:space="preserve">
+ <value>Cannot get export '{0}' from part '{1}'.</value>
+ </data>
+ <data name="TypeCatalog_Empty" xml:space="preserve">
+ <value><Empty></value>
+ </data>
+ <data name="InvalidOperation_GetExportedValueBeforePrereqImportSet" xml:space="preserve">
+ <value>GetExportedValue cannot be called before prerequisite import '{0}' has been set.</value>
+ </data>
+ <data name="CompositionException_ErrorPrefix" xml:space="preserve">
+ <value>Resulting in:</value>
+ </data>
+ <data name="CompositionException_MultipleErrorsWithMultiplePaths" xml:space="preserve">
+ <value>The composition produced multiple composition errors, with {0:N0} root causes. The root causes are provided below.</value>
+ </data>
+ <data name="CompositionException_ReviewErrorProperty" xml:space="preserve">
+ <value>Review the CompositionException.Errors property for more detailed information.</value>
+ </data>
+ <data name="CompositionException_SingleErrorWithMultiplePaths" xml:space="preserve">
+ <value>The composition produced a single composition error, with {0:N0} root causes. The root causes are provided below.</value>
+ </data>
+ <data name="CompositionException_SingleErrorWithSinglePath" xml:space="preserve">
+ <value>The composition produced a single composition error. The root cause is provided below.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionGetThrewException" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because an exception occurred while trying to access the collection value. If the collection is not IEnumerable<T> or T[] it must implement ICollection<T> and be either pre-initialized or be writable with a default constructor.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionAddThrewException" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because an exception occurred while calling the Add method on the type '{1}'.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionClearThrewException" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because an exception occurred while calling the Clear method on the type '{1}'.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionIsReadOnlyThrewException" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because an exception occurred while reading the IsReadOnly property on the type '{1}'.</value>
+ </data>
+ <data name="ReflectionModel_ImportCollectionConstructionThrewException" xml:space="preserve">
+ <value>Cannot populate the collection '{0}' because an exception occurred while calling the default constructor on the type '{1}'.</value>
+ </data>
+ <data name="CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany" xml:space="preserve">
+ <value>The member or parameter '{0}' is marked with multiple Import and ImportMany attributes. Only the first attribute encountered will be respected.</value>
+ </data>
+ <data name="Discovery_MetadataContainsValueWithInvalidType" xml:space="preserve">
+ <value>Property '{0}' has type '{1}' which is an invalid metadata type. Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification.</value>
+ </data>
+ <data name="Discovery_DuplicateMetadataNameValues" xml:space="preserve">
+ <value>Member or Type '{0}' contains multiple metadata entries with the name '{1}'. The metadata entries could be coming from the ExportMetadataAttribute or from a property of a custom metadata attribute. Either remove the duplicate entries or enable the metadata entry with name '{1}' to allow multiple entries via the IsMultiple property on ExportMetadataAttribute or AttributeUsage.AllowMultiple on custom metadata attributes.</value>
+ </data>
+ <data name="Discovery_ReservedMetadataNameUsed" xml:space="preserve">
+ <value>Member or Type '{0}' contains a metadata entry with the name '{1}', which is a reserved metadata key name. Either remove this metadata entry or change the name associated with the entry.</value>
+ </data>
+ <data name="ReflectionModel_InvalidExportDefinition" xml:space="preserve">
+ <value>ExportDefinition of type '{0}' cannot be used in this context. Only export definitions produced by the ReflectionModelServices.CreateExportDefinition are supported.</value>
+ </data>
+ <data name="ImportEngine_PreventedByExistingImport" xml:space="preserve">
+ <value>Change in exports prevented by non-recomposable import '{0}' on part '{1}'.</value>
+ </data>
+ <data name="ReflectionModel_InvalidImportDefinition" xml:space="preserve">
+ <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition are supported.</value>
+ </data>
+ <data name="ReflectionModel_InvalidPartDefinition" xml:space="preserve">
+ <value>ComposablePartDefinition of type '{0}' cannot be used in this context. Only part definitions produced by the ReflectionModelServices.CreatePartDefinition are supported.</value>
+ </data>
+ <data name="ArgumentOutOfRange_InvalidEnumInSet" xml:space="preserve">
+ <value>The value of argument '{0}' ({1}) is not supported. Allowed values are : '{2}'.</value>
+ </data>
+ <data name="ReflectionModel_InvalidMemberImportDefinition" xml:space="preserve">
+ <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on members are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter.</value>
+ </data>
+ <data name="ReflectionModel_InvalidParameterImportDefinition" xml:space="preserve">
+ <value>ImportDefinition of type '{0}' cannot be used in this context. Only import definitions produced by the ReflectionModelServices.CreateImportDefinition based on parameters are supported. Use ReflectionModelServices.IsImportingParameter to determine whether a given import definition is based on a member or a parameter.</value>
+ </data>
+ <data name="LazyMemberInfo_AccessorsNull" xml:space="preserve">
+ <value>Accessors must not be null (Nothing in Visual Basic).</value>
+ </data>
+ <data name="LazyMemberInfo_InvalidAccessorOnSimpleMember" xml:space="preserve">
+ <value>A member of type '{0}' must have exactly a single accessor of type '{0}'</value>
+ </data>
+ <data name="LazyMemberinfo_InvalidEventAccessors_AccessorType" xml:space="preserve">
+ <value>All event accessors must be methods.</value>
+ </data>
+ <data name="LazyMemberInfo_InvalidEventAccessors_Cardinality" xml:space="preserve">
+ <value>An event must have exactly three accessors.</value>
+ </data>
+ <data name="LazyMemberinfo_InvalidPropertyAccessors_AccessorType" xml:space="preserve">
+ <value>All property accessors must be methods.</value>
+ </data>
+ <data name="LazyMemberInfo_InvalidPropertyAccessors_Cardinality" xml:space="preserve">
+ <value>A property must have exactly two accessors.</value>
+ </data>
+ <data name="LazyMemberInfo_NoAccessors" xml:space="preserve">
+ <value>A member must have at least one accessor.</value>
+ </data>
+ <data name="LazyServices_LazyResolvesToNull" xml:space="preserve">
+ <value>The lazily evaluated value of type '{0}' passed to the ReflectionModelServices API as part of the argument '{1}' must not return null (Nothing in Visual Basic).</value>
+ </data>
+ <data name="InvalidMetadataValue" xml:space="preserve">
+ <value>Metadata can only contain values with a type that is available to be embedded at compile-time into attributes. For more details of what types are valid reference section 17.1.3 in the C# specification.</value>
+ </data>
+ <data name="ContractMismatch_InvalidCastOnMetadataField" xml:space="preserve">
+ <value>Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with the value '{2}' as type '{3}' but the view imports it as type '{4}'.</value>
+ </data>
+ <data name="ContractMismatch_NullReferenceOnMetadataField" xml:space="preserve">
+ <value>Unable to create an Instance of the Metadata view '{0}' because the exporter exported the metadata for the item '{1}' with a null value and null is not a valid value for type '{2}'.</value>
+ </data>
+ <data name="InvalidSetterOnMetadataField" xml:space="preserve">
+ <value>The MetadataView '{0}' is invalid because property '{1}' has a property set method.</value>
+ </data>
+ <data name="CompositionException_ChangesRejected" xml:space="preserve">
+ <value>The composition remains unchanged. The changes were rejected because of the following error(s): {0}</value>
+ </data>
+ <data name="ImportEngine_InvalidStateForRecomposition" xml:space="preserve">
+ <value>The ComposablePart of type '{0}' cannot be recomposed because it is in an invalid state. It can only be recomposed if it has already been fully previewed or composed.</value>
+ </data>
+ <data name="AtomicComposition_AlreadyCompleted" xml:space="preserve">
+ <value>The atomicComposition can no longer be changed because the atomicComposition has already been completed.</value>
+ </data>
+ <data name="AtomicComposition_PartOfAnotherAtomicComposition" xml:space="preserve">
+ <value>The atomicComposition contains another inner atomicComposition and cannot be changed until the that inner atomicComposition has been completed.</value>
+ </data>
+ <data name="AtomicComposition_AlreadyNested" xml:space="preserve">
+ <value>The atomicComposition is already contains an inner atomicComposition and cannot contain more than one atomicComposition at a time.</value>
+ </data>
+ <data name="ReentrantCompose" xml:space="preserve">
+ <value>Currently composing another batch in this ComposablePartExportProvider. Only one batch can be composed at a time.</value>
+ </data>
+ <data name="ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned" xml:space="preserve">
+ <value>The importing constructor on type '{0}' is using ImportManyAttribute on parameter '{1}' with a non-assignable type. On constructor parameters the ImportManyAttribute only supports importing into types T[] or IEnumerable<T>.</value>
+ </data>
+ <data name="CompositionException_ElementPrefix" xml:space="preserve">
+ <value>Element: {0}</value>
+ </data>
+ <data name="CompositionException_OriginSeparator" xml:space="preserve">
+ <value>--> </value>
+ </data>
+ <data name="CompositionTrace_Rejection_DefinitionRejected" xml:space="preserve">
+ <value>The ComposablePartDefinition '{0}' has been rejected. {1}</value>
+ </data>
+ <data name="CompositionTrace_Rejection_DefinitionResurrected" xml:space="preserve">
+ <value>The ComposablePartDefinition '{0}' that was previously rejected has been resurrected.</value>
+ </data>
+ <data name="CompositionTrace_Discovery_AssemblyLoadFailed" xml:space="preserve">
+ <value>The catalog '{0}' could not load assembly '{1}'. {2}</value>
+ </data>
+ <data name="CompositionTrace_Discovery_DefinitionContainsGenericParameters" xml:space="preserve">
+ <value>The ComposablePartDefinition '{0}' was ignored because it is an open generic type.</value>
+ </data>
+ <data name="CompositionTrace_Discovery_DefinitionContainsNoExports" xml:space="preserve">
+ <value>The ComposablePartDefinition '{0}' was ignored because it contains no exports.</value>
+ </data>
+ <data name="CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute" xml:space="preserve">
+ <value>The ComposablePartDefinition '{0}' was ignored because it was marked with PartNotDiscoverableAttribute.</value>
+ </data>
+ <data name="CompositionException_MetadataViewInvalidConstructor" xml:space="preserve">
+ <value>Unable to create an instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>.</value>
+ </data>
+ <data name="CompositionException_PathsCountSeparator" xml:space="preserve">
+ <value>)</value>
+ </data>
+ <data name="CompositionException_OriginFormat" xml:space="preserve">
+ <value> {0} {1}</value>
+ </data>
+ <data name="TypeCatalog_DisplayNameFormat" xml:space="preserve">
+ <value>{0} (Types='{1}').</value>
+ </data>
+</root>
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/SuppressMessages.cs b/System.ComponentModel.Composition/SuppressMessages.cs
new file mode 100644
index 0000000..4c57e17
--- /dev/null
+++ b/System.ComponentModel.Composition/SuppressMessages.cs
@@ -0,0 +1,10 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System.ComponentModel.Composition.ReflectionModel")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "System")]
+[assembly: SuppressMessage("Microsoft.MSInternal", "CA905:SystemNamespacesRequireApproval", Scope = "namespace", Target = "System.ComponentModel.Composition.ReflectionModel", Justification = "Approved by Framework")]
+
diff --git a/System.ComponentModel.Composition/SuppressMessagesBaselined.cs b/System.ComponentModel.Composition/SuppressMessagesBaselined.cs
new file mode 100644
index 0000000..3976948
--- /dev/null
+++ b/System.ComponentModel.Composition/SuppressMessagesBaselined.cs
@@ -0,0 +1,659 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+// The following are untriaged violations, do not add to this list unless you hit a bug in Code Analysis. Any explicitly
+// suppressed violations should either be applied against the member or type itself, or if raised against a namespace,
+// resource or assembly, placed in SuppressMessages.cs.
+
+// Code Analysis Bug: ValidateArgumentsOfPublicMethods should not fire on protected members
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+
+// Code Analysis Bug: ValidateArgumentsOfPublicMethods should not fire on usage of Requires.NotNull
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,System.String,!!0)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddPart(System.ComponentModel.Composition.Hosting.CompositionBatch,System.Object)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionContainer,System.String,!!0)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionContainer,!!0)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeParts(System.ComponentModel.Composition.Hosting.CompositionContainer,System.Object[])")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#SatisfyImportsOnce(System.ComponentModel.Composition.ICompositionService,System.Object)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SourceProvider")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`2(System.Collections.Generic.IEnumerable`1<System.Lazy`2<!!0,!!1>>)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`1(System.Collections.Generic.IEnumerable`1<System.Lazy`1<!!0>>)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#OnExportsChanged(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#OnExportsChanging(System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetExportingMember(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingMember(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetPartType(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsDisposalRequired(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+
+// DevDiv 10: 583413 AsmMeta: No longer finds APTCA bit on assemblies
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.Lazy`2", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.AttributedModelServices", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ChangeRejectedException", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionContractMismatchException", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionError", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.CreationPolicy", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ExportAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ExportMetadataAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportingConstructorAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ImportManyAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.InheritedExportAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.MetadataAttributeAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartCreationPolicyAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartMetadataAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.PartNotDiscoverableAttribute", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AdaptingExportProvider", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionConstants", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ExportProvider", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.ImportEngine", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.Export", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePart", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartDefinition", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ImportCardinality", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2117:AptcaTypesShouldOnlyExtendAptcaBaseTypes", Scope = "type", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices", Justification = "Razzle mscorlib is not APTCA")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Hosting.ExportProvider>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AggregateExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#.ctor(System.Reflection.Assembly,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#InnerCatalog")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalog.#LoadAssembly(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AssemblyCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Hosting.AssemblyCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes+InternalErrorException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes+InternalErrorException.#.ctor(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Assumes.#NotNullOrEmpty(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#AddCompleteAction(System.Action)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#AddRevertAction(System.Action)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#.ctor(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ContainsInnerAtomicComposition")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#CopyComplete()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#FinalComplete()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#SetValueInternal(System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ThrowIfCompleteed()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#ThrowIfContainsInnerAtomicComposition()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicComposition.#TryGetValueInternal`1(System.Object,System.Boolean,!!0&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicCompositionExtensions.#AddCompleteActionAllowNull(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Action)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.AtomicCompositionExtensions.#AddRevertActionAllowNull(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Action)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedExportDefinition.#Metadata")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.#CreatePart(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedModelDiscovery.#GetImportDefinitionCreationInfo(System.ComponentModel.Composition.ReflectionModel.ReflectionItem,System.Reflection.ICustomAttributeProvider)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,System.String,!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#AddExportedValue`1(System.ComponentModel.Composition.Hosting.CompositionBatch,!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModelServices.#ComposeParts(System.ComponentModel.Composition.Hosting.CompositionContainer,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#.ctor(System.Type,System.ComponentModel.Composition.PartCreationPolicyAttribute,System.Boolean,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetConstructor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetExportDefinitions()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetImportDefinitions()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#GetLazyPartType()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#HasExports()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#IsDisposalRequired")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#IsPartDiscoverable()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.AttributedModel.AttributedPartCreationInfo.#SelectPartConstructor(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetAttributes`1(System.Reflection.ICustomAttributeProvider)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetAttributes`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetFirstAttribute`1(System.Reflection.ICustomAttributeProvider)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#GetFirstAttribute`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#IsAttributeDefined`1(System.Reflection.ICustomAttributeProvider)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.AttributeServices.#IsAttributeDefined`1(System.Reflection.ICustomAttributeProvider,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider+CatalogChangeProxy.#Parts")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#DetermineRejection(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureCanRun()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureCanSet`1(!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#EnsureRunning()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetAtomicCompositionQuery(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetComposablePart(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#GetSharedPart(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#IsRejected(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#OnCatalogChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#OnExportsChangingInternal(System.Object,System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#ReleasePart(System.Object,System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SetConditionalReferenceForRecomposablePart(System.Object,System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#SourceProvider")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#UpdateAtomicCompositionQuery(System.ComponentModel.Composition.Hosting.AtomicComposition,System.Func`2<System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.Boolean>,System.ComponentModel.Composition.Hosting.CatalogExportProvider+AtomicCompositionQueryState)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CatalogExportProvider.#UpdateRejections(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ChangeRejectedException.#Message")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#AsArray`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#Add(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#Clear()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#.ctor(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObject`1.#IsReadOnly")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#Add(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#Clear()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#.ctor(System.Collections.IList)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices+CollectionOfObjectList.#IsReadOnly")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ConcatAllowingNull`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#Copy`1(System.Collections.Generic.Stack`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#FastAny`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ForEach`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Action`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCardinality`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCollectionElementType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetCollectionWrapper(System.Type,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#GetEnumerableElementType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#ToReadOnlyCollection`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.CollectionServices.#WhereNotNull`1(System.Collections.Generic.IEnumerable`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePart.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Add(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Changed")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Changing")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Clear()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>,System.Action`1<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs>,System.Action`1<System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Contains(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#CopyTo(System.ComponentModel.Composition.Primitives.ComposablePartCatalog[],System.Int32)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Count")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#GetEnumerator()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#HasChanged")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnChanged(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnContainedCatalogChanged(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#OnContainedCatalogChanging(System.Object,System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#RaiseChangedEvent(System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#RaiseChangingEvent(System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartDefinition>>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#Remove(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#SubscribeToCatalogNotifications(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#SubscribeToCatalogNotifications(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#UnsubscribeFromCatalogNotifications(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartCatalogCollection.#UnsubscribeFromCatalogNotifications(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePartCatalog>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartDefinition.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#.ctor(System.ComponentModel.Composition.CompositionErrorId,System.String,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ComposablePartException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#.ctor(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Compose(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#CreateExport(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureCanRun()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureCanSet`1(!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#EnsureRunning()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#GetUpdatedPartsList(System.ComponentModel.Composition.Hosting.CompositionBatch)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#Recompose(System.ComponentModel.Composition.Hosting.CompositionBatch,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#SourceProvider")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.#ThrowIfDisposed()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#AddPart(System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePart>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ComposablePart>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#PartsToAdd")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#PartsToRemove")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch.#RemovePart(System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionBatch+SingleExportComposablePart.#ImportDefinitions")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#.ctor(System.ComponentModel.Composition.Primitives.ComposablePartCatalog,System.Boolean,System.ComponentModel.Composition.Hosting.ExportProvider[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExport(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExport`1(System.Lazy`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`2(System.Collections.Generic.IEnumerable`1<System.Lazy`2<!!0,!!1>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionContainer.#ReleaseExports`1(System.Collections.Generic.IEnumerable`1<System.Lazy`1<!!0>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionContractMismatchException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionContractMismatchException.#.ctor(System.String,System.Exception)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElement.#.ctor(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElementDebuggerProxy.#.ctor(System.ComponentModel.Composition.Primitives.CompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.CompositionElementExtensions.#GetDisplayNameCore(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.ComponentModel.Composition.CompositionErrorId,System.String,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#Create(System.ComponentModel.Composition.CompositionErrorId,System.ComponentModel.Composition.Primitives.ICompositionElement,System.Exception,System.String,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionError.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionErrorDebuggerProxy.#.ctor(System.ComponentModel.Composition.CompositionError)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#BuildDefaultMessage()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#CalculatePaths(System.ComponentModel.Composition.CompositionException)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#.ctor(System.String,System.Exception,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#Message")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitCompositionException(System.ComponentModel.Composition.CompositionException,System.ComponentModel.Composition.CompositionException+VisitContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitError(System.ComponentModel.Composition.CompositionError,System.ComponentModel.Composition.CompositionException+VisitContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#VisitException(System.Exception,System.ComponentModel.Composition.CompositionException+VisitContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteElementGraph(System.Text.StringBuilder,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteError(System.Text.StringBuilder,System.ComponentModel.Composition.CompositionError)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WriteHeader(System.Text.StringBuilder,System.Int32,System.Int32)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WritePath(System.Text.StringBuilder,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>,System.Int32)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException.#WritePaths(System.Text.StringBuilder,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.CompositionError>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#.ctor(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+CompositionLockHolder.#.ctor(System.ComponentModel.Composition.Hosting.CompositionLock)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+CompositionLockHolder.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock+EmptyLockHolder.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#EnterCompositionLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionLock.#ExitCompositionLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionResult.#Errors")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionResult`1.#Errors")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractNameFromExport(System.Reflection.MemberInfo,System.ComponentModel.Composition.ExportAttribute)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractNameFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetContractTypeFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetDefaultTypeFromMember(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetPartMetadataForType(System.Type,System.ComponentModel.Composition.CreationPolicy)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetRequiredMetadata(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetTypeIdentityFromExport(System.Reflection.MemberInfo,System.ComponentModel.Composition.ExportAttribute)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#GetTypeIdentityFromImport(System.ComponentModel.Composition.IAttributedImport,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#IsRecomposable(System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#IsValidAttributeType(System.Type,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#Add(System.Object,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#InferArrayType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices+MetadataList.#ToArray()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryContributeMetadataValue(System.Collections.Generic.IDictionary`2<System.String,System.Object>,System.String,System.Object,System.Type,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryExportMetadataForMember(System.Reflection.MemberInfo,System.Collections.Generic.IDictionary`2<System.String,System.Object>&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryFire`1(System.EventHandler`1<!!0>,System.Object,!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryInvoke(System.Action)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.CompositionServices.#TryInvoke`1(System.Func`1<!!0>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.CompositionTrace.#AssemblyLoadFailed(System.ComponentModel.Composition.Hosting.DirectoryCatalog,System.String,System.Exception)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.CompositionTrace.#PartDefinitionRejected(System.ComponentModel.Composition.Primitives.ComposablePartDefinition,System.ComponentModel.Composition.ChangeRejectedException)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#AndAlso`1(System.Linq.Expressions.Expression`1<System.Func`2<!!0,System.Boolean>>,System.Linq.Expressions.Expression`1<System.Func`2<!!0,System.Boolean>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateConstraint(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateConstraint(System.String,System.String,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.ComponentModel.Composition.CreationPolicy)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateContractConstraintBody(System.String,System.Linq.Expressions.ParameterExpression)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateCreationPolicyContraint(System.ComponentModel.Composition.CreationPolicy,System.Linq.Expressions.ParameterExpression)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataConstraintBody(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.Linq.Expressions.ParameterExpression)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataContainsKeyExpression(System.Linq.Expressions.ParameterExpression,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataOfTypeExpression(System.Linq.Expressions.ParameterExpression,System.String,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateMetadataValueEqualsExpression(System.Linq.Expressions.ParameterExpression,System.Object,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ConstraintServices.#CreateTypeIdentityContraint(System.String,System.Linq.Expressions.ParameterExpression)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#.ctor(System.String,System.String,System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<System.String,System.Type>>,System.ComponentModel.Composition.Primitives.ImportCardinality,System.Boolean,System.Boolean,System.ComponentModel.Composition.CreationPolicy)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#MatchRequiredMatadata(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#FindArrayElementType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#FindGenericTypeName(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetGenericArity(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetTypeIdentity(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#GetTypeIdentityFromMethod(System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#TypeIdentityCache")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteArrayType(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteArrayTypeDimensions(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteByRefType(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteCustomModifiers(System.Text.StringBuilder,System.String,System.Type[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteGenericType(System.Text.StringBuilder,System.Type,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteGenericTypeName(System.Text.StringBuilder,System.Type,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteNonGenericType(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WritePointerType(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteType(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteTypeArgumentsString(System.Text.StringBuilder,System.Int32,System.Boolean,System.Collections.Generic.Queue`1<System.Type>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ContractNameServices.#WriteTypeWithNamespace(System.Text.StringBuilder,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ContractServices.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ContractServices.#TryCast(System.Type,System.Object,System.Object&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Changed")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Changing")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#DiffChanges(System.String[],System.String[],System.Collections.Generic.List`1<System.Tuple`2<System.String,System.ComponentModel.Composition.Hosting.AssemblyCatalog>>&,System.Collections.Generic.List`1<System.Tuple`2<System.String,System.ComponentModel.Composition.Hosting.AssemblyCatalog>>&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog+DirectoryCatalogDebuggerProxy.#Assemblies")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog+DirectoryCatalogDebuggerProxy.#.ctor(System.ComponentModel.Composition.Hosting.DirectoryCatalog)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetFiles()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#GetFullPath(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Initialize(System.String,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#LoadedFiles")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#OnChanged(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#OnChanging(System.ComponentModel.Composition.Hosting.ComposablePartCatalogChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.DirectoryCatalog.#Refresh()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.DisposableReflectionComposablePart.#System.IDisposable.Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.DisposableReflectionComposablePart.#ReleaseInstanceIfNecessary(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ErrorBuilder.#CreateImportCardinalityMismatch(System.ComponentModel.Composition.ImportCardinalityMismatchException,System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateContainsNullElement(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateDiscoveryException(System.String,System.String[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateExportDefinitionNotOnThisComposablePart(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateImportDefinitionNotOnThisComposablePart(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateNotOverriddenByDerived(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#CreateObjectDisposed(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExceptionBuilder.#Format(System.String,System.String[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#.ctor(System.ComponentModel.Composition.Primitives.ExportDefinition,System.Func`1<System.Object>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#GetExportedValueCore()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.Export.#Value")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportAttribute.#.ctor(System.String,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportDefinition.#.ctor(System.String,System.Collections.Generic.IDictionary`2<System.String,System.Object>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#ConvertMethodInfoToFuncOrActionType(System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#CreateDelegate(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ExportedDelegate.#.ctor(System.Object,System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#EnsureReadable()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#.ctor(System.ComponentModel.Composition.Primitives.ExportDefinition,System.ComponentModel.Composition.ReflectionModel.ReflectionMember)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ExportingMember.#GetExportedValue(System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportMetadataAttribute.#.ctor(System.String,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#BuildImportDefinition(System.Type,System.Type,System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#ExportsChanged")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#ExportsChanging")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportCore`2(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportCore`1(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportedValueCore`1(System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportedValuesCore`1(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExports(System.Type,System.Type,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore(System.Type,System.Type,System.String,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore`2(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#GetExportsCore`1(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportProvider.#TryGetExportsCore(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs.#ChangedContractNames")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs.#.ctor(System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateSemiStronglyTypedExport`2(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateSemiStronglyTypedExportFactory(System.Type,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportFactory(System.Type,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportOfT`1(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#CreateStronglyTypedExportOfTM`2(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`2.#System.IDisposable.Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`1.#.ctor(System.Func`1<!0>,System.IDisposable)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices+DisposableLazy`1.#System.IDisposable.Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#GetExportedValueFromLazy`1(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#IsDefaultMetadataViewType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ExportServices.#IsDictionaryConstructorViewType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#AddItemToLocalDictionary(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#AddLocalToLocalDictionary(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Object,System.Reflection.Emit.LocalBuilder)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#CreateGeneratorForPublicConstructor(System.Reflection.Emit.TypeBuilder,System.Type[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#GetExceptionDataAndStoreInLocal(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Reflection.Emit.LocalBuilder)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#IsBoxingRequiredForValue(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadDouble(System.Reflection.Emit.ILGenerator,System.Double)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadEnumerable(System.Reflection.Emit.ILGenerator,System.Collections.IEnumerable)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadFloat(System.Reflection.Emit.ILGenerator,System.Single)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadInt(System.Reflection.Emit.ILGenerator,System.Int32)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadLong(System.Reflection.Emit.ILGenerator,System.Int64)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadNull(System.Reflection.Emit.ILGenerator)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadString(System.Reflection.Emit.ILGenerator,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadTypeOf(System.Reflection.Emit.ILGenerator,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.GenerationServices.#LoadValue(System.Reflection.Emit.ILGenerator,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportAttribute.#.ctor(System.String,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportCardinalityMismatchException.#.ctor(System.String,System.Exception)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#.ctor(System.String,System.ComponentModel.Composition.Primitives.ImportCardinality,System.Boolean,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#IsConstraintSatisfiedBy(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ImportDefinition.#ToString()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#Dispose(System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#AddPartManager(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#Complete()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#.ctor(System.ComponentModel.Composition.Hosting.ImportEngine,System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+EngineContext.#RemovePartManager(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#GetEngineContext(System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#GetPartManager(System.ComponentModel.Composition.Primitives.ComposablePart,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#.ctor(System.ComponentModel.Composition.Hosting.ExportProvider,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#InPrerequisiteLoop()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#OnExportsChanging(System.Object,System.ComponentModel.Composition.Hosting.ExportsChangeEventArgs)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#DisposeAllDependencies()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#GetImportedContractNames()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#GetSavedImport(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#.ctor(System.ComponentModel.Composition.Hosting.ImportEngine,System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#SetSavedImport(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Primitives.Export[],System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#State")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+PartManager.#UpdateDisposableDependencies(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.Export>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#PreviewImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#AddIndexEntries(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetAffectedImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetAffectedParts(System.Collections.Generic.IEnumerable`1<System.String>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#GetPartsImporting(System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#IsAffectedImport(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#RemoveIndexEntries(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine+RecompositionManager.#UpdateImportIndex()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#ReleaseImports(System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#SatisfyImports(System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#SatisfyImportsOnce(System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#StopSatisfyingImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryPreviewImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryRecomposeImport(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Boolean,System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TryRecomposeImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImports(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImportsStateMachine(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.ComponentModel.Composition.Primitives.ComposablePart)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.ImportEngine.#TrySatisfyImportSubset(System.ComponentModel.Composition.Hosting.ImportEngine+PartManager,System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>,System.ComponentModel.Composition.Hosting.AtomicComposition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportingConstructorAttribute.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#Cast(System.Type,System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#CastExportsToCollectionImportType(System.ComponentModel.Composition.Primitives.Export[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingItem.#.ctor(System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition,System.ComponentModel.Composition.ReflectionModel.ImportType)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#EnsureCollectionIsWritable(System.Collections.Generic.ICollection`1<System.Object>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#EnsureWritable()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#GetNormalizedCollection(System.Type,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#PopulateCollection(System.Collections.Generic.ICollection`1<System.Object>,System.Collections.IEnumerable)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#SetCollectionMemberValue(System.Object,System.Collections.IEnumerable)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportingMember.#SetSingleMemberValue(System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ImportManyAttribute.#.ctor(System.String,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#CreateLazyType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#GetStronglyTypedExport(System.ComponentModel.Composition.Primitives.Export)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#.ctor(System.Type,System.ComponentModel.Composition.Primitives.ImportCardinality)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType.#IsTypeAssignableCollectionType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ImportType+SpecificLazyType.#.ctor(System.Type,System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(System.Func`1<!0>,!1)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(System.Func`1<!0>,!1,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(!1)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.Lazy`2.#.ctor(!1,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#AreAccessorsValid(System.Reflection.MemberTypes,System.Reflection.MemberInfo[],System.String&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#Equals(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#GetAccessors()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#GetHashCode()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#.ctor(System.Reflection.MemberTypes,System.Reflection.MemberInfo[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#op_Inequality(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo,System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo.#op_Equality(System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo,System.ComponentModel.Composition.ReflectionModel.LazyMemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.LazyServices.#AsLazy`1(!!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.LazyServices.#GetNotNullValue`1(System.Lazy`1<!!0>,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#EnterReadLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#EnterWriteLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#ExitReadLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#ExitWriteLock()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Lock.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataAttributeAttribute.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataServices.#GetValue`1(System.Collections.Generic.IDictionary`2<System.String,System.Object>,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateFieldAssignmentFromLocalValue(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Reflection.Emit.FieldBuilder)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateInterfaceViewProxyType(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateLocalAssignmentFromDefaultAttribute(System.Reflection.Emit.ILGenerator,System.ComponentModel.DefaultValueAttribute[],System.Reflection.Emit.LocalBuilder)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateLocalAssignmentFromFlag(System.Reflection.Emit.ILGenerator,System.Reflection.Emit.LocalBuilder,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#GenerateView(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewGenerator.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewProvider.#GetMetadataView`1(System.Collections.Generic.IDictionary`2<System.String,System.Object>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.MetadataViewProvider.#IsViewTypeValid(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartCreationPolicyAttribute.#.ctor(System.ComponentModel.Composition.CreationPolicy)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartMetadataAttribute.#.ctor(System.String,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.PartNotDiscoverableAttribute.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReadLock.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Contains(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#ContainsKey(!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#CopyTo(System.Collections.Generic.KeyValuePair`2<!0,!1>[],System.Int32)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Count")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#GetEnumerator()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Add(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Clear()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.ICollection`1<System.Collections.Generic.KeyValuePair`2<!0,!1>>.Remove(System.Collections.Generic.KeyValuePair`2<!0,!1>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.IDictionary`2<!0,!1>.Add(!0,!1)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.Generic.IDictionary`2<!0,!1>.Remove(!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#System.Collections.IEnumerable.GetEnumerator()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Keys")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#.ctor(System.Collections.Generic.IDictionary`2<!0,!1>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Item[!0]")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#TryGetValue(!0,!1&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionary`2.#Values")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionaryDebuggerProxy`2.#Items")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.ReadOnlyDictionaryDebuggerProxy`2.#.ctor(Microsoft.Internal.Collections.ReadOnlyDictionary`2<!0,!1>)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#Activate()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#CachedInstance")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#CreateInstance(System.Reflection.ConstructorInfo,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureCardinality(System.ComponentModel.Composition.Primitives.ImportDefinition,System.ComponentModel.Composition.Primitives.Export[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureGettable()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#EnsureSettable(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetConstructorArguments()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetExportedValue(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetExportingMemberFromDefinition(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetImportingItemFromDefinition(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#GetInstanceActivatingIfNeeded()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#NotifyImportSatisfied()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#.ctor(System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#.ctor(System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#RequiresActivation()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#SetImport(System.ComponentModel.Composition.ReflectionModel.ImportingItem,System.ComponentModel.Composition.Primitives.Export[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#SetNonPrerequisiteImports()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#TryGetImportValue(System.ComponentModel.Composition.Primitives.ImportDefinition,System.Object&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePart.#UseImportedValues`1(System.Collections.Generic.IEnumerable`1<!!0>,System.Action`3<System.ComponentModel.Composition.ReflectionModel.ImportingItem,!!0,System.Object>,System.Boolean)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#ExportDefinitions")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#GetConstructor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#ImportDefinitions")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#Metadata")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionComposablePartDefinition.#.ctor(System.ComponentModel.Composition.ReflectionModel.IReflectionPartCreationInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#CreateReflectionProperty(System.Reflection.MethodInfo,System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToLazyMember(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToLazyMember(System.ComponentModel.Composition.ReflectionModel.ReflectionMember)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToReflectionProperty(System.Reflection.PropertyInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionExtensions.#ToReflectionWritableMember(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#CanWrite")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#GetValue(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#RequiresInstance")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#ReturnType")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionField.#SetValue(System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionItem.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMember.#DeclaringType")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMember.#Name")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMemberExportDefinition.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMemberImportDefinition.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMethod.#RequiresInstance")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionMethod.#ReturnType")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetExportingMember(System.ComponentModel.Composition.Primitives.ExportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingMember(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#GetPartType(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsDisposalRequired(System.ComponentModel.Composition.Primitives.ComposablePartDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices.#IsImportingParameter(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+LazyExportDefinition.#Metadata")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#GetConstructor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#GetMetadata()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionModelServices+ReflectionPartCreationInfo.#.ctor(System.Lazy`1<System.Type>,System.Boolean,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>>,System.Lazy`1<System.Collections.Generic.IDictionary`2<System.String,System.Object>>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#Name")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameter.#ReturnType")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameterImportDefinition.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionParameterImportDefinition.#ToImportingItem()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#CanRead")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#CanWrite")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#GetValue(System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#Name")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#.ctor(System.Reflection.MethodInfo,System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#RequiresInstance")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#ReturnType")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionProperty.#SetValue(System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetAllProperties(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetDisplayName(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#GetDisplayName(System.Type,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#TryGetGenericInterfaceType(System.Type,System.Type,System.Type&)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#IsInMembertypeSet(System.Reflection.MemberTypes,System.String,System.Reflection.MemberTypes)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNull`1(!!0,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullElements`1(System.Collections.Generic.IEnumerable`1<!!0>,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullElements`2(System.Collections.Generic.IEnumerable`1<System.Collections.Generic.KeyValuePair`2<!!0,!!1>>,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Requires.#NotNullOrEmpty(System.String,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.SerializableCompositionElement.#.ctor(System.String,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Runtime.Serialization.SerializationServices.#GetValue`1(System.Runtime.Serialization.SerializationInfo,System.String)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.StringComparers.#ContractName")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.StringComparers.#MetadataKeyNames")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteError")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteInformation")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#CanWriteWarning")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceSourceTraceWriter.#WriteEvent(System.Diagnostics.TraceEventType,System.ComponentModel.Composition.Diagnostics.CompositionTraceId,System.String,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Diagnostics.TraceWriter.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#CreateIndex()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetCandidateParts(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetDisplayName()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetExports(System.ComponentModel.Composition.Primitives.ImportDefinition)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#GetTypesDisplay()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#PartsInternal")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Hosting.TypeCatalog.#.ctor(System.Collections.Generic.IEnumerable`1<System.Type>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Add(!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#AliveItemsToList()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#CleanupDeadReferences()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Clear()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#IndexOf(!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#Remove(!0)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.Collections.WeakReferenceCollection`1.#.ctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.WriteLock.#Dispose()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.Primitives.ContractBasedImportDefinition.#ValidateRequiredMetadata()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.LazyExportDefinition.#Metadata")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandMemberAccess(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandMemberAccessIfNeeded(System.Type)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#DemandRestrictedMemberAccess(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#.cctor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeCreateInstance(System.Type,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeGetValue(System.Reflection.FieldInfo,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeInvoke(System.Reflection.ConstructorInfo,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeInvoke(System.Reflection.MethodInfo,System.Object,System.Object[])")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#SafeSetValue(System.Reflection.FieldInfo,System.Object,System.Object)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionInvoke.#UnsafePermissionSet(System.Reflection.Assembly)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#GetConstructor()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#GetMetadata()")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.ReflectionModel.ReflectionPartCreationInfo.#.ctor(System.Lazy`1<System.Type>,System.Boolean,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ImportDefinition>>,System.Lazy`1<System.Collections.Generic.IEnumerable`1<System.ComponentModel.Composition.Primitives.ExportDefinition>>,System.Lazy`1<System.Collections.Generic.IDictionary`2<System.String,System.Object>>,System.ComponentModel.Composition.Primitives.ICompositionElement)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#Assembly(System.Reflection.MemberInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.ConstructorInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.FieldInfo)")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "Microsoft.Internal.ReflectionServices.#IsVisible(System.Reflection.MethodInfo)")]
+[module: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "System.ComponentModel.Composition.ChangeRejectedException")]
+[module: SuppressMessage("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException")]
+[module: SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Scope = "type", Target = "System.ComponentModel.Composition.CompositionException")]
+[module: SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods", Scope = "member", Target = "System.ComponentModel.Composition.CompositionException+CompositionExceptionData.#System.Runtime.Serialization.ISafeSerializationData.CompleteDeserialization(System.Object)")]
+
+
+
diff --git a/System.ComponentModel.Composition/System.ComponentModel.Composition.csproj b/System.ComponentModel.Composition/System.ComponentModel.Composition.csproj
new file mode 100644
index 0000000..89d3819
--- /dev/null
+++ b/System.ComponentModel.Composition/System.ComponentModel.Composition.csproj
@@ -0,0 +1,226 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>10.0.0</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1BBA5101-D4F0-48B8-A5D6-7B23A099DCE3}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <RootNamespace>Microsoft.Internal</RootNamespace>
+ <AssemblyName>System.ComponentModel.Composition</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <NoStdLib>true</NoStdLib>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\bin</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <NoWarn>1570;1572;1573;1591;1699</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\bin</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ <NoWarn>1570;1572;1573;1591;1699</NoWarn>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="mscorlib" />
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AssemblyInfo.cs" />
+ <Compile Include="Microsoft\Internal\Assumes.cs" />
+ <Compile Include="Microsoft\Internal\AttributeServices.cs" />
+ <Compile Include="Microsoft\Internal\Collections\CollectionServices.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ConditionalWeakTable.cs" />
+ <Compile Include="Microsoft\Internal\Collections\CollectionServices.CollectionOfObject.cs" />
+ <Compile Include="Microsoft\Internal\Collections\EnumerableCardinality.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionary.cs" />
+ <Compile Include="Microsoft\Internal\Collections\ReadOnlyDictionaryDebuggerProxy.cs" />
+ <Compile Include="Microsoft\Internal\Collections\WeakReferenceCollection.cs" />
+ <Compile Include="Microsoft\Internal\ContractServices.cs" />
+ <Compile Include="Microsoft\Internal\Assumes.InternalErrorException.cs" />
+ <Compile Include="Microsoft\Internal\SilverlightReflectionInvoke.cs" />
+ <Compile Include="Microsoft\Internal\GenerationServices.cs" />
+ <Compile Include="Microsoft\Internal\LazyServices.cs" />
+ <Compile Include="Microsoft\Internal\Lock.cs" />
+ <Compile Include="Microsoft\Internal\Lock.Reader.cs" />
+ <Compile Include="Microsoft\Internal\Lock.Writer.cs" />
+ <Compile Include="Microsoft\Internal\Requires.cs" />
+ <Compile Include="Microsoft\Internal\Runtime\Serialization\SerializationServices.cs" />
+ <Compile Include="Microsoft\Internal\StringComparers.cs" />
+ <Compile Include="Microsoft\Internal\ReflectionServices.cs" />
+ <Compile Include="Strings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Strings.resx</DependentUpon>
+ <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
+ </Compile>
+ <Compile Include="SuppressMessages.cs" />
+ <Compile Include="SuppressMessagesBaselined.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModelServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedModelDiscovery.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedPartCreationInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\AttributedModel\AttributedExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTrace.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceId.cs" />
+ <Compile Include="System\ComponentModel\Composition\ConstraintServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionContractMismatchException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionError.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionResultOfT.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.PartCreatorExport.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionLock.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\CompositionTraceSource.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\TraceSourceTraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\Diagnostics\SilverlightTraceWriter.cs" />
+ <Compile Include="System\ComponentModel\Composition\InheritedExportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportServices.DisposableLazy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AtomicComposition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AtomicCompositionExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionConstants.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogChangeProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\IPartCreatorImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorParameterImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\PartCreatorMemberImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\IAttributedImport.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportCardinalityMismatchException.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportManyAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ErrorBuilder.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionErrorDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExceptionBuilder.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportCardinalityCheckResult.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AggregateCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AggregateExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\AssemblyCatalogDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.CatalogExport.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CatalogExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogChangeEventArgs.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartCatalogCollection.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ComposablePartExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionBatch.SingleExportComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionContainer.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\CompositionServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ExportsChangeEventArgs.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.RecompositionManager.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.EngineContext.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.PartManager.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\ImportEngine.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\INotifyComposablePartCatalogChanged.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\TypeCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\ICompositionError.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportingConstructorAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\IPartImportsSatisfiedNotification.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartCatalogDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ComposablePartException.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementDebuggerProxy.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\CompositionElementExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\Export.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ExportedDelegate.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ICompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ImportCardinality.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\ImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\Primitives\SerializableCompositionElement.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\DisposableReflectionComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\IReflectionPartCreationInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\LazyMemberInfo.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionImportDefinition.cs" />
+ <Compile Include="Microsoft\Internal\ReflectionInvoke.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItemType.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataViewProvider.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartCreationPolicyAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartMetadataAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\PartNotDiscoverableAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionExtensions.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingParameter.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingItem.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ExportingMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportingMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ImportType.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePart.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionComposablePartDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberExportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMemberImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameterImportDefinition.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionWritableMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataViewGenerator.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionField.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionParameter.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionProperty.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionType.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionItem.cs" />
+ <Compile Include="System\ComponentModel\Composition\ReflectionModel\ReflectionMethod.cs" />
+ <Compile Include="System\ComponentModel\Composition\ChangeRejectedException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionException.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionErrorId.cs" />
+ <Compile Include="System\ComponentModel\Composition\CompositionResult.cs" />
+ <Compile Include="System\ComponentModel\Composition\ContractNameServices.cs" />
+ <Compile Include="System\ComponentModel\Composition\CreationPolicy.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ExportMetadataAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\ICompositionService.cs" />
+ <Compile Include="System\ComponentModel\Composition\ImportAttribute.cs" />
+ <Compile Include="System\ComponentModel\Composition\MetadataAttributeAttribute.cs" />
+ <Compile Include="System\Lazy.cs" />
+ <Compile Include="System\LazyOfTTMetadata.cs" />
+ <Compile Include="System\Tuple.cs" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(IsSilverLight)' != 'true'">
+ <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.cs" />
+ <Compile Include="System\ComponentModel\Composition\Hosting\DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="Strings.resx">
+ <SubType>Designer</SubType>
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Strings.Designer.cs</LastGenOutput>
+ <CustomToolNamespace>Microsoft.Internal</CustomToolNamespace>
+ </EmbeddedResource>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+</Project>
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs
new file mode 100644
index 0000000..2f8d7e2
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedExportDefinition.cs
@@ -0,0 +1,65 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.ComponentModel.Composition.AttributedModel;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.AttributedModel
+{
+ internal class AttributedExportDefinition : ExportDefinition
+ {
+ private readonly AttributedPartCreationInfo _partCreationInfo;
+ private readonly MemberInfo _member;
+ private readonly ExportAttribute _exportAttribute;
+
+ private IDictionary<string, object> _metadata;
+
+ public AttributedExportDefinition(AttributedPartCreationInfo partCreationInfo, MemberInfo member, ExportAttribute exportAttribute)
+ : base(member.GetContractNameFromExport(exportAttribute), (IDictionary<string, object>)null)
+ {
+ Assumes.NotNull(partCreationInfo);
+ Assumes.NotNull(member);
+ Assumes.NotNull(exportAttribute);
+
+ this._partCreationInfo = partCreationInfo;
+ this._member = member;
+ this._exportAttribute = exportAttribute;
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ if (this._metadata == null)
+ {
+ IDictionary<string, object> metadata;
+ this._member.TryExportMetadataForMember(out metadata);
+
+ string typeIdentity = this._member.GetTypeIdentityFromExport(this._exportAttribute);
+ metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
+
+ var partMetadata = this._partCreationInfo.GetMetadata();
+ if (partMetadata != null && partMetadata.ContainsKey(CompositionConstants.PartCreationPolicyMetadataName))
+ {
+ metadata.Add(CompositionConstants.PartCreationPolicyMetadataName, partMetadata[CompositionConstants.PartCreationPolicyMetadataName]);
+ }
+
+ this._metadata = metadata;
+ }
+ return this._metadata;
+ }
+ }
+ }
+
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs
new file mode 100644
index 0000000..c100257
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedModelDiscovery.cs
@@ -0,0 +1,138 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Diagnostics;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.AttributedModel
+{
+ internal static class AttributedModelDiscovery
+ {
+ public static ComposablePartDefinition CreatePartDefinitionIfDiscoverable(Type type, ICompositionElement origin)
+ {
+ AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, null, false, origin);
+ if (!creationInfo.IsPartDiscoverable())
+ {
+ return null;
+ }
+
+ return new ReflectionComposablePartDefinition(creationInfo);
+ }
+
+ public static ReflectionComposablePartDefinition CreatePartDefinition(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
+ {
+ Assumes.NotNull(type);
+
+ AttributedPartCreationInfo creationInfo = new AttributedPartCreationInfo(type, partCreationPolicy, ignoreConstructorImports, origin);
+
+ return new ReflectionComposablePartDefinition(creationInfo);
+ }
+
+ public static ReflectionComposablePart CreatePart(object attributedPart)
+ {
+ Assumes.NotNull(attributedPart);
+
+ // If given an instance then we want to pass the default composition options because we treat it as a shared part
+ // TODO: ICompositionElement Give this def an origin indicating that it was added directly to the ComposablePartExportProvider.
+
+ ReflectionComposablePartDefinition definition = AttributedModelDiscovery.CreatePartDefinition(attributedPart.GetType(), PartCreationPolicyAttribute.Shared, true, (ICompositionElement)null);
+
+ return new ReflectionComposablePart(definition, attributedPart);
+ }
+
+ public static ReflectionParameterImportDefinition CreateParameterImportDefinition(ParameterInfo parameter, ICompositionElement origin)
+ {
+ Requires.NotNull(parameter, "parameter");
+
+ ReflectionParameter reflectionParameter = parameter.ToReflectionParameter();
+ IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionParameter, parameter);
+ ImportType importType = new ImportType(reflectionParameter.ReturnType, attributedImport.Cardinality);
+
+ if (importType.IsPartCreator)
+ {
+ return new PartCreatorParameterImportDefinition(
+ new Lazy<ParameterInfo>(() => parameter),
+ origin,
+ new ContractBasedImportDefinition(
+ attributedImport.GetContractNameFromImport(importType),
+ attributedImport.GetTypeIdentityFromImport(importType),
+ CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
+ attributedImport.Cardinality,
+ false,
+ true,
+ CreationPolicy.NonShared));
+ }
+ else
+ {
+ return new ReflectionParameterImportDefinition(
+ new Lazy<ParameterInfo>(() => parameter),
+ attributedImport.GetContractNameFromImport(importType),
+ attributedImport.GetTypeIdentityFromImport(importType),
+ CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
+ attributedImport.Cardinality,
+ attributedImport.RequiredCreationPolicy,
+ origin);
+ }
+ }
+
+ public static ReflectionMemberImportDefinition CreateMemberImportDefinition(MemberInfo member, ICompositionElement origin)
+ {
+ Requires.NotNull(member, "member");
+
+ ReflectionWritableMember reflectionMember = member.ToReflectionWritableMember();
+ IAttributedImport attributedImport = AttributedModelDiscovery.GetAttributedImport(reflectionMember, member);
+ ImportType importType = new ImportType(reflectionMember.ReturnType, attributedImport.Cardinality);
+
+ if (importType.IsPartCreator)
+ {
+ return new PartCreatorMemberImportDefinition(
+ new LazyMemberInfo(member),
+ origin,
+ new ContractBasedImportDefinition(
+ attributedImport.GetContractNameFromImport(importType),
+ attributedImport.GetTypeIdentityFromImport(importType),
+ CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
+ attributedImport.Cardinality,
+ attributedImport.AllowRecomposition,
+ false,
+ CreationPolicy.NonShared));
+ }
+ else
+ {
+ return new ReflectionMemberImportDefinition(
+ new LazyMemberInfo(member),
+ attributedImport.GetContractNameFromImport(importType),
+ attributedImport.GetTypeIdentityFromImport(importType),
+ CompositionServices.GetRequiredMetadata(importType.MetadataViewType),
+ attributedImport.Cardinality,
+ attributedImport.AllowRecomposition,
+ attributedImport.RequiredCreationPolicy,
+ origin);
+ }
+ }
+
+ private static IAttributedImport GetAttributedImport(ReflectionItem item, ICustomAttributeProvider attributeProvider)
+ {
+ IAttributedImport[] imports = attributeProvider.GetAttributes<IAttributedImport>(false);
+
+ // For constructor parameters they may not have an ImportAttribute
+ if (imports.Length == 0)
+ {
+ return new ImportAttribute();
+ }
+
+ if (imports.Length > 1)
+ {
+ CompositionTrace.MemberMarkedWithMultipleImportAndImportMany(item);
+ }
+
+ // Regardless of how many imports, always return the first one
+ return imports[0];
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs
new file mode 100644
index 0000000..827a709
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModel/AttributedPartCreationInfo.cs
@@ -0,0 +1,446 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Diagnostics;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.AttributedModel
+{
+ internal class AttributedPartCreationInfo : IReflectionPartCreationInfo
+ {
+ private readonly Type _type;
+ private readonly bool _ignoreConstructorImports = false;
+ private readonly ICompositionElement _origin;
+ private PartCreationPolicyAttribute _partCreationPolicy = null;
+ private ConstructorInfo _constructor;
+ private IEnumerable<ExportDefinition> _exports;
+ private IEnumerable<ImportDefinition> _imports;
+ private HashSet<string> _contractNamesOnNonInterfaces;
+
+ public AttributedPartCreationInfo(Type type, PartCreationPolicyAttribute partCreationPolicy, bool ignoreConstructorImports, ICompositionElement origin)
+ {
+ Assumes.NotNull(type);
+ this._type = type;
+ this._ignoreConstructorImports = ignoreConstructorImports;
+ this._partCreationPolicy = partCreationPolicy;
+ this._origin = origin;
+ }
+
+ public Type GetPartType()
+ {
+ return this._type;
+ }
+
+ public Lazy<Type> GetLazyPartType()
+ {
+ return new Lazy<Type>(this.GetPartType, false);
+ }
+
+ public ConstructorInfo GetConstructor()
+ {
+ if (this._constructor == null && !this._ignoreConstructorImports)
+ {
+ this._constructor = SelectPartConstructor(this._type);
+ }
+ return this._constructor;
+ }
+
+ public IDictionary<string, object> GetMetadata()
+ {
+ return this._type.GetPartMetadataForType(this.CreationPolicy);
+ }
+
+ public IEnumerable<ExportDefinition> GetExports()
+ {
+ DiscoverExportsAndImports();
+ return this._exports;
+ }
+
+ public IEnumerable<ImportDefinition> GetImports()
+ {
+ DiscoverExportsAndImports();
+ return this._imports;
+ }
+
+ public bool IsDisposalRequired
+ {
+ get
+ {
+ return typeof(IDisposable).IsAssignableFrom(this.GetPartType());
+ }
+ }
+
+ public bool IsPartDiscoverable()
+ {
+ if (this._type.IsAttributeDefined<PartNotDiscoverableAttribute>())
+ {
+ CompositionTrace.DefinitionMarkedWithPartNotDiscoverableAttribute(this._type);
+ return false;
+ }
+
+ if (this._type.ContainsGenericParameters)
+ {
+ CompositionTrace.DefinitionContainsGenericsParameters(this._type);
+ return false;
+ }
+
+ if (!HasExports())
+ {
+ CompositionTrace.DefinitionContainsNoExports(this._type);
+ return false;
+ }
+
+ return true;
+ }
+
+ private bool HasExports()
+ {
+ return GetExportMembers(this._type).Any() ||
+ GetInheritedExports(this._type).Any();
+ }
+
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return this._origin; }
+ }
+
+ public override string ToString()
+ {
+ return GetDisplayName();
+ }
+
+ private string GetDisplayName()
+ {
+ return this.GetPartType().GetDisplayName();
+ }
+
+ private CreationPolicy CreationPolicy
+ {
+ get
+ {
+ if (this._partCreationPolicy == null)
+ {
+ this._partCreationPolicy = this._type.GetFirstAttribute<PartCreationPolicyAttribute>() ?? PartCreationPolicyAttribute.Default;
+ }
+ return this._partCreationPolicy.CreationPolicy;
+ }
+ }
+
+ private static ConstructorInfo SelectPartConstructor(Type type)
+ {
+ Assumes.NotNull(type);
+
+ if (type.IsAbstract)
+ {
+ return null;
+ }
+
+ // Only deal with non-static constructors
+ BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
+
+ ConstructorInfo[] constructors = type.GetConstructors(flags);
+
+ // Should likely only happen for static or abstract types
+ if (constructors.Length == 0)
+ {
+ return null;
+ }
+
+ // Optimize single default constructor.
+ if (constructors.Length == 1 && constructors[0].GetParameters().Length == 0)
+ {
+ return constructors[0];
+ }
+
+ // Select the marked constructor if there is exactly one marked
+ IEnumerable<ConstructorInfo> importingConstructors = constructors.Where(
+ ctor => ctor.IsAttributeDefined<ImportingConstructorAttribute>());
+
+ switch (importingConstructors.GetCardinality())
+ {
+ case EnumerableCardinality.One:
+ {
+ return importingConstructors.First();
+ }
+
+ case EnumerableCardinality.TwoOrMore:
+ {
+ // Return null, the part will error on instantiation.
+ return null;
+ }
+ }
+
+ // If there are no marked constructors then select the default constructor
+ IEnumerable<ConstructorInfo> defaultConstructors = constructors.Where(
+ ctor => ctor.GetParameters().Length == 0);
+
+ // There should only ever be zero or one default constructors
+ return defaultConstructors.SingleOrDefault();
+ }
+
+ private void DiscoverExportsAndImports()
+ {
+ // NOTE : in most cases both of these will be null or not null at the same time
+ // the only situation when that is not the case is when there was a failure during the previous discovery
+ // and one of them ended up not being set. In that case we will force the discovery again so that the same exception is thrown.
+ if ((this._exports != null) && (this._imports != null))
+ {
+ return;
+ }
+
+ this._exports = GetExportDefinitions();
+ this._imports = GetImportDefinitions();
+ }
+
+ private IEnumerable<ExportDefinition> GetExportDefinitions()
+ {
+ List<ExportDefinition> exports = new List<ExportDefinition>();
+
+ this._contractNamesOnNonInterfaces = new HashSet<string>();
+
+ // GetExportMembers should only contain the type itself along with the members declared on it,
+ // it should not contain any base types, members on base types or interfaces on the type.
+ foreach (MemberInfo member in GetExportMembers(this._type))
+ {
+ foreach (ExportAttribute exportAttribute in member.GetAttributes<ExportAttribute>())
+ {
+ var attributedExportDefinition = new AttributedExportDefinition(this, member, exportAttribute);
+
+ if (exportAttribute.GetType() == CompositionServices.InheritedExportAttributeType)
+ {
+ // Any InheritedExports on the type itself are contributed during this pass
+ // and we need to do the book keeping for those.
+ if (!this._contractNamesOnNonInterfaces.Contains(attributedExportDefinition.ContractName))
+ {
+ exports.Add(new ReflectionMemberExportDefinition(member.ToLazyMember(), attributedExportDefinition, this));
+ this._contractNamesOnNonInterfaces.Add(attributedExportDefinition.ContractName);
+ }
+ }
+ else
+ {
+ exports.Add(new ReflectionMemberExportDefinition(member.ToLazyMember(), attributedExportDefinition, this));
+ }
+ }
+ }
+
+ // GetInheritedExports should only contain InheritedExports on base types or interfaces.
+ // The order of types returned here is important because it is used as a
+ // priority list of which InhertedExport to choose if multiple exists with
+ // the same contract name. Therefore ensure that we always return the types
+ // in the hiearchy from most derived to the lowest base type, followed
+ // by all the interfaces that this type implements.
+ foreach (Type type in GetInheritedExports(this._type))
+ {
+ foreach (InheritedExportAttribute exportAttribute in type.GetAttributes<InheritedExportAttribute>())
+ {
+ var attributedExportDefinition = new AttributedExportDefinition(this, type, exportAttribute);
+
+ if (!this._contractNamesOnNonInterfaces.Contains(attributedExportDefinition.ContractName))
+ {
+ exports.Add(new ReflectionMemberExportDefinition(type.ToLazyMember(), attributedExportDefinition, this));
+
+ if (!type.IsInterface)
+ {
+ this._contractNamesOnNonInterfaces.Add(attributedExportDefinition.ContractName);
+ }
+ }
+ }
+ }
+
+ this._contractNamesOnNonInterfaces = null; // No need to hold this state around any longer
+
+ return exports;
+ }
+
+ private IEnumerable<MemberInfo> GetExportMembers(Type type)
+ {
+ BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public |
+ BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
+
+ // If the type is abstract only find local static exports
+ if (type.IsAbstract)
+ {
+ flags &= ~BindingFlags.Instance;
+ }
+ else if (IsExport(type))
+ {
+ yield return type;
+ }
+
+ // Walk the fields
+ foreach (var member in type.GetFields(flags))
+ {
+ if (IsExport(member))
+ {
+ yield return member;
+ }
+ }
+
+ // Walk the properties
+ foreach (var member in type.GetProperties(flags))
+ {
+ if (IsExport(member))
+ {
+ yield return member;
+ }
+ }
+
+ // Walk the methods
+ foreach (var member in type.GetMethods(flags))
+ {
+ if (IsExport(member))
+ {
+ yield return member;
+ }
+ }
+ }
+
+ private IEnumerable<Type> GetInheritedExports(Type type)
+ {
+ // If the type is abstract we aren't interested in type level exports
+ if (type.IsAbstract)
+ {
+ yield break;
+ }
+
+ // The order of types returned here is important because it is used as a
+ // priority list of which InhertedExport to choose if multiple exists with
+ // the same contract name. Therefore ensure that we always return the types
+ // in the hiearchy from most derived to the lowest base type, followed
+ // by all the interfaces that this type implements.
+
+ Type currentType = type.BaseType;
+
+ if (currentType == null)
+ {
+ yield break;
+ }
+
+ // Stopping at object instead of null to help with performance. It is a noticable performance
+ // gain (~5%) if we don't have to try and pull the attributes we know don't exist on object.
+ // We also need the null check in case we're passed a type that doesn't live in the runtime context.
+ while (currentType != null && currentType != CompositionServices.ObjectType)
+ {
+ if (IsInheritedExport(currentType))
+ {
+ yield return currentType;
+ }
+ currentType = currentType.BaseType;
+ }
+
+ foreach (Type iface in type.GetInterfaces())
+ {
+ if (IsInheritedExport(iface))
+ {
+ yield return iface;
+ }
+ }
+ }
+
+ private static bool IsExport(ICustomAttributeProvider attributeProvider)
+ {
+ return attributeProvider.IsAttributeDefined<ExportAttribute>(false);
+ }
+
+ private static bool IsInheritedExport(ICustomAttributeProvider attributedProvider)
+ {
+ return attributedProvider.IsAttributeDefined<InheritedExportAttribute>(false);
+ }
+
+ private IEnumerable<ImportDefinition> GetImportDefinitions()
+ {
+ List<ImportDefinition> imports = new List<ImportDefinition>();
+
+ foreach (MemberInfo member in GetImportMembers(this._type))
+ {
+ ReflectionMemberImportDefinition importDefinition = AttributedModelDiscovery.CreateMemberImportDefinition(member, this);
+ imports.Add(importDefinition);
+ }
+
+ var constructor = this.GetConstructor();
+
+ if (constructor != null)
+ {
+ foreach (ParameterInfo parameter in constructor.GetParameters())
+ {
+ ReflectionParameterImportDefinition importDefinition = AttributedModelDiscovery.CreateParameterImportDefinition(parameter, this);
+ imports.Add(importDefinition);
+ }
+ }
+
+ return imports;
+ }
+
+ private IEnumerable<MemberInfo> GetImportMembers(Type type)
+ {
+ if (type.IsAbstract)
+ {
+ yield break;
+ }
+
+ foreach (MemberInfo member in GetDeclaredOnlyImportMembers(type))
+ {
+ yield return member;
+ }
+
+ // Walk up the type chain until you hit object.
+ if (type.BaseType != null)
+ {
+ Type baseType = type.BaseType;
+
+ // Stopping at object instead of null to help with performance. It is a noticable performance
+ // gain (~5%) if we don't have to try and pull the attributes we know don't exist on object.
+ // We also need the null check in case we're passed a type that doesn't live in the runtime context.
+ while (baseType != null && baseType != CompositionServices.ObjectType)
+ {
+ foreach (MemberInfo member in GetDeclaredOnlyImportMembers(baseType))
+ {
+ yield return member;
+ }
+ baseType = baseType.BaseType;
+ }
+ }
+ }
+
+ private IEnumerable<MemberInfo> GetDeclaredOnlyImportMembers(Type type)
+ {
+ BindingFlags flags = BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
+
+ // Walk the fields
+ foreach (var member in type.GetFields(flags))
+ {
+ if (IsImport(member))
+ {
+ yield return member;
+ }
+ }
+
+ // Walk the properties
+ foreach (var member in type.GetProperties(flags))
+ {
+ if (IsImport(member))
+ {
+ yield return member;
+ }
+ }
+ }
+
+ private static bool IsImport(ICustomAttributeProvider attributeProvider)
+ {
+ return attributeProvider.IsAttributeDefined<IAttributedImport>(false);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModelServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModelServices.cs
new file mode 100644
index 0000000..2d33502
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/AttributedModelServices.cs
@@ -0,0 +1,161 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Runtime.Serialization;
+using System.ComponentModel.Composition.AttributedModel;
+using System.Reflection;
+using System.Linq;
+using Microsoft.Internal;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ public static class AttributedModelServices
+ {
+ [SuppressMessage("Microsoft.Design", "CA1004")]
+ public static TMetadataView GetMetadataView<TMetadataView>(IDictionary<string, object> metadata)
+ {
+ Requires.NotNull(metadata, "metadata");
+
+ return MetadataViewProvider.GetMetadataView<TMetadataView>(metadata);
+ }
+
+ public static ComposablePart CreatePart(object attributedPart)
+ {
+ Requires.NotNull(attributedPart, "attributedPart");
+ return AttributedModelDiscovery.CreatePart(attributedPart);
+ }
+
+ public static ComposablePartDefinition CreatePartDefinition(Type type, ICompositionElement origin)
+ {
+ Requires.NotNull(type, "type");
+ return AttributedModelServices.CreatePartDefinition(type, origin, false);
+ }
+
+ public static ComposablePartDefinition CreatePartDefinition(Type type, ICompositionElement origin, bool ensureIsDiscoverable)
+ {
+ Requires.NotNull(type, "type");
+ if (ensureIsDiscoverable)
+ {
+ return AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, origin);
+ }
+ else
+ {
+ return AttributedModelDiscovery.CreatePartDefinition(type, null, false, origin);
+ }
+ }
+
+ public static string GetTypeIdentity(Type type)
+ {
+ Requires.NotNull(type, "type");
+
+ return ContractNameServices.GetTypeIdentity(type);
+ }
+
+ public static string GetTypeIdentity(MethodInfo method)
+ {
+ Requires.NotNull(method, "method");
+
+ return ContractNameServices.GetTypeIdentityFromMethod(method);
+ }
+
+ public static string GetContractName(Type type)
+ {
+ return AttributedModelServices.GetTypeIdentity(type);
+ }
+
+ public static ComposablePart AddExportedValue<T>(this CompositionBatch batch, T exportedValue)
+ {
+ Requires.NotNull(batch, "batch");
+ string contractName = AttributedModelServices.GetContractName(typeof(T));
+
+ return batch.AddExportedValue<T>(contractName, exportedValue);
+ }
+
+ public static void ComposeExportedValue<T>(this CompositionContainer container, T exportedValue)
+ {
+ Requires.NotNull(container, "container");
+
+ CompositionBatch batch = new CompositionBatch();
+ batch.AddExportedValue<T>(exportedValue);
+ container.Compose(batch);
+ }
+
+ public static ComposablePart AddExportedValue<T>(this CompositionBatch batch, string contractName, T exportedValue)
+ {
+ Requires.NotNull(batch, "batch");
+
+ string typeIdentity = AttributedModelServices.GetTypeIdentity(typeof(T));
+
+ IDictionary<string, object> metadata = new Dictionary<string, object>();
+ metadata.Add(CompositionConstants.ExportTypeIdentityMetadataName, typeIdentity);
+
+ return batch.AddExport(new Export(contractName, metadata, () => exportedValue));
+ }
+
+ public static void ComposeExportedValue<T>(this CompositionContainer container, string contractName, T exportedValue)
+ {
+ Requires.NotNull(container, "container");
+
+ CompositionBatch batch = new CompositionBatch();
+ batch.AddExportedValue<T>(contractName, exportedValue);
+ container.Compose(batch);
+ }
+
+ public static ComposablePart AddPart(this CompositionBatch batch, object attributedPart)
+ {
+ Requires.NotNull(batch, "batch");
+ Requires.NotNull(attributedPart, "attributedPart");
+
+ ComposablePart part = AttributedModelServices.CreatePart(attributedPart);
+
+ batch.AddPart(part);
+
+ return part;
+ }
+
+ public static void ComposeParts(this CompositionContainer container, params object[] attributedParts)
+ {
+ Requires.NotNull(container, "container");
+ Requires.NotNullOrNullElements(attributedParts, "attributedParts");
+
+ CompositionBatch batch = new CompositionBatch(
+ attributedParts.Select(attributedPart => AttributedModelServices.CreatePart(attributedPart)).ToArray(),
+ Enumerable.Empty<ComposablePart>());
+
+ container.Compose(batch);
+ }
+
+ /// <summary>
+ /// Satisfies the imports of the specified attributed object exactly once and they will not
+ /// ever be recomposed.
+ /// </summary>
+ /// <param name="part">
+ /// The attributed object to set the imports.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="attributedPart"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ICompositionService"/> has been disposed of.
+ /// </exception>
+ public static ComposablePart SatisfyImportsOnce(this ICompositionService compositionService, object attributedPart)
+ {
+ Requires.NotNull(compositionService, "compositionService");
+ Requires.NotNull(attributedPart, "attributedPart");
+
+ ComposablePart part = AttributedModelServices.CreatePart(attributedPart);
+ compositionService.SatisfyImportsOnce(part);
+
+ return part;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ChangeRejectedException.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ChangeRejectedException.cs
new file mode 100644
index 0000000..3f5da5c
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ChangeRejectedException.cs
@@ -0,0 +1,69 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Security.Permissions;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// The exception that is thrown when one or more recoverable errors occur during
+ /// composition which results in those changes being rejected.
+ /// </summary>
+ [Serializable]
+ public class ChangeRejectedException : CompositionException
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
+ /// </summary>
+ public ChangeRejectedException()
+ : this((string)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
+ /// </summary>
+ public ChangeRejectedException(string message)
+ : this(message, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
+ /// </summary>
+ public ChangeRejectedException(string message, Exception innerException)
+ : base(message, innerException, (IEnumerable<CompositionError>)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ChangeRejectedException"/> class.
+ /// </summary>
+ /// <param name="errors">List of errors that occured while applying the changes.</param>
+ public ChangeRejectedException(IEnumerable<CompositionError> errors)
+ : base((string)null, (Exception)null, errors)
+ {
+ }
+
+ /// <summary>
+ /// Gets a message that describes the exception.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ChangeRejectedException"/>.
+ /// </value>
+ public override string Message
+ {
+ get
+ {
+ return string.Format(CultureInfo.CurrentCulture,
+ Strings.CompositionException_ChangesRejected,
+ base.Message);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionContractMismatchException.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionContractMismatchException.cs
new file mode 100644
index 0000000..55a8c4d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionContractMismatchException.cs
@@ -0,0 +1,90 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Runtime.Serialization;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// The exception that is thrown when the underlying exported value or metadata of an
+ /// <see cref="Lazy{T}"/> or <see cref="Lazy{T, TMetadataView}"/> object cannot be
+ /// cast to <c>T</c> or <c>TMetadataView</c>, respectively.
+ /// </summary>
+ [Serializable]
+ public class CompositionContractMismatchException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class.
+ /// </summary>
+ public CompositionContractMismatchException()
+ : this((string)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
+ /// with the specified error message.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ public CompositionContractMismatchException(string message)
+ : this(message, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
+ /// with the specified error message and exception that is the cause of the
+ /// exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="innerException">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="CompositionContractMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
+ /// </param>
+ public CompositionContractMismatchException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+#if !SILVERLIGHT
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContractMismatchException"/> class
+ /// with the specified serialization data.
+ /// </summary>
+ /// <param name="info">
+ /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
+ /// <see cref="CompositionContractMismatchException"/>.
+ /// </param>
+ /// <param name="context">
+ /// The <see cref="StreamingContext"/> that contains contextual information about the
+ /// source or destination.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="info"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="SerializationException">
+ /// <paramref name="info"/> is missing a required value.
+ /// </exception>
+ /// <exception cref="InvalidCastException">
+ /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
+ /// </exception>
+ [System.Security.SecuritySafeCritical]
+ protected CompositionContractMismatchException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+
+#endif
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionError.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionError.cs
new file mode 100644
index 0000000..a85b9f5
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionError.cs
@@ -0,0 +1,188 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Globalization;
+using System.Security.Permissions;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Represents an error that occurs during composition in a <see cref="CompositionContainer"/>.
+ /// </summary>
+ [Serializable]
+ [DebuggerTypeProxy(typeof(CompositionErrorDebuggerProxy))]
+ public class CompositionError : ICompositionError
+ {
+ private readonly CompositionErrorId _id;
+ private readonly string _description;
+ private readonly Exception _exception;
+
+ private readonly ICompositionElement _element;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionError"/> class
+ /// with the specified error message.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
+ /// <see cref="Description"/> property to an empty string ("").
+ /// </param>
+ public CompositionError(string message)
+ : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionError"/> class
+ /// with the specified error message and composition element that is the
+ /// cause of the composition error.
+ /// </summary>
+ /// <param name="element">
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set
+ /// the <see cref="CompositionError.Element"/> property to
+ /// <see langword="null"/>.
+ /// </param>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
+ /// <see cref="Description"/> property to an empty string ("").
+ /// </param>
+ public CompositionError(string message, ICompositionElement element)
+ : this(CompositionErrorId.Unknown, message, element, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionError"/> class
+ /// with the specified error message and exception that is the cause of the
+ /// composition error.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
+ /// <see cref="Description"/> property to an empty string ("").
+ /// </param>
+ /// <param name="exception">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set
+ /// the <see cref="CompositionError.Exception"/> property to <see langword="null"/>.
+ /// </param>
+ public CompositionError(string message, Exception exception)
+ : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, exception)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionError"/> class
+ /// with the specified error message, and composition element and exception that
+ /// is the cause of the composition error.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set the
+ /// <see cref="Description"/> property to an empty string ("").
+ /// </param>
+ /// <param name="element">
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set
+ /// the <see cref="CompositionError.Element"/> property to
+ /// <see langword="null"/>.
+ /// </param>
+ /// <param name="exception">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="CompositionError"/>; or <see langword="null"/> to set
+ /// the <see cref="CompositionError.Exception"/> property to <see langword="null"/>.
+ /// </param>
+ public CompositionError(string message, ICompositionElement element, Exception exception)
+ : this(CompositionErrorId.Unknown, message, element, exception)
+ {
+ }
+
+ internal CompositionError(CompositionErrorId id, string description, ICompositionElement element, Exception exception)
+ {
+ _id = id;
+ _description = description ?? string.Empty;
+ _element = element;
+ _exception = exception;
+ }
+
+ /// <summary>
+ /// Gets the composition element that is the cause of the error.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="CompositionError"/>. The default is <see langword="null"/>.
+ /// </value>
+ public ICompositionElement Element
+ {
+ get { return _element; }
+ }
+
+ /// <summary>
+ /// Gets the message that describes the composition error.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionError"/>.
+ /// </value>
+ public string Description
+ {
+ get { return _description; }
+ }
+
+ /// <summary>
+ /// Gets the exception that is the underlying cause of the composition error.
+ /// </summary>
+ /// <value>
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="CompositionError"/>. The default is <see langword="null"/>.
+ /// </value>
+ public Exception Exception
+ {
+ get { return _exception; }
+ }
+
+ CompositionErrorId ICompositionError.Id
+ {
+ get { return _id; }
+ }
+
+ Exception ICompositionError.InnerException
+ {
+ get { return Exception; }
+ }
+
+ /// <summary>
+ /// Returns a string representation of the composition error.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the <see cref="Description"/> property.
+ /// </returns>
+ public override string ToString()
+ {
+ return this.Description;
+ }
+
+ internal static CompositionError Create(CompositionErrorId id, string format, params object[] parameters)
+ {
+ return Create(id, (ICompositionElement)null, (Exception)null, format, parameters);
+ }
+
+ internal static CompositionError Create(CompositionErrorId id, ICompositionElement element, string format, params object[] parameters)
+ {
+ return Create(id, element, (Exception)null, format, parameters);
+ }
+
+ internal static CompositionError Create(CompositionErrorId id, ICompositionElement element, Exception exception, string format, params object[] parameters)
+ {
+ return new CompositionError(id, string.Format(CultureInfo.CurrentCulture, format, parameters), element, exception);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs
new file mode 100644
index 0000000..9530adb
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorDebuggerProxy.cs
@@ -0,0 +1,37 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ internal class CompositionErrorDebuggerProxy
+ {
+ private readonly CompositionError _error;
+
+ public CompositionErrorDebuggerProxy(CompositionError error)
+ {
+ Requires.NotNull(error, "error");
+
+ this._error = error;
+ }
+
+ public string Description
+ {
+ get { return this._error.Description; }
+ }
+
+ public Exception Exception
+ {
+ get { return this._error.Exception; }
+ }
+
+ public ICompositionElement Element
+ {
+ get { return this._error.Element; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorId.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorId.cs
new file mode 100644
index 0000000..c69dd66
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionErrorId.cs
@@ -0,0 +1,41 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition
+{
+ internal enum CompositionErrorId : int
+ {
+ Unknown = 0,
+ InvalidExportMetadata,
+ RequiredMetadataNotFound,
+ UnsupportedExportType,
+ ImportNotSetOnPart,
+ ImportEngine_ComposeTookTooManyIterations,
+ ImportEngine_ImportCardinalityMismatch,
+ ImportEngine_PartCycle,
+ ImportEngine_PartCannotSetImport,
+ ImportEngine_PartCannotGetExportedValue,
+ ImportEngine_PartCannotActivate,
+ ImportEngine_PreventedByExistingImport,
+ ImportEngine_InvalidStateForRecomposition,
+ ReflectionModel_PartConstructorMissing,
+ ReflectionModel_PartConstructorThrewException,
+ ReflectionModel_PartOnImportsSatisfiedThrewException,
+ ReflectionModel_ExportNotReadable,
+ ReflectionModel_ExportThrewException,
+ ReflectionModel_ExportMethodTooManyParameters,
+ ReflectionModel_ImportNotWritable,
+ ReflectionModel_ImportThrewException,
+ ReflectionModel_ImportNotAssignableFromExport,
+ ReflectionModel_ImportCollectionNull,
+ ReflectionModel_ImportCollectionNotWritable,
+ ReflectionModel_ImportCollectionConstructionThrewException,
+ ReflectionModel_ImportCollectionGetThrewException,
+ ReflectionModel_ImportCollectionIsReadOnlyThrewException,
+ ReflectionModel_ImportCollectionClearThrewException,
+ ReflectionModel_ImportCollectionAddThrewException,
+ ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionException.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionException.cs
new file mode 100644
index 0000000..071db1f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionException.cs
@@ -0,0 +1,340 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+using System.Text;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition
+{
+
+ /// <summary>
+ /// The exception that is thrown when one or more errors occur during composition in
+ /// a <see cref="CompositionContainer"/>.
+ /// </summary>
+ [Serializable]
+ public class CompositionException : Exception
+ {
+ const string ErrorsKey = "Errors";
+ private ReadOnlyCollection<CompositionError> _errors;
+
+#if CLR40 && !SILVERLIGHT
+ [Serializable]
+ private struct CompositionExceptionData : ISafeSerializationData
+ {
+ public CompositionError[] _errors;
+
+ void ISafeSerializationData.CompleteDeserialization(object obj)
+ {
+ CompositionException exception = obj as CompositionException;
+
+ exception._errors = new ReadOnlyCollection<CompositionError>(this._errors);
+ }
+ }
+#endif
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionException"/> class.
+ /// </summary>
+ public CompositionException()
+ : this((string)null, (Exception)null, (IEnumerable<CompositionError>)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionException"/> class
+ /// with the specified error message.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ public CompositionException(string message)
+ : this(message, (Exception)null, (IEnumerable<CompositionError>)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionException"/> class
+ /// with the specified error message and exception that is the cause of the
+ /// exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="innerException">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
+ /// </param>
+ public CompositionException(string message, Exception innerException)
+ : this(message, innerException, (IEnumerable<CompositionError>)null)
+ {
+ }
+
+ internal CompositionException(CompositionError error)
+ : this(new CompositionError[] { error })
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionException"/> class
+ /// with the specified errors.
+ /// </summary>
+ /// <param name="errors">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="CompositionError"/> objects
+ /// representing the errors that are the cause of the
+ /// <see cref="CompositionException"/>; or <see langword="null"/> to set the
+ /// <see cref="Errors"/> property to an empty <see cref="IEnumerable{T}"/>.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="errors"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public CompositionException(IEnumerable<CompositionError> errors)
+ : this((string)null, (Exception)null, errors)
+ {
+ }
+
+ internal CompositionException(string message, Exception innerException, IEnumerable<CompositionError> errors)
+ : base(message, innerException)
+ {
+ Requires.NullOrNotNullElements(errors, "errors");
+#if CLR40 && !SILVERLIGHT
+ SerializeObjectState += delegate(object exception, SafeSerializationEventArgs eventArgs)
+ {
+ var data = new CompositionExceptionData();
+ if(this._errors != null)
+ {
+ data._errors = this._errors.Select(error => new CompositionError(
+ ((ICompositionError)error).Id,
+ error.Description,
+ error.Element.ToSerializableElement(),
+ error.Exception)).ToArray();
+ }
+ else
+ {
+ data._errors = new CompositionError[0];
+ }
+
+ eventArgs.AddSerializedState(data);
+ };
+#endif
+ _errors = new ReadOnlyCollection<CompositionError>(errors == null ? new CompositionError[0] : errors.ToArray<CompositionError>());
+ }
+
+ /// <summary>
+ /// Gets the errors that are the cause of the exception.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="CompositionError"/> objects
+ /// representing the errors that are the cause of the
+ /// <see cref="CompositionException"/>.
+ /// </value>
+ public ReadOnlyCollection<CompositionError> Errors
+ {
+ get { return _errors; }
+ }
+
+ /// <summary>
+ /// Gets a message that describes the exception.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="CompositionException"/>.
+ /// </value>
+ public override string Message
+ {
+ [System.Security.SecuritySafeCritical]
+ get
+ {
+ if (this.Errors.Count == 0)
+ { // If there are no errors, then we simply return base.Message,
+ // which will either use the default Exception message, or if
+ // one was specified; the user supplied message.
+
+ return base.Message;
+ }
+
+ return BuildDefaultMessage();
+ }
+ }
+
+ private string BuildDefaultMessage()
+ {
+ IEnumerable<IEnumerable<CompositionError>> paths = CalculatePaths(this);
+
+ StringBuilder writer = new StringBuilder();
+
+ WriteHeader(writer, this.Errors.Count, paths.Count());
+ WritePaths(writer, paths);
+
+ return writer.ToString();
+ }
+
+ private static void WriteHeader(StringBuilder writer, int errorsCount, int pathCount)
+ {
+ if (errorsCount > 1 && pathCount > 1)
+ {
+ // The composition produced multiple composition errors, with {0} root causes. The root causes are provided below.
+ writer.AppendFormat(
+ CultureInfo.CurrentCulture,
+ Strings.CompositionException_MultipleErrorsWithMultiplePaths,
+ pathCount);
+ }
+ else if (errorsCount == 1 && pathCount > 1)
+ {
+ // The composition produced a single composition error, with {0} root causes. The root causes are provided below.
+ writer.AppendFormat(
+ CultureInfo.CurrentCulture,
+ Strings.CompositionException_SingleErrorWithMultiplePaths,
+ pathCount);
+ }
+ else
+ {
+ Assumes.IsTrue(errorsCount == 1);
+ Assumes.IsTrue(pathCount == 1);
+
+ // The composition produced a single composition error. The root cause is provided below.
+ writer.AppendFormat(
+ CultureInfo.CurrentCulture,
+ Strings.CompositionException_SingleErrorWithSinglePath,
+ pathCount);
+ }
+
+ writer.Append(' ');
+ writer.AppendLine(Strings.CompositionException_ReviewErrorProperty);
+ }
+
+ private static void WritePaths(StringBuilder writer, IEnumerable<IEnumerable<CompositionError>> paths)
+ {
+ int ordinal = 0;
+ foreach (IEnumerable<CompositionError> path in paths)
+ {
+ ordinal++;
+ WritePath(writer, path, ordinal);
+ }
+ }
+
+ private static void WritePath(StringBuilder writer, IEnumerable<CompositionError> path, int ordinal)
+ {
+ writer.AppendLine();
+ writer.Append(ordinal.ToString(CultureInfo.CurrentCulture));
+ writer.Append(Strings.CompositionException_PathsCountSeparator);
+ writer.Append(' ');
+
+ WriteError(writer, path.First());
+
+ foreach (CompositionError error in path.Skip(1))
+ {
+ writer.AppendLine();
+ writer.Append(Strings.CompositionException_ErrorPrefix);
+ writer.Append(' ');
+ WriteError(writer, error);
+ }
+ }
+
+ private static void WriteError(StringBuilder writer, CompositionError error)
+ {
+ writer.AppendLine(error.Description);
+
+ if (error.Element != null)
+ {
+ WriteElementGraph(writer, error.Element);
+ }
+ }
+
+ private static void WriteElementGraph(StringBuilder writer, ICompositionElement element)
+ {
+ // Writes the composition element and its origins in the format:
+ // Element: Export --> Part --> PartDefinition --> Catalog
+
+ writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_ElementPrefix, element.DisplayName);
+
+ while ((element = element.Origin) != null)
+ {
+ writer.AppendFormat(CultureInfo.CurrentCulture, Strings.CompositionException_OriginFormat, Strings.CompositionException_OriginSeparator, element.DisplayName);
+ }
+
+ writer.AppendLine();
+ }
+
+ private static IEnumerable<IEnumerable<CompositionError>> CalculatePaths(CompositionException exception)
+ {
+ List<IEnumerable<CompositionError>> paths = new List<IEnumerable<CompositionError>>();
+
+ VisitContext context = new VisitContext();
+ context.Path = new Stack<CompositionError>();
+ context.LeafVisitor = path =>
+ {
+ // Take a snapshot of the path
+ paths.Add(path.Copy());
+ };
+
+ VisitCompositionException(exception, context);
+
+ return paths;
+ }
+
+ private static void VisitCompositionException(CompositionException exception, VisitContext context)
+ {
+ foreach (CompositionError error in exception.Errors)
+ {
+ VisitError(error, context);
+ }
+
+ if (exception.InnerException != null)
+ {
+ VisitException(exception.InnerException, context);
+ }
+ }
+
+ private static void VisitError(CompositionError error, VisitContext context)
+ {
+ context.Path.Push(error);
+
+ if (error.Exception == null)
+ { // This error is a root cause, so write
+ // out the stack from this point
+
+ context.LeafVisitor(context.Path);
+ }
+ else
+ {
+ VisitException(error.Exception, context);
+ }
+
+ context.Path.Pop();
+ }
+
+ private static void VisitException(Exception exception, VisitContext context)
+ {
+ CompositionException composition = exception as CompositionException;
+ if (composition != null)
+ {
+ VisitCompositionException(composition, context);
+ }
+ else
+ {
+ VisitError(new CompositionError(exception.Message, exception.InnerException), context);
+ }
+ }
+
+ private struct VisitContext
+ {
+ public Stack<CompositionError> Path;
+ public Action<Stack<CompositionError>> LeafVisitor;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResult.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResult.cs
new file mode 100644
index 0000000..f8c3c49
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResult.cs
@@ -0,0 +1,86 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using Microsoft.Internal.Collections;
+using System.ComponentModel.Composition.Hosting;
+
+namespace System.ComponentModel.Composition
+{
+ internal struct CompositionResult
+ {
+ public static readonly CompositionResult SucceededResult = new CompositionResult();
+ private readonly IEnumerable<CompositionError> _errors;
+
+ public CompositionResult(params CompositionError[] errors)
+ : this((IEnumerable<CompositionError>)errors)
+ {
+ }
+
+ public CompositionResult(IEnumerable<CompositionError> errors)
+ {
+ this._errors = errors;
+ }
+
+ public bool Succeeded
+ {
+ get { return this._errors == null || !this._errors.FastAny(); }
+ }
+
+ public IEnumerable<CompositionError> Errors
+ {
+ get { return this._errors ?? Enumerable.Empty<CompositionError>(); }
+ }
+
+ public CompositionResult MergeResult(CompositionResult result)
+ {
+ if (this.Succeeded)
+ {
+ return result;
+ }
+ if (result.Succeeded)
+ {
+ return this;
+ }
+ return MergeErrors(result._errors);
+ }
+
+ public CompositionResult MergeError(CompositionError error)
+ {
+ return MergeErrors(new CompositionError[] { error });
+ }
+
+ public CompositionResult MergeErrors(IEnumerable<CompositionError> errors)
+ {
+ return new CompositionResult(this._errors.ConcatAllowingNull(errors));
+ }
+
+ public CompositionResult<T> ToResult<T>(T value)
+ {
+ return new CompositionResult<T>(value, this._errors);
+ }
+
+ public void ThrowOnErrors()
+ {
+ ThrowOnErrors(null);
+ }
+
+ public void ThrowOnErrors(AtomicComposition atomicComposition)
+ {
+ if (!this.Succeeded)
+ {
+ if (atomicComposition == null)
+ {
+ throw new CompositionException(this._errors);
+ }
+ else
+ {
+ throw new ChangeRejectedException(this._errors);
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResultOfT.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResultOfT.cs
new file mode 100644
index 0000000..65ee76d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CompositionResultOfT.cs
@@ -0,0 +1,79 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition
+{
+ internal struct CompositionResult<T>
+ {
+ private readonly IEnumerable<CompositionError> _errors;
+ private readonly T _value;
+
+ public CompositionResult(T value)
+ : this(value, (CompositionError[])null)
+ {
+ }
+
+ public CompositionResult(params CompositionError[] errors)
+ : this(default(T), (IEnumerable<CompositionError>)errors)
+ {
+ }
+
+ public CompositionResult(IEnumerable<CompositionError> errors)
+ : this(default(T), errors)
+ {
+ }
+
+ internal CompositionResult(T value, IEnumerable<CompositionError> errors)
+ {
+ this._errors = errors;
+ this._value = value;
+ }
+
+ public bool Succeeded
+ {
+ get { return this._errors == null || !this._errors.FastAny(); }
+ }
+
+ public IEnumerable<CompositionError> Errors
+ {
+ get { return this._errors ?? Enumerable.Empty<CompositionError>(); }
+ }
+
+ /// <summary>
+ /// Gets the value from the result, throwing a CompositionException if there are any errors.
+ /// </summary>
+ public T Value
+ {
+ get
+ {
+ ThrowOnErrors();
+
+ return this._value;
+ }
+ }
+
+ internal CompositionResult<TValue> ToResult<TValue>()
+ {
+ return new CompositionResult<TValue>(this._errors);
+ }
+
+ internal CompositionResult ToResult()
+ {
+ return new CompositionResult(this._errors);
+ }
+
+ private void ThrowOnErrors()
+ {
+ if (!this.Succeeded)
+ {
+ throw new CompositionException(this._errors);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ConstraintServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ConstraintServices.cs
new file mode 100644
index 0000000..0fd6e66
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ConstraintServices.cs
@@ -0,0 +1,214 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class ConstraintServices
+ {
+ // NOTE : these are here as Reflection member search is pretty expensive, and we want that to be done once.
+ // Also, making these static would cause this class to fail loading if we rename members of ExportDefinition.
+ private static readonly PropertyInfo _exportDefinitionContractNameProperty = typeof(ExportDefinition).GetProperty("ContractName");
+ private static readonly PropertyInfo _exportDefinitionMetadataProperty = typeof(ExportDefinition).GetProperty("Metadata");
+ private static readonly MethodInfo _metadataContainsKeyMethod = typeof(IDictionary<string, object>).GetMethod("ContainsKey");
+ private static readonly MethodInfo _metadataItemMethod = typeof(IDictionary<string, object>).GetMethod("get_Item");
+ private static readonly MethodInfo _metadataEqualsMethod = typeof(object).GetMethod("Equals", new Type[] { typeof(object) });
+ private static readonly MethodInfo _typeIsInstanceOfTypeMethod = typeof(Type).GetMethod("IsInstanceOfType");
+
+ public static Expression<Func<ExportDefinition, bool>> CreateConstraint(IEnumerable<KeyValuePair<string, Type>> requiredMetadata)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(ExportDefinition), "exportDefinition");
+ Expression metadataConstraintBody = null;
+
+ if (requiredMetadata != null)
+ {
+ metadataConstraintBody = ConstraintServices.CreateMetadataConstraintBody(requiredMetadata, parameter);
+ }
+
+ if (metadataConstraintBody != null)
+ {
+ return Expression.Lambda<Func<ExportDefinition, bool>>(metadataConstraintBody, parameter);
+ }
+
+ return null;
+ }
+
+ public static Expression<Func<ExportDefinition, bool>> CreateConstraint(string contractName, string requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, CreationPolicy requiredCreationPolicy)
+ {
+ ParameterExpression parameter = Expression.Parameter(typeof(ExportDefinition), "exportDefinition");
+
+ Expression constraintBody = ConstraintServices.CreateContractConstraintBody(contractName, parameter);
+
+ if (!string.IsNullOrEmpty(requiredTypeIdentity))
+ {
+ Expression typeIdentityConstraintBody = ConstraintServices.CreateTypeIdentityContraint(requiredTypeIdentity, parameter);
+
+ constraintBody = Expression.AndAlso(constraintBody, typeIdentityConstraintBody);
+ }
+
+ if (requiredMetadata != null)
+ {
+ Expression metadataConstraintBody = ConstraintServices.CreateMetadataConstraintBody(requiredMetadata, parameter);
+ if (metadataConstraintBody != null)
+ {
+ constraintBody = Expression.AndAlso(constraintBody, metadataConstraintBody);
+ }
+ }
+
+ if (requiredCreationPolicy != CreationPolicy.Any)
+ {
+ Expression policyConstraintBody = ConstraintServices.CreateCreationPolicyContraint(requiredCreationPolicy, parameter);
+
+ constraintBody = Expression.AndAlso(constraintBody, policyConstraintBody);
+ }
+
+ Expression<Func<ExportDefinition, bool>> constraint = Expression.Lambda<Func<ExportDefinition, bool>>(constraintBody, parameter);
+ return constraint;
+ }
+
+ private static Expression CreateContractConstraintBody(string contractName, ParameterExpression parameter)
+ {
+ Assumes.NotNull(parameter);
+
+ // export.ContractName=<contract>;
+ return Expression.Equal(
+ Expression.Property(parameter, ConstraintServices._exportDefinitionContractNameProperty),
+ Expression.Constant(contractName ?? string.Empty, typeof(string)));
+ }
+
+ private static Expression CreateMetadataConstraintBody(IEnumerable<KeyValuePair<string, Type>> requiredMetadata, ParameterExpression parameter)
+ {
+ Assumes.NotNull(requiredMetadata);
+ Assumes.NotNull(parameter);
+
+ Expression body = null;
+ foreach (KeyValuePair<string, Type> requiredMetadataItem in requiredMetadata)
+ {
+ // export.Metadata.ContainsKey(<metadataItem>)
+ Expression metadataItemExpression = CreateMetadataContainsKeyExpression(parameter, requiredMetadataItem.Key);
+
+ body = (body != null) ? Expression.AndAlso(body, metadataItemExpression) : metadataItemExpression;
+ body = Expression.AndAlso(body, CreateMetadataOfTypeExpression(parameter, requiredMetadataItem.Key, requiredMetadataItem.Value));
+ }
+
+ return body;
+ }
+
+ private static Expression CreateCreationPolicyContraint(CreationPolicy policy, ParameterExpression parameter)
+ {
+ Assumes.IsTrue(policy != CreationPolicy.Any);
+ Assumes.NotNull(parameter);
+
+ // !definition.Metadata.ContainsKey(CompositionConstants.PartCreationPolicyMetadataName) ||
+ // CreationPolicy.Any.Equals(definition.Metadata[CompositionConstants.PartCreationPolicyMetadataName]) ||
+ // policy.Equals(definition.Metadata[CompositionConstants.PartCreationPolicyMetadataName]);
+
+ return Expression.MakeBinary(ExpressionType.OrElse,
+ Expression.MakeBinary(ExpressionType.OrElse,
+ Expression.Not(CreateMetadataContainsKeyExpression(parameter, CompositionConstants.PartCreationPolicyMetadataName)),
+ CreateMetadataValueEqualsExpression(parameter, CreationPolicy.Any, CompositionConstants.PartCreationPolicyMetadataName)),
+ CreateMetadataValueEqualsExpression(parameter, policy, CompositionConstants.PartCreationPolicyMetadataName));
+ }
+
+ private static Expression CreateTypeIdentityContraint(string requiredTypeIdentity, ParameterExpression parameter)
+ {
+ Assumes.NotNull(requiredTypeIdentity);
+ Assumes.NotNull(parameter);
+
+ // definition.Metadata.ContainsKey(CompositionServices.ExportTypeIdentity) &&
+ // requiredTypeIdentity.Equals(definition.Metadata[CompositionConstants.ExportTypeIdentityMetadataName]);
+
+ return Expression.MakeBinary(ExpressionType.AndAlso,
+ CreateMetadataContainsKeyExpression(parameter, CompositionConstants.ExportTypeIdentityMetadataName),
+ CreateMetadataValueEqualsExpression(parameter, requiredTypeIdentity, CompositionConstants.ExportTypeIdentityMetadataName));
+ }
+
+ private static Expression CreateMetadataContainsKeyExpression(ParameterExpression parameter, string constantKey)
+ {
+ Assumes.NotNull(parameter, constantKey);
+
+ // definition.Metadata.ContainsKey(constantKey)
+ return Expression.Call(
+ Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
+ ConstraintServices._metadataContainsKeyMethod,
+ Expression.Constant(constantKey));
+ }
+
+ private static Expression CreateMetadataOfTypeExpression(ParameterExpression parameter, string constantKey, Type constantType)
+ {
+ Assumes.NotNull(parameter, constantKey);
+ Assumes.NotNull(parameter, constantType);
+
+ // constantType.IsInstanceOfType(definition.Metadata[constantKey])
+ return Expression.Call(
+ Expression.Constant(constantType, typeof(Type)),
+ ConstraintServices._typeIsInstanceOfTypeMethod,
+ Expression.Call(
+ Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
+ ConstraintServices._metadataItemMethod,
+ Expression.Constant(constantKey))
+ );
+ }
+
+ private static Expression CreateMetadataValueEqualsExpression(ParameterExpression parameter, object constantValue, string metadataName)
+ {
+ Assumes.NotNull(parameter, constantValue);
+
+ // constantValue.Equals(definition.Metadata[CompositionServices.PartCreationPolicyMetadataName])
+ return Expression.Call(
+ Expression.Constant(constantValue),
+ ConstraintServices._metadataEqualsMethod,
+ Expression.Call(
+ Expression.Property(parameter, ConstraintServices._exportDefinitionMetadataProperty),
+ ConstraintServices._metadataItemMethod,
+ Expression.Constant(metadataName)));
+ }
+
+ public static Expression<Func<ExportDefinition, bool>> CreatePartCreatorConstraint(Expression<Func<ExportDefinition, bool>> baseConstraint, ImportDefinition productImportDefinition)
+ {
+ ParameterExpression exportDefinitionParameter = baseConstraint.Parameters[0];
+
+ // exportDefinition.Metadata
+ Expression metadataExpression = Expression.Property(exportDefinitionParameter, ConstraintServices._exportDefinitionMetadataProperty);
+
+ // exportDefinition.Metadata.ContainsKey("ProductDefinition")
+ Expression containsProductExpression = Expression.Call(
+ metadataExpression,
+ ConstraintServices._metadataContainsKeyMethod,
+ Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
+
+ // exportDefinition.Metadata["ProductDefinition"]
+ Expression productExportDefinitionExpression = Expression.Call(
+ metadataExpression,
+ ConstraintServices._metadataItemMethod,
+ Expression.Constant(CompositionConstants.ProductDefinitionMetadataName));
+
+ // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
+ Expression productMatchExpression =
+ Expression.Invoke(productImportDefinition.Constraint,
+ Expression.Convert(productExportDefinitionExpression, typeof(ExportDefinition)));
+
+ // baseContraint(exportDefinition) &&
+ // exportDefinition.Metadata.ContainsKey("ProductDefinition") &&
+ // ProductImportDefinition.Contraint((ExportDefinition)exportDefinition.Metadata["ProductDefinition"])
+ Expression<Func<ExportDefinition, bool>> constraint =
+ Expression.Lambda<Func<ExportDefinition, bool>>(
+ Expression.AndAlso(
+ baseConstraint.Body,
+ Expression.AndAlso(
+ containsProductExpression,
+ productMatchExpression)),
+ exportDefinitionParameter);
+
+ return constraint;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ContractNameServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ContractNameServices.cs
new file mode 100644
index 0000000..603f6c9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ContractNameServices.cs
@@ -0,0 +1,310 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Reflection;
+using System.Text;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class ContractNameServices
+ {
+ const char NamespaceSeparator = '.';
+ const char ArrayOpeningBracket = '[';
+ const char ArrayClosingBracket = ']';
+ const char ArraySeparator = ',';
+ const char PointerSymbol = '*';
+ const char ReferenceSymbol = '&';
+ const char GenericArityBackQuote = '`';
+ const char NestedClassSeparator = '+';
+ const char ContractNameGenericOpeningBracket = '(';
+ const char ContractNameGenericClosingBracket = ')';
+ const char ContractNameGenericArgumentSeparator = ',';
+ const char CustomModifiersSeparator = ' ';
+
+ [ThreadStatic]
+ private static Dictionary<Type, string> typeIdentityCache;
+
+ private static Dictionary<Type, string> TypeIdentityCache
+ {
+ get
+ {
+ return typeIdentityCache = typeIdentityCache ?? new Dictionary<Type, string>();
+ }
+ }
+
+ internal static string GetTypeIdentity(Type type)
+ {
+ Assumes.NotNull(type);
+ string typeIdentity = null;
+
+ if (!TypeIdentityCache.TryGetValue(type, out typeIdentity))
+ {
+ if (!type.IsAbstract && type.IsSubclassOf(typeof(Delegate)))
+ {
+ MethodInfo method = type.GetMethod("Invoke");
+ typeIdentity = ContractNameServices.GetTypeIdentityFromMethod(method);
+ }
+ else
+ {
+ StringBuilder typeIdentityStringBuilder = new StringBuilder();
+ WriteTypeWithNamespace(typeIdentityStringBuilder, type);
+ typeIdentity = typeIdentityStringBuilder.ToString();
+ }
+
+ TypeIdentityCache.Add(type, typeIdentity);
+ }
+
+ return typeIdentity;
+ }
+
+ internal static string GetTypeIdentityFromMethod(MethodInfo method)
+ {
+ StringBuilder methodNameStringBuilder = new StringBuilder();
+
+ WriteTypeWithNamespace(methodNameStringBuilder, method.ReturnType);
+
+ methodNameStringBuilder.Append("(");
+
+ ParameterInfo[] parameters = method.GetParameters();
+
+ for (int i = 0; i < parameters.Length; i++)
+ {
+ if (i != 0)
+ {
+ methodNameStringBuilder.Append(",");
+ }
+
+ WriteTypeWithNamespace(methodNameStringBuilder, parameters[i].ParameterType);
+ }
+ methodNameStringBuilder.Append(")");
+
+ return methodNameStringBuilder.ToString();
+ }
+
+ private static void WriteTypeWithNamespace(StringBuilder typeName, Type type)
+ {
+ // Writes type with namesapce
+ if (!string.IsNullOrEmpty(type.Namespace))
+ {
+ typeName.Append(type.Namespace);
+ typeName.Append(NamespaceSeparator);
+ }
+ WriteType(typeName, type);
+ }
+
+ private static void WriteType(StringBuilder typeName, Type type)
+ {
+ // Writes type name
+ if (type.IsGenericType)
+ {
+ //
+ // Reflection format stores all the generic arguments (including the ones for parent types) on the leaf type.
+ // These arguments are placed in a queue and are written out based on generic arity (`X) of each type
+ //
+ Queue<Type> genericTypeArguments = new Queue<Type>(type.GetGenericArguments());
+ WriteGenericType(typeName, type, type.IsGenericTypeDefinition, genericTypeArguments);
+ Assumes.IsTrue(genericTypeArguments.Count == 0, "Expecting genericTypeArguments queue to be empty.");
+ }
+ else
+ {
+ WriteNonGenericType(typeName, type);
+ }
+ }
+
+ private static void WriteNonGenericType(StringBuilder typeName, Type type)
+ {
+ //
+ // Writes non-generic type
+ //
+ if (type.DeclaringType != null)
+ {
+ WriteType(typeName, type.DeclaringType);
+ typeName.Append(NestedClassSeparator);
+ }
+ if (type.IsArray)
+ {
+ WriteArrayType(typeName, type);
+ }
+ else if (type.IsPointer)
+ {
+ WritePointerType(typeName, type);
+ }
+ else if (type.IsByRef)
+ {
+ WriteByRefType(typeName, type);
+ }
+ else
+ {
+ typeName.Append(type.Name);
+ }
+ }
+
+ private static void WriteArrayType(StringBuilder typeName, Type type)
+ {
+ //
+ // Writes array type e.g <TypeName>[]
+ // Note that jagged arrays are stored in reverse order
+ // e.g. C#: Int32[][,] Reflection: Int32[,][]
+ // we are following C# order for arrays
+ //
+ Type rootElementType = FindArrayElementType(type);
+ WriteType(typeName, rootElementType);
+ Type elementType = type;
+ do
+ {
+ WriteArrayTypeDimensions(typeName, elementType);
+ }
+ while ((elementType = elementType.GetElementType()) != null && elementType.IsArray);
+ }
+
+ private static void WritePointerType(StringBuilder typeName, Type type)
+ {
+ //
+ // Writes pointer type e.g <TypeName>*
+ //
+ WriteType(typeName, type.GetElementType());
+ typeName.Append(PointerSymbol);
+ }
+
+ private static void WriteByRefType(StringBuilder typeName, Type type)
+ {
+ //
+ // Writes by ref type e.g <TypeName>&
+ //
+ WriteType(typeName, type.GetElementType());
+ typeName.Append(ReferenceSymbol);
+ }
+
+ private static void WriteArrayTypeDimensions(StringBuilder typeName, Type type)
+ {
+ //
+ // Writes array type dimensions e.g. [,,]
+ //
+ typeName.Append(ArrayOpeningBracket);
+ int rank = type.GetArrayRank();
+ for (int i = 1; i < rank; i++)
+ {
+ typeName.Append(ArraySeparator);
+ }
+ typeName.Append(ArrayClosingBracket);
+ }
+
+ private static void WriteGenericType(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments)
+ {
+ //
+ // Writes generic type including parent generic types
+ // genericTypeArguments contains type arguments obtained from the most nested type
+ // isDefinition parameter indicates if we are dealing with generic type definition
+ //
+ if (type.DeclaringType != null)
+ {
+ if (type.DeclaringType.IsGenericType)
+ {
+ WriteGenericType(typeName, type.DeclaringType, isDefinition, genericTypeArguments);
+ }
+ else
+ {
+ WriteNonGenericType(typeName, type.DeclaringType);
+ }
+ typeName.Append(NestedClassSeparator);
+ }
+ WriteGenericTypeName(typeName, type, isDefinition, genericTypeArguments);
+ }
+
+ private static void WriteGenericTypeName(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments)
+ {
+ //
+ // Writes generic type name, e.g. generic name and generic arguments
+ //
+ Assumes.IsTrue(type.IsGenericType, "Expecting type to be a generic type");
+ int genericArity = GetGenericArity(type);
+ string genericTypeName = FindGenericTypeName(type.GetGenericTypeDefinition().Name);
+ typeName.Append(genericTypeName);
+ WriteTypeArgumentsString(typeName, genericArity, isDefinition, genericTypeArguments);
+ }
+
+ private static void WriteTypeArgumentsString(StringBuilder typeName, int argumentsCount, bool isDefinition, Queue<Type> genericTypeArguments)
+ {
+ //
+ // Writes type arguments in brackets, e.g. (<contract_name1>, <contract_name2>, ...)
+ //
+ if (argumentsCount == 0)
+ {
+ return;
+ }
+ typeName.Append(ContractNameGenericOpeningBracket);
+ for (int i = 0; i < argumentsCount; i++)
+ {
+ Assumes.IsTrue(genericTypeArguments.Count > 0, "Expecting genericTypeArguments to contain at least one Type");
+ Type genericTypeArgument = genericTypeArguments.Dequeue();
+ if (!isDefinition)
+ {
+ WriteTypeWithNamespace(typeName, genericTypeArgument);
+ }
+ typeName.Append(ContractNameGenericArgumentSeparator);
+ }
+ typeName.Remove(typeName.Length - 1, 1);
+ typeName.Append(ContractNameGenericClosingBracket);
+ }
+
+ //internal for testability
+ internal static void WriteCustomModifiers(StringBuilder typeName, string customKeyword, Type[] types)
+ {
+ //
+ // Writes custom modifiers in the format: customKeyword(<contract_name>,<contract_name>,...)
+ //
+ typeName.Append(CustomModifiersSeparator);
+ typeName.Append(customKeyword);
+ Queue<Type> typeArguments = new Queue<Type>(types);
+ WriteTypeArgumentsString(typeName, types.Length, false, typeArguments);
+ Assumes.IsTrue(typeArguments.Count == 0, "Expecting genericTypeArguments queue to be empty.");
+ }
+
+ private static Type FindArrayElementType(Type type)
+ {
+ //
+ // Gets array element type by calling GetElementType() until the element is not an array
+ //
+ Type elementType = type;
+ while ((elementType = elementType.GetElementType()) != null && elementType.IsArray) { }
+ return elementType;
+ }
+
+ private static string FindGenericTypeName(string genericName)
+ {
+ //
+ // Gets generic type name omitting the backquote and arity indicator
+ // List`1 -> List
+ // Arity indicator is returned as output parameter
+ //
+ int indexOfBackQuote = genericName.IndexOf(GenericArityBackQuote);
+ if (indexOfBackQuote > -1)
+ {
+ genericName = genericName.Substring(0, indexOfBackQuote);
+ }
+ return genericName;
+ }
+
+ private static int GetGenericArity(Type type)
+ {
+ if (type.DeclaringType == null)
+ {
+ return type.GetGenericArguments().Length;
+ }
+
+ // The generic arity is equal to the difference in the number of generic arguments
+ // from the type and the declaring type.
+
+ int delclaringTypeGenericArguments = type.DeclaringType.GetGenericArguments().Length;
+ int typeGenericArguments = type.GetGenericArguments().Length;
+
+ Assumes.IsTrue(typeGenericArguments >= delclaringTypeGenericArguments);
+
+ return typeGenericArguments - delclaringTypeGenericArguments;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/CreationPolicy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/CreationPolicy.cs
new file mode 100644
index 0000000..38277c4
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/CreationPolicy.cs
@@ -0,0 +1,36 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Option placed on a type that controls when the <see cref="CompositionContainer"/> creates
+ /// a new instance of a <see cref="ComposablePart"/>.
+ /// </summary>
+ public enum CreationPolicy : int
+ {
+ /// <summary>
+ /// Let the <see cref="CompositionContainer"/> choose the most appropriate <see cref="CreationPolicy"/>
+ /// for the part given the current context. This is the default <see cref="CreationPolicy"/>, with
+ /// the <see cref="CompositionContainer"/> choosing <see cref="CreationPolicy.Shared"/> by default
+ /// unless the <see cref="ComposablePart"/> or importer requests <see cref="CreationPolicy.NonShared"/>.
+ /// </summary>
+ Any = 0,
+
+ /// <summary>
+ /// A single shared instance of the associated <see cref="ComposablePart"/> will be created
+ /// by the <see cref="CompositionContainer"/> and shared by all requestors.
+ /// </summary>
+ Shared = 1,
+
+ /// <summary>
+ /// A new non-shared instance of the associated <see cref="ComposablePart"/> will be created
+ /// by the <see cref="CompositionContainer"/> for every requestor.
+ /// </summary>
+ NonShared = 2,
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs
new file mode 100644
index 0000000..b6bdec7
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTrace.cs
@@ -0,0 +1,106 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ internal static class CompositionTrace
+ {
+ internal static void PartDefinitionResurrected(ComposablePartDefinition definition)
+ {
+ Assumes.NotNull(definition);
+
+ if (CompositionTraceSource.CanWriteInformation)
+ {
+ CompositionTraceSource.WriteInformation(CompositionTraceId.Rejection_DefinitionResurrected,
+ Strings.CompositionTrace_Rejection_DefinitionResurrected,
+ definition.GetDisplayName());
+ }
+ }
+
+ internal static void PartDefinitionRejected(ComposablePartDefinition definition, ChangeRejectedException exception)
+ {
+ Assumes.NotNull(definition, exception);
+
+ if (CompositionTraceSource.CanWriteWarning)
+ {
+ CompositionTraceSource.WriteWarning(CompositionTraceId.Rejection_DefinitionRejected,
+ Strings.CompositionTrace_Rejection_DefinitionRejected,
+ definition.GetDisplayName(),
+ exception.Message);
+ }
+ }
+
+#if !SILVERLIGHT
+
+ internal static void AssemblyLoadFailed(DirectoryCatalog catalog, string fileName, Exception exception)
+ {
+ Assumes.NotNull(catalog, exception);
+ Assumes.NotNullOrEmpty(fileName);
+
+ if (CompositionTraceSource.CanWriteWarning)
+ {
+ CompositionTraceSource.WriteWarning(CompositionTraceId.Discovery_AssemblyLoadFailed,
+ Strings.CompositionTrace_Discovery_AssemblyLoadFailed,
+ catalog.GetDisplayName(),
+ fileName,
+ exception.Message);
+ }
+ }
+
+#endif
+
+ internal static void DefinitionMarkedWithPartNotDiscoverableAttribute(Type type)
+ {
+ Assumes.NotNull(type);
+
+ if (CompositionTraceSource.CanWriteInformation)
+ {
+ CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute,
+ Strings.CompositionTrace_Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute,
+ type.GetDisplayName());
+ }
+ }
+
+ internal static void DefinitionContainsGenericsParameters(Type type)
+ {
+ Assumes.NotNull(type);
+
+ if (CompositionTraceSource.CanWriteInformation)
+ {
+ CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionContainsGenericParameters,
+ Strings.CompositionTrace_Discovery_DefinitionContainsGenericParameters,
+ type.GetDisplayName());
+ }
+ }
+
+ internal static void DefinitionContainsNoExports(Type type)
+ {
+ Assumes.NotNull(type);
+
+ if (CompositionTraceSource.CanWriteInformation)
+ {
+ CompositionTraceSource.WriteInformation(CompositionTraceId.Discovery_DefinitionContainsNoExports,
+ Strings.CompositionTrace_Discovery_DefinitionContainsNoExports,
+ type.GetDisplayName());
+ }
+ }
+
+ internal static void MemberMarkedWithMultipleImportAndImportMany(ReflectionItem item)
+ {
+ Assumes.NotNull(item);
+
+ if (CompositionTraceSource.CanWriteError)
+ {
+ CompositionTraceSource.WriteError(CompositionTraceId.Discovery_MemberMarkedWithMultipleImportAndImportMany,
+ Strings.CompositionTrace_Discovery_MemberMarkedWithMultipleImportAndImportMany,
+ item.GetDisplayName());
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs
new file mode 100644
index 0000000..53e9f85
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceId.cs
@@ -0,0 +1,24 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ // NOTE: Do not change the trace ids of values that have already shipped,
+ // these leak out to TraceListerners which could take a dependency on them.
+ // This enum is a ushort deliberately, the maximum value of a trace id is 65535.
+ internal enum CompositionTraceId : ushort
+ {
+ // Rejection
+
+ Rejection_DefinitionRejected = 1,
+ Rejection_DefinitionResurrected = 2,
+
+ Discovery_AssemblyLoadFailed = 3,
+ Discovery_DefinitionMarkedWithPartNotDiscoverableAttribute = 4,
+ Discovery_DefinitionContainsGenericParameters = 5,
+ Discovery_DefinitionContainsNoExports = 6,
+ Discovery_MemberMarkedWithMultipleImportAndImportMany = 7,
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs
new file mode 100644
index 0000000..d728709
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/CompositionTraceSource.cs
@@ -0,0 +1,58 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ internal static class CompositionTraceSource
+ {
+#if SILVERLIGHT
+ private static readonly SilverlightTraceWriter Source = new SilverlightTraceWriter();
+#else
+ private static readonly TraceSourceTraceWriter Source = new TraceSourceTraceWriter();
+#endif
+
+ public static bool CanWriteInformation
+ {
+ get { return Source.CanWriteInformation; }
+ }
+
+ public static bool CanWriteWarning
+ {
+ get { return Source.CanWriteWarning; }
+ }
+
+ public static bool CanWriteError
+ {
+ get { return Source.CanWriteError; }
+ }
+
+ public static void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ EnsureEnabled(CanWriteInformation);
+
+ Source.WriteInformation(traceId, format, arguments);
+ }
+
+ public static void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ EnsureEnabled(CanWriteWarning);
+
+ Source.WriteWarning(traceId, format, arguments);
+ }
+
+ public static void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ EnsureEnabled(CanWriteError);
+
+ Source.WriteError(traceId, format, arguments);
+ }
+
+ private static void EnsureEnabled(bool condition)
+ {
+ Assumes.IsTrue(condition, "To avoid unnecessary work when a trace level has not been enabled, check CanWriteXXX before calling this method.");
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs
new file mode 100644
index 0000000..68828d9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/SilverlightTraceWriter.cs
@@ -0,0 +1,90 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if SILVERLIGHT
+
+using System;
+using System.Diagnostics;
+using System.Globalization;
+using System.Text;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ internal sealed class SilverlightTraceWriter : TraceWriter
+ {
+ private static readonly string SourceName = "System.ComponentModel.Composition";
+
+ public override bool CanWriteInformation
+ {
+ get { return false; }
+ }
+
+ public override bool CanWriteWarning
+ {
+ get { return Debugger.IsLogging(); }
+ }
+
+ public override bool CanWriteError
+ {
+ get { return Debugger.IsLogging(); }
+ }
+
+ public override void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Information, traceId, format, arguments);
+ }
+
+ public override void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Warning, traceId, format, arguments);
+ }
+
+ public override void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Error, traceId, format, arguments);
+ }
+
+ private static void WriteEvent(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ if (!Debugger.IsLogging())
+ {
+ return;
+ }
+
+ string logMessage = CreateLogMessage(eventType, traceId, format, arguments);
+ Debugger.Log(0, null, logMessage);
+ }
+
+ internal static string CreateLogMessage(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ StringBuilder messageBuilder = new StringBuilder();
+
+ // Format taken from TraceListener.TraceEvent in full framework
+ messageBuilder.AppendFormat(CultureInfo.InvariantCulture, "{0} {1}: {2} : ",
+ SourceName, eventType.ToString(), (int)traceId);
+
+ if (arguments == null)
+ {
+ messageBuilder.Append(format);
+ }
+ else
+ {
+ messageBuilder.AppendFormat(CultureInfo.InvariantCulture, format, arguments);
+ }
+
+ messageBuilder.AppendLine();
+
+ return messageBuilder.ToString();
+ }
+
+ // Copied from TraceEventType in full framework
+ internal enum TraceEventType
+ {
+ Error = 2,
+ Warning = 4,
+ Information = 8,
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs
new file mode 100644
index 0000000..1282002
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceSourceTraceWriter.cs
@@ -0,0 +1,54 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !SILVERLIGHT
+
+using System;
+using System.Diagnostics;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ // Represents a trace writer that writes to a System.Diagnostics TraceSource
+ internal sealed class TraceSourceTraceWriter : TraceWriter
+ {
+ internal static readonly TraceSource Source = new TraceSource("System.ComponentModel.Composition", SourceLevels.Warning);
+
+ public override bool CanWriteInformation
+ {
+ get { return Source.Switch.ShouldTrace(TraceEventType.Information); }
+ }
+
+ public override bool CanWriteWarning
+ {
+ get { return Source.Switch.ShouldTrace(TraceEventType.Warning); }
+ }
+
+ public override bool CanWriteError
+ {
+ get { return Source.Switch.ShouldTrace(TraceEventType.Error); }
+ }
+
+ public override void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Information, traceId, format, arguments);
+ }
+
+ public override void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Warning, traceId, format, arguments);
+ }
+
+ public override void WriteError(CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ WriteEvent(TraceEventType.Error, traceId, format, arguments);
+ }
+
+ private static void WriteEvent(TraceEventType eventType, CompositionTraceId traceId, string format, params object[] arguments)
+ {
+ Source.TraceEvent(eventType, (int)traceId, format, arguments);
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs
new file mode 100644
index 0000000..4be992a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Diagnostics/TraceWriter.cs
@@ -0,0 +1,33 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+
+using System;
+
+namespace System.ComponentModel.Composition.Diagnostics
+{
+ internal abstract class TraceWriter
+ {
+ public abstract bool CanWriteInformation
+ {
+ get;
+ }
+
+ public abstract bool CanWriteWarning
+ {
+ get;
+ }
+
+ public abstract bool CanWriteError
+ {
+ get;
+ }
+
+ public abstract void WriteInformation(CompositionTraceId traceId, string format, params object[] arguments);
+
+ public abstract void WriteWarning(CompositionTraceId traceId, string format, params object[] arguments);
+
+ public abstract void WriteError(CompositionTraceId traceId, string format, params object[] arguments);
+ }
+}
+
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ErrorBuilder.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ErrorBuilder.cs
new file mode 100644
index 0000000..83eb9d6
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ErrorBuilder.cs
@@ -0,0 +1,102 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class ErrorBuilder
+ {
+ public static CompositionError PreventedByExistingImport(ComposablePart part, ImportDefinition import)
+ {
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_PreventedByExistingImport,
+ Strings.ImportEngine_PreventedByExistingImport,
+ import.ToElement().DisplayName,
+ part.ToElement().DisplayName);
+ }
+
+ public static CompositionError InvalidStateForRecompposition(ComposablePart part)
+ {
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_InvalidStateForRecomposition,
+ Strings.ImportEngine_InvalidStateForRecomposition,
+ part.ToElement().DisplayName);
+ }
+
+ public static CompositionError ComposeTookTooManyIterations(int maximumNumberOfCompositionIterations)
+ {
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_ComposeTookTooManyIterations,
+ Strings.ImportEngine_ComposeTookTooManyIterations,
+ maximumNumberOfCompositionIterations);
+ }
+
+ public static CompositionError CreateImportCardinalityMismatch(ImportCardinalityMismatchException exception, ImportDefinition definition)
+ {
+ Assumes.NotNull(exception, definition);
+
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_ImportCardinalityMismatch,
+ exception.Message,
+ definition.ToElement(),
+ (Exception)null);
+ }
+
+ public static CompositionError CreatePartCannotActivate(ComposablePart part, Exception innerException)
+ {
+ Assumes.NotNull(part, innerException);
+
+ ICompositionElement element = part.ToElement();
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_PartCannotActivate,
+ element,
+ innerException,
+ Strings.ImportEngine_PartCannotActivate,
+ element.DisplayName);
+ }
+
+ public static CompositionError CreatePartCannotSetImport(ComposablePart part, ImportDefinition definition, Exception innerException)
+ {
+ Assumes.NotNull(part, definition, innerException);
+
+ ICompositionElement element = definition.ToElement();
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_PartCannotSetImport,
+ element,
+ innerException,
+ Strings.ImportEngine_PartCannotSetImport,
+ element.DisplayName,
+ part.ToElement().DisplayName);
+ }
+
+ public static CompositionError CreateCannotGetExportedValue(ComposablePart part, ExportDefinition definition, Exception innerException)
+ {
+ Assumes.NotNull(part, definition, innerException);
+
+ ICompositionElement element = definition.ToElement();
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_PartCannotGetExportedValue,
+ element,
+ innerException,
+ Strings.ImportEngine_PartCannotGetExportedValue,
+ element.DisplayName,
+ part.ToElement().DisplayName);
+ }
+
+ public static CompositionError CreatePartCycle(ComposablePart part)
+ {
+ Assumes.NotNull(part);
+
+ ICompositionElement element = part.ToElement();
+ return CompositionError.Create(
+ CompositionErrorId.ImportEngine_PartCycle,
+ element,
+ Strings.ImportEngine_PartCycle,
+ element.DisplayName);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExceptionBuilder.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExceptionBuilder.cs
new file mode 100644
index 0000000..c790e6c
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExceptionBuilder.cs
@@ -0,0 +1,78 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class ExceptionBuilder
+ {
+ public static Exception CreateDiscoveryException(string messageFormat, params string[] arguments)
+ {
+ // DiscoveryError (Dev10:602872): This should go through the discovery error reporting when
+ // we add a way to report discovery errors properly.
+ return new InvalidOperationException(Format(messageFormat, arguments));
+ }
+
+ public static ArgumentException CreateContainsNullElement(string parameterName)
+ {
+ Assumes.NotNull(parameterName);
+
+ string message = Format(Strings.Argument_NullElement, parameterName);
+
+ return new ArgumentException(message, parameterName);
+ }
+
+ public static ObjectDisposedException CreateObjectDisposed(object instance)
+ {
+ Assumes.NotNull(instance);
+
+ return new ObjectDisposedException(instance.GetType().ToString());
+ }
+
+ public static NotImplementedException CreateNotOverriddenByDerived(string memberName)
+ {
+ Assumes.NotNullOrEmpty(memberName);
+
+ string message = Format(Strings.NotImplemented_NotOverriddenByDerived, memberName);
+
+ return new NotImplementedException(message);
+ }
+
+ public static ArgumentException CreateExportDefinitionNotOnThisComposablePart(string parameterName)
+ {
+ Assumes.NotNullOrEmpty(parameterName);
+
+ string message = Format(Strings.ExportDefinitionNotOnThisComposablePart, parameterName);
+
+ return new ArgumentException(message, parameterName);
+ }
+
+ public static ArgumentException CreateImportDefinitionNotOnThisComposablePart(string parameterName)
+ {
+ Assumes.NotNullOrEmpty(parameterName);
+
+ string message = Format(Strings.ImportDefinitionNotOnThisComposablePart, parameterName);
+
+ return new ArgumentException(message, parameterName);
+ }
+
+ public static CompositionException CreateCannotGetExportedValue(ComposablePart part, ExportDefinition definition, Exception innerException)
+ {
+ Assumes.NotNull(part, definition, innerException);
+
+ return new CompositionException(
+ ErrorBuilder.CreateCannotGetExportedValue(part, definition, innerException));
+ }
+
+ private static string Format(string format, params string[] arguments)
+ {
+ return String.Format(CultureInfo.CurrentCulture, format, arguments);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportAttribute.cs
new file mode 100644
index 0000000..ccd8813
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportAttribute.cs
@@ -0,0 +1,144 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that a type, property, field, or method provides a particular export.
+ /// </summary>
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method,
+ AllowMultiple = true, Inherited = false)]
+ public class ExportAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under the default contract name.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
+ /// property or field, or the type itself, that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ExportAttribute()
+ : this((string)null, (Type)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under a contract name derived from the
+ /// specified type.
+ /// </summary>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name to export the type or
+ /// member marked with this attribute, under; or <see langword="null"/> to use the
+ /// default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// <paramref name="contractType"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
+ /// property or field, or the type itself, that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ExportAttribute(Type contractType)
+ : this((string)null, contractType)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name to export the type or member
+ /// marked with this attribute, under; or <see langword="null"/> or an empty string
+ /// ("") to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property or field
+ /// type, or the type itself that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ExportAttribute(string contractName)
+ : this(contractName, (Type)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name to export the type or member
+ /// marked with this attribute, under; or <see langword="null"/> or an empty string
+ /// ("") to use the default contract name.
+ /// </param>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name to export the type or
+ /// member marked with this attribute, under; or <see langword="null"/> to use the
+ /// default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property or field
+ /// type, or the type itself that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ExportAttribute(string contractName, Type contractType)
+ {
+ this.ContractName = contractName;
+ this.ContractType = contractType;
+ }
+
+ /// <summary>
+ /// Gets the contract name to export the type or member under.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the contract name to export the type or member
+ /// marked with this attribute, under. The default value is an empty string ("").
+ /// </value>
+ public string ContractName { get; private set; }
+
+ /// <summary>
+ /// Get the contract type that is exported by the member that this attribute is attached to.
+ /// </summary>
+ /// <value>
+ /// A <see cref="Type"/> of the export that is be provided. The default value is
+ /// <see langword="null"/> which means that the type will be obtained by looking at the type on
+ /// the member that this export is attached to.
+ /// </value>
+ public Type ContractType { get; private set; }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs
new file mode 100644
index 0000000..566726c
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportCardinalityCheckResult.cs
@@ -0,0 +1,14 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition
+{
+ internal enum ExportCardinalityCheckResult : int
+ {
+ Match,
+ NoExports,
+ TooManyExports
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportMetadataAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportMetadataAttribute.cs
new file mode 100644
index 0000000..1663690
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportMetadataAttribute.cs
@@ -0,0 +1,65 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies metadata for a type, property, field, or method marked with the
+ /// <see cref="ExportAttribute"/>.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Property | AttributeTargets.Method | AttributeTargets.Field,
+ AllowMultiple = true, Inherited = false)]
+ public sealed class ExportMetadataAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportMetadataAttribute"/> with the
+ /// specified name and metadata value.
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="String"/> containing the name of the metadata value; or
+ /// <see langword="null"/> to set the <see cref="Name"/> property to an empty
+ /// string ("").
+ /// </param>
+ /// <param name="value">
+ /// An <see cref="object"/> containing the metadata value. This can be
+ /// <see langword="null"/>.
+ /// </param>
+ public ExportMetadataAttribute(string name, object value)
+ {
+ this.Name = name ?? string.Empty;
+ this.Value = value;
+ }
+
+ /// <summary>
+ /// Gets the name of the metadata value.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the name of the metadata value.
+ /// </value>
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Gets the metadata value.
+ /// </summary>
+ /// <value>
+ /// An <see cref="object"/> containing the metadata value.
+ /// </value>
+ public object Value
+ {
+ get;
+ private set;
+ }
+
+ public bool IsMultiple
+ {
+ get;
+ set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs
new file mode 100644
index 0000000..be89978
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.DisposableLazy.cs
@@ -0,0 +1,50 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using Microsoft.Internal;
+using System.Collections.Generic;
+
+namespace System.ComponentModel.Composition
+{
+ partial class ExportServices
+ {
+ private sealed class DisposableLazy<T, TMetadataView> : Lazy<T, TMetadataView>, IDisposable
+ {
+ private IDisposable _disposable;
+
+ public DisposableLazy(Func<T> valueFactory, TMetadataView metadataView, IDisposable disposable)
+ : base(valueFactory, metadataView)
+ {
+ Assumes.NotNull(disposable);
+
+ this._disposable = disposable;
+ }
+
+ void IDisposable.Dispose()
+ {
+ this._disposable.Dispose();
+ }
+ }
+
+ private sealed class DisposableLazy<T> : Lazy<T>, IDisposable
+ {
+ private IDisposable _disposable;
+
+ public DisposableLazy(Func<T> valueFactory, IDisposable disposable)
+ : base(valueFactory)
+ {
+ Assumes.NotNull(disposable);
+
+ this._disposable = disposable;
+ }
+
+ void IDisposable.Dispose()
+ {
+ this._disposable.Dispose();
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.cs
new file mode 100644
index 0000000..79c86a2
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ExportServices.cs
@@ -0,0 +1,249 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition
+{
+ // Provides helpers for creating and dealing with Exports
+ internal static partial class ExportServices
+ {
+ private static readonly MethodInfo _createStronglyTypedLazyOfTM = typeof(ExportServices).GetMethod("CreateStronglyTypedLazyOfTM", BindingFlags.NonPublic | BindingFlags.Static);
+ private static readonly MethodInfo _createStronglyTypedLazyOfT = typeof(ExportServices).GetMethod("CreateStronglyTypedLazyOfT", BindingFlags.NonPublic | BindingFlags.Static);
+ private static readonly MethodInfo _createSemiStronglyTypedLazy = typeof(ExportServices).GetMethod("CreateSemiStronglyTypedLazy", BindingFlags.NonPublic | BindingFlags.Static);
+ private static readonly MethodInfo _createStronglyTypedExportFactoryOfT = typeof(ExportServices).GetMethod("CreateStronglyTypedExportFactoryOfT", BindingFlags.NonPublic | BindingFlags.Static);
+ private static readonly MethodInfo _createStronglyTypedExportFactoryOfTM = typeof(ExportServices).GetMethod("CreateStronglyTypedExportFactoryOfTM", BindingFlags.NonPublic | BindingFlags.Static);
+
+ internal static readonly Type DefaultMetadataViewType = typeof(IDictionary<string, object>);
+ internal static readonly Type DefaultExportedValueType = typeof(object);
+
+ internal static bool IsDefaultMetadataViewType(Type metadataViewType)
+ {
+ Assumes.NotNull(metadataViewType);
+
+ // Consider all types that IDictionary<string, object> derives from, such
+ // as ICollection<KeyValuePair<TKey, TValue>>, IEnumerable<KeyValuePair<TKey, TValue>>
+ // and IEnumerable, as default metadata view
+ return metadataViewType.IsAssignableFrom(DefaultMetadataViewType);
+ }
+
+ internal static bool IsDictionaryConstructorViewType(Type metadataViewType)
+ {
+ Assumes.NotNull(metadataViewType);
+
+ // Does the view type have a constructor that is a Dictionary<string, object>
+ return metadataViewType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
+ Type.DefaultBinder,
+ new Type[] { typeof(IDictionary<string, object>) },
+ new ParameterModifier[0]) != null;
+ }
+
+ internal static Func<Export, object> CreateStronglyTypedLazyFactory(Type exportType, Type metadataViewType)
+ {
+ MethodInfo genericMethod = null;
+ if (metadataViewType != null)
+ {
+ genericMethod = _createStronglyTypedLazyOfTM.MakeGenericMethod(exportType ?? ExportServices.DefaultExportedValueType, metadataViewType);
+ }
+ else
+ {
+ genericMethod = _createStronglyTypedLazyOfT.MakeGenericMethod(exportType ?? ExportServices.DefaultExportedValueType);
+ }
+ Assumes.NotNull(genericMethod);
+ return (Func<Export, object>)Delegate.CreateDelegate(typeof(Func<Export, object>), genericMethod);
+ }
+
+ internal static Func<Export, Lazy<object, object>> CreateSemiStronglyTypedLazyFactory(Type exportType, Type metadataViewType)
+ {
+ MethodInfo genericMethod = _createSemiStronglyTypedLazy.MakeGenericMethod(
+ exportType ?? ExportServices.DefaultExportedValueType,
+ metadataViewType ?? ExportServices.DefaultMetadataViewType);
+ Assumes.NotNull(genericMethod);
+ return (Func<Export, Lazy<object, object>>)Delegate.CreateDelegate(typeof(Func<Export, Lazy<object,object>>), genericMethod);
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ internal static Lazy<T, M> CreateStronglyTypedLazyOfTM<T, M>(Export export)
+ {
+ IDisposable disposable = export as IDisposable;
+ if (disposable != null)
+ {
+ return new DisposableLazy<T, M>(
+ () => ExportServices.GetCastedExportedValue<T>(export),
+ AttributedModelServices.GetMetadataView<M>(export.Metadata),
+ disposable);
+ }
+ else
+ {
+ return new Lazy<T, M>(
+ () => ExportServices.GetCastedExportedValue<T>(export),
+ AttributedModelServices.GetMetadataView<M>(export.Metadata),
+ false);
+ }
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ internal static Lazy<T> CreateStronglyTypedLazyOfT<T>(Export export)
+ {
+ IDisposable disposable = export as IDisposable;
+ if (disposable != null)
+ {
+ return new DisposableLazy<T>(
+ () => ExportServices.GetCastedExportedValue<T>(export),
+ disposable);
+ }
+ else
+ {
+ return new Lazy<T>(() => ExportServices.GetCastedExportedValue<T>(export), false);
+
+ }
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ internal static Lazy<object, object> CreateSemiStronglyTypedLazy<T, M>(Export export)
+ {
+ IDisposable disposable = export as IDisposable;
+ if (disposable != null)
+ {
+ return new DisposableLazy<object, object>(
+ () => ExportServices.GetCastedExportedValue<T>(export),
+ AttributedModelServices.GetMetadataView<M>(export.Metadata),
+ disposable);
+ }
+ else
+ {
+ return new Lazy<object, object>(
+ () => ExportServices.GetCastedExportedValue<T>(export),
+ AttributedModelServices.GetMetadataView<M>(export.Metadata),
+ false
+ );
+ }
+ }
+
+ internal static Func<Export, object> CreateStronglyTypedExportFactoryFactory(Type exportType, Type metadataType, ConstructorInfo constructor)
+ {
+ MethodInfo genericMethod = null;
+ if (metadataType == null)
+ {
+ genericMethod = _createStronglyTypedExportFactoryOfT.MakeGenericMethod(exportType);
+ }
+ else
+ {
+ genericMethod = _createStronglyTypedExportFactoryOfTM.MakeGenericMethod(exportType, metadataType);
+ }
+
+ Assumes.NotNull(genericMethod);
+ Func<Export, ConstructorInfo, object> exportFactoryFactory = (Func<Export, ConstructorInfo, object>)Delegate.CreateDelegate(typeof(Func<Export, ConstructorInfo, object>), genericMethod);
+ return (e) => exportFactoryFactory.Invoke(e, constructor);
+ }
+
+ private static Tuple<T, Action> GetExportLifetimeContextFromExport<T>(Export export)
+ {
+ T exportedValue;
+ Action disposeAction;
+ IDisposable disposable = null;
+
+ CatalogExportProvider.PartCreatorExport partCreatorExport = export as CatalogExportProvider.PartCreatorExport;
+
+ if (partCreatorExport != null)
+ {
+ // PartCreatorExport is the more optimized route
+ Export exportProduct = partCreatorExport.CreateExportProduct();
+ exportedValue = GetCastedExportedValue<T>(exportProduct);
+ disposable = exportProduct as IDisposable;
+ }
+ else
+ {
+ // If it comes from somewhere else we walk through the ComposablePartDefinition
+ var factoryPartDefinition = GetCastedExportedValue<ComposablePartDefinition>(export);
+ var part = factoryPartDefinition.CreatePart();
+ var exportDef = factoryPartDefinition.ExportDefinitions.Single();
+
+ exportedValue = CastExportedValue<T>(part.ToElement(), part.GetExportedValue(exportDef));
+ disposable = part as IDisposable;
+ }
+
+ if (disposable != null)
+ {
+ disposeAction = () => disposable.Dispose();
+ }
+ else
+ {
+ disposeAction = () => { };
+ }
+
+ return new Tuple<T, Action>(exportedValue, disposeAction);
+ }
+
+ private static object CreateStronglyTypedExportFactoryOfT<T>(Export export, ConstructorInfo constructor)
+ {
+ Func<Tuple<T, Action>> exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport<T>(export);
+ return constructor.Invoke(new object[] { exportLifetimeContextCreator });
+ }
+
+ private static object CreateStronglyTypedExportFactoryOfTM<T, M>(Export export, ConstructorInfo constructor)
+ {
+ Func<Tuple<T, Action>> exportLifetimeContextCreator = () => ExportServices.GetExportLifetimeContextFromExport<T>(export);
+ return constructor.Invoke(new object[] { exportLifetimeContextCreator, AttributedModelServices.GetMetadataView<M>(export.Metadata) });
+ }
+
+ internal static T GetCastedExportedValue<T>(Export export)
+ {
+ return CastExportedValue<T>(export.ToElement(), export.Value);
+ }
+
+ internal static T CastExportedValue<T>(ICompositionElement element, object exportedValue)
+ {
+ object typedExportedValue = null;
+
+ bool succeeded = ContractServices.TryCast(typeof(T), exportedValue, out typedExportedValue);
+ if (!succeeded)
+ {
+ throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
+ Strings.ContractMismatch_ExportedValueCannotBeCastToT,
+ element.DisplayName,
+ typeof(T)));
+ }
+
+ return (T)typedExportedValue;
+ }
+
+ internal static ExportCardinalityCheckResult CheckCardinality(ImportDefinition definition, IEnumerable<Export> exports)
+ {
+ EnumerableCardinality actualCardinality = exports.GetCardinality();
+
+ switch (actualCardinality)
+ {
+ case EnumerableCardinality.Zero:
+ if (definition.Cardinality == ImportCardinality.ExactlyOne)
+ {
+ return ExportCardinalityCheckResult.NoExports;
+ }
+ break;
+
+ case EnumerableCardinality.TwoOrMore:
+ if (definition.Cardinality.IsAtMostOne())
+ {
+ return ExportCardinalityCheckResult.TooManyExports;
+ }
+ break;
+
+ default:
+ Assumes.IsTrue(actualCardinality == EnumerableCardinality.One);
+ break;
+
+ }
+
+ return ExportCardinalityCheckResult.Match;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs
new file mode 100644
index 0000000..0cbf78a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateCatalog.cs
@@ -0,0 +1,230 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// A mutable collection of <see cref="ComposablePartCatalog"/>s.
+ /// </summary>
+ /// <remarks>
+ /// This type is thread safe.
+ /// </remarks>
+ public class AggregateCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged
+ {
+ private ComposablePartCatalogCollection _catalogs = null;
+ private volatile int _isDisposed = 0;
+ private IQueryable<ComposablePartDefinition> _partsQuery;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AggregateCatalog"/> class.
+ /// </summary>
+ public AggregateCatalog()
+ : this((IEnumerable<ComposablePartCatalog>)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AggregateCatalog"/> class
+ /// with the specified catalogs.
+ /// </summary>
+ /// <param name="catalogs">
+ /// An <see cref="Array"/> of <see cref="ComposablePartCatalog"/> objects to add to the
+ /// <see cref="AggregateCatalog"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="catalogs"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="catalogs"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public AggregateCatalog(params ComposablePartCatalog[] catalogs)
+ : this((IEnumerable<ComposablePartCatalog>)catalogs)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AggregateCatalog"/> class
+ /// with the specified catalogs.
+ /// </summary>
+ /// <param name="catalogs">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartCatalog"/> objects to add
+ /// to the <see cref="AggregateCatalog"/>; or <see langword="null"/> to
+ /// create an <see cref="AggregateCatalog"/> that is empty.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="catalogs"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public AggregateCatalog(IEnumerable<ComposablePartCatalog> catalogs)
+ {
+ Requires.NullOrNotNullElements(catalogs, "catalogs");
+
+ this._catalogs = new ComposablePartCatalogCollection(catalogs, this.OnChanged, this.OnChanging);
+ this._partsQuery = this._catalogs.AsQueryable().SelectMany(catalog => catalog.Parts);
+ }
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changed.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed
+ {
+ add
+ {
+ this._catalogs.Changed += value;
+ }
+ remove
+ {
+ this._catalogs.Changed -= value;
+ }
+ }
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changing.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing
+ {
+ add
+ {
+ this._catalogs.Changing += value;
+ }
+ remove
+ {
+ this._catalogs.Changing -= value;
+ }
+ }
+
+ /// <summary>
+ /// Gets the part definitions of the catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
+ /// <see cref="AggregateCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="AggregateCatalog"/> has been disposed of.
+ /// </exception>
+ public override IQueryable<ComposablePartDefinition> Parts
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+ return this._partsQuery;
+ }
+ }
+
+ /// <summary>
+ /// Returns the export definitions that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="ExportDefinition"/> objects to return.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
+ /// <see cref="ExportDefinition"/> objects and their associated
+ /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
+ /// by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="AggregateCatalog"/> has been disposed of.
+ /// </exception>
+ public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(definition, "definition");
+
+ // delegate the query to each catalog and merge the results.
+ var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
+ foreach (var catalog in this._catalogs)
+ {
+ foreach (var export in catalog.GetExports(definition))
+ {
+ exports.Add(export);
+ }
+ }
+ return exports;
+ }
+
+ /// <summary>
+ /// Gets the underlying catalogs of the catalog.
+ /// </summary>
+ /// <value>
+ /// An <see cref="ICollection{T}"/> of underlying <see cref="ComposablePartCatalog"/> objects
+ /// of the <see cref="AggregateCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="AggregateCatalog"/> has been disposed of.
+ /// </exception>
+ public ICollection<ComposablePartCatalog> Catalogs
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+ return this._catalogs;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ try
+ {
+ if (disposing)
+ {
+ // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
+#pragma warning disable 420
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+#pragma warning restore 420
+ {
+ this._catalogs.Dispose();
+ }
+ }
+ }
+ finally
+ {
+ base.Dispose(disposing);
+ }
+ }
+
+ /// <summary>
+ /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnChanged(ComposablePartCatalogChangeEventArgs e)
+ {
+ this._catalogs.OnChanged(this, e);
+ }
+
+ /// <summary>
+ /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changing"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnChanging(ComposablePartCatalogChangeEventArgs e)
+ {
+ this._catalogs.OnChanging(this, e);
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed == 1)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs
new file mode 100644
index 0000000..b624cd5
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AggregateExportProvider.cs
@@ -0,0 +1,219 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public class AggregateExportProvider : ExportProvider , IDisposable
+ {
+ private ReadOnlyCollection<ExportProvider> _providers;
+ private volatile int _isDisposed = 0;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class.
+ /// </summary>
+ /// <param name="providers">The prioritized list of export providers.</param>
+ /// <remarks>
+ /// <para>
+ /// The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when
+ /// executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>.
+ /// </para>
+ /// <para>
+ /// The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers.
+ /// That is, it will not try to dispose of any of them when it gets disposed.
+ /// </para>
+ /// </remarks>
+ public AggregateExportProvider(params ExportProvider[] providers)
+ : this(providers.AsEnumerable())
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class.
+ /// </summary>
+ /// <param name="providers">The prioritized list of export providers. The providers are consulted in order in which they are supplied.</param>
+ /// <remarks>
+ /// <para>
+ /// The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when
+ /// executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>.
+ /// </para>
+ /// <para>
+ /// The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers.
+ /// That is, it will not try to dispose of any of them when it gets disposed.
+ /// </para>
+ /// </remarks>
+ public AggregateExportProvider(IEnumerable<ExportProvider> providers)
+ {
+ List<ExportProvider> providerList = new List<ExportProvider>();
+
+ if (providers != null)
+ {
+ // we are in the constructor, so there's no need to lock anything
+ foreach (var provider in providers)
+ {
+ if (provider == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement("providers");
+ }
+
+ providerList.Add(provider);
+
+ provider.ExportsChanged += this.OnExportChangedInternal;
+ provider.ExportsChanging += this.OnExportChangingInternal;
+ }
+ }
+
+ // this will always fully copy the array
+ this._providers = new ReadOnlyCollection<ExportProvider>(providerList);
+ }
+
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
+#pragma warning disable 420
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+#pragma warning restore 420
+ {
+ this._providers.ForEach(provider =>
+ {
+ provider.ExportsChanged -= this.OnExportChangedInternal;
+ provider.ExportsChanging -= this.OnExportChangingInternal;
+ });
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the export providers which the aggregate export provider aggregates.
+ /// </summary>
+ /// <value>
+ /// A <see cref="ReadOnlyCollection{T}"/> of <see cref="ExportProvider"/> objects
+ /// which the <see cref="AggregateExportProvider"/> aggregates.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="AggregateExportProvider"/> has been disposed of.
+ /// </exception>
+ public ReadOnlyCollection<ExportProvider> Providers
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ return this._providers;
+ }
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> to get.</param>
+ /// <returns></returns>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// The implementers should not treat the cardinality-related mismatches as errors, and are not
+ /// expected to throw exceptions in those cases.
+ /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
+ /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
+ /// </note>
+ /// </remarks>
+ protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+
+ if (definition.Cardinality == ImportCardinality.ZeroOrMore)
+ {
+ var exports = new List<Export>();
+ foreach (var provider in this._providers)
+ {
+ foreach (var export in provider.GetExports(definition, atomicComposition))
+ {
+ exports.Add(export);
+ }
+ }
+ return exports;
+ }
+ else
+ {
+ IEnumerable<Export> allExports = Enumerable.Empty<Export>();
+
+ // if asked for "one or less", the prioriry is at play - the first provider that agrees to return the value
+ // which best complies with the request, wins.
+ foreach (ExportProvider provider in this._providers)
+ {
+ IEnumerable<Export> exports;
+ bool cardinalityCheckResult = provider.TryGetExports(definition, atomicComposition, out exports);
+ bool anyExports = exports.FastAny();
+ if (cardinalityCheckResult && anyExports)
+ {
+ // NOTE : if the provider returned nothing, we need to proceed, even if it indicated that the
+ // cardinality is correct - when asked for "one or less", the provider might - correctly -
+ // return an empty sequence, but we shouldn't be satisfied with that as providers down the list
+ // might have a value we are interested in.
+ return exports;
+ }
+ else
+ {
+ // TODO
+ // This is a sneaky thing that we do - if in the end no provider returns the exports with the right cardinality
+ // we simply return the aggregation of all exports they have restuned. This way the end result is still not waht we want
+ // but no information is lost.
+ // WE SHOULD fix this behavior, but this is ONLY possible if we can treat many exports as no exports for the sake of singles
+ if (anyExports)
+ {
+ allExports = allExports.Concat(exports);
+ }
+ }
+ }
+
+ return allExports;
+ }
+ }
+
+ private void OnExportChangedInternal(object sender, ExportsChangeEventArgs e)
+ {
+ this.OnExportsChanged(e);
+ }
+
+ private void OnExportChangingInternal(object sender, ExportsChangeEventArgs e)
+ {
+ this.OnExportsChanging(e);
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed == 1)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs
new file mode 100644
index 0000000..b2db43d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalog.cs
@@ -0,0 +1,301 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Security;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// An immutable ComposablePartCatalog created from a managed code assembly.
+ /// </summary>
+ /// <remarks>
+ /// This type is thread safe.
+ /// </remarks>
+ [DebuggerTypeProxy(typeof(AssemblyCatalogDebuggerProxy))]
+ public class AssemblyCatalog : ComposablePartCatalog, ICompositionElement
+ {
+ private readonly object _thisLock = new object();
+ private readonly ICompositionElement _definitionOrigin;
+ private volatile Assembly _assembly = null;
+ private volatile TypeCatalog _innerCatalog = null;
+ private int _isDisposed = 0;
+
+#if !SILVERLIGHT
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AssemblyCatalog"/> class
+ /// with the specified code base.
+ /// </summary>
+ /// <param name="codeBase">
+ /// A <see cref="String"/> containing the code base of the assembly containing the
+ /// attributed <see cref="Type"/> objects to add to the <see cref="AssemblyCatalog"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="codeBase"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="codeBase"/> is a zero-length string, contains only white space,
+ /// or contains one or more invalid characters as defined by <see cref="Path.InvalidPathChars"/>.
+ /// </exception>
+ /// <exception cref="PathTooLongException">
+ /// The specified path, file name, or both exceed the system-defined maximum length.
+ /// </exception>
+ /// <exception cref="SecurityException">
+ /// The caller does not have path discovery permission.
+ /// </exception>
+ /// <exception cref="FileNotFoundException">
+ /// <paramref name="codeBase"/> is not found.
+ /// </exception>
+ /// <exception cref="FileLoadException ">
+ /// <paramref name="codeBase"/> could not be loaded.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="codeBase"/> specified a directory.
+ /// </exception>
+ /// <exception cref="BadImageFormatException">
+ /// <paramref name="codeBase"/> is not a valid assembly
+ /// -or-
+ /// Version 2.0 or later of the common language runtime is currently loaded
+ /// and <paramref name="codeBase"/> was compiled with a later version.
+ /// </exception>
+ /// <remarks>
+ /// The assembly referenced by <paramref langword="codeBase"/> is loaded into the Load context.
+ /// </remarks>
+ public AssemblyCatalog(string codeBase)
+ : this(codeBase, (ICompositionElement)null)
+ {
+ }
+
+ internal AssemblyCatalog(string codeBase, ICompositionElement definitionOrigin)
+ : this(LoadAssembly(codeBase), definitionOrigin)
+ {
+ }
+
+#endif
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AssemblyCatalog"/> class
+ /// with the specified assembly.
+ /// </summary>
+ /// <param name="assembly">
+ /// The <see cref="Assembly"/> containing the attributed <see cref="Type"/> objects to
+ /// add to the <see cref="AssemblyCatalog"/>.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="assembly"/> is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="assembly"/> was loaded in the reflection-only context.
+ /// </exception>
+ public AssemblyCatalog(Assembly assembly)
+ : this(assembly, (ICompositionElement)null)
+ {
+ }
+
+ internal AssemblyCatalog(Assembly assembly, ICompositionElement definitionOrigin)
+ {
+ Requires.NotNull(assembly, "assembly");
+
+#if !SILVERLIGHT
+ if (assembly.ReflectionOnly)
+ {
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_AssemblyReflectionOnly, "assembly"), "assembly");
+ }
+#endif
+ this._assembly = assembly;
+ this._definitionOrigin = definitionOrigin ?? this;
+ }
+
+ /// <summary>
+ /// Gets the part definitions of the assembly catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
+ /// <see cref="AssemblyCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="AssemblyCatalog"/> has been disposed of.
+ /// </exception>
+ public override IQueryable<ComposablePartDefinition> Parts
+ {
+ get
+ {
+ return this.InnerCatalog.Parts;
+ }
+ }
+
+ /// <summary>
+ /// Returns the export definitions that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="ExportDefinition"/> objects to return.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
+ /// <see cref="ExportDefinition"/> objects and their associated
+ /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
+ /// by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePartCatalog"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>, if no
+ /// <see cref="ExportDefinition"/> match the conditions defined by
+ /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
+ /// </note>
+ /// </remarks>
+ public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
+ {
+ return this.InnerCatalog.GetExports(definition);
+ }
+
+ private TypeCatalog InnerCatalog
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ if (this._innerCatalog == null)
+ {
+ lock (this._thisLock)
+ {
+ if (this._innerCatalog == null)
+ {
+ var catalog = new TypeCatalog(this._assembly.GetTypes(), _definitionOrigin);
+ this._innerCatalog = catalog;
+ }
+ }
+ }
+ return this._innerCatalog;
+ }
+ }
+
+ /// <summary>
+ /// Gets the assembly containing the attributed types contained within the assembly
+ /// catalog.
+ /// </summary>
+ /// <value>
+ /// The <see cref="Assembly"/> containing the attributed <see cref="Type"/> objects
+ /// contained within the <see cref="AssemblyCatalog"/>.
+ /// </value>
+ public Assembly Assembly
+ {
+ get { return this._assembly; }
+ }
+
+ /// <summary>
+ /// Gets the display name of the assembly catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a human-readable display name of the <see cref="AssemblyCatalog"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ /// <summary>
+ /// Gets the composition element from which the assembly catalog originated.
+ /// </summary>
+ /// <value>
+ /// This property always returns <see langword="null"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return null; }
+ }
+
+
+ /// <summary>
+ /// Returns a string representation of the assembly catalog.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the string representation of the <see cref="AssemblyCatalog"/>.
+ /// </returns>
+ public override string ToString()
+ {
+ return this.GetDisplayName();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ try
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ if (disposing)
+ {
+ if (this._innerCatalog != null)
+ {
+ this._innerCatalog.Dispose();
+ }
+ }
+ }
+ }
+ finally
+ {
+ base.Dispose(disposing);
+ }
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed == 1)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+
+ private string GetDisplayName()
+ {
+ return string.Format(CultureInfo.CurrentCulture,
+ "{0} (Assembly=\"{1}\")", // NOLOC
+ GetType().Name,
+ this.Assembly.FullName);
+ }
+
+#if !SILVERLIGHT
+
+ private static Assembly LoadAssembly(string codeBase)
+ {
+ Requires.NotNullOrEmpty(codeBase, "codeBase");
+
+ AssemblyName assemblyName;
+
+ try
+ {
+ assemblyName = AssemblyName.GetAssemblyName(codeBase);
+ }
+ catch (ArgumentException)
+ {
+ assemblyName = new AssemblyName();
+ assemblyName.CodeBase = codeBase;
+ }
+
+ return Assembly.Load(assemblyName);
+ }
+#endif
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs
new file mode 100644
index 0000000..e8f5198
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AssemblyCatalogDebuggerProxy.cs
@@ -0,0 +1,40 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ internal class AssemblyCatalogDebuggerProxy
+ {
+ private readonly AssemblyCatalog _catalog;
+
+ public AssemblyCatalogDebuggerProxy(AssemblyCatalog catalog)
+ {
+ Requires.NotNull(catalog, "catalog");
+
+ this._catalog = catalog;
+ }
+
+ public Assembly Assembly
+ {
+ get { return this._catalog.Assembly; }
+ }
+
+ public ReadOnlyCollection<ComposablePartDefinition> Parts
+ {
+ // NOTE: This shouldn't be cached, so that on every query of
+ // the current value of the underlying catalog is respected.
+ // We use ReadOnlyCollection as arrays do not have the
+ // appropriate debugger display attributes applied to them.
+ get { return this._catalog.Parts.ToReadOnlyCollection(); }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicComposition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicComposition.cs
new file mode 100644
index 0000000..488e1cc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicComposition.cs
@@ -0,0 +1,305 @@
+using System;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Microsoft.Internal;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// AtomicComposition provides lightweight atomicCompositional semantics to enable temporary
+ /// state to be managed for a series of nested atomicCompositions. Each atomicComposition maintains
+ /// queryable state along with a sequence of actions necessary to complete the state when
+ /// the atomicComposition is no longer in danger of being rolled back. State is completed or
+ /// rolled back when the atomicComposition is disposed, depending on the state of the
+ /// CompleteOnDipose property which defaults to false. The using(...) pattern in C# is a
+ /// convenient mechanism for defining atomicComposition scopes.
+ ///
+ /// The least obvious aspects of AtomicComposition deal with nesting.
+ ///
+ /// Firstly, no complete actions are actually performed until the outermost atomicComposition is
+ /// completed. Completeting or rolling back nested atomicCompositions serves only to change which
+ /// actions would be completed the outer atomicComposition.
+ ///
+ /// Secondly, state is added in the form of queries associated with an object key. The
+ /// key represents a unique object the state is being held on behalf of. The quieries are
+ /// accessed throught the Query methods which provide automatic chaining to execute queries
+ /// across the target atomicComposition and its inner atomicComposition as appropriate.
+ ///
+ /// Lastly, when a nested atomicComposition is created for a given outer the outer atomicComposition is locked.
+ /// It remains locked until the inner atomicComposition is disposed or completeed preventing the addition of
+ /// state, actions or other inner atomicCompositions.
+ /// </summary>
+ public class AtomicComposition : IDisposable
+ {
+ private readonly AtomicComposition _outerAtomicComposition;
+ private KeyValuePair<object, object>[] _values;
+ private int _valueCount = 0;
+ private List<Action> _completeActionList;
+ private List<Action> _revertActionList;
+ private bool _isDisposed = false;
+ private bool _isCompleted = false;
+ private bool _containsInnerAtomicComposition = false;
+
+ public AtomicComposition()
+ : this(null)
+ {
+ }
+
+ public AtomicComposition(AtomicComposition outerAtomicComposition)
+ {
+ // Lock the inner atomicComposition so that we can assume nothing changes except on
+ // the innermost scope, and thereby optimize the query path
+ if (outerAtomicComposition != null)
+ {
+ this._outerAtomicComposition = outerAtomicComposition;
+ this._outerAtomicComposition.ContainsInnerAtomicComposition = true;
+ }
+ }
+
+ public void SetValue(object key, object value)
+ {
+ ThrowIfDisposed();
+ ThrowIfCompleteed();
+ ThrowIfContainsInnerAtomicComposition();
+
+ Requires.NotNull(key, "key");
+
+ SetValueInternal(key, value);
+ }
+
+ public bool TryGetValue<T>(object key, out T value)
+ {
+ return TryGetValue(key, false, out value);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters")]
+ public bool TryGetValue<T>(object key, bool localAtomicCompositionOnly, out T value)
+ {
+ ThrowIfDisposed();
+ ThrowIfCompleteed();
+
+ Requires.NotNull(key, "key");
+
+ return TryGetValueInternal(key, localAtomicCompositionOnly, out value);
+ }
+
+ public void AddCompleteAction(Action completeAction)
+ {
+ ThrowIfDisposed();
+ ThrowIfCompleteed();
+ ThrowIfContainsInnerAtomicComposition();
+
+ Requires.NotNull(completeAction, "completeAction");
+
+ if (this._completeActionList == null)
+ {
+ this._completeActionList = new List<Action>();
+ }
+ this._completeActionList.Add(completeAction);
+ }
+
+ public void AddRevertAction(Action revertAction)
+ {
+ ThrowIfDisposed();
+ ThrowIfCompleteed();
+ ThrowIfContainsInnerAtomicComposition();
+
+ Requires.NotNull(revertAction, "revertAction");
+
+ if (this._revertActionList == null)
+ {
+ this._revertActionList = new List<Action>();
+ }
+ this._revertActionList.Add(revertAction);
+ }
+
+ public void Complete()
+ {
+ ThrowIfDisposed();
+ ThrowIfCompleteed();
+
+ if (this._outerAtomicComposition == null)
+ { // Execute all the complete actions
+ FinalComplete();
+ }
+ else
+ { // Copy the actions and state to the outer atomicComposition
+ CopyComplete();
+ }
+
+ this._isCompleted = true;
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ ThrowIfDisposed();
+ this._isDisposed = true;
+
+ if (this._outerAtomicComposition != null)
+ {
+ this._outerAtomicComposition.ContainsInnerAtomicComposition = false;
+ }
+
+ // Revert is always immediate and involves forgetting information and
+ // exceuting any appropriate revert actions
+ if (!this._isCompleted)
+ {
+ if (this._revertActionList != null)
+ {
+ // Execute the revert actions in reverse order to ensure
+ // everything incrementally rollsback its state.
+ for (int i = this._revertActionList.Count - 1; i >= 0; i--)
+ {
+ Action action = this._revertActionList[i];
+ action();
+ }
+ this._revertActionList = null;
+ }
+ }
+ }
+
+ private void FinalComplete()
+ {
+ // Completeting the outer most scope is easy, just execute all the actions
+ if (this._completeActionList != null)
+ {
+ foreach (Action action in this._completeActionList)
+ {
+ action();
+ }
+ this._completeActionList = null;
+ }
+ }
+
+ private void CopyComplete()
+ {
+ Assumes.NotNull(this._outerAtomicComposition);
+
+ this._outerAtomicComposition.ContainsInnerAtomicComposition = false;
+
+ // Inner scopes are much odder, because completeting them means coalescing them into the
+ // outer scope - the complete or revert actions are deferred until the outermost scope completes
+ // or any intermediate rolls back
+ if (this._completeActionList != null)
+ {
+ foreach (Action action in this._completeActionList)
+ {
+ this._outerAtomicComposition.AddCompleteAction(action);
+ }
+ }
+
+ if (this._revertActionList != null)
+ {
+ foreach (Action action in this._revertActionList)
+ {
+ this._outerAtomicComposition.AddRevertAction(action);
+ }
+ }
+
+ // We can copy over existing atomicComposition entries because they're either already chained or
+ // overwrite by design and can now be completed or rolled back together
+ for (var index = 0; index < this._valueCount; index++)
+ {
+ this._outerAtomicComposition.SetValueInternal(
+ this._values[index].Key, this._values[index].Value);
+ }
+ }
+
+ private bool ContainsInnerAtomicComposition
+ {
+ set
+ {
+ if (value == true && this._containsInnerAtomicComposition == true)
+ {
+ throw new InvalidOperationException(Strings.AtomicComposition_AlreadyNested);
+ }
+ this._containsInnerAtomicComposition = value;
+ }
+ }
+
+ private bool TryGetValueInternal<T>(object key, bool localAtomicCompositionOnly, out T value)
+ {
+ for (var index = 0; index < this._valueCount; index++)
+ {
+ if (this._values[index].Key == key)
+ {
+ value = (T)this._values[index].Value;
+ return true;
+ }
+ }
+
+ // If there's no atomicComposition available then recurse until we hit the outermost
+ // scope, where upon we go ahead and return null
+ if (!localAtomicCompositionOnly && this._outerAtomicComposition != null)
+ {
+ return this._outerAtomicComposition.TryGetValueInternal<T>(key, localAtomicCompositionOnly, out value);
+ }
+
+ value = default(T);
+ return false;
+ }
+
+ private void SetValueInternal(object key, object value)
+ {
+ // Handle overwrites quickly
+ for (var index = 0; index < this._valueCount; index++)
+ {
+ if (this._values[index].Key == key)
+ {
+ this._values[index] = new KeyValuePair<object,object>(key, value);
+ return;
+ }
+ }
+
+ // Expand storage when needed
+ if (this._values == null || this._valueCount == this._values.Length)
+ {
+ var newQueries = new KeyValuePair<object, object>[this._valueCount == 0 ? 5 : this._valueCount * 2];
+ if (this._values != null)
+ {
+ Array.Copy(this._values, newQueries, this._valueCount);
+ }
+ this._values = newQueries;
+ }
+
+ // Store a new entry
+ this._values[_valueCount] = new KeyValuePair<object, object>(key, value);
+ this._valueCount++;
+ return;
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfContainsInnerAtomicComposition()
+ {
+ if (this._containsInnerAtomicComposition)
+ {
+ throw new InvalidOperationException(Strings.AtomicComposition_PartOfAnotherAtomicComposition);
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfCompleteed()
+ {
+ if (this._isCompleted)
+ {
+ throw new InvalidOperationException(Strings.AtomicComposition_AlreadyCompleted);
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs
new file mode 100644
index 0000000..af57329
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/AtomicCompositionExtensions.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ internal static class AtomicCompositionExtensions
+ {
+ internal static T GetValueAllowNull<T>(this AtomicComposition atomicComposition, T defaultResultAndKey) where T : class
+ {
+ Assumes.NotNull(defaultResultAndKey);
+
+ return GetValueAllowNull<T>(atomicComposition, defaultResultAndKey, defaultResultAndKey);
+ }
+
+ internal static T GetValueAllowNull<T>(this AtomicComposition atomicComposition, object key, T defaultResult)
+ {
+ T result;
+ if (atomicComposition != null && atomicComposition.TryGetValue(key, out result))
+ {
+ return result;
+ }
+
+ return defaultResult;
+ }
+
+ internal static void AddRevertActionAllowNull(this AtomicComposition atomicComposition, Action action)
+ {
+ Assumes.NotNull(action);
+
+ if (atomicComposition == null)
+ {
+ action();
+ }
+ else
+ {
+ atomicComposition.AddRevertAction(action);
+ }
+ }
+
+ internal static void AddCompleteActionAllowNull(this AtomicComposition atomicComposition, Action action)
+ {
+ Assumes.NotNull(action);
+
+ if (atomicComposition == null)
+ {
+ action();
+ }
+ else
+ {
+ atomicComposition.AddCompleteAction(action);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs
new file mode 100644
index 0000000..a66471d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogChangeProxy.cs
@@ -0,0 +1,67 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CatalogExportProvider : ExportProvider, IDisposable
+ {
+ private class CatalogChangeProxy : ComposablePartCatalog
+ {
+ private ComposablePartCatalog _originalCatalog;
+ private List<ComposablePartDefinition> _addedParts;
+ private HashSet<ComposablePartDefinition> _removedParts;
+
+ public CatalogChangeProxy(ComposablePartCatalog originalCatalog,
+ IEnumerable<ComposablePartDefinition> addedParts,
+ IEnumerable<ComposablePartDefinition> removedParts)
+ {
+ this._originalCatalog = originalCatalog;
+ this._addedParts = new List<ComposablePartDefinition>(addedParts);
+ this._removedParts = new HashSet<ComposablePartDefinition>(removedParts);
+ }
+
+ public override IQueryable<ComposablePartDefinition> Parts
+ {
+ get
+ {
+ return this._originalCatalog.Parts.Concat(this._addedParts).Except(this._removedParts);
+ }
+ }
+
+ public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(
+ ImportDefinition definition)
+ {
+ Requires.NotNull(definition, "definition");
+
+ var originalExports = this._originalCatalog.GetExports(definition);
+ var trimmedExports = originalExports.Where(partAndExport =>
+ !this._removedParts.Contains(partAndExport.Item1));
+
+ var addedExports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
+ foreach (var part in this._addedParts)
+ {
+ foreach (var export in part.ExportDefinitions)
+ {
+ if (definition.IsConstraintSatisfiedBy(export))
+ {
+ addedExports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
+ }
+ }
+ }
+ return trimmedExports.Concat(addedExports);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs
new file mode 100644
index 0000000..35ea352
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.CatalogExport.cs
@@ -0,0 +1,132 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CatalogExportProvider
+ {
+ private class CatalogExport : Export
+ {
+ protected readonly CatalogExportProvider _catalogExportProvider;
+ protected readonly ComposablePartDefinition _partDefinition;
+ protected readonly ExportDefinition _definition;
+ protected ComposablePart _part;
+
+ public CatalogExport(CatalogExportProvider catalogExportProvider,
+ ComposablePartDefinition partDefinition, ExportDefinition definition)
+ {
+ this._catalogExportProvider = catalogExportProvider;
+ this._partDefinition = partDefinition;
+ this._definition = definition;
+ }
+
+ public override ExportDefinition Definition
+ {
+ get
+ {
+ return this._definition;
+ }
+ }
+
+ protected virtual bool IsSharedPart
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ protected override object GetExportedValueCore()
+ {
+ ComposablePart part = this._catalogExportProvider.GetComposablePart(this._partDefinition, this.IsSharedPart);
+ object exportedValue = this._catalogExportProvider.GetExportedValue(part, this._definition, this.IsSharedPart);
+ this._part = part;
+
+ return exportedValue;
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ public static CatalogExport CreateExport(CatalogExportProvider catalogExportProvider,
+ ComposablePartDefinition partDefinition, ExportDefinition definition, CreationPolicy importCreationPolicy)
+ {
+ CreationPolicy partPolicy = partDefinition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName);
+ bool isSharedPart = ShouldUseSharedPart(partPolicy, importCreationPolicy);
+
+ if (isSharedPart)
+ {
+ return new CatalogExport(catalogExportProvider, partDefinition, definition);
+ }
+ else
+ {
+ return new NonSharedCatalogExport(catalogExportProvider, partDefinition, definition);
+ }
+ }
+
+ private static bool ShouldUseSharedPart(CreationPolicy partPolicy, CreationPolicy importPolicy)
+ {
+ // Matrix that details which policy to use for a given part to satisfy a given import.
+ // Part.Any Part.Shared Part.NonShared
+ // Import.Any Shared Shared NonShared
+ // Import.Shared Shared Shared N/A
+ // Import.NonShared NonShared N/A NonShared
+
+ switch (partPolicy)
+ {
+ case CreationPolicy.Any:
+ {
+ if (importPolicy == CreationPolicy.Any ||
+ importPolicy == CreationPolicy.Shared)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ case CreationPolicy.NonShared:
+ {
+ Assumes.IsTrue(importPolicy != CreationPolicy.Shared);
+ return false;
+ }
+
+ default:
+ {
+ Assumes.IsTrue(partPolicy == CreationPolicy.Shared);
+ Assumes.IsTrue(importPolicy != CreationPolicy.NonShared);
+ return true;
+ }
+ }
+ }
+ }
+
+ private sealed class NonSharedCatalogExport : CatalogExport, IDisposable
+ {
+ public NonSharedCatalogExport(CatalogExportProvider catalogExportProvider,
+ ComposablePartDefinition partDefinition, ExportDefinition definition)
+ : base(catalogExportProvider, partDefinition, definition)
+ {
+ }
+
+ protected override bool IsSharedPart
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ void IDisposable.Dispose()
+ {
+ if (this._part != null)
+ {
+ this._catalogExportProvider.ReleasePart(this.Value, this._part, null);
+ this._part = null;
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs
new file mode 100644
index 0000000..62202b2
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.PartCreatorExport.cs
@@ -0,0 +1,132 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Linq;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CatalogExportProvider
+ {
+ internal class PartCreatorExport : Export
+ {
+ private readonly CatalogExportProvider _catalogExportProvider;
+ private readonly ComposablePartDefinition _partDefinition;
+ private readonly ExportDefinition _exportDefinition;
+ private ExportDefinition _partCreatorExportDefinition;
+ private PartCreatorPartDefinition _partCreatorPartDefinition;
+
+ public PartCreatorExport(CatalogExportProvider catalogExportProvider, ComposablePartDefinition partDefinition, ExportDefinition exportDefinition)
+ {
+ this._catalogExportProvider = catalogExportProvider;
+ this._partDefinition = partDefinition;
+ this._exportDefinition = exportDefinition;
+ this._partCreatorExportDefinition = new PartCreatorExportDefinition(this._exportDefinition);
+ }
+
+ public override ExportDefinition Definition
+ {
+ get { return this._partCreatorExportDefinition; }
+ }
+
+ protected override object GetExportedValueCore()
+ {
+ if (this._partCreatorPartDefinition == null)
+ {
+ this._partCreatorPartDefinition = new PartCreatorPartDefinition(this);
+ }
+ return this._partCreatorPartDefinition;
+ }
+
+ public Export CreateExportProduct()
+ {
+ return new NonSharedCatalogExport(this._catalogExportProvider, this._partDefinition, this._exportDefinition);
+ }
+
+ private class PartCreatorPartDefinition : ComposablePartDefinition
+ {
+ private readonly PartCreatorExport _partCreatorExport;
+
+ public PartCreatorPartDefinition(PartCreatorExport partCreatorExport)
+ {
+ this._partCreatorExport = partCreatorExport;
+ }
+
+ public override IEnumerable<ExportDefinition> ExportDefinitions
+ {
+ get { return new ExportDefinition[] { this._partCreatorExport.Definition }; }
+ }
+
+ public override IEnumerable<ImportDefinition> ImportDefinitions
+ {
+ get { return Enumerable.Empty<ImportDefinition>(); }
+ }
+
+ public ExportDefinition PartCreatorExportDefinition
+ {
+ get { return this._partCreatorExport.Definition; }
+ }
+
+ public Export CreateProductExport()
+ {
+ return this._partCreatorExport.CreateExportProduct();
+ }
+
+ public override ComposablePart CreatePart()
+ {
+ return new PartCreatorPart(this);
+ }
+ }
+
+ private sealed class PartCreatorPart : ComposablePart, IDisposable
+ {
+ private readonly PartCreatorPartDefinition _definition;
+ private readonly Export _export;
+
+ public PartCreatorPart(PartCreatorPartDefinition definition)
+ {
+ this._definition = definition;
+ this._export = definition.CreateProductExport();
+ }
+
+ public override IEnumerable<ExportDefinition> ExportDefinitions
+ {
+ get { return this._definition.ExportDefinitions; }
+ }
+
+ public override IEnumerable<ImportDefinition> ImportDefinitions
+ {
+ get { return this._definition.ImportDefinitions; }
+ }
+
+ public override object GetExportedValue(ExportDefinition definition)
+ {
+ if (definition != this._definition.PartCreatorExportDefinition)
+ {
+ throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
+ }
+
+ return this._export.Value;
+ }
+
+ public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
+ {
+ throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
+ }
+
+ public void Dispose()
+ {
+ IDisposable disposable = this._export as IDisposable;
+
+ if (disposable != null)
+ {
+ disposable.Dispose();
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs
new file mode 100644
index 0000000..9318d80
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CatalogExportProvider.cs
@@ -0,0 +1,816 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Diagnostics;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CatalogExportProvider : ExportProvider, IDisposable
+ {
+ private readonly CompositionLock _lock;
+ private Dictionary<ComposablePartDefinition, ComposablePart> _activatedParts = new Dictionary<ComposablePartDefinition, ComposablePart>();
+ private HashSet<ComposablePartDefinition> _rejectedParts = new HashSet<ComposablePartDefinition>();
+ private ConditionalWeakTable<object, List<ComposablePart>> _conditionalReferencesForRecomposableParts = new ConditionalWeakTable<object, List<ComposablePart>>();
+ private HashSet<IDisposable> _partsToDispose = new HashSet<IDisposable>();
+ private ComposablePartCatalog _catalog;
+ private volatile bool _isDisposed = false;
+ private volatile bool _isRunning = false;
+ private ExportProvider _sourceProvider;
+ private ImportEngine _importEngine;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CatalogExportProvider"/> class.
+ /// </summary>
+ /// <param name="catalog">
+ /// The <see cref="ComposablePartCatalog"/> that the <see cref="CatalogExportProvider"/>
+ /// uses to produce <see cref="Export"/> objects.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="catalog"/> is <see langword="null"/>.
+ /// </exception>
+ public CatalogExportProvider(ComposablePartCatalog catalog)
+ : this(catalog, false)
+ {
+ }
+
+ public CatalogExportProvider(ComposablePartCatalog catalog, bool isThreadSafe)
+ {
+ Requires.NotNull(catalog, "catalog");
+
+ this._catalog = catalog;
+
+ var notifyCatalogChanged = this._catalog as INotifyComposablePartCatalogChanged;
+ if (notifyCatalogChanged != null)
+ {
+ notifyCatalogChanged.Changing += this.OnCatalogChanging;
+ }
+
+ this._lock = new CompositionLock(isThreadSafe);
+ }
+
+ /// <summary>
+ /// Gets the composable part catalog that the provider users to
+ /// produce exports.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ComposablePartCatalog"/> that the
+ /// <see cref="CatalogExportProvider"/>
+ /// uses to produce <see cref="Export"/> objects.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public ComposablePartCatalog Catalog
+ {
+ get
+ {
+ ThrowIfDisposed();
+
+ return this._catalog;
+ }
+ }
+
+ /// <summary>
+ /// Gets the export provider which provides the provider access to additional
+ /// exports.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ExportProvider"/> which provides the
+ /// <see cref="CatalogExportProvider"/> access to additional
+ /// <see cref="Export"/> objects. The default is <see langword="null"/>.
+ /// </value>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="value"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// This property has already been set.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// The methods on the <see cref="CatalogExportProvider"/>
+ /// have already been accessed.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CatalogExportProvider"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// This property must be set before accessing any methods on the
+ /// <see cref="CatalogExportProvider"/>.
+ /// </remarks>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification="EnsureCanSet ensures that the property is set only once, Dispose is not required")]
+ public ExportProvider SourceProvider
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+ using (this._lock.LockStateForRead())
+ {
+ return this._sourceProvider;
+ }
+ }
+ set
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(value, "value");
+
+ ImportEngine newImportEngine = null;
+ bool isThrowing = true;
+ try
+ {
+ newImportEngine = new ImportEngine(value, this._lock.IsThreadSafe);
+ value.ExportsChanging += this.OnExportsChangingInternal;
+
+ using (this._lock.LockStateForWrite())
+ {
+ this.EnsureCanSet(this._sourceProvider);
+
+ this._sourceProvider = value;
+ this._importEngine = newImportEngine;
+
+ isThrowing = false;
+ }
+ }
+ finally
+ {
+ if (isThrowing)
+ {
+ value.ExportsChanging -= this.OnExportsChangingInternal;
+ newImportEngine.Dispose();
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (!this._isDisposed)
+ {
+ bool disposeLock = false;
+ INotifyComposablePartCatalogChanged catalogToUnsubscribeFrom = null;
+ HashSet<IDisposable> partsToDispose = null;
+ ExportProvider sourceProviderToUnsubscribeFrom = null;
+ ImportEngine importEngineToDispose = null;
+
+ try
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._isDisposed)
+ {
+ catalogToUnsubscribeFrom = this._catalog as INotifyComposablePartCatalogChanged;
+ this._catalog = null;
+
+ sourceProviderToUnsubscribeFrom = this._sourceProvider;
+ this._sourceProvider = null;
+
+ importEngineToDispose = this._importEngine;
+ this._importEngine = null;
+
+ partsToDispose = this._partsToDispose;
+ this._partsToDispose = new HashSet<IDisposable>();
+ this._activatedParts.Clear();
+ this._conditionalReferencesForRecomposableParts = null;
+
+ disposeLock = true;
+ this._isDisposed = true;
+ }
+ }
+ }
+ finally
+ {
+ if (catalogToUnsubscribeFrom != null)
+ {
+ catalogToUnsubscribeFrom.Changing -= this.OnCatalogChanging;
+ }
+
+ if (sourceProviderToUnsubscribeFrom != null)
+ {
+ sourceProviderToUnsubscribeFrom.ExportsChanging -= this.OnExportsChangingInternal;
+ }
+
+ if (importEngineToDispose != null)
+ {
+ importEngineToDispose.Dispose();
+ }
+
+ if (partsToDispose != null)
+ {
+ foreach (var part in partsToDispose)
+ {
+ part.Dispose();
+ }
+ }
+
+ if (disposeLock)
+ {
+ this._lock.Dispose();
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> to get.</param>
+ /// <returns></returns>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// The implementers should not treat the cardinality-related mismatches as errors, and are not
+ /// expected to throw exceptions in those cases.
+ /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
+ /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
+ /// </note>
+ /// </remarks>
+ protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ // Use the version of the catalog appropriate to this atomicComposition
+ ComposablePartCatalog currentCatalog = atomicComposition.GetValueAllowNull(this._catalog);
+
+ IPartCreatorImportDefinition partCreatorDefinition = definition as IPartCreatorImportDefinition;
+ bool isPartCreator = false;
+
+ if (partCreatorDefinition != null)
+ {
+ definition = partCreatorDefinition.ProductImportDefinition;
+ isPartCreator = true;
+ }
+
+ CreationPolicy importPolicy = definition.GetRequiredCreationPolicy();
+
+ List<Export> exports = new List<Export>();
+ foreach (var partDefinitionAndExportDefinition in currentCatalog.GetExports(definition))
+ {
+ if (!IsRejected(partDefinitionAndExportDefinition.Item1, atomicComposition))
+ {
+ if (isPartCreator)
+ {
+ exports.Add(new PartCreatorExport(this,
+ partDefinitionAndExportDefinition.Item1,
+ partDefinitionAndExportDefinition.Item2));
+ }
+ else
+ {
+ exports.Add(CatalogExport.CreateExport(this,
+ partDefinitionAndExportDefinition.Item1,
+ partDefinitionAndExportDefinition.Item2,
+ importPolicy));
+ }
+ }
+ }
+
+ return exports;
+ }
+
+ private void OnExportsChangingInternal(object sender, ExportsChangeEventArgs e)
+ {
+ UpdateRejections(e.AddedExports.Concat(e.RemovedExports), e.AtomicComposition);
+ }
+
+ private static ExportDefinition[] GetExportsFromPartDefinitions(IEnumerable<ComposablePartDefinition> partDefinitions)
+ {
+ List<ExportDefinition> exports = new List<ExportDefinition>();
+
+ foreach (var partDefinition in partDefinitions)
+ {
+ foreach (var export in partDefinition.ExportDefinitions)
+ {
+ exports.Add(export);
+
+ // While creating a PartCreatorExportDefinition for every changed definition may not be the most
+ // efficient way to do this the PartCreatorExportDefinition is very efficient and doesn't do any
+ // real work unless its metadata is pulled on. If this turns out to be a bottleneck then we
+ // will need to start tracking all the PartCreator's we hand out and only send those which we
+ // have handed out. In fact we could do the same thing for all the Exports if we wished but
+ // that requires a cache management which we don't want to do at this point.
+ exports.Add(new PartCreatorExportDefinition(export));
+ }
+ }
+
+ return exports.ToArray();
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ private void OnCatalogChanging(object sender, ComposablePartCatalogChangeEventArgs e)
+ {
+ using (var atomicComposition = new AtomicComposition(e.AtomicComposition))
+ {
+ // Save the preview catalog to use in place of the original while handling
+ // this event
+ atomicComposition.SetValue(this._catalog,
+ new CatalogChangeProxy(this._catalog, e.AddedDefinitions, e.RemovedDefinitions));
+
+ IEnumerable<ExportDefinition> addedExports = GetExportsFromPartDefinitions(e.AddedDefinitions);
+ IEnumerable<ExportDefinition> removedExports = GetExportsFromPartDefinitions(e.RemovedDefinitions);
+
+ // Remove any parts based on eliminated definitions (in a atomicComposition-friendly
+ // fashion)
+ foreach (var definition in e.RemovedDefinitions)
+ {
+ ComposablePart removedPart = null;
+ bool removed = false;
+
+ using (this._lock.LockStateForRead())
+ {
+ removed = this._activatedParts.TryGetValue(definition, out removedPart);
+ }
+ if (removed)
+ {
+ var capturedDefinition = definition;
+ ReleasePart(null, removedPart, atomicComposition);
+ atomicComposition.AddCompleteActionAllowNull(() =>
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ this._activatedParts.Remove(capturedDefinition);
+ }
+ });
+ }
+ }
+
+ UpdateRejections(addedExports.ConcatAllowingNull(removedExports), atomicComposition);
+
+ this.OnExportsChanging(
+ new ExportsChangeEventArgs(addedExports, removedExports, atomicComposition));
+
+ atomicComposition.AddCompleteAction(() => this.OnExportsChanged(
+ new ExportsChangeEventArgs(addedExports, removedExports, null)));
+
+ atomicComposition.Complete();
+ }
+ }
+
+ private ComposablePart GetComposablePart(ComposablePartDefinition partDefinition, bool isSharedPart)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ ComposablePart part;
+
+ if (isSharedPart)
+ {
+ part = GetSharedPart(partDefinition);
+ }
+ else
+ {
+ part = partDefinition.CreatePart();
+
+ IDisposable disposablePart = part as IDisposable;
+ if (disposablePart != null)
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ this._partsToDispose.Add(disposablePart);
+ }
+ }
+ }
+
+ return part;
+ }
+
+ private ComposablePart GetSharedPart(ComposablePartDefinition partDefinition)
+ {
+ ComposablePart part;
+ bool found = false;
+
+ using (this._lock.LockStateForRead())
+ {
+ found = this._activatedParts.TryGetValue(partDefinition, out part);
+ }
+
+ if (!found)
+ {
+ ComposablePart newPart = partDefinition.CreatePart();
+
+ using (this._lock.LockStateForWrite())
+ {
+ found = this._activatedParts.TryGetValue(partDefinition, out part);
+
+ if (!found)
+ {
+ part = newPart;
+ this._activatedParts.Add(partDefinition, part);
+ IDisposable disposablePart = part as IDisposable;
+ if (disposablePart != null)
+ {
+ this._partsToDispose.Add(disposablePart);
+ }
+ }
+ }
+ }
+
+ return part;
+ }
+
+ private object GetExportedValue(ComposablePart part, ExportDefinition export, bool isSharedPart)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ Assumes.NotNull(part, export);
+
+ object exportedValue = CompositionServices.GetExportedValueFromComposedPart(
+ this._importEngine, part, export);
+
+ // Only hold conditional references for recomposable non-shared parts because we are
+ // already holding strong references to the shared parts.
+ if (exportedValue != null && !isSharedPart && part.IsRecomposable())
+ {
+ SetConditionalReferenceForRecomposablePart(exportedValue, part);
+ }
+
+ return exportedValue;
+ }
+
+ private void ReleasePart(object exportedValue, ComposablePart part, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ Assumes.NotNull(part);
+
+ this._importEngine.ReleaseImports(part, atomicComposition);
+
+ if (exportedValue != null)
+ {
+ atomicComposition.AddCompleteActionAllowNull(() =>
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ this._conditionalReferencesForRecomposableParts.Remove(exportedValue);
+ }
+ });
+ }
+
+ IDisposable diposablePart = part as IDisposable;
+ if (diposablePart != null)
+ {
+ atomicComposition.AddCompleteActionAllowNull(() =>
+ {
+ bool removed = false;
+ using (this._lock.LockStateForWrite())
+ {
+ removed = this._partsToDispose.Remove(diposablePart);
+ }
+ if (removed)
+ {
+ diposablePart.Dispose();
+ }
+ });
+ }
+ }
+
+ private void SetConditionalReferenceForRecomposablePart(object exportedValue, ComposablePart part)
+ {
+ Assumes.NotNull(exportedValue, part);
+
+ List<ComposablePart> partList;
+
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._conditionalReferencesForRecomposableParts.TryGetValue(exportedValue, out partList))
+ {
+ partList = new List<ComposablePart>();
+ this._conditionalReferencesForRecomposableParts.Add(exportedValue, partList);
+ }
+
+ // There is one really obscure case (one part exporting exact value multiple times) where
+ // the part may already be in the list but it isn't a scenario that is interesting so
+ // we simply always add. Later if we change this to support more than non-shared we may
+ // need to check if the part already exists to pervent adding it multiple times.
+ partList.Add(part);
+ }
+ }
+
+ private bool IsRejected(ComposablePartDefinition definition, AtomicComposition atomicComposition)
+ {
+ // Check to see if we're currently working on the definition in question.
+ // Recursive queries always answer optimistically, as if the definition hasn't
+ // been rejected - because if it is we can discard all decisions that were based
+ // on the faulty assumption in the first place.
+ var forceRejectionTest = false;
+ if (atomicComposition != null)
+ {
+ var atomicCompositionQuery = GetAtomicCompositionQuery(atomicComposition);
+ AtomicCompositionQueryState state = atomicCompositionQuery(definition);
+ switch (state)
+ {
+ case AtomicCompositionQueryState.TreatAsRejected:
+ return true;
+ case AtomicCompositionQueryState.TreatAsValidated:
+ return false;
+ case AtomicCompositionQueryState.NeedsTesting:
+ forceRejectionTest = true;
+ break;
+ default:
+ Assumes.IsTrue(state == AtomicCompositionQueryState.Unknown);
+ // Need to do the work to determine the state
+ break;
+ }
+ }
+
+ if (!forceRejectionTest)
+ {
+ // Next, anything that has been activated is not rejected
+ using (this._lock.LockStateForRead())
+ {
+ if (this._activatedParts.ContainsKey(definition))
+ {
+ return false;
+ }
+
+ // Last stop before doing the hard work: check a specific registry of rejected parts
+ if (this._rejectedParts.Contains(definition))
+ {
+ return true;
+ }
+ }
+ }
+
+ // Determine whether or not the definition's imports can be satisfied
+ return DetermineRejection(definition, atomicComposition);
+ }
+
+ private bool DetermineRejection(ComposablePartDefinition definition, AtomicComposition parentAtomicComposition)
+ {
+ ChangeRejectedException exception = null;
+
+ using (var localAtomicComposition = new AtomicComposition(parentAtomicComposition))
+ {
+ // The part definition we're currently working on is treated optimistically
+ // as if we know it hasn't been rejected. This handles recursion, and if we
+ // later decide that it has been rejected we'll discard all nested progress so
+ // all side-effects of the mistake are erased.
+ //
+ // Note that this means that recursive failures that would be detected by the
+ // import engine are not discovered by rejection currently. Loops among
+ // prerequisites, runaway import chains involving factories, and prerequisites
+ // that cannot be fully satisfied still result in runtime errors. Doing
+ // otherwise would be possible but potentially expensive - and could be a v2
+ // improvement if deemed worthwhile.
+ UpdateAtomicCompositionQuery(localAtomicComposition,
+ def => definition.Equals(def), AtomicCompositionQueryState.TreatAsValidated);
+
+ var newPart = definition.CreatePart();
+ try
+ {
+ this._importEngine.PreviewImports(newPart, localAtomicComposition);
+
+ // Reuse the partially-fleshed out part the next time we need a shared
+ // instance to keep the expense of pre-validation to a minimum. Note that
+ // _activatedParts holds references to both shared and non-shared parts.
+ // The non-shared parts will only be used for rejection purposes only but
+ // the shared parts will be handed out when requested via GetExports as
+ // well as be used for rejection purposes.
+ localAtomicComposition.AddCompleteActionAllowNull(() =>
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._activatedParts.ContainsKey(definition))
+ {
+ this._activatedParts.Add(definition, newPart);
+ IDisposable newDisposablePart = newPart as IDisposable;
+ if (newDisposablePart != null)
+ {
+ this._partsToDispose.Add(newDisposablePart);
+ }
+ }
+ }
+ });
+
+ // Success! Complete any recursive work that was conditioned on this part's validation
+ localAtomicComposition.Complete();
+
+ return false;
+ }
+ catch (ChangeRejectedException ex)
+ {
+ exception = ex;
+ }
+ }
+
+ // If we've reached this point then this part has been rejected so we need to
+ // record the rejection in our parent composition or execute it immediately if
+ // one doesn't exist.
+ parentAtomicComposition.AddCompleteActionAllowNull(() =>
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ this._rejectedParts.Add(definition);
+ }
+
+ CompositionTrace.PartDefinitionRejected(definition, exception);
+
+ });
+ if (parentAtomicComposition != null)
+ {
+ UpdateAtomicCompositionQuery(parentAtomicComposition,
+ def => definition.Equals(def), AtomicCompositionQueryState.TreatAsRejected);
+ }
+
+ return true;
+ }
+
+ private void UpdateRejections(IEnumerable<ExportDefinition> changedExports, AtomicComposition atomicComposition)
+ {
+ using (var localAtomicComposition = new AtomicComposition(atomicComposition))
+ {
+ // Reconsider every part definition that has been previously
+ // rejected to see if any of them can be added back.
+ var affectedRejections = new HashSet<ComposablePartDefinition>();
+ var atomicCompositionQuery = GetAtomicCompositionQuery(localAtomicComposition);
+
+ ComposablePartDefinition[] rejectedParts;
+ using (this._lock.LockStateForRead())
+ {
+ rejectedParts = this._rejectedParts.ToArray();
+ }
+ foreach (var definition in rejectedParts)
+ {
+ if (atomicCompositionQuery(definition) == AtomicCompositionQueryState.TreatAsValidated)
+ {
+ continue;
+ }
+
+ foreach (var import in definition.ImportDefinitions.Where(ImportEngine.IsRequiredImportForPreview))
+ {
+ if (changedExports.Any(export => import.IsConstraintSatisfiedBy(export)))
+ {
+ affectedRejections.Add(definition);
+ break;
+ }
+ }
+ }
+ UpdateAtomicCompositionQuery(localAtomicComposition,
+ def => affectedRejections.Contains(def), AtomicCompositionQueryState.NeedsTesting);
+
+ // Determine if any of the resurrectable parts is now available so that we can
+ // notify listeners of the exact changes to exports
+ var resurrectedExports = new List<ExportDefinition>();
+
+ foreach (var partDefinition in affectedRejections)
+ {
+ if (!IsRejected(partDefinition, localAtomicComposition))
+ {
+ // Notify listeners of the newly available exports and
+ // prepare to remove the rejected part from the list of rejections
+ resurrectedExports.AddRange(partDefinition.ExportDefinitions);
+
+ // Capture the local so that the closure below refers to the current definition
+ // in the loop and not the value of 'partDefinition' when the closure executes
+ var capturedPartDefinition = partDefinition;
+ localAtomicComposition.AddCompleteAction(() =>
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ this._rejectedParts.Remove(capturedPartDefinition);
+ }
+
+ CompositionTrace.PartDefinitionResurrected(capturedPartDefinition);
+ });
+ }
+ }
+
+ // Notify anyone sourcing exports that the resurrected exports have appeared
+ if (resurrectedExports.Any())
+ {
+ this.OnExportsChanging(
+ new ExportsChangeEventArgs(resurrectedExports, new ExportDefinition[0], localAtomicComposition));
+
+ localAtomicComposition.AddCompleteAction(() => this.OnExportsChanged(
+ new ExportsChangeEventArgs(resurrectedExports, new ExportDefinition[0], null)));
+ }
+
+ localAtomicComposition.Complete();
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+
+ /// <summary>
+ /// EnsureCanRun must be called from within a lock.
+ /// </summary>
+ [DebuggerStepThrough]
+ private void EnsureCanRun()
+ {
+ if ((this._sourceProvider == null) || (this._importEngine == null))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectMustBeInitialized, "SourceProvider")); // NOLOC
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void EnsureRunning()
+ {
+ if (!this._isRunning)
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._isRunning)
+ {
+ this.EnsureCanRun();
+ this._isRunning = true;
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// EnsureCanSet<T> must be called from within a lock.
+ /// </summary>
+ /// <typeparam name="T"></typeparam>
+ /// <param name="currentValue"></param>
+ [DebuggerStepThrough]
+ private void EnsureCanSet<T>(T currentValue)
+ where T : class
+ {
+ if ((this._isRunning) || (currentValue != null))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectAlreadyInitialized));
+ }
+ }
+
+ private Func<ComposablePartDefinition, AtomicCompositionQueryState> GetAtomicCompositionQuery(AtomicComposition atomicComposition)
+ {
+ Func<ComposablePartDefinition, AtomicCompositionQueryState> atomicCompositionQuery;
+ atomicComposition.TryGetValue(this, out atomicCompositionQuery);
+
+ if (atomicCompositionQuery == null)
+ {
+ return (definition) => AtomicCompositionQueryState.Unknown;
+ }
+
+ return atomicCompositionQuery;
+ }
+
+ private void UpdateAtomicCompositionQuery(
+ AtomicComposition atomicComposition,
+ Func<ComposablePartDefinition, bool> query,
+ AtomicCompositionQueryState state)
+ {
+ var parentQuery = GetAtomicCompositionQuery(atomicComposition);
+ Func<ComposablePartDefinition, AtomicCompositionQueryState> newQuery = definition =>
+ {
+ if (query(definition))
+ {
+ return state;
+ }
+ return parentQuery(definition);
+ };
+
+ atomicComposition.SetValue(this, newQuery);
+ }
+
+ private enum AtomicCompositionQueryState
+ {
+ Unknown,
+ TreatAsRejected,
+ TreatAsValidated,
+ NeedsTesting
+ };
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs
new file mode 100644
index 0000000..9d2ee11
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogChangeEventArgs.cs
@@ -0,0 +1,81 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// Provides data for the <see cref="INotifyComposablePartCatalogChanged.Changed"/> and
+ /// <see cref="INotifyComposablePartCatalogChanged.Changing"/> events.
+ /// </summary>
+ public class ComposablePartCatalogChangeEventArgs : EventArgs
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartCatalogChangeEventArgs"/>.
+ /// </summary>
+ /// <param name="addedDefinitions">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
+ /// are being added to the <see cref="ComposablePartCatalog"/>.
+ /// </param>
+ /// <param name="removedDefinitions">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
+ /// are being removed from the <see cref="ComposablePartCatalog"/>.
+ /// </param>
+ /// <param name="atomicComposition">
+ /// A <see cref="AtomicComposition"/> representing all tentative changes that will
+ /// be completed if the change is successful, or discarded if it is not.
+ /// <see langword="null"/> if being applied outside a <see cref="AtomicComposition"/>
+ /// or during a <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="addedDefinitions"/> or <paramref name="removedDefinitions"/> is <see langword="null"/>.
+ /// </exception>
+ public ComposablePartCatalogChangeEventArgs(IEnumerable<ComposablePartDefinition> addedDefinitions,
+ IEnumerable<ComposablePartDefinition> removedDefinitions, AtomicComposition atomicComposition)
+ {
+ Requires.NotNull(addedDefinitions, "addedDefinitions");
+ Requires.NotNull(removedDefinitions, "removedDefinitions");
+
+ this.AddedDefinitions = addedDefinitions.AsArray();
+ this.RemovedDefinitions = removedDefinitions.AsArray();
+ this.AtomicComposition = atomicComposition;
+ }
+
+ /// <summary>
+ /// Gets the identifiers of the parts that have been added.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
+ /// have been added to the <see cref="ComposablePartCatalog"/>.
+ /// </value>
+ public IEnumerable<ComposablePartDefinition> AddedDefinitions { get; private set; }
+
+ /// <summary>
+ /// Gets the identifiers of the parts that have been removed.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ComposablePartDefinition"/> objects that
+ /// have been removed from from the <see cref="ComposablePartCatalog"/>.
+ /// </value>
+ public IEnumerable<ComposablePartDefinition> RemovedDefinitions { get; private set; }
+
+ /// <summary>
+ /// Gets the atomicComposition, if any, that this change applies to.
+ /// </summary>
+ /// <value>
+ /// A <see cref="AtomicComposition"/> that this set of changes applies too.
+ /// It can be <see langword="null"/> if the changes are being applied outside a
+ /// <see cref="AtomicComposition"/> or during a
+ /// <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
+ ///
+ /// When the value is non-null it should be used to record temporary changed state
+ /// and actions that will be executed when the atomicComposition is completeed.
+ /// </value>
+ public AtomicComposition AtomicComposition { get; private set; }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs
new file mode 100644
index 0000000..ed20128
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartCatalogCollection.cs
@@ -0,0 +1,420 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.ObjectModel;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Diagnostics;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// This class implements a threadsafe ICollection{T} of ComposablePartCatalog.
+ /// It is exposed as an ICollection(ComposablePartCatalog)
+ /// It is threadsafe, notifications are not marshalled using a SynchronizationContext.
+ /// It is Disposable.
+ /// </summary>
+ internal class ComposablePartCatalogCollection : ICollection<ComposablePartCatalog>, INotifyComposablePartCatalogChanged, IDisposable
+ {
+ private readonly Lock _lock = new Lock();
+ private Action<ComposablePartCatalogChangeEventArgs> _onChanged;
+ private Action<ComposablePartCatalogChangeEventArgs> _onChanging;
+ private List<ComposablePartCatalog> _catalogs = new List<ComposablePartCatalog>();
+ private volatile bool _isCopyNeeded = false;
+ private volatile bool _isDisposed = false;
+ private bool _hasChanged = false;
+
+ public ComposablePartCatalogCollection(IEnumerable<ComposablePartCatalog> catalogs)
+ : this(catalogs, null, null)
+ {
+ }
+
+ public ComposablePartCatalogCollection(
+ IEnumerable<ComposablePartCatalog> catalogs,
+ Action<ComposablePartCatalogChangeEventArgs> onChanged,
+ Action<ComposablePartCatalogChangeEventArgs> onChanging)
+ {
+ catalogs = catalogs ?? Enumerable.Empty<ComposablePartCatalog>();
+ this._catalogs = new List<ComposablePartCatalog>(catalogs);
+ this._onChanged = onChanged;
+ this._onChanging = onChanging;
+
+ SubscribeToCatalogNotifications(catalogs);
+ }
+
+ public void Add(ComposablePartCatalog item)
+ {
+ Requires.NotNull(item, "item");
+
+ this.ThrowIfDisposed();
+
+ var addedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.Parts.ToArray(), false);
+
+ using (var atomicComposition = new AtomicComposition())
+ {
+ this.RaiseChangingEvent(addedParts, null, atomicComposition);
+
+ using (new WriteLock(this._lock))
+ {
+ if (this._isCopyNeeded)
+ {
+ this._catalogs = new List<ComposablePartCatalog>(this._catalogs);
+ this._isCopyNeeded = false;
+ }
+ this._hasChanged = true;
+ this._catalogs.Add(item);
+ }
+
+ this.SubscribeToCatalogNotifications(item);
+
+ // Complete after the catalog changes are written
+ atomicComposition.Complete();
+ }
+
+ this.RaiseChangedEvent(addedParts, null);
+ }
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changed.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changing.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
+
+ public void Clear()
+ {
+ this.ThrowIfDisposed();
+
+ // No action is required if we are already empty
+ ComposablePartCatalog[] catalogs = null;
+ using (new ReadLock(this._lock))
+ {
+ if (this._catalogs.Count == 0)
+ {
+ return;
+ }
+ catalogs = this._catalogs.ToArray();
+ }
+
+ //TODO-MT: This is pretty suspect - we can easily eliminate catalogs that aren't listed as being
+ // removed. Then again, the idea of trying to mutate the catalog on two threads at the same time is pretty
+ // suspect to begin with. When would that ever result in a meaningful composition?
+
+ // We are doing this outside of the lock, so it's possible that the catalog will continute propagating events from things
+ // we are about to unsubscribe from. Given the non-specificity of our event, in the worst case scenario we would simply fire
+ // unnecessary events.
+
+ var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => catalogs.SelectMany(catalog => catalog.Parts).ToArray(), false);
+
+ // Validate the changes before applying them
+ using (var atomicComposition = new AtomicComposition())
+ {
+ this.RaiseChangingEvent(null, removedParts, atomicComposition);
+ this.UnsubscribeFromCatalogNotifications(catalogs);
+
+ using (new WriteLock(this._lock))
+ {
+ this._catalogs = new List<ComposablePartCatalog>();
+
+ this._isCopyNeeded = false;
+ this._hasChanged = true;
+ }
+
+ // Complete after the catalog changes are written
+ atomicComposition.Complete();
+ }
+
+ this.RaiseChangedEvent(null, removedParts);
+ }
+
+ public bool Contains(ComposablePartCatalog item)
+ {
+ Requires.NotNull(item, "item");
+
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ return this._catalogs.Contains(item);
+ }
+ }
+
+ public void CopyTo(ComposablePartCatalog[] array, int arrayIndex)
+ {
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ this._catalogs.CopyTo(array, arrayIndex);
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ return this._catalogs.Count;
+ }
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ return false;
+ }
+ }
+
+ public bool Remove(ComposablePartCatalog item)
+ {
+ Requires.NotNull(item, "item");
+
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ if (!this._catalogs.Contains(item))
+ {
+ return false;
+ }
+ }
+
+ bool isSuccessfulRemoval = false;
+
+ var removedParts = new Lazy<IEnumerable<ComposablePartDefinition>>(() => item.Parts.ToArray(), false);
+ using (var atomicComposition = new AtomicComposition())
+ {
+ this.RaiseChangingEvent(null, removedParts, atomicComposition);
+
+ using (new WriteLock(this._lock))
+ {
+ if (_isCopyNeeded)
+ {
+ this._catalogs = new List<ComposablePartCatalog>(this._catalogs);
+ this._isCopyNeeded = false;
+ }
+
+ isSuccessfulRemoval = this._catalogs.Remove(item);
+ if (isSuccessfulRemoval)
+ {
+ this._hasChanged = true;
+ }
+ }
+
+ this.UnsubscribeFromCatalogNotifications(item);
+
+ // Complete after the catalog changes are written
+ atomicComposition.Complete();
+ }
+
+ this.RaiseChangedEvent(null, removedParts);
+
+ return isSuccessfulRemoval;
+ }
+
+ internal bool HasChanged
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ return this._hasChanged;
+ }
+ }
+ }
+
+ public IEnumerator<ComposablePartCatalog> GetEnumerator()
+ {
+ this.ThrowIfDisposed();
+
+ using (new ReadLock(this._lock))
+ {
+ IEnumerator<ComposablePartCatalog> enumerator = this._catalogs.GetEnumerator();
+ this._isCopyNeeded = true;
+ return enumerator;
+ }
+ }
+
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return this.GetEnumerator();
+ }
+
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (!this._isDisposed)
+ {
+ bool disposeLock = false;
+ IEnumerable<ComposablePartCatalog> catalogs = null;
+ try
+ {
+ using (new WriteLock(this._lock))
+ {
+ if (!this._isDisposed)
+ {
+ disposeLock = true;
+
+ catalogs = this._catalogs;
+ this._catalogs = null;
+
+ this._isDisposed = true;
+ }
+ }
+ }
+ finally
+ {
+ if (catalogs != null)
+ {
+ this.UnsubscribeFromCatalogNotifications(catalogs);
+ catalogs.ForEach(catalog => catalog.Dispose());
+ }
+
+ if (disposeLock)
+ {
+ this._lock.Dispose();
+ }
+ }
+ }
+ }
+ }
+
+ private void RaiseChangedEvent(
+ Lazy<IEnumerable<ComposablePartDefinition>> addedDefinitions,
+ Lazy<IEnumerable<ComposablePartDefinition>> removedDefinitions)
+ {
+ if (this._onChanged == null || this.Changed == null)
+ {
+ return;
+ }
+
+ var added = (addedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : addedDefinitions.Value);
+ var removed = (removedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : removedDefinitions.Value);
+
+ this._onChanged.Invoke(new ComposablePartCatalogChangeEventArgs(added, removed, null));
+ }
+
+ public void OnChanged(object sender, ComposablePartCatalogChangeEventArgs e)
+ {
+ var changedEvent = this.Changed;
+ if (changedEvent != null)
+ {
+ changedEvent(sender, e);
+ }
+ }
+
+ private void RaiseChangingEvent(
+ Lazy<IEnumerable<ComposablePartDefinition>> addedDefinitions,
+ Lazy<IEnumerable<ComposablePartDefinition>> removedDefinitions,
+ AtomicComposition atomicComposition)
+ {
+ if (this._onChanging == null || this.Changing == null)
+ {
+ return;
+ }
+ var added = (addedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : addedDefinitions.Value);
+ var removed = (removedDefinitions == null ? Enumerable.Empty<ComposablePartDefinition>() : removedDefinitions.Value);
+
+ this._onChanging.Invoke(new ComposablePartCatalogChangeEventArgs(added, removed, atomicComposition));
+ }
+
+ public void OnChanging(object sender, ComposablePartCatalogChangeEventArgs e)
+ {
+ var changingEvent = this.Changing;
+ if (changingEvent != null)
+ {
+ changingEvent(sender, e);
+ }
+ }
+
+ private void OnContainedCatalogChanged(object sender, ComposablePartCatalogChangeEventArgs e)
+ {
+ if (this._onChanged == null || this.Changed == null)
+ {
+ return;
+ }
+
+ this._onChanged.Invoke(e);
+ }
+
+ private void OnContainedCatalogChanging(object sender, ComposablePartCatalogChangeEventArgs e)
+ {
+ if (this._onChanging == null || this.Changing == null)
+ {
+ return;
+ }
+
+ this._onChanging.Invoke(e);
+ }
+
+ private void SubscribeToCatalogNotifications(ComposablePartCatalog catalog)
+ {
+ INotifyComposablePartCatalogChanged notifyCatalog = catalog as INotifyComposablePartCatalogChanged;
+ if (notifyCatalog != null)
+ {
+ notifyCatalog.Changed += this.OnContainedCatalogChanged;
+ notifyCatalog.Changing += this.OnContainedCatalogChanging;
+ }
+ }
+
+ private void SubscribeToCatalogNotifications(IEnumerable<ComposablePartCatalog> catalogs)
+ {
+ foreach (var catalog in catalogs)
+ {
+ SubscribeToCatalogNotifications(catalog);
+ }
+ }
+
+ private void UnsubscribeFromCatalogNotifications(ComposablePartCatalog catalog)
+ {
+ INotifyComposablePartCatalogChanged notifyCatalog = catalog as INotifyComposablePartCatalogChanged;
+ if (notifyCatalog != null)
+ {
+ notifyCatalog.Changed -= this.OnContainedCatalogChanged;
+ notifyCatalog.Changing -= this.OnContainedCatalogChanging;
+ }
+ }
+
+ private void UnsubscribeFromCatalogNotifications(IEnumerable<ComposablePartCatalog> catalogs)
+ {
+ foreach (var catalog in catalogs)
+ {
+ UnsubscribeFromCatalogNotifications(catalog);
+ }
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs
new file mode 100644
index 0000000..5337b4e
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ComposablePartExportProvider.cs
@@ -0,0 +1,396 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Globalization;
+using System.Linq;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public class ComposablePartExportProvider : ExportProvider, IDisposable
+ {
+ private List<ComposablePart> _parts = new List<ComposablePart>();
+ private volatile bool _isDisposed = false;
+ private volatile bool _isRunning = false;
+ private CompositionLock _lock = null;
+ private ExportProvider _sourceProvider;
+ private ImportEngine _importEngine;
+ private volatile bool _currentlyComposing;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartExportProvider"/> class.
+ /// </summary>
+ public ComposablePartExportProvider() :
+ this(false)
+ {
+ }
+
+ public ComposablePartExportProvider(bool isThreadSafe)
+ {
+ this._lock = new CompositionLock(isThreadSafe);
+ }
+
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (!this._isDisposed)
+ {
+ bool disposeLock = false;
+ ImportEngine oldImportEngine = null;
+ try
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._isDisposed)
+ {
+ oldImportEngine = this._importEngine;
+ this._importEngine = null;
+ this._sourceProvider = null;
+ this._isDisposed = true;
+ disposeLock = true;
+ }
+ }
+ }
+ finally
+ {
+ if (oldImportEngine != null)
+ {
+ oldImportEngine.Dispose();
+ }
+
+ if (disposeLock)
+ {
+ this._lock.Dispose();
+ }
+ }
+ }
+ }
+ }
+
+ /// <summary>
+ /// Gets the export provider which provides the provider access to
+ /// exports.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ExportProvider"/> which provides the
+ /// <see cref="ComposablePartExportProvider"/> access to <see cref="Export"/> objects.
+ /// The default is <see langword="null"/>.
+ /// </value>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="value"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// This property has already been set.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// The methods on the <see cref="ComposablePartExportProvider"/>
+ /// have already been accessed.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePartExportProvider"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// This property must be set before accessing any methods on the
+ /// <see cref="ComposablePartExportProvider"/>.
+ /// </remarks>
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "EnsureCanSet ensures that the property is set only once, Dispose is not required")]
+ public ExportProvider SourceProvider
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ return this._sourceProvider;
+ }
+ set
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(value, "value");
+ using (this._lock.LockStateForWrite())
+ {
+ this.EnsureCanSet(this._sourceProvider);
+ this._sourceProvider = value;
+ }
+
+ // This should be safe to do outside the lock, because only the first setter will ever win
+ // and others will throw
+ ImportEngine importEngine = new ImportEngine(this._sourceProvider, this._lock.IsThreadSafe);
+ Thread.MemoryBarrier();
+ this._importEngine = importEngine;
+ }
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> to get.</param>
+ /// <returns></returns>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// The implementers should not treat the cardinality-related mismatches as errors, and are not
+ /// expected to throw exceptions in those cases.
+ /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
+ /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
+ /// </note>
+ /// </remarks>
+ protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ // Determine whether there is a composition atomicComposition-specific list of parts to use,
+ // failing that use the usual list. We never change the list of parts in place,
+ // but rather copy, change and write a new list atomically. Therefore all we need
+ // to do here is to read the _parts member.
+ List<ComposablePart> parts = null;
+ using (this._lock.LockStateForRead())
+ {
+ parts = atomicComposition.GetValueAllowNull(this, this._parts);
+ }
+
+ if (parts.Count == 0)
+ {
+ return Enumerable.Empty<Export>();
+ }
+
+ List<Export> exports = new List<Export>();
+ foreach (var part in parts)
+ {
+ foreach (var exportDefinition in part.ExportDefinitions)
+ {
+ if (definition.IsConstraintSatisfiedBy(exportDefinition))
+ {
+ exports.Add(this.CreateExport(part, exportDefinition));
+ }
+ }
+ }
+ return exports;
+ }
+
+ public void Compose(CompositionBatch batch)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ Requires.NotNull(batch, "batch");
+
+ // Quick exit test can be done prior to cloning since it's just an optimization, not a
+ // change in behavior
+ if ((batch.PartsToAdd.Count == 0) && (batch.PartsToRemove.Count == 0))
+ {
+ return;
+ }
+
+ CompositionResult result = CompositionResult.SucceededResult;
+
+ // Clone the batch, so that the external changes wouldn't happen half-way thorugh compose
+ // NOTE : this does not guarantee the atomicity of cloning, which is not the goal anyway,
+ // rather the fact that all subsequent calls will deal with an unchanging batch
+ batch = new CompositionBatch(batch.PartsToAdd, batch.PartsToRemove);
+
+ var newParts = GetUpdatedPartsList(batch);
+
+ // Allow only recursive calls from the import engine to see the changes until
+ // they've been verified ...
+ using (var atomicComposition = new AtomicComposition())
+ {
+ // Don't allow reentrant calls to compose during previewing to prevent
+ // corrupted state.
+ if (this._currentlyComposing)
+ {
+ throw new InvalidOperationException(Strings.ReentrantCompose);
+ }
+
+ this._currentlyComposing = true;
+
+ try
+ {
+ // In the meantime recursive calls need to be able to see the list as well
+ atomicComposition.SetValue(this, newParts);
+
+ // Recompose any existing imports effected by the these changes first so that
+ // adapters, resurrected parts, etc. can all play their role in satisfying
+ // imports for added parts
+ this.Recompose(batch, atomicComposition);
+
+ // Ensure that required imports can be satisfied
+ foreach (ComposablePart part in batch.PartsToAdd)
+ {
+ // collect the result of previewing all the adds in the batch
+ try
+ {
+ this._importEngine.PreviewImports(part, atomicComposition);
+ }
+ catch (ChangeRejectedException ex)
+ {
+ result = result.MergeResult(new CompositionResult(ex.Errors));
+ }
+ }
+
+ result.ThrowOnErrors(atomicComposition);
+
+ // Complete the new parts since they passed previewing.`
+ using (this._lock.LockStateForWrite())
+ {
+ this._parts = newParts;
+ }
+
+ atomicComposition.Complete();
+ }
+ finally
+ {
+ this._currentlyComposing = false;
+ }
+ }
+
+ // Satisfy Imports
+ // - Satisfy imports on all newly added component parts
+ foreach (ComposablePart part in batch.PartsToAdd)
+ {
+ result = result.MergeResult(CompositionServices.TryInvoke(() =>
+ this._importEngine.SatisfyImports(part)));
+ }
+
+ // return errors
+ result.ThrowOnErrors();
+ }
+
+ private List<ComposablePart> GetUpdatedPartsList(CompositionBatch batch)
+ {
+ Assumes.NotNull(batch);
+
+ // Copy the current list of parts - we are about to modify it
+ // This is an OK thing to do as this is the only method that can modify the List AND Compose can
+ // only be executed on one thread at a time - thus two different threads cannot tramp over each other
+ List<ComposablePart> parts = null;
+ using (this._lock.LockStateForRead())
+ {
+ parts = this._parts.ToList(); // this copies the list
+ }
+
+ foreach (ComposablePart part in batch.PartsToAdd)
+ {
+ parts.Add(part);
+ }
+
+ foreach (ComposablePart part in batch.PartsToRemove)
+ {
+ parts.Remove(part);
+ }
+
+ return parts;
+ }
+
+ private void Recompose(CompositionBatch batch, AtomicComposition atomicComposition)
+ {
+ Assumes.NotNull(batch);
+
+ // Unregister any removed component parts
+ foreach (ComposablePart part in batch.PartsToRemove)
+ {
+ this._importEngine.ReleaseImports(part, atomicComposition);
+ }
+
+ // Recompose any imports effected by the these changes (the changes are
+ // observable through GetExports in the appropriate atomicComposition, thus we can fire
+ // the event
+ IEnumerable<ExportDefinition> addedExports = batch.PartsToAdd.Count != 0 ?
+ batch.PartsToAdd.SelectMany(part => part.ExportDefinitions).ToArray() :
+ new ExportDefinition[0];
+
+ IEnumerable<ExportDefinition> removedExports = batch.PartsToRemove.Count != 0 ?
+ batch.PartsToRemove.SelectMany(part => part.ExportDefinitions).ToArray() :
+ new ExportDefinition[0];
+
+ this.OnExportsChanging(
+ new ExportsChangeEventArgs(addedExports, removedExports, atomicComposition));
+
+ atomicComposition.AddCompleteAction(() => this.OnExportsChanged(
+ new ExportsChangeEventArgs(addedExports, removedExports, null)));
+ }
+
+ private Export CreateExport(ComposablePart part, ExportDefinition export)
+ {
+ return new Export(export, () => GetExportedValue(part, export));
+ }
+
+ private object GetExportedValue(ComposablePart part, ExportDefinition export)
+ {
+ this.ThrowIfDisposed();
+ this.EnsureRunning();
+
+ return CompositionServices.GetExportedValueFromComposedPart(this._importEngine, part, export);
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw new ObjectDisposedException(this.GetType().Name);
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void EnsureCanRun()
+ {
+ if ((this._sourceProvider == null) || (this._importEngine == null))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectMustBeInitialized, "SourceProvider")); // NOLOC
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void EnsureRunning()
+ {
+ if (!this._isRunning)
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._isRunning)
+ {
+ this.EnsureCanRun();
+ this._isRunning = true;
+ }
+ }
+ }
+ }
+
+ [DebuggerStepThrough]
+ private void EnsureCanSet<T>(T currentValue)
+ where T : class
+ {
+ if ((this._isRunning) || (currentValue != null))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.ObjectAlreadyInitialized));
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs
new file mode 100644
index 0000000..fd5875e
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.SingleExportComposablePart.cs
@@ -0,0 +1,62 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ partial class CompositionBatch
+ {
+ // Represents a part that exports a single export
+ private class SingleExportComposablePart : ComposablePart
+ {
+ private readonly Export _export;
+
+ public SingleExportComposablePart(Export export)
+ {
+ Assumes.NotNull(export);
+
+ this._export = export;
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get { return MetadataServices.EmptyMetadata; }
+ }
+
+ public override IEnumerable<ExportDefinition> ExportDefinitions
+ {
+ get { return new ExportDefinition[] { _export.Definition }; }
+ }
+
+ public override IEnumerable<ImportDefinition> ImportDefinitions
+ {
+ get { return Enumerable.Empty<ImportDefinition>(); }
+ }
+
+ public override object GetExportedValue(ExportDefinition definition)
+ {
+ Requires.NotNull(definition, "definition");
+
+ if (definition != _export.Definition)
+ {
+ throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
+ }
+
+ return _export.Value;
+ }
+
+ public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
+ {
+ Requires.NotNull(definition, "definition");
+ Requires.NotNullOrNullElements(exports, "exports");
+
+ throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.cs
new file mode 100644
index 0000000..43dd7f9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionBatch.cs
@@ -0,0 +1,174 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq;
+using Microsoft.Internal;
+using System.Collections.ObjectModel;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CompositionBatch
+ {
+ private object _lock = new object();
+ private bool _copyNeededForAdd;
+ private bool _copyNeededForRemove;
+ private List<ComposablePart> _partsToAdd;
+ private ReadOnlyCollection<ComposablePart> _readOnlyPartsToAdd;
+ private List<ComposablePart> _partsToRemove;
+ private ReadOnlyCollection<ComposablePart> _readOnlyPartsToRemove;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionBatch"/> class.
+ /// </summary>
+ public CompositionBatch() :
+ this(null, null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionBatch"/> class.
+ /// </summary>
+ /// <param name="partsToAdd">The parts to add.</param>
+ /// <param name="partsToRemove">The parts to remove.</param>
+ public CompositionBatch(IEnumerable<ComposablePart> partsToAdd, IEnumerable<ComposablePart> partsToRemove)
+ {
+ this._partsToAdd = new List<ComposablePart>();
+ if (partsToAdd != null)
+ {
+ foreach (var part in partsToAdd)
+ {
+ if (part == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement("partsToAdd");
+ }
+ this._partsToAdd.Add(part);
+ }
+ }
+ this._readOnlyPartsToAdd = this._partsToAdd.AsReadOnly();
+
+ this._partsToRemove = new List<ComposablePart>();
+ if (partsToRemove != null)
+ {
+ foreach (var part in partsToRemove)
+ {
+ if (part == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement("partsToRemove");
+ }
+ this._partsToRemove.Add(part);
+ }
+ }
+ this._readOnlyPartsToRemove = this._partsToRemove.AsReadOnly();
+ }
+
+ /// <summary>
+ /// Returns the collection of parts that will be added.
+ /// </summary>
+ /// <value>The parts to be added.</value>
+ public ReadOnlyCollection<ComposablePart> PartsToAdd
+ {
+ get
+ {
+ lock (this._lock)
+ {
+ this._copyNeededForAdd = true;
+ return this._readOnlyPartsToAdd;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Returns the collection of parts that will be removed.
+ /// </summary>
+ /// <value>The parts to be removed.</value>
+ public ReadOnlyCollection<ComposablePart> PartsToRemove
+ {
+ get
+ {
+ lock (this._lock)
+ {
+ this._copyNeededForRemove = true;
+ return this._readOnlyPartsToRemove;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Adds the specified part to the <see cref="CompositionBatch"/>.
+ /// </summary>
+ /// <param name="part">
+ /// The part.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ public void AddPart(ComposablePart part)
+ {
+ Requires.NotNull(part, "part");
+ lock (this._lock)
+ {
+ if (this._copyNeededForAdd)
+ {
+ this._partsToAdd = new List<ComposablePart>(this._partsToAdd);
+ this._readOnlyPartsToAdd = this._partsToAdd.AsReadOnly();
+ this._copyNeededForAdd = false;
+ }
+ this._partsToAdd.Add(part);
+ }
+ }
+
+ /// <summary>
+ /// Removes the specified part from the <see cref="CompositionBatch"/>.
+ /// </summary>
+ /// <param name="part">
+ /// The part.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ public void RemovePart(ComposablePart part)
+ {
+ Requires.NotNull(part, "part");
+ lock (this._lock)
+ {
+ if (this._copyNeededForRemove)
+ {
+ this._partsToRemove = new List<ComposablePart>(this._partsToRemove);
+ this._readOnlyPartsToRemove = this._partsToRemove.AsReadOnly();
+ this._copyNeededForRemove = false;
+ }
+ this._partsToRemove.Add(part);
+ }
+ }
+
+ /// <summary>
+ /// Adds the specified export to the <see cref="CompositionBatch"/>.
+ /// </summary>
+ /// <param name="export">
+ /// The <see cref="Export"/> to add to the <see cref="CompositionBatch"/>.
+ /// </param>
+ /// <returns>
+ /// A <see cref="ComposablePart"/> that can be used remove the <see cref="Export"/>
+ /// from the <see cref="CompositionBatch"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="export"/> is <see langword="null"/>.
+ /// </exception>
+ /// <remarks>
+ /// </remarks>
+ public ComposablePart AddExport(Export export)
+ {
+ Requires.NotNull(export, "export");
+
+ ComposablePart part = new SingleExportComposablePart(export);
+
+ this.AddPart(part);
+
+ return part;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionConstants.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionConstants.cs
new file mode 100644
index 0000000..5a1c29a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionConstants.cs
@@ -0,0 +1,20 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public static class CompositionConstants
+ {
+ private const string CompositionNamespace = "System.ComponentModel.Composition";
+
+ public const string PartCreationPolicyMetadataName = CompositionNamespace + ".CreationPolicy";
+ public const string ExportTypeIdentityMetadataName = "ExportTypeIdentity";
+ internal const string ProductDefinitionMetadataName = "ProductDefinition";
+
+ internal const string PartCreatorContractName = CompositionNamespace + ".Contracts.ExportFactory";
+ internal static readonly string PartCreatorTypeIdentity = AttributedModelServices.GetTypeIdentity(typeof(ComposablePartDefinition));
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionContainer.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionContainer.cs
new file mode 100644
index 0000000..34c5e6c
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionContainer.cs
@@ -0,0 +1,410 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class CompositionContainer : ExportProvider, ICompositionService, IDisposable
+ {
+ private ImportEngine _importEngine;
+ private ComposablePartExportProvider _partExportProvider;
+ private AggregateExportProvider _aggregatingExportProvider;
+ private ExportProvider _rootProvider;
+ private CatalogExportProvider _catalogExportProvider;
+ private readonly ReadOnlyCollection<ExportProvider> _providers;
+ private volatile int _isDisposed = 0;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContainer"/> class.
+ /// </summary>
+ public CompositionContainer()
+ : this((ComposablePartCatalog)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContainer"/> class
+ /// with the specified export providers.
+ /// </summary>
+ /// <param name="providers">
+ /// A <see cref="Array"/> of <see cref="ExportProvider"/> objects which provide
+ /// the <see cref="CompositionContainer"/> access to <see cref="Export"/> objects,
+ /// or <see langword="null"/> to set <see cref="Providers"/> to an empty
+ /// <see cref="ReadOnlyCollection{T}"/>.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="providers"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public CompositionContainer(params ExportProvider[] providers) :
+ this((ComposablePartCatalog)null, providers)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CompositionContainer"/> class
+ /// with the specified catalog and export providers.
+ /// </summary>
+ /// <param name="providers">
+ /// A <see cref="Array"/> of <see cref="ExportProvider"/> objects which provide
+ /// the <see cref="CompositionContainer"/> access to <see cref="Export"/> objects,
+ /// or <see langword="null"/> to set <see cref="Providers"/> to an empty
+ /// <see cref="ReadOnlyCollection{T}"/>.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="providers"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public CompositionContainer(ComposablePartCatalog catalog, params ExportProvider[] providers):
+ this(catalog, false, providers)
+ {
+ }
+
+ public CompositionContainer(ComposablePartCatalog catalog, bool isThreadSafe, params ExportProvider[] providers)
+ {
+ this._importEngine = new ImportEngine(this, isThreadSafe);
+ this._partExportProvider = new ComposablePartExportProvider(isThreadSafe);
+ this._partExportProvider.SourceProvider = this;
+ this._providers = new ReadOnlyCollection<ExportProvider>(providers != null ? (ExportProvider[])providers.Clone() : new ExportProvider[0]);
+
+ List<ExportProvider> providerList = new List<ExportProvider>();
+
+ providerList.Add(this._partExportProvider);
+
+ if (catalog != null)
+ {
+ this._catalogExportProvider = new CatalogExportProvider(catalog, isThreadSafe);
+ this._catalogExportProvider.SourceProvider = this;
+
+ providerList.Add(this._catalogExportProvider);
+ }
+
+ foreach (var provider in this._providers)
+ {
+ if (provider == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement("providers");
+ }
+ providerList.Add(provider);
+ }
+
+ // we only build the aggregating provider if necessary - that is, if we have more than one provider to aggregate
+ if (providerList.Count > 1)
+ {
+ this._aggregatingExportProvider = new AggregateExportProvider(providerList);
+ this._rootProvider = this._aggregatingExportProvider;
+ }
+ else
+ {
+ Assumes.IsTrue(providerList.Count == 1);
+ this._rootProvider = providerList[0];
+ }
+
+ this._rootProvider.ExportsChanged += this.OnExportsChangedInternal;
+ this._rootProvider.ExportsChanging += this.OnExportsChangingInternal;
+ }
+
+ /// <summary>
+ /// Gets the catalog which provides the container access to exports produced
+ /// from composable parts.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ComposablePartCatalog"/> which provides the
+ /// <see cref="CompositionContainer"/> access to exports produced from
+ /// <see cref="ComposablePart"/> objects. The default is <see langword="null"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public ComposablePartCatalog Catalog
+ {
+ get
+ {
+ ThrowIfDisposed();
+
+ if (_catalogExportProvider != null)
+ {
+ return _catalogExportProvider.Catalog;
+ }
+
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Gets the export providers which provide the container access to additional exports.
+ /// </summary>
+ /// <value>
+ /// A <see cref="ReadOnlyCollection{T}"/> of <see cref="ExportProvider"/> objects
+ /// which provide the <see cref="CompositionContainer"/> access to additional
+ /// <see cref="Export"/> objects. The default is an empty
+ /// <see cref="ReadOnlyCollection{T}"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public ReadOnlyCollection<ExportProvider> Providers
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ return this._providers;
+ }
+ }
+
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
+#pragma warning disable 420
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+#pragma warning restore 420
+ {
+ this._rootProvider.ExportsChanged -= this.OnExportsChangedInternal;
+ this._rootProvider.ExportsChanging -= this.OnExportsChangingInternal;
+ if (this._aggregatingExportProvider != null)
+ {
+ this._aggregatingExportProvider.Dispose();
+ }
+ this._partExportProvider.Dispose();
+ if (this._catalogExportProvider != null)
+ {
+ this._catalogExportProvider.Dispose();
+ }
+ this._importEngine.Dispose();
+ }
+ }
+ }
+
+ public void Compose(CompositionBatch batch)
+ {
+ Requires.NotNull(batch, "batch");
+
+ this.ThrowIfDisposed();
+ this._partExportProvider.Compose(batch);
+ }
+
+ /// <summary>
+ /// Releases the <see cref="Export"/> from the <see cref="CompositionContainer"/>. The behavior
+ /// may vary depending on the implementation of the <see cref="ExportProvider"/> that produced
+ /// the <see cref="Export"/> instance. As a general rule non shared exports should be early
+ /// released causing them to be detached from the container.
+ ///
+ /// For example the <see cref="CatalogExportProvider"/> will only release
+ /// an <see cref="Export"/> if it comes from a <see cref="ComposablePart"/> that was constructed
+ /// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking
+ /// the dependency chain of the <see cref="Export"/>s, detaching references from the container and
+ /// calling Dispose on the <see cref="ComposablePart"/>s as needed. If the <see cref="Export"/>
+ /// was constructed under a <see cref="CreationPolicy.Shared" /> context the
+ /// <see cref="CatalogExportProvider"/> will do nothing as it may be in use by other requestors.
+ /// Those will only be detached when the container is itself disposed.
+ /// </summary>
+ /// <param name="export"><see cref="Export"/> that needs to be released.</param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="export"/> is <see langword="null"/>.
+ /// </exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822")]
+ public void ReleaseExport(Export export)
+ {
+ Requires.NotNull(export, "export");
+
+ IDisposable dependency = export as IDisposable;
+
+ if (dependency != null)
+ {
+ dependency.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Releases the <see cref="Lazy{T}"/> from the <see cref="CompositionContainer"/>. The behavior
+ /// may vary depending on the implementation of the <see cref="ExportProvider"/> that produced
+ /// the <see cref="Export"/> instance. As a general rule non shared exports should be early
+ /// released causing them to be detached from the container.
+ ///
+ /// For example the <see cref="CatalogExportProvider"/> will only release
+ /// an <see cref="Lazy{T}"/> if it comes from a <see cref="ComposablePart"/> that was constructed
+ /// under a <see cref="CreationPolicy.NonShared" /> context. Release in this context means walking
+ /// the dependency chain of the <see cref="Export"/>s, detaching references from the container and
+ /// calling Dispose on the <see cref="ComposablePart"/>s as needed. If the <see cref="Export"/>
+ /// was constructed under a <see cref="CreationPolicy.Shared" /> context the
+ /// <see cref="CatalogExportProvider"/> will do nothing as it may be in use by other requestors.
+ /// Those will only be detached when the container is itself disposed.
+ /// </summary>
+ /// <param name="export"><see cref="Export"/> that needs to be released.</param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="export"/> is <see langword="null"/>.
+ /// </exception>
+ [SuppressMessage("Microsoft.Performance", "CA1822")]
+ public void ReleaseExport<T>(Lazy<T> export)
+ {
+ Requires.NotNull(export, "export");
+
+ IDisposable dependency = export as IDisposable;
+
+ if (dependency != null)
+ {
+ dependency.Dispose();
+ }
+ }
+
+ /// <summary>
+ /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
+ /// See also <see cref="ReleaseExport"/>.
+ /// </summary>
+ /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="exports"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ public void ReleaseExports(IEnumerable<Export> exports)
+ {
+ Requires.NotNullOrNullElements(exports, "exports");
+
+ foreach (Export export in exports)
+ {
+ this.ReleaseExport(export);
+ }
+ }
+
+ /// <summary>
+ /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
+ /// See also <see cref="ReleaseExport"/>.
+ /// </summary>
+ /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="exports"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public void ReleaseExports<T>(IEnumerable<Lazy<T>> exports)
+ {
+ Requires.NotNullOrNullElements(exports, "exports");
+
+ foreach (Lazy<T> export in exports)
+ {
+ this.ReleaseExport(export);
+ }
+ }
+
+ /// <summary>
+ /// Releases a set of <see cref="Export"/>s from the <see cref="CompositionContainer"/>.
+ /// See also <see cref="ReleaseExport"/>.
+ /// </summary>
+ /// <param name="exports"><see cref="Export"/>s that need to be released.</param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="exports"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public void ReleaseExports<T, TMetadataView>(IEnumerable<Lazy<T, TMetadataView>> exports)
+ {
+ Requires.NotNullOrNullElements(exports, "exports");
+
+ foreach (Lazy<T, TMetadataView> export in exports)
+ {
+ this.ReleaseExport(export);
+ }
+ }
+
+ /// <summary>
+ /// Sets the imports of the specified composable part exactly once and they will not
+ /// ever be recomposed.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to set the imports.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ICompositionService"/> has been disposed of.
+ /// </exception>
+ public void SatisfyImportsOnce(ComposablePart part)
+ {
+ this.ThrowIfDisposed();
+ this._importEngine.SatisfyImportsOnce(part);
+ }
+
+ internal void OnExportsChangedInternal(object sender, ExportsChangeEventArgs e)
+ {
+ this.OnExportsChanged(e);
+ }
+
+ internal void OnExportsChangingInternal(object sender, ExportsChangeEventArgs e)
+ {
+ this.OnExportsChanging(e);
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> to get.</param>
+ /// <returns></returns>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// The implementers should not treat the cardinality-related mismatches as errors, and are not
+ /// expected to throw exceptions in those cases.
+ /// For instance, if the import requests exactly one export and the provider has no matching exports or more than one,
+ /// it should return an empty <see cref="IEnumerable{T}"/> of <see cref="Export"/>.
+ /// </note>
+ /// </remarks>
+ protected override IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+
+ IEnumerable<Export> exports = null;
+ this._rootProvider.TryGetExports(definition, atomicComposition, out exports);
+
+ return exports;
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed == 1)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionLock.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionLock.cs
new file mode 100644
index 0000000..4edf397
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionLock.cs
@@ -0,0 +1,153 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#define SINGLETHREADEDLOCKENFORCEMENT
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ // This a a lock class that needs to be held in order to perform any mutation of the parts/parts state in the composition
+ // Today's implementation relies on the AppDomain-wide re-entrant lock for changes on the composition, and a narrow lock for changes in
+ // the state of the specific ImportEngine
+ // Today we make several assumptions to ensure thread-safety:
+ // 1. Each composition doesn't change lock affinity
+ // 2. Every part of the system that updates the status of the parts (in our case ImportEngine) needs to hold the same wide - lock
+ // 3. State of the import engine that gets accessed outside of the wide lock needs to be accessed in the context of the narrow lock
+ // 4. Narrow lock CAN be taken inside the wide lock
+ // 5. Wide lock CANNOT be taken inside the narrow lock
+ // 6. No 3rd party code will EVER get called inside the narrow lock
+ // Sadly, this means that we WILL be calling 3rd party code under a lock, but as long as the lock is re-entrant and they can't invoke us on anotehr thread
+ // we have no issue, other than potential overlocking
+ internal sealed class CompositionLock : IDisposable
+ {
+ // narrow lock
+ private readonly Lock _stateLock = null;
+ // wide lock
+ private static object _compositionLock = new object();
+
+ private int _isDisposed = 0;
+ private bool _isThreadSafe = false;
+
+ private static readonly EmptyLockHolder _EmptyLockHolder = new EmptyLockHolder();
+
+ public CompositionLock(bool isThreadSafe)
+ {
+ this._isThreadSafe = isThreadSafe;
+ if (isThreadSafe)
+ {
+ this._stateLock = new Lock();
+ }
+ }
+
+ public void Dispose()
+ {
+ if (this._isThreadSafe)
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ this._stateLock.Dispose();
+ }
+ }
+ }
+
+ public bool IsThreadSafe
+ {
+ get
+ {
+ return this._isThreadSafe;
+ }
+ }
+
+ private void EnterCompositionLock()
+ {
+#pragma warning disable 618
+ if (this._isThreadSafe)
+ {
+ Monitor.Enter(_compositionLock);
+ }
+#pragma warning restore 618
+ }
+
+ private void ExitCompositionLock()
+ {
+ if (this._isThreadSafe)
+ {
+ Monitor.Exit(_compositionLock);
+ }
+ }
+
+ public IDisposable LockComposition()
+ {
+ if (this._isThreadSafe)
+ {
+ return new CompositionLockHolder(this);
+ }
+ else
+ {
+ return _EmptyLockHolder;
+ }
+ }
+
+ public IDisposable LockStateForRead()
+ {
+ if (this._isThreadSafe)
+ {
+ return new ReadLock(this._stateLock);
+ }
+ else
+ {
+ return _EmptyLockHolder;
+ }
+ }
+
+ public IDisposable LockStateForWrite()
+ {
+ if (this._isThreadSafe)
+ {
+ return new WriteLock(this._stateLock);
+ }
+ else
+ {
+ return _EmptyLockHolder;
+ }
+ }
+
+ // NOTE : this should NOT be changed to a struct as ImportEngine relies on it
+ public sealed class CompositionLockHolder : IDisposable
+ {
+ private CompositionLock _lock;
+ private int _isDisposed;
+
+ public CompositionLockHolder(CompositionLock @lock)
+ {
+ this._lock = @lock;
+
+ this._isDisposed = 0;
+ this._lock.EnterCompositionLock();
+ }
+
+ public void Dispose()
+ {
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+ {
+ this._lock.ExitCompositionLock();
+ }
+ }
+ }
+
+ private sealed class EmptyLockHolder : IDisposable
+ {
+ public void Dispose()
+ {
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionServices.cs
new file mode 100644
index 0000000..77e5fdc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/CompositionServices.cs
@@ -0,0 +1,522 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.ComponentModel.Composition.AttributedModel;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.ReflectionModel;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ internal static class CompositionServices
+ {
+ internal static readonly Type InheritedExportAttributeType = typeof(InheritedExportAttribute);
+ internal static readonly Type ExportAttributeType = typeof(ExportAttribute);
+ internal static readonly Type AttributeType = typeof(Attribute);
+ internal static readonly Type ObjectType = typeof(object);
+
+ private static readonly string[] reservedMetadataNames = new string[]
+ {
+ CompositionConstants.PartCreationPolicyMetadataName
+ };
+
+ internal static Type GetDefaultTypeFromMember(this MemberInfo member)
+ {
+ Assumes.NotNull(member);
+
+ switch (member.MemberType)
+ {
+ case MemberTypes.Property:
+ return ((PropertyInfo)member).PropertyType;
+
+ case MemberTypes.NestedType:
+ case MemberTypes.TypeInfo:
+ return ((Type)member);
+
+ case MemberTypes.Field:
+ default:
+ Assumes.IsTrue(member.MemberType == MemberTypes.Field);
+ return ((FieldInfo)member).FieldType;
+ }
+ }
+
+ internal static string GetContractNameFromExport(this MemberInfo member, ExportAttribute export)
+ {
+ if (!string.IsNullOrEmpty(export.ContractName))
+ {
+ return export.ContractName;
+ }
+
+ if (export.ContractType != null)
+ {
+ return AttributedModelServices.GetContractName(export.ContractType);
+ }
+
+ if (member.MemberType == MemberTypes.Method)
+ {
+ return AttributedModelServices.GetTypeIdentity((MethodInfo)member);
+ }
+
+ return AttributedModelServices.GetContractName(member.GetDefaultTypeFromMember());
+ }
+
+ internal static string GetTypeIdentityFromExport(this MemberInfo member, ExportAttribute export)
+ {
+ if (export.ContractType != null)
+ {
+ return AttributedModelServices.GetTypeIdentity(export.ContractType);
+ }
+
+ if (member.MemberType == MemberTypes.Method)
+ {
+ return AttributedModelServices.GetTypeIdentity((MethodInfo)member);
+ }
+
+ return AttributedModelServices.GetTypeIdentity(member.GetDefaultTypeFromMember());
+ }
+
+ internal static Type GetContractTypeFromImport(this IAttributedImport import, ImportType importType)
+ {
+ if (import.ContractType != null)
+ {
+ return import.ContractType;
+ }
+
+ return importType.ContractType;
+ }
+
+ internal static string GetContractNameFromImport(this IAttributedImport import, ImportType importType)
+ {
+ if (!string.IsNullOrEmpty(import.ContractName))
+ {
+ return import.ContractName;
+ }
+
+ Type contractType = import.GetContractTypeFromImport(importType);
+
+ return AttributedModelServices.GetContractName(contractType);
+ }
+
+ internal static string GetTypeIdentityFromImport(this IAttributedImport import, ImportType importType)
+ {
+ Type contractType = import.GetContractTypeFromImport(importType);
+
+ // For our importers we treat object as not having a type identity
+ if (contractType == CompositionServices.ObjectType)
+ {
+ return null;
+ }
+
+ return AttributedModelServices.GetTypeIdentity(contractType);
+ }
+
+ internal static IDictionary<string, object> GetPartMetadataForType(this Type type, CreationPolicy creationPolicy)
+ {
+ IDictionary<string, object> dictionary = new Dictionary<string, object>(StringComparers.MetadataKeyNames);
+
+ if (creationPolicy != CreationPolicy.Any)
+ {
+ dictionary.Add(CompositionConstants.PartCreationPolicyMetadataName, creationPolicy);
+ }
+
+ foreach (PartMetadataAttribute partMetadata in type.GetAttributes<PartMetadataAttribute>())
+ {
+ if (reservedMetadataNames.Contains(partMetadata.Name, StringComparers.MetadataKeyNames)
+ || dictionary.ContainsKey(partMetadata.Name))
+ {
+ // Perhaps we should log an error here so that people know this value is being ignored.
+ continue;
+ }
+
+ dictionary.Add(partMetadata.Name, partMetadata.Value);
+ }
+
+ if (dictionary.Count == 0)
+ {
+ return MetadataServices.EmptyMetadata;
+ }
+ else
+ {
+ return dictionary;
+ }
+ }
+
+ internal static void TryExportMetadataForMember(this MemberInfo member, out IDictionary<string, object> dictionary)
+ {
+ dictionary = new Dictionary<string, object>();
+
+ foreach (var attr in member.GetAttributes<Attribute>())
+ {
+ var provider = attr as ExportMetadataAttribute;
+
+ if (provider != null)
+ {
+ if (reservedMetadataNames.Contains(provider.Name, StringComparers.MetadataKeyNames))
+ {
+ throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_ReservedMetadataNameUsed, member.GetDisplayName(), provider.Name);
+ }
+
+ // we pass "null" for valueType which would make it inferred. We don;t have additional type information when metadata
+ // goes through the ExportMetadataAttribute path
+ if (!dictionary.TryContributeMetadataValue(provider.Name, provider.Value, null, provider.IsMultiple))
+ {
+ throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_DuplicateMetadataNameValues, member.GetDisplayName(), provider.Name);
+ }
+ }
+ else
+ {
+ Type attrType = attr.GetType();
+ if ((attrType != CompositionServices.ExportAttributeType) && attrType.IsAttributeDefined<MetadataAttributeAttribute>(true))
+ {
+ bool allowsMultiple = false;
+ AttributeUsageAttribute usage = attrType.GetFirstAttribute<AttributeUsageAttribute>(true);
+
+ if (usage != null)
+ {
+ allowsMultiple = usage.AllowMultiple;
+ }
+
+ foreach (PropertyInfo pi in attrType.GetProperties())
+ {
+ if (pi.DeclaringType == CompositionServices.ExportAttributeType || pi.DeclaringType == CompositionServices.AttributeType)
+ {
+ // Don't contribute metadata properies from the base attribute types.
+ continue;
+ }
+
+ if (reservedMetadataNames.Contains(pi.Name, StringComparers.MetadataKeyNames))
+ {
+ throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_ReservedMetadataNameUsed, member.GetDisplayName(), provider.Name);
+ }
+
+ object value = pi.GetValue(attr, null);
+
+ if (value != null && !IsValidAttributeType(value.GetType()))
+ {
+ throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_MetadataContainsValueWithInvalidType, pi.GetDisplayName(), value.GetType().GetDisplayName());
+ }
+
+ if (!dictionary.TryContributeMetadataValue(pi.Name, value, pi.PropertyType, allowsMultiple))
+ {
+ throw ExceptionBuilder.CreateDiscoveryException(Strings.Discovery_DuplicateMetadataNameValues, member.GetDisplayName(), pi.Name);
+ }
+ }
+ }
+ }
+ }
+
+ // Need Keys.ToArray because we alter the dictionary in the loop
+ foreach (var key in dictionary.Keys.ToArray())
+ {
+ var list = dictionary[key] as MetadataList;
+ if (list != null)
+ {
+ dictionary[key] = list.ToArray();
+ }
+ }
+
+ return;
+ }
+
+ private static bool TryContributeMetadataValue(this IDictionary<string, object> dictionary, string name, object value, Type valueType, bool allowsMultiple)
+ {
+ object metadataValue;
+ if (!dictionary.TryGetValue(name, out metadataValue))
+ {
+ if (allowsMultiple)
+ {
+ var list = new MetadataList();
+ list.Add(value, valueType);
+ value = list;
+ }
+
+ dictionary.Add(name, value);
+ }
+ else
+ {
+ var list = metadataValue as MetadataList;
+ if (!allowsMultiple || list == null)
+ {
+ // Either single value already found when should be multiple
+ // or a duplicate name already exists
+ dictionary.Remove(name);
+ return false;
+ }
+
+ list.Add(value, valueType);
+ }
+ return true;
+ }
+
+ private class MetadataList
+ {
+ private Type _arrayType = null;
+ private bool _containsNulls = false;
+ private static readonly Type ObjectType = typeof(object);
+ private static readonly Type TypeType = typeof(Type);
+ private Collection<object> _innerList = new Collection<object>();
+
+ public void Add(object item, Type itemType)
+ {
+ this._containsNulls |= (item == null);
+
+ // if we've been passed typeof(object), we basically have no type inmformation
+ if (itemType == ObjectType)
+ {
+ itemType = null;
+ }
+
+ // if we have no type information, get it from the item, if we can
+ if ((itemType == null) && (item != null))
+ {
+ itemType = item.GetType();
+ }
+
+ // Types are special, because the are abstract classes, so if the item casts to Type, we assume System.Type
+ if (item is Type)
+ {
+ itemType = TypeType;
+ }
+
+ // only try to call this if we got a meaningful type
+ if (itemType != null)
+ {
+ this.InferArrayType(itemType);
+ }
+
+ this._innerList.Add(item);
+ }
+
+ private void InferArrayType(Type itemType)
+ {
+ Assumes.NotNull(itemType);
+
+ if (this._arrayType == null)
+ {
+ // this is the first typed element we've been given, it sets the type of the array
+ this._arrayType = itemType;
+ }
+ else
+ {
+ // if there's a disagreement on the array type, we flip to Object
+ // NOTE : we can try to do better in the future to find common base class, but given that we support very limited set of types
+ // in metadata right now, it's a moot point
+ if (this._arrayType != itemType)
+ {
+ this._arrayType = ObjectType;
+ }
+ }
+ }
+
+ public Array ToArray()
+ {
+ if (this._arrayType == null)
+ {
+ // if the array type has not been set, assume Object
+ this._arrayType = ObjectType;
+ }
+ else if (this._containsNulls && this._arrayType.IsValueType)
+ {
+ // if the array type is a value type and we have seen nulls, then assume Object
+ this._arrayType = ObjectType;
+ }
+
+ Array array = Array.CreateInstance(this._arrayType, this._innerList.Count);
+
+ for(int i = 0; i < array.Length; i++)
+ {
+ array.SetValue(this._innerList[i], i);
+ }
+ return array;
+ }
+ }
+
+ //UNDONE: Need to add these warnings somewhere...Dev10:472538 should address this.
+ //internal static CompositionResult MatchRequiredMetadata(this IDictionary<string, object> metadata, IEnumerable<string> requiredMetadata, string contractName)
+ //{
+ // Assumes.IsTrue(metadata != null);
+
+ // var result = CompositionResult.SucceededResult;
+
+ // var missingMetadata = (requiredMetadata == null) ? null : requiredMetadata.Except<string>(metadata.Keys);
+ // if (missingMetadata != null && missingMetadata.Any())
+ // {
+ // result = result.MergeIssue(
+ // CompositionError.CreateIssueAsWarning(CompositionErrorId.RequiredMetadataNotFound,
+ // Strings.RequiredMetadataNotFound,
+ // contractName,
+ // string.Join(", ", missingMetadata.ToArray())));
+
+ // return new CompositionResult(false, result.Issues);
+ // }
+
+ // return result;
+ //}
+
+ internal static IEnumerable<KeyValuePair<string, Type>> GetRequiredMetadata(Type metadataViewType)
+ {
+ if ((metadataViewType == null) ||
+ ExportServices.IsDefaultMetadataViewType(metadataViewType) ||
+ ExportServices.IsDictionaryConstructorViewType(metadataViewType) ||
+ !metadataViewType.IsInterface)
+ {
+ return Enumerable.Empty<KeyValuePair<string, Type>>();
+ }
+
+ // A metadata view is required to be an Intrerface, and therefore only properties are allowed
+ List<PropertyInfo> properties = metadataViewType.GetAllProperties().
+ Where(property => property.GetFirstAttribute<DefaultValueAttribute>() == null).
+ ToList();
+
+ // NOTE : this is a carefully found balance between eager and delay-evaluation - the properties are filtered once and upfront
+ // whereas the key/Type pairs are created every time. The latter is fine as KVPs are structs and as such copied on access regardless.
+ // This also allows us to avoid creation of List<KVP> which - at least according to FxCop - leads to isues with NGEN
+ return properties.Select(property => new KeyValuePair<string, Type>(property.Name, property.PropertyType));
+ }
+
+ internal static object GetExportedValueFromComposedPart(ImportEngine engine, ComposablePart part, ExportDefinition definition)
+ {
+ try
+ {
+ engine.SatisfyImports(part);
+ }
+ catch (CompositionException ex)
+ {
+ throw ExceptionBuilder.CreateCannotGetExportedValue(part, definition, ex);
+ }
+
+ try
+ {
+ return part.GetExportedValue(definition);
+ }
+ catch (ComposablePartException ex)
+ {
+ throw ExceptionBuilder.CreateCannotGetExportedValue(part, definition, ex);
+ }
+ }
+
+ internal static bool IsRecomposable(this ComposablePart part)
+ {
+ return part.ImportDefinitions.Any(import => import.IsRecomposable);
+ }
+
+ internal static CompositionResult<T> TryInvoke<T>(Func<T> action)
+ {
+ try
+ {
+ T value = action();
+ return new CompositionResult<T>(value);
+ }
+ catch (CompositionException ex)
+ {
+ return new CompositionResult<T>(ex.Errors);
+ }
+ }
+
+ internal static CompositionResult TryInvoke(Action action)
+ {
+ try
+ {
+ action();
+ return CompositionResult.SucceededResult;
+ }
+ catch (CompositionException ex)
+ {
+ return new CompositionResult(ex.Errors);
+ }
+ }
+
+ internal static CompositionResult TryFire<TEventArgs>(EventHandler<TEventArgs> _delegate, object sender, TEventArgs e)
+ where TEventArgs : EventArgs
+ {
+ CompositionResult result = CompositionResult.SucceededResult;
+ foreach (EventHandler<TEventArgs> _subscriber in _delegate.GetInvocationList())
+ {
+ try
+ {
+ _subscriber.Invoke(sender, e);
+ }
+ catch (CompositionException ex)
+ {
+ result = result.MergeErrors(ex.Errors);
+ }
+ }
+
+ return result;
+ }
+
+ internal static CreationPolicy GetRequiredCreationPolicy(this ImportDefinition definition)
+ {
+ ContractBasedImportDefinition contractDefinition = definition as ContractBasedImportDefinition;
+
+ if (contractDefinition != null)
+ {
+ return contractDefinition.RequiredCreationPolicy;
+ }
+
+ return CreationPolicy.Any;
+ }
+
+ /// <summary>
+ /// Returns a value indicating whether cardinality is
+ /// <see cref="ImportCardinality.ZeroOrOne"/> or
+ /// <see cref="ImportCardinality.ExactlyOne"/>.
+ /// </summary>
+ internal static bool IsAtMostOne(this ImportCardinality cardinality)
+ {
+ return cardinality == ImportCardinality.ZeroOrOne || cardinality == ImportCardinality.ExactlyOne;
+ }
+
+ private static bool IsValidAttributeType(Type type)
+ {
+ return IsValidAttributeType(type, true);
+ }
+
+ private static bool IsValidAttributeType(Type type, bool arrayAllowed)
+ {
+ Assumes.NotNull(type);
+ // Definitions of valid attribute type taken from C# 3.0 Specification section 17.1.3.
+
+ // One of the following types: bool, byte, char, double, float, int, long, sbyte, short, string, uint, ulong, ushort.
+ if (type.IsPrimitive)
+ {
+ return true;
+ }
+
+ if (type == typeof(string))
+ {
+ return true;
+ }
+
+ // An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility
+ if (type.IsEnum && type.IsVisible)
+ {
+ return true;
+ }
+
+ if (typeof(Type).IsAssignableFrom(type))
+ {
+ return true;
+ }
+
+ // Single-dimensional arrays of the above types.
+ if (arrayAllowed && type.IsArray &&
+ type.GetArrayRank() == 1 &&
+ IsValidAttributeType(type.GetElementType(), false))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs
new file mode 100644
index 0000000..5c1d7d9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs
@@ -0,0 +1,71 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !SILVERLIGHT
+
+using System;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ partial class DirectoryCatalog
+ {
+ internal class DirectoryCatalogDebuggerProxy
+ {
+ private readonly DirectoryCatalog _catalog;
+
+ public DirectoryCatalogDebuggerProxy(DirectoryCatalog catalog)
+ {
+ Requires.NotNull(catalog, "catalog");
+
+ this._catalog = catalog;
+ }
+
+ public ReadOnlyCollection<Assembly> Assemblies
+ {
+ get
+ {
+ return this._catalog._assemblyCatalogs.Values.Select(catalog => catalog.Assembly)
+ .ToReadOnlyCollection();
+ }
+ }
+
+ public string SearchPattern
+ {
+ get { return this._catalog.SearchPattern; }
+ }
+
+ public string Path
+ {
+ get { return this._catalog._path; }
+ }
+
+ public string FullPath
+ {
+ get { return this._catalog._fullPath; }
+ }
+
+ public ReadOnlyCollection<string> LoadedFiles
+ {
+ get { return this._catalog._loadedFiles; }
+ }
+
+ public ReadOnlyCollection<ComposablePartDefinition> Parts
+ {
+ // NOTE: This shouldn't be cached, so that on every query of
+ // the current value of the underlying catalog is respected.
+ // We use ReadOnlyCollection as arrays do not have the
+ // appropriate debugger display attributes applied to them.
+ get { return this._catalog.Parts.ToReadOnlyCollection(); }
+ }
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs
new file mode 100644
index 0000000..c6430f2
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/DirectoryCatalog.cs
@@ -0,0 +1,542 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !SILVERLIGHT
+
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel.Composition.Diagnostics;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+using IOPath = System.IO.Path;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ [DebuggerTypeProxy(typeof(DirectoryCatalogDebuggerProxy))]
+ public partial class DirectoryCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged, ICompositionElement
+ {
+ private readonly Lock _thisLock = new Lock();
+ private ComposablePartCatalogCollection _catalogCollection;
+ private Dictionary<string, AssemblyCatalog> _assemblyCatalogs;
+ private volatile bool _isDisposed = false;
+ private string _path;
+ private string _fullPath;
+ private string _searchPattern;
+ private ReadOnlyCollection<string> _loadedFiles;
+ private IQueryable<ComposablePartDefinition> _partsQuery;
+
+ /// <summary>
+ /// Creates a catalog of <see cref="ComposablePartDefinition"/>s based on all the *.dll files
+ /// in the given directory path.
+ ///
+ /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
+ /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
+ /// </summary>
+ /// <param name="path">
+ /// Path to the directory to scan for assemblies to add to the catalog.
+ /// The path needs to be absolute or relative to <see cref="AppDomain.BaseDirectory"/>
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// If <paramref name="path"/> is a zero-length string, contains only white space, or
+ /// contains one or more implementation-specific invalid characters.
+ /// </exception>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="path"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="DirectoryNotFoundException">
+ /// The specified <paramref name="path"/> is invalid (for example, it is on an unmapped drive).
+ /// </exception>
+ /// <exception cref="PathTooLongException">
+ /// The specified <paramref name="path"/>, file name, or both exceed the system-defined maximum length.
+ /// For example, on Windows-based platforms, paths must be less than 248 characters and file names must
+ /// be less than 260 characters.
+ /// </exception>
+ /// <exception cref="UnauthorizedAccessException">
+ /// The caller does not have the required permission.
+ /// </exception>
+ public DirectoryCatalog(string path) : this(path, "*.dll")
+ {
+ }
+
+ /// <summary>
+ /// Creates a catalog of <see cref="ComposablePartDefinition"/>s based on all the given searchPattern
+ /// over the files in the given directory path.
+ ///
+ /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
+ /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
+ /// </summary>
+ /// <param name="path">
+ /// Path to the directory to scan for assemblies to add to the catalog.
+ /// The path needs to be absolute or relative to <see cref="AppDomain.BaseDirectory"/>
+ /// </param>
+ /// <param name="searchPattern">
+ /// Any valid searchPattern that <see cref="Directory.GetFiles(string, string)"/> will accept.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// If <paramref name="path"/> is a zero-length string, contains only white space, or
+ /// contains one or more implementation-specific invalid characters. Or <paramref name="searchPattern"/>
+ /// does not contain a valid pattern.
+ /// </exception>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="path"/> is <see langword="null"/> or <paramref name="searchPattern"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="DirectoryNotFoundException">
+ /// The specified <paramref name="path"/> is invalid (for example, it is on an unmapped drive).
+ /// </exception>
+ /// <exception cref="PathTooLongException">
+ /// The specified <paramref name="path"/>, file name, or both exceed the system-defined maximum length.
+ /// For example, on Windows-based platforms, paths must be less than 248 characters and file names must
+ /// be less than 260 characters.
+ /// </exception>
+ /// <exception cref="UnauthorizedAccessException">
+ /// The caller does not have the required permission.
+ /// </exception>
+ public DirectoryCatalog(string path, string searchPattern)
+ {
+ Requires.NotNullOrEmpty(path, "path");
+ this.Initialize(path, searchPattern);
+ }
+
+ /// <summary>
+ /// Translated absolute path of the path passed into the constructor of <see cref="DirectoryCatalog"/>.
+ /// </summary>
+ public string FullPath
+ {
+ get
+ {
+ return this._fullPath;
+ }
+ }
+
+ /// <summary>
+ /// Set of files that have currently been loaded into the catalog.
+ /// </summary>
+ public ReadOnlyCollection<string> LoadedFiles
+ {
+ get
+ {
+ using (new ReadLock(this._thisLock))
+ {
+ return this._loadedFiles;
+ }
+ }
+ }
+
+ /// <summary>
+ /// Path passed into the constructor of <see cref="DirectoryCatalog"/>.
+ /// </summary>
+ public string Path
+ {
+ get
+ {
+ return this._path;
+ }
+ }
+
+ /// <summary>
+ /// Gets the part definitions of the directory catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
+ /// <see cref="DirectoryCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="DirectoryCatalog"/> has been disposed of.
+ /// </exception>
+ public override IQueryable<ComposablePartDefinition> Parts
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+ return this._partsQuery;
+ }
+ }
+
+ /// <summary>
+ /// SearchPattern passed into the constructor of <see cref="DirectoryCatalog"/>, or the default *.dll.
+ /// </summary>
+ public string SearchPattern
+ {
+ get
+ {
+ return this._searchPattern;
+ }
+ }
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changed.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
+
+ /// <summary>
+ /// Notify when the contents of the Catalog has changing.
+ /// </summary>
+ public event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected override void Dispose(bool disposing)
+ {
+ try
+ {
+ if (disposing)
+ {
+ if (!this._isDisposed)
+ {
+ bool disposeLock = false;
+ ComposablePartCatalogCollection catalogs = null;
+
+ try
+ {
+ using (new WriteLock(this._thisLock))
+ {
+ if (!this._isDisposed)
+ {
+ disposeLock = true;
+ catalogs = this._catalogCollection;
+ this._catalogCollection = null;
+ this._assemblyCatalogs = null;
+ this._isDisposed = true;
+ }
+ }
+ }
+ finally
+ {
+ if (catalogs != null)
+ {
+ catalogs.Dispose();
+ }
+
+ if (disposeLock)
+ {
+ this._thisLock.Dispose();
+ }
+ }
+ }
+ }
+ }
+ finally
+ {
+ base.Dispose(disposing);
+ }
+ }
+
+ /// <summary>
+ /// Returns the export definitions that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="ExportDefinition"/> objects to return.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
+ /// <see cref="ExportDefinition"/> objects and their associated
+ /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
+ /// by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="DirectoryCatalog"/> has been disposed of.
+ /// </exception>
+ public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(definition, "definition");
+
+ return this._catalogCollection.SelectMany(catalog => catalog.GetExports(definition));
+ }
+
+ /// <summary>
+ /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changed"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnChanged(ComposablePartCatalogChangeEventArgs e)
+ {
+ EventHandler<ComposablePartCatalogChangeEventArgs> changedEvent = this.Changed;
+ if (changedEvent != null)
+ {
+ changedEvent(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Raises the <see cref="INotifyComposablePartCatalogChanged.Changing"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ComposablePartCatalogChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnChanging(ComposablePartCatalogChangeEventArgs e)
+ {
+ EventHandler<ComposablePartCatalogChangeEventArgs> changingEvent = this.Changing;
+ if (changingEvent != null)
+ {
+ changingEvent(this, e);
+ }
+ }
+
+ /// <summary>
+ /// Refreshes the <see cref="ComposablePartDefinition"/>s with the latest files in the directory that match
+ /// the searchPattern. If any files have been added they will be added to the catalog and if any files were
+ /// removed they will be removed from the catalog. For files that have been removed keep in mind that the
+ /// assembly cannot be unloaded from the process so <see cref="ComposablePartDefinition"/>s for those files
+ /// will simply be removed from the catalog.
+ ///
+ /// Possible exceptions that can be thrown are any that <see cref="Directory.GetFiles(string, string)"/> or
+ /// <see cref="Assembly.Load(AssemblyName)"/> can throw.
+ /// </summary>
+ /// <exception cref="DirectoryNotFoundException">
+ /// The specified <paramref name="path"/> has been removed since object construction.
+ /// </exception>
+ public void Refresh()
+ {
+ this.ThrowIfDisposed();
+ Assumes.NotNull(this._loadedFiles);
+
+ List<Tuple<string, AssemblyCatalog>> catalogsToAdd;
+ List<Tuple<string, AssemblyCatalog>> catalogsToRemove;
+ ComposablePartDefinition[] addedDefinitions;
+ ComposablePartDefinition[] removedDefinitions;
+ object changeReferenceObject;
+ string[] afterFiles;
+ string[] beforeFiles;
+
+ while (true)
+ {
+ afterFiles = this.GetFiles();
+
+ using (new ReadLock(this._thisLock))
+ {
+ changeReferenceObject = this._loadedFiles;
+ beforeFiles = this._loadedFiles.ToArray();
+ }
+
+ this.DiffChanges(beforeFiles, afterFiles, out catalogsToAdd, out catalogsToRemove);
+
+ // Don't go any further if there's no work to do
+ if (catalogsToAdd.Count == 0 && catalogsToRemove.Count == 0)
+ {
+ return;
+ }
+
+ // Notify listeners to give them a preview before completeting the changes
+ addedDefinitions = catalogsToAdd
+ .SelectMany(cat => cat.Item2.Parts)
+ .ToArray<ComposablePartDefinition>();
+
+ removedDefinitions = catalogsToRemove
+ .SelectMany(cat => cat.Item2.Parts)
+ .ToArray<ComposablePartDefinition>();
+
+ using (var atomicComposition = new AtomicComposition())
+ {
+ var changingArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, removedDefinitions, atomicComposition);
+ this.OnChanging(changingArgs);
+
+ // if the change went through then write the catalog changes
+ using (new WriteLock(this._thisLock))
+ {
+ if (changeReferenceObject != this._loadedFiles)
+ {
+ // Someone updated the list while we were diffing so we need to try the diff again
+ continue;
+ }
+
+ foreach (var catalogToAdd in catalogsToAdd)
+ {
+ this._assemblyCatalogs.Add(catalogToAdd.Item1, catalogToAdd.Item2);
+ this._catalogCollection.Add(catalogToAdd.Item2);
+ }
+
+ foreach (var catalogToRemove in catalogsToRemove)
+ {
+ this._assemblyCatalogs.Remove(catalogToRemove.Item1);
+ this._catalogCollection.Remove(catalogToRemove.Item2);
+ }
+
+ this._partsQuery = this._catalogCollection.AsQueryable().SelectMany(catalog => catalog.Parts);
+ this._loadedFiles = afterFiles.ToReadOnlyCollection();
+
+ // Lastly complete any changes added to the atomicComposition during the change event
+ atomicComposition.Complete();
+
+ // Break out of the while(true)
+ break;
+ } // WriteLock
+ } // AtomicComposition
+ } // while (true)
+
+ var changedArgs = new ComposablePartCatalogChangeEventArgs(addedDefinitions, removedDefinitions, null);
+ this.OnChanged(changedArgs);
+ }
+
+ /// <summary>
+ /// Returns a string representation of the directory catalog.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the string representation of the <see cref="DirectoryCatalog"/>.
+ /// </returns>
+ public override string ToString()
+ {
+ return GetDisplayName();
+ }
+
+ private AssemblyCatalog CreateAssemblyCatalogGuarded(string assemblyFilePath)
+ {
+ Exception exception = null;
+
+ try
+ {
+ return new AssemblyCatalog(assemblyFilePath, this);
+ }
+ catch (FileNotFoundException ex)
+ { // Files should always exists but don't blow up here if they don't
+ exception = ex;
+ }
+ catch (FileLoadException ex)
+ { // File was found but could not be loaded
+ exception = ex;
+ }
+ catch (BadImageFormatException ex)
+ { // Dlls that contain native code are not loaded, but do not invalidate the Directory
+ exception = ex;
+ }
+ catch (ReflectionTypeLoadException ex)
+ { // Dlls that have missing Managed dependencies are not loaded, but do not invalidate the Directory
+ exception = ex;
+ }
+
+ CompositionTrace.AssemblyLoadFailed(this, assemblyFilePath, exception);
+
+ return null;
+ }
+
+ private void DiffChanges(string[] beforeFiles, string[] afterFiles,
+ out List<Tuple<string, AssemblyCatalog>> catalogsToAdd,
+ out List<Tuple<string, AssemblyCatalog>> catalogsToRemove)
+ {
+ catalogsToAdd = new List<Tuple<string, AssemblyCatalog>>();
+ catalogsToRemove = new List<Tuple<string, AssemblyCatalog>>();
+
+ IEnumerable<string> filesToAdd = afterFiles.Except(beforeFiles);
+ foreach (string file in filesToAdd)
+ {
+ AssemblyCatalog catalog = CreateAssemblyCatalogGuarded(file);
+
+ if (catalog != null)
+ {
+ catalogsToAdd.Add(new Tuple<string, AssemblyCatalog>(file, catalog));
+ }
+ }
+
+ IEnumerable<string> filesToRemove = beforeFiles.Except(afterFiles);
+ using (new ReadLock(this._thisLock))
+ {
+ foreach (string file in filesToRemove)
+ {
+ AssemblyCatalog catalog;
+ if (this._assemblyCatalogs.TryGetValue(file, out catalog))
+ {
+ catalogsToRemove.Add(new Tuple<string, AssemblyCatalog>(file, catalog));
+ }
+ }
+ }
+ }
+
+ private string GetDisplayName()
+ {
+ return string.Format(CultureInfo.CurrentCulture,
+ "{0} (Path=\"{1}\")", // NOLOC
+ this.GetType().Name,
+ this._path);
+ }
+
+ private string[] GetFiles()
+ {
+ return Directory.GetFiles(this._fullPath, this._searchPattern);
+ }
+
+ private static string GetFullPath(string path)
+ {
+ if (!IOPath.IsPathRooted(path) && AppDomain.CurrentDomain.BaseDirectory != null)
+ {
+ path = IOPath.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
+ }
+
+ return IOPath.GetFullPath(path);
+ }
+
+ private void Initialize(string path, string searchPattern)
+ {
+ this._path = path;
+ this._fullPath = GetFullPath(path);
+ this._searchPattern = searchPattern;
+ this._assemblyCatalogs = new Dictionary<string, AssemblyCatalog>();
+ this._catalogCollection = new ComposablePartCatalogCollection(null);
+
+ this._loadedFiles = GetFiles().ToReadOnlyCollection();
+
+ foreach (string file in this._loadedFiles)
+ {
+ AssemblyCatalog assemblyCatalog = null;
+ assemblyCatalog = CreateAssemblyCatalogGuarded(file);
+
+ if (assemblyCatalog != null)
+ {
+ this._assemblyCatalogs.Add(file, assemblyCatalog);
+ this._catalogCollection.Add(assemblyCatalog);
+ }
+ }
+ this._partsQuery = this._catalogCollection.AsQueryable().SelectMany(catalog => catalog.Parts);
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+
+ /// <summary>
+ /// Gets the display name of the directory catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a human-readable display name of the <see cref="DirectoryCatalog"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ /// <summary>
+ /// Gets the composition element from which the directory catalog originated.
+ /// </summary>
+ /// <value>
+ /// This property always returns <see langword="null"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return null; }
+ }
+ }
+}
+
+#endif
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs
new file mode 100644
index 0000000..2a4c582
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.GetExportOverrides.cs
@@ -0,0 +1,817 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Collections.ObjectModel;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public abstract partial class ExportProvider
+ {
+ /// <summary>
+ /// Returns the export with the contract name derived from the specified type parameter,
+ /// throwing an exception if there is not exactly one matching export.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T}"/> object to return. The contract name is also
+ /// derived from this type parameter.
+ /// </typeparam>
+ /// <returns>
+ /// The <see cref="Lazy{T}"/> object with the contract name derived from
+ /// <typeparamref name="T"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The returned <see cref="Lazy{T}"/> object is an instance of
+ /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
+ /// <c>TMetadataView</c>
+ /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
+ /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero <see cref="Lazy{T}"/> objects with the contract name derived
+ /// from <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one <see cref="Lazy{T}"/> objects with the contract name
+ /// derived from <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public Lazy<T> GetExport<T>()
+ {
+ return this.GetExport<T>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the export with the specified contract name, throwing an exception if there
+ /// is not exactly one matching export.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T}"/> object to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
+ /// object to return; or <see langword="null"/> or an empty string ("") to use the
+ /// default contract name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Lazy{T}"/> object with the specified contract name.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The returned <see cref="Lazy{T}"/> object is an instance of
+ /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
+ /// <c>TMetadataView</c>
+ /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
+ /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is compared using a case-sensitive, non-linguistic
+ /// comparison using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero <see cref="Lazy{T}"/> objects with the specified contract name
+ /// in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one <see cref="Lazy{T}"/> objects with the specified contract
+ /// name in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public Lazy<T> GetExport<T>(string contractName)
+ {
+ return this.GetExportCore<T>(contractName);
+ }
+
+ /// <summary>
+ /// Returns the export with the contract name derived from the specified type parameter,
+ /// throwing an exception if there is not exactly one matching export.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T, TMetadataView}"/> object to return. The
+ /// contract name is also derived from this type parameter.
+ /// </typeparam>
+ /// <typeparam name="TMetadataView">
+ /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> object
+ /// to return.
+ /// </typeparam>
+ /// <returns>
+ /// The <see cref="Lazy{T, TMetadataView}"/> object with the contract name derived
+ /// from <typeparamref name="T"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero <see cref="Lazy{T, TMetadataView}"/> objects with the contract
+ /// name derived from <typeparamref name="T"/> in the
+ /// <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one <see cref="Lazy{T, TMetadataView}"/> objects with the
+ /// contract name derived from <typeparamref name="T"/> in the
+ /// <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public Lazy<T, TMetadataView> GetExport<T, TMetadataView>()
+ {
+ return this.GetExport<T, TMetadataView>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the export with the specified contract name, throwing an exception if there
+ /// is not exactly one matching export.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T, TMetadataView}"/> object to return.
+ /// </typeparam>
+ /// <typeparam name="TMetadataView">
+ /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> object
+ /// to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Lazy{T, TMetadataView}"/> object to return; or <see langword="null"/>
+ /// or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Lazy{T, TMetadataView}"/> object with the specified contract name.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero <see cref="Lazy{T, TMetadataView}"/> objects with the
+ /// specified contract name in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one <see cref="Lazy{T, TMetadataView}"/> objects with the
+ /// specified contract name in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ public Lazy<T, TMetadataView> GetExport<T, TMetadataView>(string contractName)
+ {
+ return this.GetExportCore<T, TMetadataView>(contractName);
+ }
+
+ /// <summary>
+ /// Returns the exports with the specified contract name.
+ /// </summary>
+ /// <param name="type">
+ /// The <see cref="Type"/> of the <see cref="Export"/> objects to return.
+ /// </param>
+ /// <param name="metadataViewType">
+ /// The <see cref="Type"/> of the metadata view of the <see cref="Export"/> objects to
+ /// return.
+ /// </param>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Export"/> object to return; or <see langword="null"/>
+ /// or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{Object, Object}"/> objects
+ /// with the specified contract name, if found; otherwise, an empty
+ /// <see cref="IEnumerable{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The returned <see cref="Export"/> objects are instances of
+ /// <see cref="Lazy{T, TMetadataView}"/> underneath, where <c>T</c>
+ /// is <paramref name="type"/> and <c>TMetadataView</c> is
+ /// <paramref name="metadataViewType"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <paramref name="type"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="type"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// <paramref name="metadataViewType"/> is not a valid metadata view type.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006")]
+ public IEnumerable<Lazy<object, object>> GetExports(Type type, Type metadataViewType, string contractName)
+ {
+ IEnumerable<Export> exports = this.GetExportsCore(type, metadataViewType, contractName, ImportCardinality.ZeroOrMore);
+ Collection<Lazy<object, object>> result = new Collection<Lazy<object, object>>();
+
+ Func<Export, Lazy<object, object>> typedExportFactory = ExportServices.CreateSemiStronglyTypedLazyFactory(type, metadataViewType);
+ foreach (Export export in exports)
+ {
+ result.Add(typedExportFactory.Invoke(export));
+ }
+
+ return result;
+ }
+
+ /// <summary>
+ /// Returns the exports with the contract name derived from the specified type parameter.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T}"/> objects to return. The contract name is also
+ /// derived from this type parameter.
+ /// </typeparam>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects
+ /// with the contract name derived from <typeparamref name="T"/>, if found; otherwise,
+ /// an empty <see cref="IEnumerable{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The returned <see cref="Lazy{T}"/> objects are instances of
+ /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
+ /// <c>TMetadataView</c>
+ /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
+ /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006")]
+ public IEnumerable<Lazy<T>> GetExports<T>()
+ {
+ return this.GetExports<T>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the exports with the specified contract name.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T}"/> objects to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the <see cref="Lazy{T}"/>
+ /// objects to return; or <see langword="null"/> or an empty string ("") to use the
+ /// default contract name.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> containing the <see cref="Lazy{T}"/> objects
+ /// with the specified contract name, if found; otherwise, an empty
+ /// <see cref="IEnumerable{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The returned <see cref="Lazy{T}"/> objects are instances of
+ /// <see cref="Lazy{T, TMetadataView}"/> underneath, where
+ /// <c>TMetadataView</c>
+ /// is <see cref="IDictionary{TKey, TValue}"/> and where <c>TKey</c>
+ /// is <see cref="String"/> and <c>TValue</c> is <see cref="Object"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006")]
+ public IEnumerable<Lazy<T>> GetExports<T>(string contractName)
+ {
+ return this.GetExportsCore<T>(contractName);
+ }
+
+ /// <summary>
+ /// Returns the exports with the contract name derived from the specified type parameter.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T, TMetadataView}"/> objects to return. The
+ /// contract name is also derived from this type parameter.
+ /// </typeparam>
+ /// <typeparam name="TMetadataView">
+ /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> objects
+ /// to return.
+ /// </typeparam>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> containing the
+ /// <see cref="Lazy{T, TMetadataView}"/> objects with the contract name derived from
+ /// <typeparamref name="T"/>, if found; otherwise, an empty
+ /// <see cref="IEnumerable{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">
+ /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006")]
+ public IEnumerable<Lazy<T, TMetadataView>> GetExports<T, TMetadataView>()
+ {
+ return this.GetExports<T, TMetadataView>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the exports with the specified contract name.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the <see cref="Lazy{T, TMetadataView}"/> objects to return. The
+ /// contract name is also derived from this type parameter.
+ /// </typeparam>
+ /// <typeparam name="TMetadataView">
+ /// The type of the metadata view of the <see cref="Lazy{T, TMetadataView}"/> objects
+ /// to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Lazy{T, TMetadataView}"/> objects to return; or <see langword="null"/>
+ /// or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> containing the
+ /// <see cref="Lazy{T, TMetadataView}"/> objects with the specified contract name if
+ /// found; otherwise, an empty <see cref="IEnumerable{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="InvalidOperationException">
+ /// <typeparamref name="TMetadataView"/> is not a valid metadata view type.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006")]
+ public IEnumerable<Lazy<T, TMetadataView>> GetExports<T, TMetadataView>(string contractName)
+ {
+ return this.GetExportsCore<T, TMetadataView>(contractName);
+ }
+
+ /// <summary>
+ /// Returns the exported value with the contract name derived from the specified type
+ /// parameter, throwing an exception if there is not exactly one matching exported value.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return. The contract name is also
+ /// derived from this type parameter.
+ /// </typeparam>
+ /// <returns>
+ /// The exported <see cref="Object"/> with the contract name derived from
+ /// <typeparamref name="T"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero exported values with the contract name derived from
+ /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one exported values with the contract name derived from
+ /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public T GetExportedValue<T>()
+ {
+ return this.GetExportedValue<T>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the exported value with the specified contract name, throwing an exception
+ /// if there is not exactly one matching exported value.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the exported value to return,
+ /// or <see langword="null"/> or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <returns>
+ /// The exported <see cref="Object"/> with the specified contract name.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are zero exported values with the specified contract name in the
+ /// <see cref="CompositionContainer"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// There are more than one exported values with the specified contract name in the
+ /// <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public T GetExportedValue<T>(string contractName)
+ {
+ return this.GetExportedValueCore<T>(contractName, ImportCardinality.ExactlyOne);
+ }
+
+ /// <summary>
+ /// Returns the exported value with the contract name derived from the specified type
+ /// parameter, throwing an exception if there is more than one matching exported value.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return. The contract name is also
+ /// derived from this type parameter.
+ /// </typeparam>
+ /// <returns>
+ /// The exported <see cref="Object"/> with the contract name derived from
+ /// <typeparamref name="T"/>, if found; otherwise, the default value for
+ /// <typeparamref name="T"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// If the exported value is not found, then this method returns the appropriate
+ /// default value for <typeparamref name="T"/>; for example, 0 (zero) for integer
+ /// types, <see langword="false"/> for Boolean types, and <see langword="null"/>
+ /// for reference types.
+ /// </para>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// There are more than one exported values with the contract name derived from
+ /// <typeparamref name="T"/> in the <see cref="CompositionContainer"/>.
+ /// </para>
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public T GetExportedValueOrDefault<T>()
+ {
+ return this.GetExportedValueOrDefault<T>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the exported value with the specified contract name, throwing an exception
+ /// if there is more than one matching exported value.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the exported value to return,
+ /// or <see langword="null"/> or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <returns>
+ /// The exported <see cref="Object"/> with the specified contract name, if found;
+ /// otherwise, the default value for <typeparamref name="T"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// If the exported value is not found, then this method returns the appropriate
+ /// default value for <typeparamref name="T"/>; for example, 0 (zero) for integer
+ /// types, <see langword="false"/> for Boolean types, and <see langword="null"/>
+ /// for reference types.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The underlying exported value cannot be cast to <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// There are more than one exported values with the specified contract name in the
+ /// <see cref="CompositionContainer"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public T GetExportedValueOrDefault<T>(string contractName)
+ {
+ return this.GetExportedValueCore<T>(contractName, ImportCardinality.ZeroOrOne);
+ }
+
+ /// <summary>
+ /// Returns the exported values with the contract name derived from the specified type
+ /// parameter.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return. The contract name is also
+ /// derived from this type parameter.
+ /// </typeparam>
+ /// <returns>
+ /// An <see cref="Collection{T}"/> containing the exported values with the contract name
+ /// derived from the specified type parameter, if found; otherwise, an empty
+ /// <see cref="Collection{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// One or more of the underlying exported values cannot be cast to
+ /// <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public IEnumerable<T> GetExportedValues<T>()
+ {
+ return this.GetExportedValues<T>((string)null);
+ }
+
+ /// <summary>
+ /// Returns the exported values with the specified contract name.
+ /// </summary>
+ /// <typeparam name="T">
+ /// The type of the exported value to return.
+ /// </typeparam>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the exported values to
+ /// return; or <see langword="null"/> or an empty string ("") to use the default
+ /// contract name.
+ /// </param>
+ /// <returns>
+ /// An <see cref="Collection{T}"/> containing the exported values with the specified
+ /// contract name, if found; otherwise, an empty <see cref="Collection{T}"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ /// <exception cref="CompositionContractMismatchException">
+ /// One or more of the underlying exported values cannot be cast to
+ /// <typeparamref name="T"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="CompositionContainer"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ public IEnumerable<T> GetExportedValues<T>(string contractName)
+ {
+ return this.GetExportedValuesCore<T>(contractName);
+ }
+
+ private IEnumerable<T> GetExportedValuesCore<T>(string contractName)
+ {
+ IEnumerable<Export> exports = this.GetExportsCore(typeof(T), (Type)null, contractName, ImportCardinality.ZeroOrMore);
+
+ Collection<T> result = new Collection<T>();
+ foreach (Export export in exports)
+ {
+ result.Add(ExportServices.GetCastedExportedValue<T>(export));
+ }
+ return result;
+ }
+
+ private T GetExportedValueCore<T>(string contractName, ImportCardinality cardinality)
+ {
+ Assumes.IsTrue(cardinality.IsAtMostOne());
+
+ Export export = this.GetExportsCore(typeof(T), (Type)null, contractName, cardinality).SingleOrDefault();
+
+ return (export != null) ? ExportServices.GetCastedExportedValue<T>(export) : default(T);
+ }
+
+ private IEnumerable<Lazy<T>> GetExportsCore<T>(string contractName)
+ {
+ IEnumerable<Export> exports = this.GetExportsCore(typeof(T), (Type)null, contractName, ImportCardinality.ZeroOrMore);
+
+ Collection<Lazy<T>> result = new Collection<Lazy<T>>();
+ foreach (Export export in exports)
+ {
+ result.Add(ExportServices.CreateStronglyTypedLazyOfT<T>(export));
+ }
+ return result;
+ }
+
+ private IEnumerable<Lazy<T, TMetadataView>> GetExportsCore<T, TMetadataView>(string contractName)
+ {
+ IEnumerable<Export> exports = this.GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ZeroOrMore);
+
+ Collection<Lazy<T, TMetadataView>> result = new Collection<Lazy<T, TMetadataView>>();
+ foreach (Export export in exports)
+ {
+ result.Add(ExportServices.CreateStronglyTypedLazyOfTM<T, TMetadataView>(export));
+ }
+ return result;
+ }
+
+ private Lazy<T, TMetadataView> GetExportCore<T, TMetadataView>(string contractName)
+ {
+ Export export = this.GetExportsCore(typeof(T), typeof(TMetadataView), contractName, ImportCardinality.ExactlyOne).SingleOrDefault();
+
+ return (export != null) ? ExportServices.CreateStronglyTypedLazyOfTM<T, TMetadataView>(export) : null;
+ }
+
+ private Lazy<T> GetExportCore<T>(string contractName)
+ {
+ Export export = this.GetExportsCore(typeof(T), null, contractName, ImportCardinality.ExactlyOne).SingleOrDefault();
+
+ return (export != null) ? ExportServices.CreateStronglyTypedLazyOfT<T>(export) : null;
+ }
+
+ private IEnumerable<Export> GetExportsCore(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
+ {
+ // Only 'type' cannot be null - the other parameters have sensible defaults.
+ Requires.NotNull(type, "type");
+
+ if (string.IsNullOrEmpty(contractName))
+ {
+ contractName = AttributedModelServices.GetContractName(type);
+ }
+
+ if (metadataViewType == null)
+ {
+ metadataViewType = ExportServices.DefaultMetadataViewType;
+ }
+
+ if (!MetadataViewProvider.IsViewTypeValid(metadataViewType))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Strings.InvalidMetadataView, metadataViewType.Name));
+ }
+
+ ImportDefinition importDefinition = BuildImportDefinition(type, metadataViewType, contractName, cardinality);
+ return this.GetExports(importDefinition, null);
+ }
+
+ private static ImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
+ {
+ Assumes.NotNull(type, metadataViewType, contractName);
+
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata = CompositionServices.GetRequiredMetadata(metadataViewType);
+
+ string requiredTypeIdentity = null;
+ if (type != typeof(object))
+ {
+ requiredTypeIdentity = AttributedModelServices.GetTypeIdentity(type);
+ }
+
+ return new ContractBasedImportDefinition(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, CreationPolicy.Any);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.cs
new file mode 100644
index 0000000..39893dc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportProvider.cs
@@ -0,0 +1,231 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Linq;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// Defines the <see langword="abstract"/> base class for export providers, which provide
+ /// methods for retrieving <see cref="Export"/> objects.
+ /// </summary>
+ public abstract partial class ExportProvider
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportProvider"/> class.
+ /// </summary>
+ protected ExportProvider()
+ {
+ }
+
+ /// <summary>
+ /// Occurs when the exports in the <see cref="ExportProvider"/> have changed.
+ /// </summary>
+ public event EventHandler<ExportsChangeEventArgs> ExportsChanged;
+
+ /// <summary>
+ /// Occurs when the exports in the <see cref="ExportProvider"/> are changing.
+ /// </summary>
+ public event EventHandler<ExportsChangeEventArgs> ExportsChanging;
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> objects to get.
+ /// </param>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and
+ /// there are zero <see cref="Export"/> objects that match the conditions of the specified
+ /// <see cref="ImportDefinition"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
+ /// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/>
+ /// objects that match the conditions of the specified <see cref="ImportDefinition"/>.
+ /// </para>
+ /// </exception>
+ public IEnumerable<Export> GetExports(ImportDefinition definition)
+ {
+ return GetExports(definition, null);
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> objects to get.
+ /// </param>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ImportCardinalityMismatchException">
+ /// <para>
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/> and
+ /// there are zero <see cref="Export"/> objects that match the conditions of the specified
+ /// <see cref="ImportDefinition"/>.
+ /// </para>
+ /// -or-
+ /// <para>
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
+ /// <see cref="ImportCardinality.ExactlyOne"/> and there are more than one <see cref="Export"/>
+ /// objects that match the conditions of the specified <see cref="ImportDefinition"/>.
+ /// </para>
+ /// </exception>
+ public IEnumerable<Export> GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ Requires.NotNull(definition, "definition");
+
+ IEnumerable<Export> exports;
+ ExportCardinalityCheckResult result = this.TryGetExportsCore(definition, atomicComposition, out exports);
+ switch(result)
+ {
+ case ExportCardinalityCheckResult.Match:
+ return exports;
+ case ExportCardinalityCheckResult.NoExports:
+ throw new ImportCardinalityMismatchException(string.Format(CultureInfo.CurrentCulture, Strings.CardinalityMismatch_NoExports, definition.Constraint.Body.ToString()));
+ default:
+ Assumes.IsTrue(result == ExportCardinalityCheckResult.TooManyExports);
+ throw new ImportCardinalityMismatchException(string.Format(CultureInfo.CurrentCulture, Strings.CardinalityMismatch_TooManyExports, definition.Constraint.Body.ToString()));
+ }
+ }
+
+ /// <summary>
+ /// Returns all exports that match the conditions of the specified import.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> objects to get.
+ /// </param>
+ /// <param name="exports">
+ /// When this method returns, contains an <see cref="IEnumerable{T}"/> of <see cref="Export"/>
+ /// objects that match the conditions defined by <see cref="ImportDefinition"/>, if found;
+ /// otherwise, an empty <see cref="IEnumerable{T}"/>.
+ /// </param>
+ /// <returns>
+ /// <see langword="true"/> if <see cref="ImportDefinition.Cardinality"/> is
+ /// <see cref="ImportCardinality.ZeroOrOne"/> or <see cref="ImportCardinality.ZeroOrMore"/> and
+ /// there are zero <see cref="Export"/> objects that match the conditions of the specified
+ /// <see cref="ImportDefinition"/>. <see langword="true"/> if
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
+ /// <see cref="ImportCardinality.ExactlyOne"/> and there is exactly one <see cref="Export"/>
+ /// that matches the conditions of the specified <see cref="ImportDefinition"/>; otherwise,
+ /// <see langword="false"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ public bool TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable<Export> exports)
+ {
+ Requires.NotNull(definition, "definition");
+
+ exports = null;
+ ExportCardinalityCheckResult result = this.TryGetExportsCore(definition, atomicComposition, out exports);
+ return (result == ExportCardinalityCheckResult.Match);
+ }
+
+ /// <summary>
+ /// Returns all exports that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="Export"/> objects to return.
+ /// </param>
+ /// <result>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects that match
+ /// the conditions defined by <see cref="ImportDefinition"/>, if found; otherwise, an
+ /// empty <see cref="IEnumerable{T}"/>.
+ /// </result>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this method should not treat cardinality-related mismatches
+ /// as errors, and should not throw exceptions in those cases. For instance,
+ /// if <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ExactlyOne"/>
+ /// and there are zero <see cref="Export"/> objects that match the conditions of the
+ /// specified <see cref="ImportDefinition"/>, an <see cref="IEnumerable{T}"/> should be returned.
+ /// </note>
+ /// </remarks>
+ protected abstract IEnumerable<Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition);
+
+ /// <summary>
+ /// Raises the <see cref="ExportsChanged"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ExportsChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnExportsChanged(ExportsChangeEventArgs e)
+ {
+ EventHandler<ExportsChangeEventArgs> changedEvent = this.ExportsChanged;
+ if (changedEvent != null)
+ {
+ CompositionResult result = CompositionServices.TryFire(changedEvent, this, e);
+ result.ThrowOnErrors(e.AtomicComposition);
+ }
+ }
+
+ /// <summary>
+ /// Raises the <see cref="ExportsChanging"/> event.
+ /// </summary>
+ /// <param name="e">
+ /// An <see cref="ExportsChangeEventArgs"/> containing the data for the event.
+ /// </param>
+ protected virtual void OnExportsChanging(ExportsChangeEventArgs e)
+ {
+ EventHandler<ExportsChangeEventArgs> changingEvent = this.ExportsChanging;
+ if (changingEvent != null)
+ {
+ CompositionResult result = CompositionServices.TryFire(changingEvent, this, e);
+ result.ThrowOnErrors(e.AtomicComposition);
+ }
+ }
+
+ private ExportCardinalityCheckResult TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, out IEnumerable<Export> exports)
+ {
+ Assumes.NotNull(definition);
+
+ exports = this.GetExportsCore(definition, atomicComposition);
+
+ if (exports == null)
+ {
+ exports = Enumerable.Empty<Export>();
+ }
+
+ var checkResult = ExportServices.CheckCardinality(definition, exports);
+
+ // Export providers treat >1 match as zero for cardinality 0-1 imports
+ // If this policy is moved we need to revisit the assumption that the
+ // ImportEngine made during previewing the only required imports to
+ // now also preview optional imports.
+ if (checkResult == ExportCardinalityCheckResult.TooManyExports &&
+ definition.Cardinality == ImportCardinality.ZeroOrOne)
+ {
+ checkResult = ExportCardinalityCheckResult.Match;
+ exports = Enumerable.Empty<Export>();
+ }
+
+ return checkResult;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs
new file mode 100644
index 0000000..6cff6b6
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ExportsChangeEventArgs.cs
@@ -0,0 +1,110 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// Provides data for the <see cref="ExportProvider.ExportsChanged"/> and
+ /// <see cref="ExportProvider.ExportsChanging"/> events.
+ /// </summary>
+ public class ExportsChangeEventArgs : EventArgs
+ {
+ private IEnumerable<string> _changedContractNames = null;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportsChangeEventArgs"/> class with
+ /// the specified changed export definitions.
+ /// </summary>
+ /// <param name="addedExports">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/>s of the exports
+ /// that have been added.
+ /// </param>
+ /// <param name="removedExports">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/>s of the exports
+ /// that have been removed.
+ /// </param>
+ /// <param name="atomicComposition">
+ /// A <see cref="AtomicComposition"/> representing all tentative changes that will
+ /// be completed if the change is successful, or discarded if it is not.
+ /// <see langword="null"/> if being applied outside a <see cref="AtomicComposition"/>
+ /// or during a <see cref="ExportProvider.ExportsChanged"/> event.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="addedExports"/> or <paramref name="removedExports"/> is <see langword="null"/>.
+ /// </exception>
+ public ExportsChangeEventArgs(IEnumerable<ExportDefinition> addedExports,
+ IEnumerable<ExportDefinition> removedExports, AtomicComposition atomicComposition)
+ {
+ Requires.NotNull(addedExports, "addedExports");
+ Requires.NotNull(removedExports, "removedExports");
+
+ this.AddedExports = addedExports.AsArray();
+ this.RemovedExports = removedExports.AsArray();
+ this.AtomicComposition = atomicComposition;
+ }
+
+ /// <summary>
+ /// Gets the export definitions for the exports that have been added.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IEnumerable{T}"/> of ExportDefinitions representing
+ /// the exports that have been added to the <see cref="CompositionContainer"/>.
+ /// </value>
+ public IEnumerable<ExportDefinition> AddedExports { get; private set; }
+
+ /// <summary>
+ /// Gets the export definitions for the exports that have been removed.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IEnumerable{T}"/> of ExportDefinitions representing
+ /// the exports that have been added to the <see cref="CompositionContainer"/>.
+ /// </value>
+ public IEnumerable<ExportDefinition> RemovedExports { get; private set; }
+
+ /// <summary>
+ /// Gets the contract names of the exports that have changed.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IEnumerable{T}"/> of strings representing the contract names of
+ /// the exports that have changed in the <see cref="CompositionContainer"/>.
+ /// </value>
+ public IEnumerable<string> ChangedContractNames
+ {
+ get
+ {
+ if (this._changedContractNames == null)
+ {
+ this._changedContractNames = this.AddedExports
+ .Concat(this.RemovedExports)
+ .Select(export => export.ContractName)
+ .Distinct()
+ .ToArray();
+ }
+ return this._changedContractNames;
+ }
+ }
+
+ /// <summary>
+ /// Gets the atomicComposition, if any, that this change applies to.
+ /// </summary>
+ /// <value>
+ /// A <see cref="AtomicComposition"/> that this set of changes applies too.
+ ///
+ /// It can be <see langword="null"/> if the changes are being applied outside a
+ /// <see cref="AtomicComposition"/> or during a
+ /// <see cref="ExportProvider.ExportsChanged"/> event.
+ ///
+ /// When the value is non-null it should be used to record temporary changed state
+ /// and actions that will be executed when the atomicComposition is completeed.
+ /// </value>
+ public AtomicComposition AtomicComposition { get; private set; }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs
new file mode 100644
index 0000000..28d013b
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/INotifyComposablePartCatalogChanged.cs
@@ -0,0 +1,19 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// Notifications when a ComposablePartCatalog changes.
+ /// </summary>
+ public interface INotifyComposablePartCatalogChanged
+ {
+ event EventHandler<ComposablePartCatalogChangeEventArgs> Changed;
+ event EventHandler<ComposablePartCatalogChangeEventArgs> Changing;
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs
new file mode 100644
index 0000000..d5fb427
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.EngineContext.cs
@@ -0,0 +1,84 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class ImportEngine
+ {
+ /// <summary>
+ /// Used to wrap the start and stop of enforcing export changes don't
+ /// break required imports. This context is stored in a AtomicComposition.
+ /// </summary>
+ private class EngineContext
+ {
+ private ImportEngine _importEngine;
+ private List<PartManager> _addedPartManagers = new List<PartManager>();
+ private List<PartManager> _removedPartManagers = new List<PartManager>();
+ private EngineContext _parentEngineContext;
+
+ public EngineContext(ImportEngine importEngine, EngineContext parentEngineContext)
+ {
+ this._importEngine = importEngine;
+ this._parentEngineContext = parentEngineContext;
+ }
+
+ public void AddPartManager(PartManager part)
+ {
+ Assumes.NotNull(part);
+ if (!this._removedPartManagers.Remove(part))
+ {
+ this._addedPartManagers.Add(part);
+ }
+ }
+
+ public void RemovePartManager(PartManager part)
+ {
+ Assumes.NotNull(part);
+ if (!this._addedPartManagers.Remove(part))
+ {
+ this._removedPartManagers.Add(part);
+ }
+ }
+
+ public IEnumerable<PartManager> GetAddedPartManagers()
+ {
+ if (this._parentEngineContext != null)
+ {
+ return this._addedPartManagers.ConcatAllowingNull(this._parentEngineContext.GetAddedPartManagers());
+ }
+ return this._addedPartManagers;
+ }
+
+ public IEnumerable<PartManager> GetRemovedPartManagers()
+ {
+ if (this._parentEngineContext != null)
+ {
+ return this._removedPartManagers.ConcatAllowingNull(this._parentEngineContext.GetRemovedPartManagers());
+ }
+ return this._removedPartManagers;
+ }
+
+ public void Complete()
+ {
+ foreach (var partManager in this._addedPartManagers)
+ {
+ this._importEngine.StartSatisfyingImports(partManager, null);
+ }
+
+ foreach (var partManager in this._removedPartManagers)
+ {
+ this._importEngine.StopSatisfyingImports(partManager, null);
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs
new file mode 100644
index 0000000..2af4197
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.PartManager.cs
@@ -0,0 +1,211 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class ImportEngine
+ {
+ /// <summary>
+ /// Used by the <see cref="ImportEngine"/> to manage the composition of a given part.
+ /// It stores things like the list of disposable exports used to satisfy the imports as
+ /// well as the caching of the exports discovered during previewing of a part.
+ /// </summary>
+ private class PartManager
+ {
+ private Dictionary<ImportDefinition, List<IDisposable>> _importedDisposableExports;
+ private Dictionary<ImportDefinition, Export[]> _importCache;
+ private string[] _importedContractNames;
+ private ComposablePart _part;
+ private ImportState _state = ImportState.NoImportsSatisfied;
+ private readonly ImportEngine _importEngine;
+
+ public PartManager(ImportEngine importEngine, ComposablePart part)
+ {
+ this._importEngine = importEngine;
+ this._part = part;
+ }
+
+ public ComposablePart Part
+ {
+ get
+ {
+ return this._part;
+ }
+ }
+
+ public ImportState State
+ {
+ get
+ {
+ using (this._importEngine._lock.LockStateForRead())
+ {
+ return this._state;
+ }
+ }
+ set
+ {
+ using (this._importEngine._lock.LockStateForWrite())
+ {
+ this._state = value;
+ }
+ }
+ }
+
+ public bool TrackingImports { get; set; }
+
+ public IEnumerable<string> GetImportedContractNames()
+ {
+ if (this.Part == null)
+ {
+ return Enumerable.Empty<string>();
+ }
+
+ if (this._importedContractNames == null)
+ {
+ this._importedContractNames = this.Part.ImportDefinitions.Select(import => import.ContractName ?? ImportDefinition.EmptyContractName).Distinct().ToArray();
+ }
+ return this._importedContractNames;
+ }
+
+ public CompositionResult TrySetImport(ImportDefinition import, IEnumerable<Export> exports)
+ {
+ try
+ {
+ this.Part.SetImport(import, exports);
+ UpdateDisposableDependencies(import, exports);
+ return CompositionResult.SucceededResult;
+ }
+ catch (CompositionException ex)
+ { // Pulling on one of the exports failed
+
+ return new CompositionResult(
+ ErrorBuilder.CreatePartCannotSetImport(Part, import, ex));
+ }
+ catch (ComposablePartException ex)
+ { // Type mismatch between export and import
+
+ return new CompositionResult(
+ ErrorBuilder.CreatePartCannotSetImport(Part, import, ex));
+ }
+ }
+
+ public void SetSavedImport(ImportDefinition import, Export[] exports, AtomicComposition atomicComposition)
+ {
+ if (atomicComposition != null)
+ {
+ var savedExports = this.GetSavedImport(import);
+
+ // Add a revert action to revert the stored exports
+ // in the case that this atomicComposition gets rolled back.
+ atomicComposition.AddRevertAction(() =>
+ this.SetSavedImport(import, savedExports, null));
+ }
+
+ if (this._importCache == null)
+ {
+ this._importCache = new Dictionary<ImportDefinition, Export[]>();
+ }
+
+ this._importCache[import] = exports;
+ }
+
+ public Export[] GetSavedImport(ImportDefinition import)
+ {
+ Export[] exports = null;
+ if (this._importCache != null)
+ {
+ // We don't care about the return value we just want the exports
+ // and if it isn't present we just return the initialized null value
+ this._importCache.TryGetValue(import, out exports);
+ }
+ return exports;
+ }
+
+ public void ClearSavedImports()
+ {
+ this._importCache = null;
+ }
+
+ public CompositionResult TryOnComposed()
+ {
+ try
+ {
+ this.Part.Activate();
+ return CompositionResult.SucceededResult;
+ }
+ catch (ComposablePartException ex)
+ { // Type failed to be constructed, imports could not be set, etc
+ return new CompositionResult(
+ ErrorBuilder.CreatePartCannotActivate(this.Part, ex));
+ }
+ }
+
+ public void UpdateDisposableDependencies(ImportDefinition import, IEnumerable<Export> exports)
+ {
+ // Determine if there are any new disposable exports, optimizing for the most
+ // likely case, which is that there aren't any
+ List<IDisposable> disposableExports = null;
+ foreach (var disposableExport in exports.OfType<IDisposable>())
+ {
+ if (disposableExports == null)
+ {
+ disposableExports = new List<IDisposable>();
+ }
+ disposableExports.Add(disposableExport);
+ }
+
+ // Dispose any existing references previously set on this import
+ List<IDisposable> oldDisposableExports = null;
+ if (this._importedDisposableExports != null &&
+ this._importedDisposableExports.TryGetValue(import, out oldDisposableExports))
+ {
+ oldDisposableExports.ForEach(disposable => disposable.Dispose());
+
+ // If there aren't any replacements, get rid of the old storage
+ if (disposableExports == null)
+ {
+ this._importedDisposableExports.Remove(import);
+ if (!this._importedDisposableExports.FastAny())
+ {
+ this._importedDisposableExports = null;
+ }
+
+ return;
+ }
+ }
+
+ // Record the new collection
+ if (disposableExports != null)
+ {
+ if (this._importedDisposableExports == null)
+ {
+ this._importedDisposableExports = new Dictionary<ImportDefinition, List<IDisposable>>();
+ }
+ this._importedDisposableExports[import] = disposableExports;
+ }
+ }
+
+ public void DisposeAllDependencies()
+ {
+ if (this._importedDisposableExports != null)
+ {
+ IEnumerable<IDisposable> dependencies = this._importedDisposableExports.Values
+ .SelectMany(exports => exports);
+
+ this._importedDisposableExports = null;
+
+ dependencies.ForEach(disposableExport => disposableExport.Dispose());
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs
new file mode 100644
index 0000000..ba1f98a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs
@@ -0,0 +1,159 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ public partial class ImportEngine
+ {
+ /// <summary>
+ /// Used by the <see cref="ImportEngine"/> to effiecently store and retrieve the list of parts
+ /// that will be affected by changes to exports. This allows the <see cref="ImportEngine"/> to properly
+ /// block breaking changes and also recompose imports as appropriate.
+ /// </summary>
+ private class RecompositionManager
+ {
+ private WeakReferenceCollection<PartManager> _partsToIndex = new WeakReferenceCollection<PartManager>();
+ private WeakReferenceCollection<PartManager> _partsToUnindex = new WeakReferenceCollection<PartManager>();
+ private Dictionary<string, WeakReferenceCollection<PartManager>> _partManagerIndex = new Dictionary<string, WeakReferenceCollection<PartManager>>();
+
+ public void AddPartToIndex(PartManager partManager)
+ {
+ this._partsToIndex.Add(partManager);
+ }
+
+ public void AddPartToUnindex(PartManager partManager)
+ {
+ this._partsToUnindex.Add(partManager);
+ }
+
+ public IEnumerable<PartManager> GetAffectedParts(IEnumerable<string> changedContractNames)
+ {
+ this.UpdateImportIndex();
+
+ List<PartManager> parts = new List<PartManager>();
+
+ parts.AddRange(GetPartsImporting(ImportDefinition.EmptyContractName));
+
+ foreach (string contractName in changedContractNames)
+ {
+ parts.AddRange(GetPartsImporting(contractName));
+ }
+
+ return parts;
+ }
+
+ public static IEnumerable<ImportDefinition> GetAffectedImports(ComposablePart part, IEnumerable<ExportDefinition> changedExports)
+ {
+ return part.ImportDefinitions.Where(import => IsAffectedImport(import, changedExports));
+ }
+
+ private static bool IsAffectedImport(ImportDefinition import, IEnumerable<ExportDefinition> changedExports)
+ {
+ // This could be more efficient still if the export definitions were indexed by contract name,
+ // only worth revisiting if we need to squeeze more performance out of recomposition
+ foreach (var export in changedExports)
+ {
+ if (import.IsConstraintSatisfiedBy(export))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public IEnumerable<PartManager> GetPartsImporting(string contractName)
+ {
+ WeakReferenceCollection<PartManager> partManagerList;
+ if (!this._partManagerIndex.TryGetValue(contractName, out partManagerList))
+ {
+ return Enumerable.Empty<PartManager>();
+ }
+
+ return partManagerList.AliveItemsToList();
+ }
+
+ private void AddIndexEntries(PartManager partManager)
+ {
+ foreach (string contractName in partManager.GetImportedContractNames())
+ {
+ WeakReferenceCollection<PartManager> indexEntries;
+ if (!this._partManagerIndex.TryGetValue(contractName, out indexEntries))
+ {
+ indexEntries = new WeakReferenceCollection<PartManager>();
+ this._partManagerIndex.Add(contractName, indexEntries);
+ }
+
+ if (!indexEntries.Contains(partManager))
+ {
+ indexEntries.Add(partManager);
+ }
+ }
+ }
+
+ private void RemoveIndexEntries(PartManager partManager)
+ {
+ foreach (string contractName in partManager.GetImportedContractNames())
+ {
+ WeakReferenceCollection<PartManager> indexEntries;
+ if (this._partManagerIndex.TryGetValue(contractName, out indexEntries))
+ {
+ indexEntries.Remove(partManager);
+ var aliveItems = indexEntries.AliveItemsToList();
+
+ if (aliveItems.Count == 0)
+ {
+ this._partManagerIndex.Remove(contractName);
+ }
+ }
+ }
+ }
+
+ private void UpdateImportIndex()
+ {
+ var partsToIndex = this._partsToIndex.AliveItemsToList();
+ this._partsToIndex.Clear();
+
+ var partsToUnindex = this._partsToUnindex.AliveItemsToList();
+ this._partsToUnindex.Clear();
+
+ if (partsToIndex.Count == 0 && partsToUnindex.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var partManager in partsToIndex)
+ {
+ var index = partsToUnindex.IndexOf(partManager);
+
+ // If the same part is being added and removed we can ignore both
+ if (index >= 0)
+ {
+ partsToUnindex[index] = null;
+ }
+ else
+ {
+ AddIndexEntries(partManager);
+ }
+ }
+
+ foreach (var partManager in partsToUnindex)
+ {
+ if (partManager != null)
+ {
+ RemoveIndexEntries(partManager);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.cs
new file mode 100644
index 0000000..18b296a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/ImportEngine.cs
@@ -0,0 +1,754 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ // This class guarantees thread-safety under the follwoing conditions:
+ // - Each composition is executed on a single thread
+ // - No recomposition ever takes place
+ // - The class is created with isThreadSafe=true
+ public partial class ImportEngine : ICompositionService, IDisposable
+ {
+ private const int MaximumNumberOfCompositionIterations = 100;
+
+ private volatile bool _isDisposed;
+ private ExportProvider _sourceProvider;
+ private Stack<PartManager> _recursionStateStack = new Stack<PartManager>();
+ private ConditionalWeakTable<ComposablePart, PartManager> _partManagers = new ConditionalWeakTable<ComposablePart, PartManager>();
+ private RecompositionManager _recompositionManager = new RecompositionManager();
+ private readonly CompositionLock _lock = null;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportEngine"/> class.
+ /// </summary>
+ /// <param name="sourceProvider">
+ /// The <see cref="ExportProvider"/> which provides the
+ /// <see cref="ImportEngine"/> access to <see cref="Export"/>s.
+ /// </param>
+ public ImportEngine(ExportProvider sourceProvider)
+ : this(sourceProvider, false)
+ {
+ }
+
+ public ImportEngine(ExportProvider sourceProvider, bool isThreadSafe)
+ {
+ Requires.NotNull(sourceProvider, "sourceProvider");
+
+ this._sourceProvider = sourceProvider;
+ this._sourceProvider.ExportsChanging += this.OnExportsChanging;
+ this._lock = new CompositionLock(isThreadSafe);
+ }
+
+ /// <summary>
+ /// Previews all the required imports for the given <see cref="ComposablePart"/> to
+ /// ensure they can all be satisified. The preview does not actually set the imports
+ /// only ensures that they exist in the source provider. If the preview succeeds then
+ /// the <see cref="ImportEngine"/> also enforces that changes to exports in the source
+ /// provider will not break any of the required imports. If this enforcement needs to be
+ /// lifted for this part then <see cref="ReleaseImports"/> needs to be called for this
+ /// <see cref="ComposablePart"/>.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to preview the required imports.
+ /// </param>
+ /// <param name="atomicComposition"></param>
+ /// <exception cref="CompositionException">
+ /// An error occurred during previewing and <paramref name="atomicComposition"/> is null.
+ /// <see cref="CompositionException.Errors"/> will contain a collection of errors that occurred.
+ /// The pre-existing composition is in an unknown state, depending on the errors that occured.
+ /// </exception>
+ /// <exception cref="ChangeRejectedException">
+ /// An error occurred during the previewing and <paramref name="atomicComposition"/> is not null.
+ /// <see cref="CompositionException.Errors"/> will contain a collection of errors that occurred.
+ /// The pre-existing composition remains in valid state.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ImportEngine"/> has been disposed of.
+ /// </exception>
+ public void PreviewImports(ComposablePart part, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(part, "part");
+
+ // NOTE : this is a very intricate area threading-wise, please use caution when changing, otherwise state corruption or deadlocks will ensue
+ // The gist of what we are doing is as follows:
+ // We need to lock the composition, as we will proceed modifying our internal state. The tricky part is when we release the lock
+ // Due to the fact that some actions will take place AFTER we leave this method, we need to KEEP THAT LOCK HELD until the transation is commiited or rolled back
+ // This is the reason we CAN'T use "using here.
+ // Instead, if the transaction is present we will queue up the release of the lock, otherwise we will release it when we exit this method
+ // We add the "release" lock to BOTH Commit and Revert queues, because they are mutually exclusive, and we need to release the lock regardless.
+
+ // This will take the lock, if necesary
+ IDisposable compositionLockHolder = this._lock.IsThreadSafe ? this._lock.LockComposition() : null;
+ bool compositionLockTaken = (compositionLockHolder != null);
+ try
+ {
+ // revert actions are processed in the reverse order, so we have to add the "release lock" action now
+ if (compositionLockTaken && (atomicComposition != null))
+ {
+ atomicComposition.AddRevertAction(() => compositionLockHolder.Dispose());
+ }
+
+ var partManager = GetPartManager(part, true);
+ var result = TryPreviewImportsStateMachine(partManager, part, atomicComposition);
+ result.ThrowOnErrors(atomicComposition);
+
+ StartSatisfyingImports(partManager, atomicComposition);
+
+ // Add the "release lock" to the commit actions
+ if (compositionLockTaken && (atomicComposition != null))
+ {
+ atomicComposition.AddCompleteAction(() => compositionLockHolder.Dispose());
+ }
+ }
+ finally
+ {
+ // We haven't updated the queues, so we can release the lock now
+ if (compositionLockTaken && (atomicComposition == null))
+ {
+ compositionLockHolder.Dispose();
+ }
+ }
+ }
+
+ /// <summary>
+ /// Satisfies the imports of the specified composable part. If the satisfy succeeds then
+ /// the <see cref="ImportEngine"/> also enforces that changes to exports in the source
+ /// provider will not break any of the required imports. If this enforcement needs to be
+ /// lifted for this part then <see cref="ReleaseImports"/> needs to be called for this
+ /// <see cref="ComposablePart"/>.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to set the imports.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ImportEngine"/> has been disposed of.
+ /// </exception>
+ public void SatisfyImports(ComposablePart part)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(part, "part");
+
+ // NOTE : the following two calls use the state lock
+ PartManager partManager = this.GetPartManager(part, true);
+ if (partManager.State == ImportState.Composed)
+ {
+ return;
+ }
+
+ using (this._lock.LockComposition())
+ {
+ var result = TrySatisfyImports(partManager, part, true);
+ result.ThrowOnErrors(); // throw CompositionException not ChangeRejectedException
+ }
+ }
+
+ /// <summary>
+ /// Sets the imports of the specified composable part exactly once and they will not
+ /// ever be recomposed.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to set the imports.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ICompositionService"/> has been disposed of.
+ /// </exception>
+ public void SatisfyImportsOnce(ComposablePart part)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(part, "part");
+
+ // NOTE : the following two calls use the state lock
+ PartManager partManager = this.GetPartManager(part, true);
+ if (partManager.State == ImportState.Composed)
+ {
+ return;
+ }
+
+ using (this._lock.LockComposition())
+ {
+ var result = TrySatisfyImports(partManager, part, false);
+ result.ThrowOnErrors(); // throw CompositionException not ChangeRejectedException
+ }
+ }
+
+ /// <summary>
+ /// Removes any state stored in the <see cref="ImportEngine"/> for the associated
+ /// <see cref="ComposablePart"/> and releases all the <see cref="Export"/>s used to
+ /// satisfy the imports on the <see cref="ComposablePart"/>.
+ ///
+ /// Also removes the enforcement for changes that would break a required import on
+ /// <paramref name="part"/>.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to release the imports on.
+ /// </param>
+ /// <param name="atomicComposition">
+ /// The <see cref="AtomicComposition"/> that the release imports is running under.
+ /// </param>
+ public void ReleaseImports(ComposablePart part, AtomicComposition atomicComposition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(part, "part");
+
+ using (this._lock.LockComposition())
+ {
+ PartManager partManager = this.GetPartManager(part, false);
+ if (partManager != null)
+ {
+ this.StopSatisfyingImports(partManager, atomicComposition);
+ }
+ }
+ }
+
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ public void Dispose()
+ {
+ this.Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <summary>
+ /// Releases unmanaged and - optionally - managed resources
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ if (!this._isDisposed)
+ {
+ bool disposeLock = false;
+ ExportProvider sourceProviderToUnsubscribeFrom = null;
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._isDisposed)
+ {
+ sourceProviderToUnsubscribeFrom = this._sourceProvider;
+ this._sourceProvider = null;
+ this._recompositionManager = null;
+ this._partManagers = null;
+ this._isDisposed = true;
+ disposeLock = true;
+ }
+ }
+
+ if (sourceProviderToUnsubscribeFrom != null)
+ {
+ sourceProviderToUnsubscribeFrom.ExportsChanging -= this.OnExportsChanging;
+ }
+
+ if (disposeLock)
+ {
+ this._lock.Dispose();
+ }
+ }
+ }
+ }
+
+ private CompositionResult TryPreviewImportsStateMachine(PartManager partManager,
+ ComposablePart part, AtomicComposition atomicComposition)
+ {
+ var result = CompositionResult.SucceededResult;
+
+ if (partManager.State == ImportState.ImportsPreviewing)
+ {
+ // We shouldn't nomally ever hit this case but if we do
+ // then we should just error with a cycle error.
+ return new CompositionResult(ErrorBuilder.CreatePartCycle(part));
+ }
+
+ // Transition from NoImportsStatisified to ImportsPreviewed
+ if (partManager.State == ImportState.NoImportsSatisfied)
+ {
+ partManager.State = ImportState.ImportsPreviewing;
+
+ var requiredImports = part.ImportDefinitions.Where(IsRequiredImportForPreview);
+
+ // If this atomicComposition gets rolledback for any reason we need to reset our state
+ atomicComposition.AddRevertActionAllowNull(() => partManager.State = ImportState.NoImportsSatisfied);
+
+ result = result.MergeResult(
+ this.TrySatisfyImportSubset(partManager, requiredImports, atomicComposition));
+
+ if (!result.Succeeded)
+ {
+ partManager.State = ImportState.NoImportsSatisfied;
+ return result;
+ }
+
+ partManager.State = ImportState.ImportsPreviewed;
+ }
+
+ return result;
+ }
+
+ private CompositionResult TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
+ {
+ var result = CompositionResult.SucceededResult;
+
+ while (partManager.State < ImportState.Composed)
+ {
+ var previousState = partManager.State;
+
+ switch (partManager.State)
+ {
+ // "ed" states which represent a some sort of steady state and will
+ // attempt to do a state transition
+ case ImportState.NoImportsSatisfied:
+ case ImportState.ImportsPreviewed:
+ {
+ partManager.State = ImportState.PreExportImportsSatisfying;
+
+ var prereqImports = part.ImportDefinitions.Where(import => import.IsPrerequisite);
+ result = result.MergeResult(
+ this.TrySatisfyImportSubset(partManager, prereqImports, null));
+
+ partManager.State = ImportState.PreExportImportsSatisfied;
+ break;
+ }
+ case ImportState.PreExportImportsSatisfied:
+ {
+ partManager.State = ImportState.PostExportImportsSatisfying;
+
+ var requiredImports = part.ImportDefinitions.Where(import => !import.IsPrerequisite);
+
+ result = result.MergeResult(
+ this.TrySatisfyImportSubset(partManager, requiredImports, null));
+
+ partManager.State = ImportState.PostExportImportsSatisfied;
+ break;
+ }
+ case ImportState.PostExportImportsSatisfied:
+ {
+ partManager.State = ImportState.ComposedNotifying;
+
+ partManager.ClearSavedImports();
+ result = result.MergeResult(partManager.TryOnComposed());
+
+ partManager.State = ImportState.Composed;
+ break;
+ }
+
+
+ // "ing" states which represent some sort of cycle
+ // These state should always return, error or not, instead of breaking
+ case ImportState.ImportsPreviewing:
+ {
+ // We shouldn't nomally ever hit this case but if we do
+ // then we should just error with a cycle error.
+ return new CompositionResult(ErrorBuilder.CreatePartCycle(part));
+ }
+ case ImportState.PreExportImportsSatisfying:
+ case ImportState.PostExportImportsSatisfying:
+ {
+ if (InPrerequisiteLoop())
+ {
+ return result.MergeError(ErrorBuilder.CreatePartCycle(part));
+ }
+ // Cycles in post export imports are allowed so just return in that case
+ return result;
+ }
+ case ImportState.ComposedNotifying:
+ {
+ // We are currently notifying so don't notify again just return
+ return result;
+ }
+ }
+
+ // if an error occured while doing a state transition
+ if (!result.Succeeded)
+ {
+ // revert to the previous state and return the error
+ partManager.State = previousState;
+ return result;
+ }
+ }
+ return result;
+ }
+
+ private CompositionResult TrySatisfyImports(PartManager partManager, ComposablePart part, bool shouldTrackImports)
+ {
+ Assumes.NotNull(part);
+
+ var result = CompositionResult.SucceededResult;
+
+ // get out if the part is already composed
+ if (partManager.State == ImportState.Composed)
+ {
+ return result;
+ }
+
+ // Track number of recursive iterations and throw an exception before the stack
+ // fills up and debugging the root cause becomes tricky
+ if (this._recursionStateStack.Count >= MaximumNumberOfCompositionIterations)
+ {
+ return result.MergeError(
+ ErrorBuilder.ComposeTookTooManyIterations(MaximumNumberOfCompositionIterations));
+ }
+
+ // Maintain the stack to detect whether recursive loops cross prerequisites
+ this._recursionStateStack.Push(partManager);
+ try
+ {
+ result = result.MergeResult(
+ TrySatisfyImportsStateMachine(partManager, part));
+ }
+ finally
+ {
+ this._recursionStateStack.Pop();
+ }
+
+ if (shouldTrackImports)
+ {
+ StartSatisfyingImports(partManager, null);
+ }
+
+ return result;
+ }
+
+ private CompositionResult TrySatisfyImportSubset(PartManager partManager,
+ IEnumerable<ImportDefinition> imports, AtomicComposition atomicComposition)
+ {
+ CompositionResult result = CompositionResult.SucceededResult;
+
+ var part = partManager.Part;
+ foreach (ImportDefinition import in imports)
+ {
+ var exports = partManager.GetSavedImport(import);
+
+ if (exports == null)
+ {
+ CompositionResult<IEnumerable<Export>> exportsResult = TryGetExports(
+ this._sourceProvider, part, import, atomicComposition);
+
+ if (!exportsResult.Succeeded)
+ {
+ result = result.MergeResult(exportsResult.ToResult());
+ continue;
+ }
+ exports = exportsResult.Value.AsArray();
+ }
+
+ if (atomicComposition == null)
+ {
+ result = result.MergeResult(
+ partManager.TrySetImport(import, exports));
+ }
+ else
+ {
+ partManager.SetSavedImport(import, exports, atomicComposition);
+ }
+ }
+ return result;
+ }
+
+ private void OnExportsChanging(object sender, ExportsChangeEventArgs e)
+ {
+ CompositionResult result = CompositionResult.SucceededResult;
+
+ // Prepare for the recomposition effort by minimizing the amount of work we'll have to do later
+ AtomicComposition atomicComposition = e.AtomicComposition;
+
+ IEnumerable<PartManager> affectedParts = this._recompositionManager.GetAffectedParts(e.ChangedContractNames);
+
+ // When in a atomicComposition account for everything that isn't yet reflected in the
+ // index
+ if (atomicComposition != null)
+ {
+ EngineContext engineContext;
+ if (atomicComposition.TryGetValue(this, out engineContext))
+ {
+ // always added the new part managers to see if they will also be
+ // affected by these changes
+ affectedParts = affectedParts.ConcatAllowingNull(engineContext.GetAddedPartManagers())
+ .Except(engineContext.GetRemovedPartManagers());
+ }
+ }
+
+ var changedExports = e.AddedExports.ConcatAllowingNull(e.RemovedExports);
+
+ foreach (var partManager in affectedParts)
+ {
+ result = result.MergeResult(this.TryRecomposeImports(partManager, changedExports, atomicComposition));
+ }
+
+ result.ThrowOnErrors(atomicComposition);
+ }
+
+ private CompositionResult TryRecomposeImports(PartManager partManager,
+ IEnumerable<ExportDefinition> changedExports, AtomicComposition atomicComposition)
+ {
+ var result = CompositionResult.SucceededResult;
+
+ switch (partManager.State)
+ {
+ case ImportState.ImportsPreviewed:
+ case ImportState.Composed:
+ // Validate states to continue.
+ break;
+
+ default:
+ {
+ // All other states are invalid and for recomposition.
+ return new CompositionResult(ErrorBuilder.InvalidStateForRecompposition(partManager.Part));
+ }
+ }
+
+ var affectedImports = RecompositionManager.GetAffectedImports(partManager.Part, changedExports);
+ bool partComposed = (partManager.State == ImportState.Composed);
+
+ bool recomposedImport = false;
+ foreach (var import in affectedImports)
+ {
+ result = result.MergeResult(
+ TryRecomposeImport(partManager, partComposed, import, atomicComposition));
+
+ recomposedImport = true;
+ }
+
+ // Knowing that the part has already been composed before and that the only possible
+ // changes are to recomposable imports, we can safely go ahead and do this now or
+ // schedule it for later
+ if (result.Succeeded && recomposedImport && partComposed)
+ {
+ if (atomicComposition == null)
+ {
+ result = result.MergeResult(partManager.TryOnComposed());
+ }
+ else
+ {
+ atomicComposition.AddCompleteAction(() => partManager.TryOnComposed().ThrowOnErrors());
+ }
+ }
+
+ return result;
+ }
+
+ private CompositionResult TryRecomposeImport(PartManager partManager, bool partComposed,
+ ImportDefinition import, AtomicComposition atomicComposition)
+ {
+ if (partComposed && !import.IsRecomposable)
+ {
+ return new CompositionResult(ErrorBuilder.PreventedByExistingImport(partManager.Part, import));
+ }
+
+ // During recomposition you must always requery with the new atomicComposition you cannot use any
+ // cached value in the part manager
+ var exportsResult = TryGetExports(this._sourceProvider, partManager.Part, import, atomicComposition);
+ if (!exportsResult.Succeeded)
+ {
+ return exportsResult.ToResult();
+ }
+ var exports = exportsResult.Value.AsArray();
+
+ if (partComposed)
+ {
+ // Knowing that the part has already been composed before and that the only possible
+ // changes are to recomposable imports, we can safely go ahead and do this now or
+ // schedule it for later
+ if (atomicComposition == null)
+ {
+ return partManager.TrySetImport(import, exports);
+ }
+ else
+ {
+ atomicComposition.AddCompleteAction(() => partManager.TrySetImport(import, exports).ThrowOnErrors());
+ }
+ }
+ else
+ {
+ partManager.SetSavedImport(import, exports, atomicComposition);
+ }
+
+ return CompositionResult.SucceededResult;
+ }
+
+ private void StartSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
+ {
+ // When not running in a atomicCompositional state, schedule reindexing after ensuring
+ // that this isn't a redundant addition
+ if (atomicComposition == null)
+ {
+ if (!partManager.TrackingImports)
+ {
+ partManager.TrackingImports = true;
+ this._recompositionManager.AddPartToIndex(partManager);
+ }
+ }
+ else
+ {
+ // While in a atomicCompositional state use a less efficient but effective means
+ // of achieving the same results
+ GetEngineContext(atomicComposition).AddPartManager(partManager);
+ }
+ }
+
+ private void StopSatisfyingImports(PartManager partManager, AtomicComposition atomicComposition)
+ {
+ // When not running in a atomicCompositional state, schedule reindexing after ensuring
+ // that this isn't a redundant removal
+ if (atomicComposition == null)
+ {
+ this._partManagers.Remove(partManager.Part);
+
+ // Take care of lifetime requirements
+ partManager.DisposeAllDependencies();
+
+ if (partManager.TrackingImports)
+ {
+ partManager.TrackingImports = false;
+ this._recompositionManager.AddPartToUnindex(partManager);
+ }
+ }
+ else
+ {
+ // While in a atomicCompositional state use a less efficient but effective means
+ // of achieving the same results
+ GetEngineContext(atomicComposition).RemovePartManager(partManager);
+ }
+ }
+
+ private PartManager GetPartManager(ComposablePart part, bool createIfNotpresent)
+ {
+ PartManager partManager = null;
+ using (this._lock.LockStateForRead())
+ {
+ if (this._partManagers.TryGetValue(part, out partManager))
+ {
+ return partManager;
+ }
+ }
+
+ if (createIfNotpresent)
+ {
+ using (this._lock.LockStateForWrite())
+ {
+ if (!this._partManagers.TryGetValue(part, out partManager))
+ {
+ partManager = new PartManager(this, part);
+ this._partManagers.Add(part, partManager);
+ }
+ }
+ }
+ return partManager;
+ }
+
+
+ private EngineContext GetEngineContext(AtomicComposition atomicComposition)
+ {
+ Assumes.NotNull(atomicComposition);
+
+ EngineContext engineContext;
+ if (!atomicComposition.TryGetValue(this, true, out engineContext))
+ {
+ EngineContext parentContext;
+ atomicComposition.TryGetValue(this, false, out parentContext);
+ engineContext = new EngineContext(this, parentContext);
+ atomicComposition.SetValue(this, engineContext);
+ atomicComposition.AddCompleteAction(engineContext.Complete);
+ }
+ return engineContext;
+ }
+
+ private bool InPrerequisiteLoop()
+ {
+ PartManager firstPart = this._recursionStateStack.First();
+ PartManager lastPart = null;
+
+ foreach (PartManager testPart in this._recursionStateStack.Skip(1))
+ {
+ if (testPart.State == ImportState.PreExportImportsSatisfying)
+ {
+ return true;
+ }
+
+ if (testPart == firstPart)
+ {
+ lastPart = testPart;
+ break;
+ }
+ }
+
+ // This should only be called when a loop has been detected - so it should always be on the stack
+ Assumes.IsTrue(lastPart == firstPart);
+ return false;
+ }
+
+ [DebuggerStepThrough]
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+
+ private static CompositionResult<IEnumerable<Export>> TryGetExports(ExportProvider provider,
+ ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
+ {
+ try
+ {
+ var exports = provider.GetExports(definition, atomicComposition).AsArray();
+ return new CompositionResult<IEnumerable<Export>>(exports);
+ }
+ catch (ImportCardinalityMismatchException ex)
+ {
+ // Either not enough or too many exports that match the definition
+ CompositionException exception = new CompositionException(ErrorBuilder.CreateImportCardinalityMismatch(ex, definition));
+
+ return new CompositionResult<IEnumerable<Export>>(
+ ErrorBuilder.CreatePartCannotSetImport(part, definition, exception));
+ }
+ }
+
+ internal static bool IsRequiredImportForPreview(ImportDefinition import)
+ {
+ return import.Cardinality == ImportCardinality.ExactlyOne;
+ }
+
+ // Ordering of this enum is important so be sure to use caution if you
+ // try to reorder them.
+ private enum ImportState
+ {
+ NoImportsSatisfied = 0,
+ ImportsPreviewing = 1,
+ ImportsPreviewed = 2,
+ PreExportImportsSatisfying = 3,
+ PreExportImportsSatisfied = 4,
+ PostExportImportsSatisfying = 5,
+ PostExportImportsSatisfied = 6,
+ ComposedNotifying = 7,
+ Composed = 8,
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/TypeCatalog.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/TypeCatalog.cs
new file mode 100644
index 0000000..6d3be39
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Hosting/TypeCatalog.cs
@@ -0,0 +1,347 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.AttributedModel;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Hosting
+{
+ /// <summary>
+ /// An immutable ComposablePartCatalog created from a type array or a list of managed types. This class is threadsafe.
+ /// It is Disposable.
+ /// </summary>
+ [DebuggerTypeProxy(typeof(ComposablePartCatalogDebuggerProxy))]
+ public class TypeCatalog : ComposablePartCatalog, ICompositionElement
+ {
+ private readonly object _thisLock = new object();
+ private Type[] _types = null;
+ private volatile IQueryable<ComposablePartDefinition> _queryableParts;
+ private volatile bool _isDisposed = false;
+ private readonly ICompositionElement _definitionOrigin;
+ private readonly Lazy<IDictionary<string, List<ComposablePartDefinition>>> _contractPartIndex;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TypeCatalog"/> class
+ /// with the specified types.
+ /// </summary>
+ /// <param name="types">
+ /// An <see cref="Array"/> of attributed <see cref="Type"/> objects to add to the
+ /// <see cref="TypeCatalog"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="types"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="types"/> contains an element that is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="types"/> contains an element that was loaded in the Reflection-only context.
+ /// </exception>
+ public TypeCatalog(params Type[] types)
+ : this(types, (ICompositionElement)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="TypeCatalog"/> class
+ /// with the specified types.
+ /// </summary>
+ /// <param name="types">
+ /// An <see cref="IEnumerable{T}"/> of attributed <see cref="Type"/> objects to add
+ /// to the <see cref="TypeCatalog"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="types"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="types"/> contains an element that is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="types"/> contains an element that was loaded in the reflection-only context.
+ /// </exception>
+ public TypeCatalog(IEnumerable<Type> types)
+ : this(types, (ICompositionElement)null)
+ {
+ }
+
+ internal TypeCatalog(IEnumerable<Type> types, ICompositionElement definitionOrigin)
+ {
+ Requires.NotNull(types, "types");
+
+ foreach (Type type in types)
+ {
+ if (type == null)
+ {
+ throw ExceptionBuilder.CreateContainsNullElement("types");
+ }
+#if !SILVERLIGHT
+ if (type.Assembly.ReflectionOnly)
+ {
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Argument_ElementReflectionOnlyType, "types"), "types");
+ }
+#endif
+ }
+
+ this._types = types.ToArray();
+ this._definitionOrigin = definitionOrigin ?? this;
+#if !SILVERLIGHT
+ this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex, true);
+#else
+ this._contractPartIndex = new Lazy<IDictionary<string, List<ComposablePartDefinition>>>(this.CreateIndex);
+#endif
+
+ }
+
+ /// <summary>
+ /// Gets the part definitions of the catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
+ /// <see cref="TypeCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="TypeCatalog"/> has been disposed of.
+ /// </exception>
+ public override IQueryable<ComposablePartDefinition> Parts
+ {
+ get
+ {
+ this.ThrowIfDisposed();
+
+ return this.PartsInternal;
+ }
+ }
+
+ /// <summary>
+ /// Gets the display name of the type catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a human-readable display name of the <see cref="TypeCatalog"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ /// <summary>
+ /// Gets the composition element from which the type catalog originated.
+ /// </summary>
+ /// <value>
+ /// This property always returns <see langword="null"/>.
+ /// </value>
+ [SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return null; }
+ }
+
+ private IQueryable<ComposablePartDefinition> PartsInternal
+ {
+ get
+ {
+ if (this._queryableParts == null)
+ {
+ lock (this._thisLock)
+ {
+ if (this._queryableParts == null)
+ {
+ Assumes.NotNull(this._types);
+
+ var collection = new List<ComposablePartDefinition>();
+ foreach (Type type in this._types)
+ {
+ var definition = AttributedModelDiscovery.CreatePartDefinitionIfDiscoverable(type, _definitionOrigin);
+ if (definition != null)
+ {
+ collection.Add(definition);
+ }
+ }
+ IQueryable<ComposablePartDefinition> queryableParts = collection.AsQueryable();
+ Thread.MemoryBarrier();
+
+ this._types = null;
+ this._queryableParts = queryableParts;
+ }
+ }
+ }
+
+ return this._queryableParts;
+ }
+ }
+
+ /// <summary>
+ /// Returns the export definitions that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="ExportDefinition"/> objects to return.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
+ /// <see cref="ExportDefinition"/> objects and their associated
+ /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
+ /// by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePartCatalog"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>, if no
+ /// <see cref="ExportDefinition"/> match the conditions defined by
+ /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
+ /// </note>
+ /// </remarks>
+ public override IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(definition, "definition");
+
+ IEnumerable<ComposablePartDefinition> candidateParts = this.GetCandidateParts(definition);
+ if (candidateParts == null)
+ {
+ return Enumerable.Empty<Tuple<ComposablePartDefinition, ExportDefinition>>();
+ }
+
+ var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
+ foreach (var part in candidateParts)
+ {
+ foreach (var export in part.ExportDefinitions)
+ {
+ if (definition.IsConstraintSatisfiedBy(export))
+ {
+ exports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
+ }
+ }
+ }
+ return exports;
+ }
+
+ private IEnumerable<ComposablePartDefinition> GetCandidateParts(ImportDefinition definition)
+ {
+ string contractName = definition.ContractName;
+
+ // Empty string represents a non-contract based import and thus the constraint needs
+ // to be applied to all the possible exports in this catalog.
+ if (string.IsNullOrEmpty(contractName))
+ {
+ return this.PartsInternal;
+ }
+
+ List<ComposablePartDefinition> candidateParts = null;
+ if (this._contractPartIndex.Value.TryGetValue(contractName, out candidateParts))
+ {
+ return candidateParts;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ private IDictionary<string, List<ComposablePartDefinition>> CreateIndex()
+ {
+ Dictionary<string, List<ComposablePartDefinition>> index = new Dictionary<string, List<ComposablePartDefinition>>(StringComparers.ContractName);
+
+ foreach (var part in this.PartsInternal)
+ {
+ foreach (string contractName in part.ExportDefinitions.Select(export => export.ContractName).Distinct())
+ {
+ List<ComposablePartDefinition> contractParts = null;
+ if (!index.TryGetValue(contractName, out contractParts))
+ {
+ contractParts = new List<ComposablePartDefinition>();
+ index.Add(contractName, contractParts);
+ }
+ contractParts.Add(part);
+ }
+ }
+ return index;
+ }
+
+ /// <summary>
+ /// Returns a string representation of the type catalog.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the string representation of the <see cref="TypeCatalog"/>.
+ /// </returns>
+ public override string ToString()
+ {
+ return this.GetDisplayName();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ this._isDisposed = true;
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private string GetDisplayName()
+ {
+ return String.Format(CultureInfo.CurrentCulture,
+ Strings.TypeCatalog_DisplayNameFormat,
+ this.GetType().Name,
+ this.GetTypesDisplay());
+ }
+
+ private string GetTypesDisplay()
+ {
+ int count = this.PartsInternal.Count();
+ if (count == 0)
+ {
+ return Strings.TypeCatalog_Empty;
+ }
+
+ const int displayCount = 2;
+ StringBuilder builder = new StringBuilder();
+ foreach (ReflectionComposablePartDefinition definition in this.PartsInternal.Take(displayCount))
+ {
+ if (builder.Length > 0)
+ {
+ builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
+ builder.Append(" ");
+ }
+
+ builder.Append(definition.GetPartType().GetDisplayName());
+ }
+
+ if (count > displayCount)
+ { // Add an elipse to indicate that there
+ // are more types than actually listed
+ builder.Append(CultureInfo.CurrentCulture.TextInfo.ListSeparator);
+ builder.Append(" ...");
+ }
+
+ return builder.ToString();
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/IAttributedImport.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/IAttributedImport.cs
new file mode 100644
index 0000000..28b3b4f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/IAttributedImport.cs
@@ -0,0 +1,17 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ internal interface IAttributedImport
+ {
+ string ContractName { get; }
+ Type ContractType { get; }
+ bool AllowRecomposition { get; }
+ CreationPolicy RequiredCreationPolicy { get; }
+ ImportCardinality Cardinality { get; }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionError.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionError.cs
new file mode 100644
index 0000000..12af595
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionError.cs
@@ -0,0 +1,29 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ // Internal interface for providing access to the composition error
+ // identifier for an exception or error that participates in composition.
+ internal interface ICompositionError
+ {
+ CompositionErrorId Id
+ {
+ get;
+ }
+
+ ICompositionElement Element
+ {
+ get;
+ }
+
+ Exception InnerException
+ {
+ get;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionService.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionService.cs
new file mode 100644
index 0000000..9cb9feb
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ICompositionService.cs
@@ -0,0 +1,34 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Provides methods for composing <see cref="ComposablePart"/> objects.
+ /// </summary>
+ public interface ICompositionService
+ {
+ /// <summary>
+ /// Sets the imports of the specified composable part exactly once and they will not
+ /// ever be recomposed.
+ /// </summary>
+ /// <param name="part">
+ /// The <see cref="ComposablePart"/> to set the imports.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="part"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ICompositionService"/> has been disposed of.
+ /// </exception>
+ void SatisfyImportsOnce(ComposablePart part);
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs
new file mode 100644
index 0000000..7969e0c
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/IPartImportsSatisfiedNotification.cs
@@ -0,0 +1,12 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition
+{
+ public interface IPartImportsSatisfiedNotification
+ {
+ void OnImportsSatisfied();
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportAttribute.cs
new file mode 100644
index 0000000..d2879f7
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportAttribute.cs
@@ -0,0 +1,181 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that a property, field, or parameter imports a particular export.
+ /// </summary>
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
+ AllowMultiple = false, Inherited = false)]
+ public class ImportAttribute : Attribute, IAttributedImport
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
+ /// export with the default contract name.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
+ /// or parameter type that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportAttribute()
+ : this((string)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
+ /// export with the contract name derived from the specified type.
+ /// </summary>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name of the export to import, or
+ /// <see langword="null"/> to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// <paramref name="contractType"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
+ /// or parameter type that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportAttribute(Type contractType)
+ : this((string)null, contractType)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
+ /// export with the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the export to import, or
+ /// <see langword="null"/> or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
+ /// or parameter type that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportAttribute(string contractName)
+ : this(contractName, (Type)null)
+ {
+ }
+
+ public ImportAttribute(string contractName, Type contractType)
+ {
+ this.ContractName = contractName;
+ this.ContractType = contractType;
+ }
+
+ /// <summary>
+ /// Gets the contract name of the export to import.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the contract name of the export to import. The
+ /// default value is an empty string ("").
+ /// </value>
+ public string ContractName { get; private set; }
+
+ /// <summary>
+ /// Get the contract type of the export to import.
+ /// </summary>
+ /// <value>
+ /// A <see cref="Type"/> of the export that this import is expecting. The default value is
+ /// <see langword="null"/> which means that the type will be obtained by looking at the type on
+ /// the member that this import is attached to. If the type is <see cref="object"/> then the
+ /// importer is delaring they can accept any exported type.
+ /// </value>
+ public Type ContractType { get; private set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the property, field or parameter will be set
+ /// to its type's default value when an export with the contract name is not present in
+ /// the container.
+ /// </summary>
+ /// <value>
+ /// <see langword="true"/> if the property, field or parameter will be set
+ /// its type's default value when an export with the <see cref="ContractName"/> is not
+ /// present in the <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
+ /// The default value is <see langword="false"/>.
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// The default value of a property's, field's or parameter's type is
+ /// <see langword="null"/> for reference types and 0 for numeric value types. For
+ /// other value types, the default value will be each field of the value type
+ /// initialized to zero, if the field is a value type or <see langword="null"/> if
+ /// the field is a reference type.
+ /// </para>
+ /// </remarks>
+ public bool AllowDefault { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the property or field will be recomposed
+ /// when exports that provide the same contract that this import expects, have changed
+ /// in the container.
+ /// </summary>
+ /// <value>
+ /// <see langword="true"/> if the property or field allows for recomposition when exports
+ /// that provide the same <see cref="ContractName"/> are added or removed from the
+ /// <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
+ /// The default value is <see langword="false"/>.
+ /// </value>
+ public bool AllowRecomposition { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating that the importer requires a specific
+ /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
+ /// </summary>
+ /// <value>
+ /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
+ /// require a specific <see cref="CreationPolicy"/>.
+ ///
+ /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
+ /// by everyone in the container.
+ ///
+ /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
+ /// non-shared in a container and thus everyone gets their own instance.
+ /// </value>
+ public CreationPolicy RequiredCreationPolicy { get; set; }
+
+ ImportCardinality IAttributedImport.Cardinality
+ {
+ get
+ {
+ if (this.AllowDefault == true)
+ {
+ return ImportCardinality.ZeroOrOne;
+ }
+ return ImportCardinality.ExactlyOne;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs
new file mode 100644
index 0000000..e7e09c7
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportCardinalityMismatchException.cs
@@ -0,0 +1,91 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Runtime.Serialization;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// The exception that is thrown when the cardinality of a <see cref="ImportDefinition"/>
+ /// does not match the cardinality of the <see cref="Export"/> objects available in an
+ /// <see cref="ExportProvider"/>.
+ /// </summary>
+ [Serializable]
+ public class ImportCardinalityMismatchException : Exception
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class.
+ /// </summary>
+ public ImportCardinalityMismatchException()
+ : this((string)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
+ /// with the specified error message.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ public ImportCardinalityMismatchException(string message)
+ : this(message, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
+ /// with the specified error message and exception that is the cause of the
+ /// exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="innerException">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="ImportCardinalityMismatchException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
+ /// </param>
+ public ImportCardinalityMismatchException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+
+#if !SILVERLIGHT
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportCardinalityMismatchException"/> class
+ /// with the specified serialization data.
+ /// </summary>
+ /// <param name="info">
+ /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
+ /// <see cref="ImportCardinalityMismatchException"/>.
+ /// </param>
+ /// <param name="context">
+ /// The <see cref="StreamingContext"/> that contains contextual information about the
+ /// source or destination.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="info"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="SerializationException">
+ /// <paramref name="info"/> is missing a required value.
+ /// </exception>
+ /// <exception cref="InvalidCastException">
+ /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
+ /// </exception>
+ [System.Security.SecuritySafeCritical]
+ protected ImportCardinalityMismatchException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ }
+#endif //!SILVERLIGHT
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportManyAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportManyAttribute.cs
new file mode 100644
index 0000000..cdd1163
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportManyAttribute.cs
@@ -0,0 +1,152 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that a property, field, or parameter imports a particular set of exports.
+ /// </summary>
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter,
+ AllowMultiple = false, Inherited = false)]
+ public class ImportManyAttribute : Attribute, IAttributedImport
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
+ /// set of exports with the default contract name.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the element\item type of
+ /// theproperty, field, or parameter type that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportManyAttribute()
+ : this((string)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
+ /// set of exports with the contract name derived from the specified type.
+ /// </summary>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name of the exports to import, or
+ /// <see langword="null"/> to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// <paramref name="contractType"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
+ /// or parameter type that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportManyAttribute(Type contractType)
+ : this((string)null, contractType)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
+ /// set of exports with the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the exports to import, or
+ /// <see langword="null"/> or an empty string ("") to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the property, field,
+ /// or parameter type that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public ImportManyAttribute(string contractName)
+ : this(contractName, (Type)null)
+ {
+ }
+
+ public ImportManyAttribute(string contractName, Type contractType)
+ {
+ this.ContractName = contractName;
+ this.ContractType = contractType;
+ }
+
+ /// <summary>
+ /// Gets the contract name of the exports to import.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the contract name of the exports to import. The
+ /// default value is an empty string ("").
+ /// </value>
+ public string ContractName { get; private set; }
+
+ /// <summary>
+ /// Get the contract type of the export to import.
+ /// </summary>
+ /// <value>
+ /// A <see cref="Type"/> of the export that this import is expecting. The default value is
+ /// <see langword="null"/> which means that the type will be obtained by looking at the type on
+ /// the member that this import is attached to. If the type is <see cref="object"/> then the
+ /// importer is delaring they can accept any exported type.
+ /// </value>
+ public Type ContractType { get; private set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the property or field will be recomposed
+ /// when exports that provide the same contract that this import expects, have changed
+ /// in the container.
+ /// </summary>
+ /// <value>
+ /// <see langword="true"/> if the property or field allows for recomposition when exports
+ /// that provide the same <see cref="ContractName"/> are added or removed from the
+ /// <see cref="CompositionContainer"/>; otherwise, <see langword="false"/>.
+ /// The default value is <see langword="false"/>.
+ /// </value>
+ public bool AllowRecomposition { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating that the importer requires a specific
+ /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
+ /// </summary>
+ /// <value>
+ /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
+ /// require a specific <see cref="CreationPolicy"/>.
+ ///
+ /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
+ /// by everyone in the container.
+ ///
+ /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
+ /// non-shared in a container and thus everyone gets their own instance.
+ /// </value>
+ public CreationPolicy RequiredCreationPolicy { get; set; }
+
+ ImportCardinality IAttributedImport.Cardinality
+ {
+ get { return ImportCardinality.ZeroOrMore; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportingConstructorAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportingConstructorAttribute.cs
new file mode 100644
index 0000000..db4a5eb
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ImportingConstructorAttribute.cs
@@ -0,0 +1,28 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that a constructor should be used when constructing an attributed part.
+ /// </summary>
+ /// <remarks>
+ /// By default, only a default parameter-less constructor, if available, is used to
+ /// construct an attributed part. Use this attribute to indicate that a specific constructor
+ /// should be used.
+ /// </remarks>
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
+ public class ImportingConstructorAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportingConstructorAttribute"/> class.
+ /// </summary>
+ public ImportingConstructorAttribute()
+ {
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/InheritedExportAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/InheritedExportAttribute.cs
new file mode 100644
index 0000000..fb411bc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/InheritedExportAttribute.cs
@@ -0,0 +1,122 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that a type or interface that provides a particular export.
+ /// </summary>
+ [SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
+ public class InheritedExportAttribute : ExportAttribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type marked with this attribute under the default contract name.
+ /// </summary>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type itself,
+ /// that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public InheritedExportAttribute()
+ : this((string)null, (Type)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type marked with this attribute under a contract name derived from the specified type.
+ /// </summary>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name to export the type
+ /// marked with this attribute, under; or <see langword="null"/> to use the
+ /// default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// <paramref name="contractType"/>.
+ /// </para>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on the type of the
+ /// itself, that is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public InheritedExportAttribute(Type contractType)
+ : this((string)null, contractType)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name to export the type
+ /// marked with this attribute, under; or <see langword="null"/> or an empty string
+ /// ("") to use the default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// the type itself that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public InheritedExportAttribute(string contractName)
+ : this(contractName, (Type)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
+ /// type or member marked with this attribute under the specified contract name.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name to export the type
+ /// marked with this attribute, under; or <see langword="null"/> or an empty string
+ /// ("") to use the default contract name.
+ /// </param>
+ /// <param name="contractType">
+ /// A <see cref="Type"/> of which to derive the contract name to export the type
+ /// marked with this attribute, under; or <see langword="null"/> to use the
+ /// default contract name.
+ /// </param>
+ /// <remarks>
+ /// <para>
+ /// The default contract name is the result of calling
+ /// <see cref="AttributedModelServices.GetContractName(Type)"/> on
+ /// the type itself that this is marked with this attribute.
+ /// </para>
+ /// <para>
+ /// The contract name is compared using a case-sensitive, non-linguistic comparison
+ /// using <see cref="StringComparer.Ordinal"/>.
+ /// </para>
+ /// </remarks>
+ public InheritedExportAttribute(string contractName, Type contractType)
+ : base(contractName, contractType)
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataAttributeAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataAttributeAttribute.cs
new file mode 100644
index 0000000..81ad7e9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataAttributeAttribute.cs
@@ -0,0 +1,23 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies that an attribute can be used to provide metadata for a type, property, field,
+ /// or method marked with the <see cref="ExportAttribute"/>.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class,
+ AllowMultiple=false, Inherited=true)]
+ public sealed class MetadataAttributeAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MetadataAttributeAttribute"/> class.
+ /// </summary>
+ public MetadataAttributeAttribute()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataServices.cs
new file mode 100644
index 0000000..fa363c0
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataServices.cs
@@ -0,0 +1,50 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class MetadataServices
+ {
+ public static readonly IDictionary<string, object> EmptyMetadata = new ReadOnlyDictionary<string, object>(null);
+
+ public static IDictionary<string, object> AsReadOnly(this IDictionary<string, object> metadata)
+ {
+ if (metadata == null)
+ {
+ return EmptyMetadata;
+ }
+
+ if (metadata is ReadOnlyDictionary<string, object>)
+ {
+ return metadata;
+ }
+
+ return new ReadOnlyDictionary<string, object>(metadata);
+ }
+
+ public static T GetValue<T>(this IDictionary<string, object> metadata, string key)
+ {
+ Assumes.NotNull(metadata, "metadata");
+
+ object untypedValue = true;
+ if (!metadata.TryGetValue(key, out untypedValue))
+ {
+ return default(T);
+ }
+
+ if (untypedValue is T)
+ {
+ return (T)untypedValue;
+ }
+ else
+ {
+ return default(T);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewGenerator.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewGenerator.cs
new file mode 100644
index 0000000..e40aa62
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewGenerator.cs
@@ -0,0 +1,321 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Threading;
+using Microsoft.Internal;
+using System.Reflection.Emit;
+using System.Collections;
+
+namespace System.ComponentModel.Composition
+{
+ // // Assume TMetadataView is
+ // //interface Foo
+ // //{
+ // // public typeRecord1 Record1 { get; }
+ // // public typeRecord2 Record2 { get; }
+ // // public typeRecord3 Record3 { get; }
+ // // public typeRecord4 Record4 { get; }
+ // //}
+ // // The class to be generated will look approximately like:
+ // public class __Foo__MedataViewProxy : TMetadataView
+ // {
+ // public __Foo__MedataViewProxy (IDictionary<string, object> metadata)
+ // {
+ // if(metadata == null)
+ // {
+ // throw InvalidArgumentException("metadata");
+ // }
+ // try
+ // {
+ // Record1 = (typeRecord1)Record1;
+ // Record2 = (typeRecord1)Record2;
+ // Record3 = (typeRecord1)Record3;
+ // Record4 = (typeRecord1)Record4;
+ // }
+ // catch(InvalidCastException ice)
+ // {
+ // //Annotate exception .Data with diagnostic info
+ // }
+ // catch(NulLReferenceException ice)
+ // {
+ // //Annotate exception .Data with diagnostic info
+ // }
+ // }
+ // // Interface
+ // public typeRecord1 Record1 { get; }
+ // public typeRecord2 Record2 { get; }
+ // public typeRecord3 Record3 { get; }
+ // public typeRecord4 Record4 { get; }
+ // }
+ internal static class MetadataViewGenerator
+ {
+ public const string MetadataViewType = "MetadataViewType";
+ public const string MetadataItemKey = "MetadataItemKey";
+ public const string MetadataItemTargetType = "MetadataItemTargetType";
+ public const string MetadataItemSourceType = "MetadataItemSourceType";
+ public const string MetadataItemValue = "MetadataItemValue";
+
+ private static Lock _lock = new Lock();
+ private static Dictionary<Type, Type> _proxies = new Dictionary<Type, Type>();
+
+ private static AssemblyName ProxyAssemblyName = new AssemblyName(string.Format(CultureInfo.InvariantCulture, "MetadataViewProxies_{0}", Guid.NewGuid()));
+ private static AssemblyBuilder ProxyAssemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(ProxyAssemblyName, AssemblyBuilderAccess.Run);
+ private static ModuleBuilder ProxyModuleBuilder = ProxyAssemblyBuilder.DefineDynamicModule("MetadataViewProxiesModule");
+ private static Type[] CtorArgumentTypes = new Type[] { typeof(IDictionary<string, object>) };
+ private static MethodInfo _mdvDictionaryTryGet = CtorArgumentTypes[0].GetMethod("TryGetValue");
+ private static readonly MethodInfo ObjectGetType = typeof(object).GetMethod("GetType", Type.EmptyTypes);
+
+ public static Type GenerateView(Type viewType)
+ {
+ Assumes.NotNull(viewType);
+ Assumes.IsTrue(viewType.IsInterface);
+
+ Type proxyType;
+ bool foundProxy;
+
+ using (new ReadLock(_lock))
+ {
+ foundProxy = _proxies.TryGetValue(viewType, out proxyType);
+ }
+
+ // No factory exists
+ if(!foundProxy)
+ {
+ // Try again under a write lock if still none generate the proxy
+ using (new WriteLock(_lock))
+ {
+ foundProxy = _proxies.TryGetValue(viewType, out proxyType);
+
+ if (!foundProxy)
+ {
+ proxyType = GenerateInterfaceViewProxyType(viewType);
+ Assumes.NotNull(proxyType);
+
+ _proxies.Add(viewType, proxyType);
+ }
+ }
+ }
+ return proxyType;
+ }
+
+ private static void GenerateLocalAssignmentFromDefaultAttribute(this ILGenerator IL, DefaultValueAttribute[] attrs, LocalBuilder local)
+ {
+ if (attrs.Length > 0)
+ {
+ DefaultValueAttribute defaultAttribute = attrs[0];
+ IL.LoadValue(defaultAttribute.Value);
+ if ((defaultAttribute.Value != null) && (defaultAttribute.Value.GetType().IsValueType))
+ {
+ IL.Emit(OpCodes.Box, defaultAttribute.Value.GetType());
+ }
+ IL.Emit(OpCodes.Stloc, local);
+ }
+ }
+
+ private static void GenerateFieldAssignmentFromLocalValue(this ILGenerator IL, LocalBuilder local, FieldBuilder field)
+ {
+ IL.Emit(OpCodes.Ldarg_0);
+ IL.Emit(OpCodes.Ldloc, local);
+ IL.Emit(field.FieldType.IsValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, field.FieldType);
+ IL.Emit(OpCodes.Stfld, field);
+ }
+
+ private static void GenerateLocalAssignmentFromFlag(this ILGenerator IL, LocalBuilder local, bool flag)
+ {
+ IL.Emit(flag ? OpCodes.Ldc_I4_1 : OpCodes.Ldc_I4_0);
+ IL.Emit(OpCodes.Stloc, local);
+ }
+
+ // This must be called with _readerWriterLock held for Write
+ private static Type GenerateInterfaceViewProxyType(Type viewType)
+ {
+ // View type is an interface let's cook an implementation
+ Type proxyType;
+ TypeBuilder proxyTypeBuilder;
+ Type[] interfaces = { viewType };
+
+ proxyTypeBuilder = ProxyModuleBuilder.DefineType(
+ string.Format(CultureInfo.InvariantCulture, "_proxy_{0}_{1}", viewType.FullName, Guid.NewGuid()),
+ TypeAttributes.Public,
+ typeof(object),
+ interfaces);
+
+ // Implement Constructor
+ ILGenerator proxyCtorIL = proxyTypeBuilder.CreateGeneratorForPublicConstructor(CtorArgumentTypes);
+ LocalBuilder exception = proxyCtorIL.DeclareLocal(typeof(Exception));
+ LocalBuilder exceptionData = proxyCtorIL.DeclareLocal(typeof(IDictionary));
+ LocalBuilder sourceType = proxyCtorIL.DeclareLocal(typeof(Type));
+ LocalBuilder value = proxyCtorIL.DeclareLocal(typeof(object));
+ LocalBuilder usesExportedMD = proxyCtorIL.DeclareLocal(typeof(bool));
+
+ Label tryConstructView = proxyCtorIL.BeginExceptionBlock();
+
+ // Implement interface properties
+ foreach (PropertyInfo propertyInfo in viewType.GetAllProperties())
+ {
+ string fieldName = string.Format(CultureInfo.InvariantCulture, "_{0}_{1}", propertyInfo.Name, Guid.NewGuid());
+
+ // Cache names and type for exception
+ string propertyName = string.Format(CultureInfo.InvariantCulture, "{0}", propertyInfo.Name);
+
+ Type[] propertyTypeArguments = new Type[] { propertyInfo.PropertyType };
+ Type[] optionalModifiers = null;
+ Type[] requiredModifiers = null;
+
+#if !SILVERLIGHT
+ // PropertyInfo does not support GetOptionalCustomModifiers and GetRequiredCustomModifiers on Silverlight
+ optionalModifiers = propertyInfo.GetOptionalCustomModifiers();
+ requiredModifiers = propertyInfo.GetRequiredCustomModifiers();
+ Array.Reverse(optionalModifiers);
+ Array.Reverse(requiredModifiers);
+#endif
+ // Generate field
+ FieldBuilder proxyFieldBuilder = proxyTypeBuilder.DefineField(
+ fieldName,
+ propertyInfo.PropertyType,
+ FieldAttributes.Private);
+
+ // Generate property
+ PropertyBuilder proxyPropertyBuilder = proxyTypeBuilder.DefineProperty(
+ propertyName,
+ PropertyAttributes.None,
+ propertyInfo.PropertyType,
+ propertyTypeArguments);
+
+ // Generate constructor code for retrieving the metadata value and setting the field
+ Label tryCastValue = proxyCtorIL.BeginExceptionBlock();
+ Label innerTryCastValue;
+
+ DefaultValueAttribute[] attrs = propertyInfo.GetAttributes<DefaultValueAttribute>(false);
+ if(attrs.Length > 0)
+ {
+ innerTryCastValue = proxyCtorIL.BeginExceptionBlock();
+ }
+
+ // In constructor set the backing field with the value from the dictionary
+ Label doneGettingDefaultValue = proxyCtorIL.DefineLabel();
+ GenerateLocalAssignmentFromFlag(proxyCtorIL, usesExportedMD, true);
+
+ proxyCtorIL.Emit(OpCodes.Ldarg_1);
+ proxyCtorIL.Emit(OpCodes.Ldstr, propertyInfo.Name);
+ proxyCtorIL.Emit(OpCodes.Ldloca, value);
+ proxyCtorIL.Emit(OpCodes.Callvirt, _mdvDictionaryTryGet);
+ proxyCtorIL.Emit(OpCodes.Brtrue, doneGettingDefaultValue);
+
+ proxyCtorIL.GenerateLocalAssignmentFromFlag(usesExportedMD, false);
+ proxyCtorIL.GenerateLocalAssignmentFromDefaultAttribute(attrs, value);
+
+ proxyCtorIL.MarkLabel(doneGettingDefaultValue);
+ proxyCtorIL.GenerateFieldAssignmentFromLocalValue(value, proxyFieldBuilder);
+ proxyCtorIL.Emit(OpCodes.Leave, tryCastValue);
+
+ // catch blocks for innerTryCastValue start here
+ if (attrs.Length > 0)
+ {
+ proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
+ {
+ Label notUsesExportedMd = proxyCtorIL.DefineLabel();
+ proxyCtorIL.Emit(OpCodes.Ldloc, usesExportedMD);
+ proxyCtorIL.Emit(OpCodes.Brtrue, notUsesExportedMd);
+ proxyCtorIL.Emit(OpCodes.Rethrow);
+ proxyCtorIL.MarkLabel(notUsesExportedMd);
+ proxyCtorIL.GenerateLocalAssignmentFromDefaultAttribute(attrs, value);
+ proxyCtorIL.GenerateFieldAssignmentFromLocalValue(value, proxyFieldBuilder);
+ }
+ proxyCtorIL.EndExceptionBlock();
+ }
+
+ // catch blocks for tryCast start here
+ proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException));
+ {
+ proxyCtorIL.Emit(OpCodes.Stloc, exception);
+
+ proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemKey, propertyName);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemTargetType, propertyInfo.PropertyType);
+ proxyCtorIL.Emit(OpCodes.Rethrow);
+ }
+
+ proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
+ {
+ proxyCtorIL.Emit(OpCodes.Stloc, exception);
+
+ proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemKey, propertyName);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataItemTargetType, propertyInfo.PropertyType);
+ proxyCtorIL.Emit(OpCodes.Rethrow);
+ }
+
+ proxyCtorIL.EndExceptionBlock();
+
+ if (propertyInfo.CanWrite)
+ {
+ // The MetadataView '{0}' is invalid because property '{1}' has a property set method.
+ throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture,
+ Strings.InvalidSetterOnMetadataField,
+ viewType,
+ propertyName));
+ }
+ if (propertyInfo.CanRead)
+ {
+ // Generate "get" method implementation.
+ MethodBuilder getMethodBuilder = proxyTypeBuilder.DefineMethod(
+ string.Format(CultureInfo.InvariantCulture, "get_{0}", propertyName),
+ MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.NewSlot | MethodAttributes.Virtual | MethodAttributes.Final,
+ CallingConventions.HasThis,
+ propertyInfo.PropertyType,
+ requiredModifiers,
+ optionalModifiers,
+ Type.EmptyTypes, null, null);
+
+ proxyTypeBuilder.DefineMethodOverride(getMethodBuilder, propertyInfo.GetGetMethod());
+ ILGenerator getMethodIL = getMethodBuilder.GetILGenerator();
+ getMethodIL.Emit(OpCodes.Ldarg_0);
+ getMethodIL.Emit(OpCodes.Ldfld, proxyFieldBuilder);
+ getMethodIL.Emit(OpCodes.Ret);
+
+ proxyPropertyBuilder.SetGetMethod(getMethodBuilder);
+ }
+ }
+
+ proxyCtorIL.Emit(OpCodes.Leave, tryConstructView);
+
+ // catch blocks for constructView start here
+ proxyCtorIL.BeginCatchBlock(typeof(NullReferenceException));
+ {
+ proxyCtorIL.Emit(OpCodes.Stloc, exception);
+
+ proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataViewType, viewType);
+ proxyCtorIL.Emit(OpCodes.Rethrow);
+ }
+ proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
+ {
+ proxyCtorIL.Emit(OpCodes.Stloc, exception);
+
+ proxyCtorIL.GetExceptionDataAndStoreInLocal(exception, exceptionData);
+ proxyCtorIL.Emit(OpCodes.Ldloc, value);
+ proxyCtorIL.Emit(OpCodes.Call, ObjectGetType);
+ proxyCtorIL.Emit(OpCodes.Stloc, sourceType);
+ proxyCtorIL.AddItemToLocalDictionary(exceptionData, MetadataViewType, viewType);
+ proxyCtorIL.AddLocalToLocalDictionary(exceptionData, MetadataItemSourceType, sourceType);
+ proxyCtorIL.AddLocalToLocalDictionary(exceptionData, MetadataItemValue, value);
+ proxyCtorIL.Emit(OpCodes.Rethrow);
+ }
+ proxyCtorIL.EndExceptionBlock();
+
+ // Finished implementing interface and constructor
+ proxyCtorIL.Emit(OpCodes.Ret);
+ proxyType = proxyTypeBuilder.CreateType();
+
+ return proxyType;
+ }
+
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewProvider.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewProvider.cs
new file mode 100644
index 0000000..a6efbd5
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/MetadataViewProvider.cs
@@ -0,0 +1,106 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using Microsoft.Internal;
+using System.Globalization;
+using System.Runtime.InteropServices;
+using System.Diagnostics.CodeAnalysis;
+
+namespace System.ComponentModel.Composition
+{
+ internal static class MetadataViewProvider
+ {
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
+ public static TMetadataView GetMetadataView<TMetadataView>(IDictionary<string, object> metadata)
+ {
+ Type metadataViewType = typeof(TMetadataView);
+
+ // If the Metadata dictionary is cast compatible with the passed in type
+ if (metadataViewType.IsAssignableFrom(typeof(IDictionary<string, object>)))
+ {
+ return (TMetadataView)metadata;
+ }
+ // otherwise is it a metadata view
+ else
+ {
+ Type proxyType;
+ if (metadataViewType.IsInterface)
+ {
+ try
+ {
+ proxyType = MetadataViewGenerator.GenerateView(metadataViewType);
+ }
+ catch (TypeLoadException ex)
+ {
+ throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.NotSupportedInterfaceMetadataView, metadataViewType.FullName), ex);
+ }
+ }
+ else
+ {
+ proxyType = metadataViewType;
+ }
+
+ // Now we have the type for the proxy create it
+ try
+ {
+ return (TMetadataView)proxyType.SafeCreateInstance(metadata);
+ }
+ catch (MissingMethodException ex)
+ {
+ // Unable to create an Instance of the Metadata view '{0}' because a constructor could not be selected. Ensure that the type implements a constructor which takes an argument of type IDictionary<string, object>.
+ throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
+ Strings.CompositionException_MetadataViewInvalidConstructor,
+ proxyType.AssemblyQualifiedName), ex);
+ }
+ catch (TargetInvocationException ex)
+ {
+ //Unwrap known failures that we want to present as CompositionContractMismatchException
+ if(metadataViewType.IsInterface)
+ {
+ if(ex.InnerException.GetType() == typeof(InvalidCastException))
+ {
+ // Unable to create an Instance of the Metadata view {0} because the exporter exported the metadata for the item {1} with the value {2} as type {3} but the view imports it as type {4}.
+ throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
+ Strings.ContractMismatch_InvalidCastOnMetadataField,
+ ex.InnerException.Data[MetadataViewGenerator.MetadataViewType],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemKey],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemValue],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemSourceType],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemTargetType]), ex);
+ }
+ else if (ex.InnerException.GetType() == typeof(NullReferenceException))
+ {
+ // Unable to create an Instance of the Metadata view {0} because the exporter exported the metadata for the item {1} with a null value and null is not a valid value for type {2}.
+ throw new CompositionContractMismatchException(string.Format(CultureInfo.CurrentCulture,
+ Strings.ContractMismatch_NullReferenceOnMetadataField,
+ ex.InnerException.Data[MetadataViewGenerator.MetadataViewType],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemKey],
+ ex.InnerException.Data[MetadataViewGenerator.MetadataItemTargetType]), ex);
+ }
+ }
+ throw;
+ }
+ }
+ }
+
+ public static bool IsViewTypeValid(Type metadataViewType)
+ {
+ Assumes.NotNull(metadataViewType);
+
+ // If the Metadata dictionary is cast compatible with the passed in type
+ if (ExportServices.IsDefaultMetadataViewType(metadataViewType)
+ || metadataViewType.IsInterface
+ || ExportServices.IsDictionaryConstructorViewType(metadataViewType))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs
new file mode 100644
index 0000000..43d0fc9
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartCreationPolicyAttribute.cs
@@ -0,0 +1,36 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies <see cref="CreationPolicy"/> for a given <see cref="ComposablePart" />.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
+ public sealed class PartCreationPolicyAttribute : Attribute
+ {
+ internal static PartCreationPolicyAttribute Default = new PartCreationPolicyAttribute(CreationPolicy.Any);
+ internal static PartCreationPolicyAttribute Shared = new PartCreationPolicyAttribute(CreationPolicy.Shared);
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PartCreationPolicyAttribute"/> class.
+ /// </summary>
+ public PartCreationPolicyAttribute(CreationPolicy creationPolicy)
+ {
+ this.CreationPolicy = creationPolicy;
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating the creation policy of the attributed part.
+ /// </summary>
+ /// <value>
+ /// One of the <see cref="CreationPolicy"/> values indicating the creation policy of the
+ /// attributed part. The default is
+ /// <see cref="System.ComponentModel.Composition.CreationPolicy.Any"/>.
+ /// </value>
+ public CreationPolicy CreationPolicy { get; private set; }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/PartMetadataAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartMetadataAttribute.cs
new file mode 100644
index 0000000..a75aa4e
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartMetadataAttribute.cs
@@ -0,0 +1,58 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Specifies metadata for a type to be used as a <see cref="ComposablePartDefinition"/> and
+ /// <see cref="ComposablePart"/>.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
+ public sealed class PartMetadataAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PartMetadataAttribute"/> with the
+ /// specified name and metadata value.
+ /// </summary>
+ /// <param name="name">
+ /// A <see cref="String"/> containing the name of the metadata value; or
+ /// <see langword="null"/> to use an empty string ("").
+ /// </param>
+ /// <param name="value">
+ /// An <see cref="object"/> containing the metadata value. This can be
+ /// <see langword="null"/>.
+ /// </param>
+ public PartMetadataAttribute(string name, object value)
+ {
+ this.Name = name ?? string.Empty;
+ this.Value = value;
+ }
+
+ /// <summary>
+ /// Gets the name of the metadata value.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the name of the metadata value.
+ /// </value>
+ public string Name
+ {
+ get;
+ private set;
+ }
+
+ /// <summary>
+ /// Gets the metadata value.
+ /// </summary>
+ /// <value>
+ /// An <see cref="object"/> containing the metadata value.
+ /// </value>
+ public object Value
+ {
+ get;
+ private set;
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs
new file mode 100644
index 0000000..02c8246
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/PartNotDiscoverableAttribute.cs
@@ -0,0 +1,23 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition
+{
+ /// <summary>
+ /// Place on a type that should not be discovered as a <see cref="ComposablePart" /> in
+ /// a <see cref="ComposablePartCatalog" />.
+ /// </summary>
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
+ public sealed class PartNotDiscoverableAttribute : Attribute
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PartNotDiscoverableAttribute"/> class.
+ /// </summary>
+ public PartNotDiscoverableAttribute()
+ {
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePart.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePart.cs
new file mode 100644
index 0000000..0632fee
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePart.cs
@@ -0,0 +1,210 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Defines the <see langword="abstract"/> base class for composable parts, which
+ /// import and produce exported values.
+ /// </summary>
+ public abstract class ComposablePart
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePart"/> class.
+ /// </summary>
+ protected ComposablePart()
+ {
+ }
+
+ /// <summary>
+ /// Gets the export definitions that describe the exported values provided by the part.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/> objects describing
+ /// the exported values provided by the <see cref="ComposablePart"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// If the <see cref="ComposablePart"/> was created from a
+ /// <see cref="ComposablePartDefinition"/>, this property should return the result of
+ /// <see cref="ComposablePartDefinition.ExportDefinitions"/>.
+ /// </note>
+ /// </para>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>.
+ /// If the <see cref="ComposablePart"/> does not have exports, return an empty
+ /// <see cref="IEnumerable{T}"/> instead.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public abstract IEnumerable<ExportDefinition> ExportDefinitions { get; }
+
+ /// <summary>
+ /// Gets the import definitions that describe the imports required by the part.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ImportDefinition"/> objects describing
+ /// the imports required by the <see cref="ComposablePart"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// If the <see cref="ComposablePart"/> was created from a
+ /// <see cref="ComposablePartDefinition"/>, this property should return the result of
+ /// <see cref="ComposablePartDefinition.ImportDefinitions"/>.
+ /// </note>
+ /// </para>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Overrides of this property should never return <see langword="null"/>.
+ /// If the <see cref="ComposablePart"/> does not have imports, return an empty
+ /// <see cref="IEnumerable{T}"/> instead.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public abstract IEnumerable<ImportDefinition> ImportDefinitions { get; }
+
+ /// <summary>
+ /// Gets the metadata of the part.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="ComposablePart"/>. The default is an empty, read-only
+ /// <see cref="IDictionary{TKey, TValue}"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// If the <see cref="ComposablePart"/> was created from a
+ /// <see cref="ComposablePartDefinition"/>, this property should return the result of
+ /// <see cref="ComposablePartDefinition.Metadata"/>.
+ /// </note>
+ /// </para>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should return a read-only
+ /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
+ /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
+ /// and should never return <see langword="null"/>. If the
+ /// <see cref="ComposablePart"/> does not contain metadata, return an
+ /// empty <see cref="IDictionary{TKey, TValue}"/> instead.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public virtual IDictionary<string, object> Metadata
+ {
+ get
+ {
+ return MetadataServices.EmptyMetadata;
+ }
+ }
+
+ /// <summary>
+ /// Called by the composition engine when all required imports on the part have been
+ /// satisfied.
+ /// </summary>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="ComposablePartException">
+ /// An error occurred activating the <see cref="ComposablePart"/>.
+ /// </exception>
+ public virtual void Activate()
+ {
+ }
+
+ /// <summary>
+ /// Gets the exported value described by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// One of the <see cref="ExportDefinition"/> objects from the
+ /// <see cref="ExportDefinitions"/> property describing the exported value
+ /// to return.
+ /// </param>
+ /// <returns>
+ /// The exported value described by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="definition"/> did not originate from the <see cref="ExportDefinitions"/>
+ /// property on the <see cref="ComposablePart"/>.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// One or more pre-requisite imports, indicated by <see cref="ImportDefinition.IsPrerequisite"/>,
+ /// have not been set.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="ComposablePartException">
+ /// An error occurred getting the exported value described by the <see cref="ExportDefinition"/>.
+ /// </exception>
+ public abstract object GetExportedValue(ExportDefinition definition);
+
+ /// <summary>
+ /// Sets the import described by the specified definition with the specified exports.
+ /// </summary>
+ /// <param name="definition">
+ /// One of the <see cref="ImportDefinition"/> objects from the
+ /// <see cref="ImportDefinitions"/> property describing the import to be set.
+ /// </param>
+ /// <param name="exports">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Export"/> objects of which
+ /// to set the import described by <paramref name="definition"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exports"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="definition"/> did not originate from the <see cref="ImportDefinitions"/>
+ /// property on the <see cref="ComposablePart"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exports"/> contains an element that is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exports"/> is empty and <see cref="ImportDefinition.Cardinality"/> is
+ /// <see cref="ImportCardinality.ExactlyOne"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exports"/> contains more than one element and
+ /// <see cref="ImportDefinition.Cardinality"/> is <see cref="ImportCardinality.ZeroOrOne"/> or
+ /// <see cref="ImportCardinality.ExactlyOne"/>.
+ /// </exception>
+ /// <exception cref="InvalidOperationException">
+ /// <see cref="Activate"/> has been previously called and
+ /// <see cref="ImportDefinition.IsRecomposable"/> is <see langword="false"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePart"/> has been disposed of.
+ /// </exception>
+ /// <exception cref="ComposablePartException">
+ /// An error occurred setting the import described by the <see cref="ImportDefinition"/>.
+ /// </exception>
+ public abstract void SetImport(ImportDefinition definition, IEnumerable<Export> exports);
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs
new file mode 100644
index 0000000..59b55b2
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalog.cs
@@ -0,0 +1,129 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Linq.Expressions;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Defines the <see langword="abstract"/> base class for composable part catalogs, which produce
+ /// and return <see cref="ComposablePartDefinition"/> objects.
+ /// </summary>
+ /// <remarks>
+ /// This type is thread safe.
+ /// </remarks>
+ [DebuggerTypeProxy(typeof(ComposablePartCatalogDebuggerProxy))]
+ public abstract class ComposablePartCatalog : IDisposable
+ {
+ private bool _isDisposed;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartCatalog"/> class.
+ /// </summary>
+ protected ComposablePartCatalog()
+ {
+ }
+
+ /// <summary>
+ /// Gets the part definitions of the catalog.
+ /// </summary>
+ /// <value>
+ /// A <see cref="IQueryable{T}"/> of <see cref="ComposablePartDefinition"/> objects of the
+ /// <see cref="ComposablePartCatalog"/>.
+ /// </value>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePartCatalog"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>.
+ /// </note>
+ /// </remarks>
+ public abstract IQueryable<ComposablePartDefinition> Parts
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Returns the export definitions that match the constraint defined by the specified definition.
+ /// </summary>
+ /// <param name="definition">
+ /// The <see cref="ImportDefinition"/> that defines the conditions of the
+ /// <see cref="ExportDefinition"/> objects to return.
+ /// </param>
+ /// <returns>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="Tuple{T1, T2}"/> containing the
+ /// <see cref="ExportDefinition"/> objects and their associated
+ /// <see cref="ComposablePartDefinition"/> for objects that match the constraint defined
+ /// by <paramref name="definition"/>.
+ /// </returns>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ObjectDisposedException">
+ /// The <see cref="ComposablePartCatalog"/> has been disposed of.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>, if no
+ /// <see cref="ExportDefinition"/> match the conditions defined by
+ /// <paramref name="definition"/>, return an empty <see cref="IEnumerable{T}"/>.
+ /// </note>
+ /// </remarks>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public virtual IEnumerable<Tuple<ComposablePartDefinition, ExportDefinition>> GetExports(ImportDefinition definition)
+ {
+ this.ThrowIfDisposed();
+
+ Requires.NotNull(definition, "definition");
+
+ var exports = new List<Tuple<ComposablePartDefinition, ExportDefinition>>();
+ foreach (var part in this.Parts)
+ {
+ foreach (var export in part.ExportDefinitions)
+ {
+ if (definition.IsConstraintSatisfiedBy(export))
+ {
+ exports.Add(new Tuple<ComposablePartDefinition, ExportDefinition>(part, export));
+ }
+ }
+ }
+ return exports;
+
+ }
+
+ /// <summary>
+ /// Releases the unmanaged resources used by the <see cref="ComposablePartCatalog"/> and
+ /// optionally releases the managed resources.
+ /// </summary>
+ /// <param name="disposing">
+ /// <see langword="true"/> to release both managed and unmanaged resources;
+ /// <see langword="false"/> to release only unmanaged resources.
+ /// </param>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ this._isDisposed = true;
+ }
+
+ private void ThrowIfDisposed()
+ {
+ if (this._isDisposed)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs
new file mode 100644
index 0000000..15f0031
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartCatalogDebuggerProxy.cs
@@ -0,0 +1,33 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.ObjectModel;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ // This proxy is needed to pretty up ComposablePartCatalog.Parts; IQueryable<T>
+ // instances are not displayed in a very friendly way in the debugger.
+ internal class ComposablePartCatalogDebuggerProxy
+ {
+ private readonly ComposablePartCatalog _catalog;
+
+ public ComposablePartCatalogDebuggerProxy(ComposablePartCatalog catalog)
+ {
+ Requires.NotNull(catalog, "catalog");
+
+ this._catalog = catalog;
+ }
+
+ public ReadOnlyCollection<ComposablePartDefinition> Parts
+ {
+ // NOTE: This shouldn't be cached, so that on every query of
+ // the current value of the underlying catalog is respected.
+ // We use ReadOnlyCollection as arrays do not have the
+ // appropriate debugger display attributes applied to them.
+ get { return this._catalog.Parts.ToReadOnlyCollection(); }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs
new file mode 100644
index 0000000..b82f590
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartDefinition.cs
@@ -0,0 +1,102 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Defines the <see langword="abstract"/> base class for composable part definitions, which
+ /// describe, and allow the creation of, <see cref="ComposablePart"/> objects.
+ /// </summary>
+ public abstract class ComposablePartDefinition
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartDefinition"/> class.
+ /// </summary>
+ protected ComposablePartDefinition()
+ {
+ }
+
+ /// <summary>
+ /// Gets the export definitions that describe the exported values provided by parts
+ /// created by the definition.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ExportDefinition"/> objects describing
+ /// the exported values provided by <see cref="ComposablePart"/> objects created by the
+ /// <see cref="ComposablePartDefinition"/>.
+ /// </value>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overrides of this property should never return <see langword="null"/>.
+ /// If the <see cref="ComposablePart"/> objects created by the
+ /// <see cref="ComposablePartDefinition"/> do not provide exported values, return
+ /// an empty <see cref="IEnumerable{T}"/> instead.
+ /// </note>
+ /// </remarks>
+ public abstract IEnumerable<ExportDefinition> ExportDefinitions { get; }
+
+ /// <summary>
+ /// Gets the import definitions that describe the imports required by parts created
+ /// by the definition.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of <see cref="ImportDefinition"/> objects describing
+ /// the imports required by <see cref="ComposablePart"/> objects created by the
+ /// <see cref="ComposablePartDefinition"/>.
+ /// </value>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>.
+ /// If the <see cref="ComposablePart"/> objects created by the
+ /// <see cref="ComposablePartDefinition"/> do not have imports, return an empty
+ /// <see cref="IEnumerable{T}"/> instead.
+ /// </note>
+ /// </remarks>
+ public abstract IEnumerable<ImportDefinition> ImportDefinitions { get; }
+
+ /// <summary>
+ /// Gets the metadata of the definition.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="ComposablePartDefinition"/>. The default is an empty, read-only
+ /// <see cref="IDictionary{TKey, TValue}"/>.
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should return a read-only
+ /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
+ /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
+ /// and should never return <see langword="null"/>. If the
+ /// <see cref="ComposablePartDefinition"/> does contain metadata,
+ /// return an empty <see cref="IDictionary{TKey, TValue}"/> instead.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public virtual IDictionary<string, object> Metadata
+ {
+ get { return MetadataServices.EmptyMetadata; }
+ }
+
+ /// <summary>
+ /// Creates a new instance of a part that the definition describes.
+ /// </summary>
+ /// <returns>
+ /// The created <see cref="ComposablePart"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Derived types overriding this method should return a new instance of a
+ /// <see cref="ComposablePart"/> on every invoke and should never return
+ /// <see langword="null"/>.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public abstract ComposablePart CreatePart();
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartException.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartException.cs
new file mode 100644
index 0000000..72b1a33
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ComposablePartException.cs
@@ -0,0 +1,214 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.Runtime.Serialization;
+using System.Security.Permissions;
+using Microsoft.Internal;
+
+#if !SILVERLIGHT
+using Microsoft.Internal.Runtime.Serialization;
+#endif
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// The exception that is thrown when an error occurs when calling methods on a
+ /// <see cref="ComposablePart"/>.
+ /// </summary>
+ [Serializable]
+ public class ComposablePartException : Exception, ICompositionError
+ {
+ private readonly CompositionErrorId _id;
+ private readonly ICompositionElement _element;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class.
+ /// </summary>
+ public ComposablePartException()
+ : this(CompositionErrorId.Unknown, (string)null, (ICompositionElement)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class
+ /// with the specified error message.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="element">
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="ComposablePartException.Element"/> property to
+ /// <see langword="null"/>.
+ /// </param>
+ public ComposablePartException(string message)
+ : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class
+ /// with the specified error message and composition element that is the cause of
+ /// the exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ public ComposablePartException(string message, ICompositionElement element)
+ : this(CompositionErrorId.Unknown, message, element, (Exception)null)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class
+ /// with the specified error message and exception that is the cause of the
+ /// exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="innerException">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
+ /// </param>
+ public ComposablePartException(string message, Exception innerException)
+ : this(CompositionErrorId.Unknown, message, (ICompositionElement)null, innerException)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class
+ /// with the specified error message, and composition element and exception that
+ /// are the cause of the exception.
+ /// </summary>
+ /// <param name="message">
+ /// A <see cref="String"/> containing a message that describes the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.Message"/> property to its default value.
+ /// </param>
+ /// <param name="element">
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="ComposablePartException.Element"/> property to
+ /// <see langword="null"/>.
+ /// </param>
+ /// <param name="innerException">
+ /// The <see cref="Exception"/> that is the underlying cause of the
+ /// <see cref="ComposablePartException"/>; or <see langword="null"/> to set
+ /// the <see cref="Exception.InnerException"/> property to <see langword="null"/>.
+ /// </param>
+ public ComposablePartException(string message, ICompositionElement element, Exception innerException)
+ : this(CompositionErrorId.Unknown, message, element, innerException)
+ {
+ }
+
+ internal ComposablePartException(CompositionErrorId id, string message)
+ : this(id, message, (ICompositionElement)null, (Exception)null)
+ {
+ }
+
+ internal ComposablePartException(CompositionErrorId id, string message, Exception exception)
+ : this(id, message, (ICompositionElement)null, exception)
+ {
+ }
+
+ internal ComposablePartException(CompositionErrorId id, string message, ICompositionElement element)
+ : this(id, message, (ICompositionElement)element, (Exception)null)
+ {
+ }
+
+ internal ComposablePartException(CompositionErrorId id, string message, ICompositionElement element, Exception innerException)
+ : base(message, innerException)
+ {
+ _id = id;
+ _element = element;
+ }
+
+#if !SILVERLIGHT
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ComposablePartException"/> class
+ /// with the specified serialization data.
+ /// </summary>
+ /// <param name="info">
+ /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
+ /// <see cref="ComposablePartException"/>.
+ /// </param>
+ /// <param name="context">
+ /// The <see cref="StreamingContext"/> that contains contextual information about the
+ /// source or destination.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="info"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="SerializationException">
+ /// <paramref name="info"/> is missing a required value.
+ /// </exception>
+ /// <exception cref="InvalidCastException">
+ /// <paramref name="info"/> contains a value that cannot be cast to the correct type.
+ /// </exception>
+ [System.Security.SecuritySafeCritical]
+ protected ComposablePartException(SerializationInfo info, StreamingContext context)
+ : base(info, context)
+ {
+ _id = info.GetValue<CompositionErrorId>("Id");
+ _element = info.GetValue<ICompositionElement>("Element");
+ }
+
+#endif
+
+ /// <summary>
+ /// Gets the composition element that is the cause of the exception.
+ /// </summary>
+ /// <value>
+ /// The <see cref="ICompositionElement"/> that is the cause of the
+ /// <see cref="ComposablePartException"/>. The default is <see langword="null"/>.
+ /// </value>
+ public ICompositionElement Element
+ {
+ get { return _element; }
+ }
+
+ CompositionErrorId ICompositionError.Id
+ {
+ get { return _id; }
+ }
+
+#if !SILVERLIGHT
+
+ /// <summary>
+ /// Gets the serialization data of the exception.
+ /// </summary>
+ /// <param name="info">
+ /// The <see cref="SerializationInfo"/> that holds the serialized object data about the
+ /// <see cref="ComposablePartException"/>.
+ /// </param>
+ /// <param name="context">
+ /// The <see cref="StreamingContext"/> that contains contextual information about the
+ /// source or destination.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="info"/> is <see langword="null"/>.
+ /// </exception>
+ [System.Security.SecurityCritical]
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+
+ info.AddValue("Id", _id);
+ info.AddValue("Element", _element.ToSerializableElement());
+ }
+
+#endif
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElement.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElement.cs
new file mode 100644
index 0000000..23f7677
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElement.cs
@@ -0,0 +1,30 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ // Represents the ICompositionElement placeholder for an
+ // object that does not implement ICompositionElement
+ [DebuggerTypeProxy(typeof(CompositionElementDebuggerProxy))]
+ [Serializable]
+ internal class CompositionElement : SerializableCompositionElement
+ {
+ private static readonly ICompositionElement UnknownOrigin = new SerializableCompositionElement(Strings.CompositionElement_UnknownOrigin, (ICompositionElement)null);
+ private readonly object _underlyingObject;
+
+ public CompositionElement(object underlyingObject)
+ : base(underlyingObject.ToString(), UnknownOrigin)
+ {
+ this._underlyingObject = underlyingObject;
+ }
+
+ public object UnderlyingObject
+ {
+ get { return _underlyingObject; }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs
new file mode 100644
index 0000000..00442c5
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementDebuggerProxy.cs
@@ -0,0 +1,39 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ // Because the debugger displays only the members available on ICompositionElement
+ // when viewing CompositionError.Element in the watch and data tips windows, we
+ // need this proxy so that the underlying object wrapped by the CompositionElement
+ // placeholder is displayed by default.
+ internal class CompositionElementDebuggerProxy
+ {
+ private readonly CompositionElement _element;
+
+ public CompositionElementDebuggerProxy(CompositionElement element)
+ {
+ Requires.NotNull(element, "element");
+
+ this._element = element;
+ }
+
+ public string DisplayName
+ {
+ get { return this._element.DisplayName; }
+ }
+
+ public ICompositionElement Origin
+ {
+ get { return this._element.Origin; }
+ }
+
+ public object UnderlyingObject
+ {
+ get { return this._element.UnderlyingObject; }
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs
new file mode 100644
index 0000000..0f34d72
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/CompositionElementExtensions.cs
@@ -0,0 +1,82 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ internal static class CompositionElementExtensions
+ {
+#if !SILVERLIGHT
+ public static ICompositionElement ToSerializableElement(this ICompositionElement element)
+ {
+ return SerializableCompositionElement.FromICompositionElement(element);
+ }
+#endif
+ public static ICompositionElement ToElement(this Export export)
+ {
+ // First try the export
+ ICompositionElement element = export as ICompositionElement;
+ if (element != null)
+ {
+ return element;
+ }
+
+ // Otherwise, try the definition
+ return ToElement(export.Definition);
+ }
+
+ public static ICompositionElement ToElement(this ExportDefinition definition)
+ {
+ return ToElementCore(definition);
+ }
+
+ public static ICompositionElement ToElement(this ImportDefinition definition)
+ {
+ return ToElementCore(definition);
+ }
+
+ public static ICompositionElement ToElement(this ComposablePart part)
+ {
+ return ToElementCore(part);
+ }
+
+ public static ICompositionElement ToElement(this ComposablePartDefinition definition)
+ {
+ return ToElementCore(definition);
+ }
+
+ public static string GetDisplayName(this ComposablePartDefinition definition)
+ {
+ return GetDisplayNameCore(definition);
+ }
+
+ public static string GetDisplayName(this ComposablePartCatalog catalog)
+ {
+ return GetDisplayNameCore(catalog);
+ }
+
+ private static string GetDisplayNameCore(object value)
+ {
+ ICompositionElement element = value as ICompositionElement;
+ if (element != null)
+ {
+ return element.DisplayName;
+ }
+
+ return value.ToString();
+ }
+
+ private static ICompositionElement ToElementCore(object value)
+ {
+ ICompositionElement element = value as ICompositionElement;
+ if (element != null)
+ {
+ return element;
+ }
+
+ return new CompositionElement(value);
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs
new file mode 100644
index 0000000..148f46b
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ContractBasedImportDefinition.cs
@@ -0,0 +1,309 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Linq.Expressions;
+using Microsoft.Internal;
+using System.Globalization;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Represents a contract name and metadata-based import
+ /// required by a <see cref="ComposablePart"/> object.
+ /// </summary>
+ public class ContractBasedImportDefinition : ImportDefinition
+ {
+ // Unlike contract name, required metadata has a sensible default; set it to an empty
+ // enumerable, so that derived definitions only need to override ContractName by default.
+ private readonly IEnumerable<KeyValuePair<string, Type>> _requiredMetadata = Enumerable.Empty<KeyValuePair<string, Type>>();
+ private Expression<Func<ExportDefinition, bool>> _constraint;
+ private readonly CreationPolicy _requiredCreationPolicy = CreationPolicy.Any;
+ private readonly string _requiredTypeIdentity = null;
+ private bool _isRequiredMetadataValidated = false;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ContractBasedImportDefinition"/> class.
+ /// </summary>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Derived types calling this constructor can optionally override the
+ /// <see cref="ImportDefinition.ContractName"/>, <see cref="RequiredTypeIdentity"/>,
+ /// <see cref="RequiredMetadata"/>, <see cref="ImportDefinition.Cardinality"/>,
+ /// <see cref="ImportDefinition.IsPrerequisite"/>, <see cref="ImportDefinition.IsRecomposable"/>
+ /// and <see cref="RequiredCreationPolicy"/> properties.
+ /// </note>
+ /// </remarks>
+ protected ContractBasedImportDefinition()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ContractBasedImportDefinition"/> class
+ /// with the specified contract name, required metadataq, cardinality, value indicating
+ /// if the import definition is recomposable and a value indicating if the import definition
+ /// is a prerequisite.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Export"/> required by the <see cref="ContractBasedImportDefinition"/>.
+ /// </param>
+ /// <param name="requiredTypeIdentity">
+ /// The type identity of the export type expected. Use <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
+ /// to generate a type identity for a given type. If no specific type is required pass <see langword="null"/>.
+ /// </param>
+ /// <param name="requiredMetadata">
+ /// An <see cref="IEnumerable{T}"/> of <see cref="String"/> objects containing
+ /// the metadata names of the <see cref="Export"/> required by the
+ /// <see cref="ContractBasedImportDefinition"/>; or <see langword="null"/> to
+ /// set the <see cref="RequiredMetadata"/> property to an empty <see cref="IEnumerable{T}"/>.
+ /// </param>
+ /// <param name="cardinality">
+ /// One of the <see cref="ImportCardinality"/> values indicating the
+ /// cardinality of the <see cref="Export"/> objects required by the
+ /// <see cref="ContractBasedImportDefinition"/>.
+ /// </param>
+ /// <param name="isRecomposable">
+ /// <see langword="true"/> if the <see cref="ContractBasedImportDefinition"/> can be satisfied
+ /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
+ /// <see langword="false"/>.
+ /// </param>
+ /// <param name="isPrerequisite">
+ /// <see langword="true"/> if the <see cref="ContractBasedImportDefinition"/> is required to be
+ /// satisfied before a <see cref="ComposablePart"/> can start producing exported
+ /// objects; otherwise, <see langword="false"/>.
+ /// </param>
+ /// <param name="requiredCreationPolicy">
+ /// A value indicating that the importer requires a specific <see cref="CreationPolicy"/> for
+ /// the exports used to satisfy this import. If no specific <see cref="CreationPolicy"/> is needed
+ /// pass the default <see cref="CreationPolicy.Any"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="contractName"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="contractName"/> is an empty string ("").
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="requiredMetadata"/> contains an element that is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/>
+ /// values.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public ContractBasedImportDefinition(string contractName, string requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite, CreationPolicy requiredCreationPolicy)
+ : base(contractName, cardinality, isRecomposable, isPrerequisite)
+ {
+ Requires.NotNullOrEmpty(contractName, "contractName");
+
+ this._requiredTypeIdentity = requiredTypeIdentity;
+
+ if (requiredMetadata != null)
+ {
+ this._requiredMetadata = requiredMetadata;
+ }
+
+ this._requiredCreationPolicy = requiredCreationPolicy;
+ }
+
+ /// <summary>
+ /// The type identity of the export type expected.
+ /// </summary>
+ /// <value>
+ /// A <see cref="string"/> that is generated by <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
+ /// on the type that this import expects. If the value is <see langword="null"/> then this import
+ /// doesn't expect a particular type.
+ /// </value>
+ public virtual string RequiredTypeIdentity
+ {
+ get { return this._requiredTypeIdentity; }
+ }
+
+ /// <summary>
+ /// Gets the metadata names of the export required by the import definition.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IEnumerable{T}"/> of pairs of metadata keys and types of the <see cref="Export"/> required by the
+ /// <see cref="ContractBasedImportDefinition"/>. The default is an empty
+ /// <see cref="IEnumerable{T}"/>.
+ /// </value>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>
+ /// or return an <see cref="IEnumerable{T}"/> that contains an element that is
+ /// <see langword="null"/>. If the definition does not contain required metadata,
+ /// return an empty <see cref="IEnumerable{T}"/> instead.
+ /// </note>
+ /// </remarks>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public virtual IEnumerable<KeyValuePair<string, Type>> RequiredMetadata
+ {
+ get
+ {
+ // NOTE : unlike other arguments, we validate this one as late as possible, because its validation may lead to type loading
+ this.ValidateRequiredMetadata();
+
+ return this._requiredMetadata;
+ }
+ }
+
+ private void ValidateRequiredMetadata()
+ {
+ if (!this._isRequiredMetadataValidated)
+ {
+ foreach (KeyValuePair<string, Type> metadataItem in this._requiredMetadata)
+ {
+ if ((metadataItem.Key == null) || (metadataItem.Value == null))
+ {
+ throw new InvalidOperationException(
+ string.Format(CultureInfo.CurrentCulture, Strings.Argument_NullElement, "requiredMetadata"));
+ }
+ }
+ this._isRequiredMetadataValidated = true;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating that the importer requires a specific
+ /// <see cref="CreationPolicy"/> for the exports used to satisfy this import. T
+ /// </summary>
+ /// <value>
+ /// <see cref="CreationPolicy.Any"/> - default value, used if the importer doesn't
+ /// require a specific <see cref="CreationPolicy"/>.
+ ///
+ /// <see cref="CreationPolicy.Shared"/> - Requires that all exports used should be shared
+ /// by everyone in the container.
+ ///
+ /// <see cref="CreationPolicy.NonShared"/> - Requires that all exports used should be
+ /// non-shared in a container and thus everyone gets their own instance.
+ /// </value>
+ public virtual CreationPolicy RequiredCreationPolicy
+ {
+ get { return this._requiredCreationPolicy; }
+ }
+
+ /// <summary>
+ /// Gets an expression that defines conditions that must be matched for the import
+ /// described by the import definition to be satisfied.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
+ /// that defines the conditions that must be matched for the
+ /// <see cref="ImportDefinition"/> to be satisfied by an <see cref="Export"/>.
+ /// </returns>
+ /// <remarks>
+ /// <para>
+ /// This property returns an expression that defines conditions based on the
+ /// <see cref="ImportDefinition.ContractName"/>, <see cref="RequiredTypeIdentity"/>,
+ /// <see cref="RequiredMetadata"/>, and <see cref="RequiredCreationPolicy"/>
+ /// properties.
+ /// </para>
+ /// </remarks>
+ public override Expression<Func<ExportDefinition, bool>> Constraint
+ {
+ get
+ {
+ if (this._constraint == null)
+ {
+ this._constraint = ConstraintServices.CreateConstraint(this.ContractName, this.RequiredTypeIdentity, this.RequiredMetadata, this.RequiredCreationPolicy);
+ }
+
+ return this._constraint;
+ }
+ }
+
+ /// <summary>
+ /// Executes an optimized version of the contraint given by the <see cref="Constraint"/> property
+ /// </summary>
+ /// <param name="exportDefinition">
+ /// A definition for a <see cref="Export"/> used to determine if it satisfies the
+ /// requirements for this <see cref="ImportDefinition"/>.
+ /// </param>
+ /// <returns>
+ /// <see langword="True"/> if the <see cref="Export"/> satisfies the requirements for
+ /// this <see cref="ImportDefinition"/>, otherwise returns <see langword="False"/>.
+ /// </returns>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overrides of this method can provide a more optimized execution of the
+ /// <see cref="Constraint"/> property but the result should remain consistent.
+ /// </note>
+ /// </remarks>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="exportDefinition"/> is <see langword="null"/>.
+ /// </exception>
+ public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
+ {
+ Requires.NotNull(exportDefinition, "exportDefinition");
+
+ if (!StringComparers.ContractName.Equals(this.ContractName, exportDefinition.ContractName))
+ {
+ return false;
+ }
+
+ return MatchRequiredMatadata(exportDefinition);
+ }
+
+ private bool MatchRequiredMatadata(ExportDefinition definition)
+ {
+ if (!string.IsNullOrEmpty(this.RequiredTypeIdentity))
+ {
+ string exportTypeIdentity = definition.Metadata.GetValue<string>(CompositionConstants.ExportTypeIdentityMetadataName);
+
+ if (!StringComparers.ContractName.Equals(this.RequiredTypeIdentity, exportTypeIdentity))
+ {
+ return false;
+ }
+ }
+
+ foreach (KeyValuePair<string, Type> metadataItem in this.RequiredMetadata)
+ {
+ string metadataKey = metadataItem.Key;
+ Type metadataValueType = metadataItem.Value;
+
+ object metadataValue = null;
+ if (!definition.Metadata.TryGetValue(metadataKey, out metadataValue))
+ {
+ return false;
+ }
+
+ if (metadataValue != null)
+ {
+ // the metadata value is not null, we can rely on IsInstanceOfType to do the right thing
+ if (!metadataValueType.IsInstanceOfType(metadataValue))
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // this is an unfortunate special case - typeof(object).IsInstanceofType(null) == false
+ // basically nulls are not considered valid values for anything
+ // We want them to match anything that is a reference type
+ if (metadataValueType.IsValueType)
+ {
+ // this is a pretty expensive check, but we only invoke it when metadata values are null, which is very rare
+ return false;
+ }
+ }
+ }
+
+ if (this.RequiredCreationPolicy == CreationPolicy.Any)
+ {
+ return true;
+ }
+
+ CreationPolicy exportPolicy = definition.Metadata.GetValue<CreationPolicy>(CompositionConstants.PartCreationPolicyMetadataName);
+ return exportPolicy == CreationPolicy.Any ||
+ exportPolicy == this.RequiredCreationPolicy;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/Export.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/Export.cs
new file mode 100644
index 0000000..e347551
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/Export.cs
@@ -0,0 +1,245 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Represents an export. That is, a type that is made up of a delay-created exported value
+ /// and metadata that describes that object.
+ /// </summary>
+ public class Export
+ {
+ private readonly ExportDefinition _definition;
+ private readonly Func<object> _exportedValueGetter;
+ private static readonly object _EmptyValue = new object();
+ private volatile object _exportedValue = Export._EmptyValue;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Export"/> class.
+ /// </summary>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Derived types calling this constructor must override <see cref="Definition"/>
+ /// and <see cref="GetExportedValueCore"/>.
+ /// </note>
+ /// </remarks>
+ protected Export()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Export"/> class
+ /// with the specified contract name and exported value getter.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Export"/>.
+ /// </param>
+ /// <param name="exportedValueGetter">
+ /// A <see cref="Func{T}"/> that is called to create the exported value of the
+ /// <see cref="Export"/>. This allows the creation of the object to be delayed
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="contractName"/> is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="contractName"/> is an empty string ("").
+ /// </exception>
+ public Export(string contractName, Func<object> exportedValueGetter)
+ : this(new ExportDefinition(contractName, (IDictionary<string, object>)null), exportedValueGetter)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Export"/> class
+ /// with the specified contract name, metadata and exported value getter.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="Export"/>.
+ /// </param>
+ /// <param name="metadata">
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="Export"/>; or <see langword="null"/> to set the
+ /// <see cref="Metadata"/> property to an empty, read-only
+ /// <see cref="IDictionary{TKey, TValue}"/>.
+ /// </param>
+ /// <param name="exportedValueGetter">
+ /// A <see cref="Func{T}"/> that is called to create the exported value of the
+ /// <see cref="Export"/>. This allows the creation of the object to be delayed.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="contractName"/> is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="contractName"/> is an empty string ("").
+ /// </exception>
+ public Export(string contractName, IDictionary<string, object> metadata, Func<object> exportedValueGetter)
+ : this(new ExportDefinition(contractName, metadata), exportedValueGetter)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Export"/> class
+ /// with the specified export definition and exported value getter.
+ /// </summary>
+ /// <param name="definition">
+ /// An <see cref="ExportDefinition"/> that describes the contract that the
+ /// <see cref="Export"/> satisfies.
+ /// </param>
+ /// <param name="exportedValueGetter">
+ /// A <see cref="Func{T}"/> that is called to create the exported value of the
+ /// <see cref="Export"/>. This allows the creation of the object to be delayed.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="definition"/> is <see langword="null"/>.
+ /// <para>
+ /// -or-
+ /// </para>
+ /// <paramref name="exportedValueGetter"/> is <see langword="null"/>.
+ /// </exception>
+ public Export(ExportDefinition definition, Func<object> exportedValueGetter)
+ {
+ Requires.NotNull(definition, "definition");
+ Requires.NotNull(exportedValueGetter, "exportedValueGetter");
+
+ this._definition = definition;
+ this._exportedValueGetter = exportedValueGetter;
+ }
+
+ /// <summary>
+ /// Gets the definition that describes the contract that the export satisfies.
+ /// </summary>
+ /// <value>
+ /// An <see cref="ExportDefinition"/> that describes the contract that
+ /// the <see cref="Export"/> satisfies.
+ /// </value>
+ /// <exception cref="NotImplementedException">
+ /// This property was not overridden by a derived class.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return
+ /// <see langword="null"/>.
+ /// </note>
+ /// </remarks>
+ public virtual ExportDefinition Definition
+ {
+ get
+ {
+ if (_definition != null)
+ {
+ return _definition;
+ }
+
+ throw ExceptionBuilder.CreateNotOverriddenByDerived("Definition");
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata of the export.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="Export"/>.
+ /// </value>
+ /// <exception cref="NotImplementedException">
+ /// The <see cref="Definition"/> property was not overridden by a derived class.
+ /// </exception>
+ /// <remarks>
+ /// <para>
+ /// This property returns the value of <see cref="ExportDefinition.Metadata"/>
+ /// of the <see cref="Definition"/> property.
+ /// </para>
+ /// </remarks>
+ public IDictionary<string, object> Metadata
+ {
+ get { return Definition.Metadata; }
+ }
+
+ /// <summary>
+ /// Returns the exported value of the export.
+ /// </summary>
+ /// <returns>
+ /// The exported <see cref="Object"/> of the <see cref="Export"/>.
+ /// </returns>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying
+ /// exported value cannot be cast to <c>T</c>.
+ /// </exception>
+ /// <exception cref="NotImplementedException">
+ /// The <see cref="GetExportedValueCore"/> method was not overridden by a derived class.
+ /// </exception>
+ public object Value
+ {
+ get
+ {
+ // NOTE : the logic below guarantees that the value will be set exactly once. It DOES NOT, however, guarantee that GetExportedValueCore() will be executed
+ // more than once, as locking would be required for that. The said locking is problematic, as we can't reliable call 3rd party code under a lock.
+ if (this._exportedValue == Export._EmptyValue)
+ {
+ object exportedValue = this.GetExportedValueCore();
+
+ // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
+#pragma warning disable 420
+ Interlocked.CompareExchange(ref this._exportedValue, exportedValue, Export._EmptyValue);
+#pragma warning restore 420
+ }
+
+ return this._exportedValue;
+ }
+ }
+
+ /// <summary>
+ /// Returns the exported value of the export.
+ /// </summary>
+ /// <returns>
+ /// The exported <see cref="Object"/> of the <see cref="Export"/>.
+ /// </returns>
+ /// <exception cref="CompositionException">
+ /// An error occurred during composition. <see cref="CompositionException.Errors"/> will
+ /// contain a collection of errors that occurred.
+ /// </exception>
+ /// <exception cref="CompositionContractMismatchException">
+ /// The current instance is an instance of <see cref="Lazy{T}"/> and the underlying
+ /// exported value cannot be cast to <c>T</c>.
+ /// </exception>
+ /// <exception cref="NotImplementedException">
+ /// The method was not overridden by a derived class.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this method should never return
+ /// <see langword="null"/>.
+ /// </note>
+ /// </remarks>
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
+ protected virtual object GetExportedValueCore()
+ {
+ if (this._exportedValueGetter != null)
+ {
+ return this._exportedValueGetter.Invoke();
+ }
+
+ throw ExceptionBuilder.CreateNotOverriddenByDerived("GetExportedValueCore");
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportDefinition.cs
new file mode 100644
index 0000000..fb3db62
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportDefinition.cs
@@ -0,0 +1,131 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Describes the contract that an <see cref="Export"/> object satisfies.
+ /// </summary>
+ public class ExportDefinition
+ {
+ // Unlike contract name, metadata has a sensible default; set it to an empty bag,
+ // so that derived definitions only need to override ContractName by default.
+ private readonly IDictionary<string, object> _metadata = MetadataServices.EmptyMetadata;
+ private readonly string _contractName;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportDefinition"/> class.
+ /// </summary>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Derived types calling this constructor must override <see cref="ContractName"/>
+ /// and optionally, <see cref="Metadata"/>. By default, <see cref="Metadata"/>
+ /// returns an empty, read-only dictionary.
+ /// </note>
+ /// </remarks>
+ protected ExportDefinition()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ExportDefinition"/> class with
+ /// the specified contract name and metadata.
+ /// </summary>
+ /// <param name="contractName">
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="ExportDefinition"/>.
+ /// </param>
+ /// <param name="metadata">
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="ExportDefinition"/>; or <see langword="null"/> to set the
+ /// <see cref="Metadata"/> property to an empty, read-only
+ /// <see cref="IDictionary{TKey, TValue}"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="contractName"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="contractName"/> is an empty string ("").
+ /// </exception>
+ public ExportDefinition(string contractName, IDictionary<string, object> metadata)
+ {
+ Requires.NotNullOrEmpty(contractName, "contractName");
+
+ _contractName = contractName;
+
+ if (metadata != null)
+ {
+ _metadata = metadata.AsReadOnly();
+ }
+ }
+
+ /// <summary>
+ /// Gets the contract name of the export definition.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the contract name of the
+ /// <see cref="ExportDefinition"/>.
+ /// </value>
+ /// <exception cref="NotImplementedException">
+ /// The property was not overridden by a derived class.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>
+ /// or an empty string ("").
+ /// </note>
+ /// </remarks>
+ public virtual string ContractName
+ {
+ get
+ {
+ if (_contractName != null)
+ {
+ return _contractName;
+ }
+
+ throw ExceptionBuilder.CreateNotOverriddenByDerived("ContractName");
+ }
+ }
+
+ /// <summary>
+ /// Gets the metadata of the export definition.
+ /// </summary>
+ /// <value>
+ /// An <see cref="IDictionary{TKey, TValue}"/> containing the metadata of the
+ /// <see cref="ExportDefinition"/>. The default is an empty, read-only
+ /// <see cref="IDictionary{TKey, TValue}"/>.
+ /// </value>
+ /// <remarks>
+ /// <para>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should return a read-only
+ /// <see cref="IDictionary{TKey, TValue}"/> object with a case-sensitive,
+ /// non-linguistic comparer, such as <see cref="StringComparer.Ordinal"/>,
+ /// and should never return <see langword="null"/>.
+ /// If the <see cref="ExportDefinition"/> does not contain metadata
+ /// return an empty <see cref="IDictionary{TKey, TValue}"/> instead.
+ /// </note>
+ /// </para>
+ /// </remarks>
+ public virtual IDictionary<string, object> Metadata
+ {
+ get { return _metadata; }
+ }
+
+ /// <summary>
+ /// Returns a string representation of the export definition.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the value of the <see cref="ContractName"/> property.
+ /// </returns>
+ public override string ToString()
+ {
+ return this.ContractName;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs
new file mode 100644
index 0000000..438b0dd
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ExportedDelegate.cs
@@ -0,0 +1,97 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ [SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
+ public class ExportedDelegate
+ {
+ private object _instance;
+ private MethodInfo _method;
+
+ protected ExportedDelegate() { }
+#if !SILVERLIGHT
+ [System.Security.SecurityCritical]
+#endif
+ public ExportedDelegate(object instance, MethodInfo method)
+ {
+ Requires.NotNull(method, "method");
+
+ this._instance = instance;
+ this._method = method;
+ }
+
+ public virtual Delegate CreateDelegate(Type delegateType)
+ {
+ Requires.NotNull(delegateType, "delegateType");
+
+ if (delegateType == typeof(Delegate) || delegateType == typeof(MulticastDelegate))
+ {
+ Type funcOrAction = ConvertMethodInfoToFuncOrActionType(this._method);
+
+ if (funcOrAction != null)
+ {
+ delegateType = funcOrAction;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ return Delegate.CreateDelegate(delegateType, this._instance, this._method, false);
+ }
+
+ private static Type[] _funcTypes =
+ {
+ typeof(Func<>), typeof(Func<,>), typeof(Func<,,>), typeof(Func<,,,>), typeof(Func<,,,,>)
+#if CLR40 && !SILVERLIGHT
+ , typeof(Func<,,,,,>), typeof(Func<,,,,,,>), typeof(Func<,,,,,,,>), typeof(Func<,,,,,,,,>)
+#endif
+ };
+
+ private static Type[] _actionTypes =
+ {
+ typeof(Action), typeof(Action<>), typeof(Action<,>), typeof(Action<,,>), typeof(Action<,,,>)
+#if CLR40 && !SILVERLIGHT
+ , typeof(Action<,,,,>), typeof(Action<,,,,,>), typeof(Action<,,,,,,>), typeof(Action<,,,,,,,>)
+#endif
+ };
+
+ private static Type ConvertMethodInfoToFuncOrActionType(MethodInfo method)
+ {
+ ParameterInfo[] parameters = method.GetParameters();
+
+ bool isVoid = method.ReturnType == typeof(void);
+ Type[] typeArray = isVoid ? _actionTypes : _funcTypes;
+
+ if (parameters.Length >= typeArray.Length)
+ {
+ return null;
+ }
+
+ Type[] genericArgTypes = new Type[parameters.Length + (isVoid ? 0 : 1)];
+
+ for (int i = 0; i < parameters.Length; i++)
+ {
+ genericArgTypes[i] = parameters[i].ParameterType;
+ }
+
+ if (!isVoid)
+ {
+ genericArgTypes[parameters.Length] = method.ReturnType;
+ }
+
+ Type delegateType = typeArray[parameters.Length].IsGenericType ?
+ typeArray[parameters.Length].MakeGenericType(genericArgTypes) :
+ typeArray[parameters.Length];
+
+ return delegateType;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ICompositionElement.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ICompositionElement.cs
new file mode 100644
index 0000000..32ff5f7
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ICompositionElement.cs
@@ -0,0 +1,44 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Represents an element that participates in composition.
+ /// </summary>
+ public interface ICompositionElement
+ {
+ /// <summary>
+ /// Gets the display name of the composition element.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing a human-readable display name of the <see cref="ICompositionElement"/>.
+ /// </value>
+ /// <remarks>
+ /// <note type="implementnotes">
+ /// Implementors of this property should never return <see langword="null"/> or an empty
+ /// string ("").
+ /// </note>
+ /// </remarks>
+ string DisplayName
+ {
+ get;
+ }
+
+ /// <summary>
+ /// Gets the composition element from which the current composition element
+ /// originated.
+ /// </summary>
+ /// <value>
+ /// A <see cref="ICompositionElement"/> from which the current
+ /// <see cref="ICompositionElement"/> originated, or <see langword="null"/>
+ /// if the <see cref="ICompositionElement"/> is the root composition element.
+ /// </value>
+ ICompositionElement Origin
+ {
+ get;
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs
new file mode 100644
index 0000000..27ac034
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/IPartCreatorImportDefinition.cs
@@ -0,0 +1,12 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ internal interface IPartCreatorImportDefinition
+ {
+ ContractBasedImportDefinition ProductImportDefinition { get; }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportCardinality.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportCardinality.cs
new file mode 100644
index 0000000..5ce945f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportCardinality.cs
@@ -0,0 +1,28 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Indicates the cardinality of the <see cref="Export"/> objects required by an <see cref="ImportDefinition"/>.
+ /// </summary>
+ public enum ImportCardinality
+ {
+ /// <summary>
+ /// Zero or one <see cref="Export"/> objects are required by an <see cref="ImportDefinition"/>.
+ /// </summary>
+ ZeroOrOne = 0,
+
+ /// <summary>
+ /// Exactly one <see cref="Export"/> object is required by an <see cref="ImportDefinition"/>.
+ /// </summary>
+ ExactlyOne = 1,
+
+ /// <summary>
+ /// Zero or more <see cref="Export"/> objects are required by an <see cref="ImportDefinition"/>.
+ /// </summary>
+ ZeroOrMore = 2,
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportDefinition.cs
new file mode 100644
index 0000000..cff9886
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/ImportDefinition.cs
@@ -0,0 +1,236 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq.Expressions;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ /// <summary>
+ /// Represents an import required by a <see cref="ComposablePart"/> object.
+ /// </summary>
+ public class ImportDefinition
+ {
+ internal static readonly string EmptyContractName = string.Empty;
+ private readonly Expression<Func<ExportDefinition, bool>> _constraint;
+ private readonly ImportCardinality _cardinality = ImportCardinality.ExactlyOne;
+ private readonly string _contractName = EmptyContractName;
+ private readonly bool _isRecomposable;
+ private readonly bool _isPrerequisite = true;
+ private Func<ExportDefinition, bool> _compiledConstraint;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportDefinition"/> class.
+ /// </summary>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Derived types calling this constructor must override the <see cref="Constraint"/>
+ /// property, and optionally, the <see cref="Cardinality"/>, <see cref="IsPrerequisite"/>
+ /// and <see cref="IsRecomposable"/>
+ /// properties.
+ /// </note>
+ /// </remarks>
+ protected ImportDefinition()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="ImportDefinition"/> class
+ /// with the specified constraint, cardinality, value indicating if the import
+ /// definition is recomposable and a value indicating if the import definition
+ /// is a prerequisite.
+ /// </summary>
+ /// <param name="constraint">
+ /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
+ /// that defines the conditions that must be matched for the <see cref="ImportDefinition"/>
+ /// to be satisfied by an <see cref="Export"/>.
+ /// </param>
+ /// <param name="contractName">
+ /// The contract name of the export that this import is interested in. The contract name
+ /// property is used as guidance and not automatically enforced in the constraint. If
+ /// the contract name is a required in the constraint then it should be added to the constraint
+ /// by the caller of this constructor.
+ /// </param>
+ /// <param name="cardinality">
+ /// One of the <see cref="ImportCardinality"/> values indicating the
+ /// cardinality of the <see cref="Export"/> objects required by the
+ /// <see cref="ImportDefinition"/>.
+ /// </param>
+ /// <param name="isRecomposable">
+ /// <see langword="true"/> if the <see cref="ImportDefinition"/> can be satisfied
+ /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
+ /// <see langword="false"/>.
+ /// </param>
+ /// <param name="isPrerequisite">
+ /// <see langword="true"/> if the <see cref="ImportDefinition"/> is required to be
+ /// satisfied before a <see cref="ComposablePart"/> can start producing exported
+ /// objects; otherwise, <see langword="false"/>.
+ /// </param>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="constraint"/> is <see langword="null"/>.
+ /// </exception>
+ /// <exception cref="ArgumentException">
+ /// <paramref name="cardinality"/> is not one of the <see cref="ImportCardinality"/>
+ /// values.
+ /// </exception>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public ImportDefinition(Expression<Func<ExportDefinition, bool>> constraint, string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
+ : this(contractName, cardinality, isRecomposable, isPrerequisite)
+ {
+ Requires.NotNull(constraint, "constraint");
+
+ this._constraint = constraint;
+ }
+
+ internal ImportDefinition(string contractName, ImportCardinality cardinality, bool isRecomposable, bool isPrerequisite)
+ {
+ if (
+ (cardinality != ImportCardinality.ExactlyOne) &&
+ (cardinality != ImportCardinality.ZeroOrMore) &&
+ (cardinality != ImportCardinality.ZeroOrOne)
+ )
+ {
+ throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.ArgumentOutOfRange_InvalidEnum, "cardinality", cardinality, typeof(ImportCardinality).Name), "cardinality");
+ }
+
+ this._contractName = contractName ?? EmptyContractName;
+ this._cardinality = cardinality;
+ this._isRecomposable = isRecomposable;
+ this._isPrerequisite = isPrerequisite;
+ }
+
+ /// <summary>
+ /// Gets the contract name of the export required by the import definition.
+ /// </summary>
+ /// <value>
+ /// A <see cref="String"/> containing the contract name of the <see cref="Export"/>
+ /// required by the <see cref="ContractBasedImportDefinition"/>. This property should
+ /// return <see cref="String.Empty"/> for imports that do not require a specific
+ /// contract name.
+ /// </value>
+ public virtual string ContractName
+ {
+ get { return this._contractName; }
+ }
+
+ /// <summary>
+ /// Gets the cardinality of the exports required by the import definition.
+ /// </summary>
+ /// <value>
+ /// One of the <see cref="ImportCardinality"/> values indicating the
+ /// cardinality of the <see cref="Export"/> objects required by the
+ /// <see cref="ImportDefinition"/>. The default is
+ /// <see cref="ImportCardinality.ExactlyOne"/>
+ /// </value>
+ public virtual ImportCardinality Cardinality
+ {
+ get { return this._cardinality; }
+ }
+
+ /// <summary>
+ /// Gets an expression that defines conditions that must be matched for the import
+ /// described by the import definition to be satisfied.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="Expression{TDelegate}"/> containing a <see cref="Func{T, TResult}"/>
+ /// that defines the conditions that must be matched for the
+ /// <see cref="ImportDefinition"/> to be satisfied by an <see cref="Export"/>.
+ /// </returns>
+ /// <exception cref="NotImplementedException">
+ /// The property was not overridden by a derived class.
+ /// </exception>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overriders of this property should never return <see langword="null"/>.
+ /// </note>
+ /// </remarks>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public virtual Expression<Func<ExportDefinition, bool>> Constraint
+ {
+ get
+ {
+ if (this._constraint != null)
+ {
+ return this._constraint;
+ }
+
+ throw ExceptionBuilder.CreateNotOverriddenByDerived("Constraint");
+ }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the import definition is required to be
+ /// satisfied before a part can start producing exported values.
+ /// </summary>
+ /// <value>
+ /// <see langword="true"/> if the <see cref="ImportDefinition"/> is required to be
+ /// satisfied before a <see cref="ComposablePart"/> can start producing exported
+ /// objects; otherwise, <see langword="false"/>. The default is <see langword="true"/>.
+ /// </value>
+ public virtual bool IsPrerequisite
+ {
+ get { return this._isPrerequisite; }
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether the import definition can be satisfied multiple times.
+ /// </summary>
+ /// <value>
+ /// <see langword="true"/> if the <see cref="ImportDefinition"/> can be satisfied
+ /// multiple times throughout the lifetime of a <see cref="ComposablePart"/>, otherwise,
+ /// <see langword="false"/>. The default is <see langword="false"/>.
+ /// </value>
+ public virtual bool IsRecomposable
+ {
+ get { return this._isRecomposable; }
+ }
+
+ /// <summary>
+ /// Executes of the constraint provided by the <see cref="Constraint"/> property
+ /// against a given <see cref="ExportDefinition"/> to determine if this
+ /// <see cref="ImportDefinition"/> can be satisfied by the given <see cref="Export"/>.
+ /// </summary>
+ /// <param name="exportDefinition">
+ /// A definition for a <see cref="Export"/> used to determine if it satisfies the
+ /// requirements for this <see cref="ImportDefinition"/>.
+ /// </param>
+ /// <returns>
+ /// <see langword="True"/> if the <see cref="Export"/> satisfies the requirements for
+ /// this <see cref="ImportDefinition"/>, otherwise returns <see langword="False"/>.
+ /// </returns>
+ /// <remarks>
+ /// <note type="inheritinfo">
+ /// Overrides of this method can provide a more optimized execution of the
+ /// <see cref="Constraint"/> property but the result should remain consistent.
+ /// </note>
+ /// </remarks>
+ /// <exception cref="ArgumentNullException">
+ /// <paramref name="exportDefinition"/> is <see langword="null"/>.
+ /// </exception>
+ public virtual bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
+ {
+ Requires.NotNull(exportDefinition, "exportDefinition");
+
+ if (this._compiledConstraint == null)
+ {
+ this._compiledConstraint = this.Constraint.Compile();
+ }
+
+ return this._compiledConstraint.Invoke(exportDefinition);
+ }
+
+ /// <summary>
+ /// Returns a string representation of the import definition.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="String"/> containing the value of the <see cref="Constraint"/> property.
+ /// </returns>
+ public override string ToString()
+ {
+ return this.Constraint.Body.ToString();
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs
new file mode 100644
index 0000000..45958bc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/Primitives/SerializableCompositionElement.cs
@@ -0,0 +1,57 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.Primitives
+{
+ // As most objects that implement ICompositionElement (such as Export, ComposablePart,
+ // ComposablePartCatalog, etc) are not serializable, this class is used as a serializable
+ // placeholder for these types when ICompositionElement is used within serializable types,
+ // such as CompositionException, CompositionIssue, etc.
+ [Serializable]
+ internal class SerializableCompositionElement : ICompositionElement
+ {
+ private readonly string _displayName;
+ private readonly ICompositionElement _origin;
+
+ public SerializableCompositionElement(string displayName, ICompositionElement origin)
+ {
+#if !SILVERLIGHT
+ Assumes.IsTrue(origin == null || origin.GetType().IsSerializable);
+#endif
+ this._displayName = displayName ?? string.Empty;
+ this._origin = origin;
+ }
+
+ public string DisplayName
+ {
+ get { return this._displayName; }
+ }
+
+ public ICompositionElement Origin
+ {
+ get { return this._origin; }
+ }
+
+ public override string ToString()
+ {
+ return this.DisplayName;
+ }
+
+ public static ICompositionElement FromICompositionElement(ICompositionElement element)
+ {
+ if (element == null)
+ { // Null is always serializable
+
+ return null;
+ }
+
+ ICompositionElement origin = FromICompositionElement(element.Origin);
+
+ // Otherwise, we need to create a serializable wrapper
+ return new SerializableCompositionElement(element.DisplayName, origin);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs
new file mode 100644
index 0000000..c883d1d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/DisposableReflectionComposablePart.cs
@@ -0,0 +1,57 @@
+
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal sealed class DisposableReflectionComposablePart : ReflectionComposablePart, IDisposable
+ {
+ private volatile int _isDisposed = 0;
+
+ public DisposableReflectionComposablePart(ReflectionComposablePartDefinition definition)
+ : base(definition)
+ {
+ }
+
+ protected override void ReleaseInstanceIfNecessary(object instance)
+ {
+ IDisposable disposable = instance as IDisposable;
+ if (disposable != null)
+ {
+ disposable.Dispose();
+ }
+ }
+
+ protected override void EnsureRunning()
+ {
+ base.EnsureRunning();
+ if (this._isDisposed == 1)
+ {
+ throw ExceptionBuilder.CreateObjectDisposed(this);
+ }
+ }
+
+ void IDisposable.Dispose()
+ {
+ // NOTE : According to http://msdn.microsoft.com/en-us/library/4bw5ewxy.aspx, the warning is bogus when used with Interlocked API.
+#pragma warning disable 420
+ if (Interlocked.CompareExchange(ref this._isDisposed, 1, 0) == 0)
+#pragma warning restore 420
+ {
+ this.ReleaseInstanceIfNecessary(this.CachedInstance);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs
new file mode 100644
index 0000000..44dbcea
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ExportingMember.cs
@@ -0,0 +1,93 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ExportingMember
+ {
+ private readonly ExportDefinition _definition;
+ private readonly ReflectionMember _member;
+ private object _cachedValue = null;
+ private volatile bool _isValueCached = false;
+
+ public ExportingMember(ExportDefinition definition, ReflectionMember member)
+ {
+ Assumes.NotNull(definition, member);
+
+ this._definition = definition;
+ this._member = member;
+ }
+
+ public bool RequiresInstance
+ {
+ get { return _member.RequiresInstance; }
+ }
+
+ public ExportDefinition Definition
+ {
+ get { return _definition; }
+ }
+
+ public object GetExportedValue(object instance, object @lock)
+ {
+ this.EnsureReadable();
+
+ if (!this._isValueCached)
+ {
+ object exportedValue;
+ try
+ {
+ exportedValue = this._member.GetValue(instance);
+ }
+ catch (TargetInvocationException exception)
+ { // Member threw an exception. Avoid letting this
+ // leak out as a 'raw' unhandled exception, instead,
+ // we'll add some context and rethrow.
+
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ExportThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ExportThrewException,
+ this._member.GetDisplayName()),
+ Definition.ToElement(),
+ exception.InnerException);
+ }
+
+ lock (@lock)
+ {
+ if (!this._isValueCached)
+ {
+ this._cachedValue = exportedValue;
+ Thread.MemoryBarrier();
+
+ this._isValueCached = true;
+ }
+ }
+ }
+
+ return this._cachedValue;
+ }
+
+ private void EnsureReadable()
+ {
+ if (!this._member.CanRead)
+ { // Property does not have a getter
+
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ExportNotReadable,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ExportNotReadable,
+ this._member.GetDisplayName()),
+ Definition.ToElement());
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs
new file mode 100644
index 0000000..fa43610
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/IReflectionPartCreationInfo.cs
@@ -0,0 +1,22 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Reflection;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal interface IReflectionPartCreationInfo : ICompositionElement
+ {
+ Type GetPartType();
+ Lazy<Type> GetLazyPartType();
+ ConstructorInfo GetConstructor();
+ IDictionary<string, object> GetMetadata();
+ IEnumerable<ExportDefinition> GetExports();
+ IEnumerable<ImportDefinition> GetImports();
+ bool IsDisposalRequired { get; }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportType.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportType.cs
new file mode 100644
index 0000000..776c54b
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportType.cs
@@ -0,0 +1,140 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Reflection;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ // Describes the import type of a Reflection-based import definition
+ internal class ImportType
+ {
+ private static readonly Type LazyOfTType = typeof(Lazy<>);
+ private static readonly Type LazyOfTMType = typeof(Lazy<,>);
+ private const string ExportFactoryTypeName = "System.ComponentModel.Composition.ExportFactory";
+
+ private readonly Type _type;
+ private readonly bool _isAssignableCollectionType;
+ private readonly Type _contractType;
+ private Func<Export, object> _castSingleValue;
+
+ public ImportType(Type type, ImportCardinality cardinality)
+ {
+ Assumes.NotNull(type);
+
+ this._type = type;
+ this._contractType = type;
+
+ if (cardinality == ImportCardinality.ZeroOrMore)
+ {
+ this._isAssignableCollectionType = IsTypeAssignableCollectionType(type);
+ this._contractType = CheckForCollection(type);
+ }
+
+ this._contractType = CheckForLazyAndPartCreator(this._contractType);
+ }
+
+ public bool IsAssignableCollectionType
+ {
+ get { return this._isAssignableCollectionType; }
+ }
+
+ public Type ElementType { get; private set; }
+
+ public Type ActualType
+ {
+ get { return this._type; }
+ }
+
+ public bool IsPartCreator { get; private set; }
+
+ public Type ContractType { get { return this._contractType; } }
+
+ public Func<Export, object> CastExport { get { return this._castSingleValue; } }
+
+ public Type MetadataViewType { get; private set; }
+
+ private Type CheckForCollection(Type type)
+ {
+ this.ElementType = CollectionServices.GetEnumerableElementType(type);
+ if (this.ElementType != null)
+ {
+ return this.ElementType;
+ }
+ return type;
+ }
+
+ private Type CheckForLazyAndPartCreator(Type type)
+ {
+ if (type.IsGenericType)
+ {
+ Type genericType = type.GetGenericTypeDefinition();
+ Type[] arguments = type.GetGenericArguments();
+
+ if (genericType == LazyOfTType)
+ {
+ this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], null);
+ return arguments[0];
+ }
+
+ if (genericType == LazyOfTMType)
+ {
+ this.MetadataViewType = arguments[1];
+ this._castSingleValue = ExportServices.CreateStronglyTypedLazyFactory(arguments[0], arguments[1]);
+ return arguments[0];
+ }
+
+ if (
+ type.FullName.StartsWith(ExportFactoryTypeName, StringComparison.Ordinal) &&
+ ((arguments.Length == 1) || (arguments.Length == 2)))
+ {
+ // Func<Tuple<T, Action>>
+ Type exportLifetimeContextCreatorType = typeof(Func<>).MakeGenericType(typeof(Tuple<,>).MakeGenericType(arguments[0], typeof(Action)));
+ ConstructorInfo constructor = null;
+
+ if (arguments.Length == 1)
+ {
+ constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType });
+ }
+ else
+ {
+ Assumes.IsTrue(arguments.Length == 2);
+ constructor = type.GetConstructor(new Type[] { exportLifetimeContextCreatorType, arguments[1] });
+ }
+
+ if (constructor != null)
+ {
+ this.IsPartCreator = true;
+ if (arguments.Length == 1)
+ {
+ this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], null, constructor);
+ }
+ else
+ {
+ Assumes.IsTrue(arguments.Length == 2);
+ this._castSingleValue = ExportServices.CreateStronglyTypedExportFactoryFactory(arguments[0], arguments[1], constructor);
+ this.MetadataViewType = arguments[1];
+ }
+
+ return arguments[0];
+ }
+ }
+ }
+
+ return type;
+ }
+
+ private static bool IsTypeAssignableCollectionType(Type type)
+ {
+ if (type.IsArray || CollectionServices.IsEnumerableOfT(type))
+ {
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs
new file mode 100644
index 0000000..c45245e
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingItem.cs
@@ -0,0 +1,116 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Globalization;
+using System.Linq;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal abstract class ImportingItem
+ {
+ private readonly ContractBasedImportDefinition _definition;
+ private readonly ImportType _importType;
+
+ protected ImportingItem(ContractBasedImportDefinition definition, ImportType importType)
+ {
+ Assumes.NotNull(definition);
+
+ this._definition = definition;
+ this._importType = importType;
+ }
+
+ public ContractBasedImportDefinition Definition
+ {
+ get { return this._definition; }
+ }
+
+ public ImportType ImportType
+ {
+ get { return this._importType; }
+ }
+
+ public object CastExportsToImportType(Export[] exports)
+ {
+ if (this.Definition.Cardinality == ImportCardinality.ZeroOrMore)
+ {
+ return CastExportsToCollectionImportType(exports);
+ }
+ else
+ {
+ return CastExportsToSingleImportType(exports);
+ }
+ }
+
+ private object CastExportsToCollectionImportType(Export[] exports)
+ {
+ Assumes.NotNull(exports);
+
+ // Element type could be null if the actually import type of the member is not a collection
+ // This particular case will end up failing when we set the member.
+ Type elementType = this.ImportType.ElementType ?? typeof(object);
+
+ Array array = Array.CreateInstance(elementType, exports.Length);
+
+ for (int i = 0; i < array.Length; i++)
+ {
+ object value = CastSingleExportToImportType(elementType, exports[i]);
+
+ array.SetValue(value, i);
+ }
+
+ return array;
+ }
+
+ private object CastExportsToSingleImportType(Export[] exports)
+ {
+ Assumes.NotNull(exports);
+ Assumes.IsTrue(exports.Length < 2);
+
+ if (exports.Length == 0)
+ {
+ return null;
+ }
+
+ return CastSingleExportToImportType(this.ImportType.ActualType, exports[0]);
+ }
+
+ private object CastSingleExportToImportType(Type type, Export export)
+ {
+ if (this.ImportType.CastExport != null)
+ {
+ return this.ImportType.CastExport(export);
+ }
+
+ return Cast(type, export);
+ }
+
+ private object Cast(Type type, Export export)
+ {
+ // TODO: Need to catch CompositionException to provide
+ // additional information about what member we're setting
+ // and the current dependency graph.
+ object value = export.Value;
+
+ object result;
+ if (!ContractServices.TryCast(type, value, out result))
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportNotAssignableFromExport,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportNotAssignableFromExport,
+ export.ToElement().DisplayName,
+ type.FullName),
+ this.Definition.ToElement());
+ }
+
+ return result;
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs
new file mode 100644
index 0000000..723131f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingMember.cs
@@ -0,0 +1,253 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ImportingMember : ImportingItem
+ {
+ private readonly ReflectionWritableMember _member;
+
+ public ImportingMember(ContractBasedImportDefinition definition, ReflectionWritableMember member, ImportType importType)
+ : base(definition, importType)
+ {
+ Assumes.NotNull(definition, member);
+
+ this._member = member;
+ }
+
+ public void SetExportedValue(object instance, object value)
+ {
+ if (RequiresCollectionNormalization())
+ {
+ this.SetCollectionMemberValue(instance, (IEnumerable)value);
+ }
+ else
+ {
+ this.SetSingleMemberValue(instance, value);
+ }
+ }
+
+ private bool RequiresCollectionNormalization()
+ {
+ if (this.Definition.Cardinality != ImportCardinality.ZeroOrMore)
+ { // If we're not looking at a collection import, then don't
+ // 'normalize' the collection.
+
+ return false;
+ }
+
+ if (this._member.CanWrite && this.ImportType.IsAssignableCollectionType)
+ { // If we can simply replace the entire value of the property/field, then
+ // we don't need to 'normalize' the collection.
+
+ return false;
+ }
+
+ return true;
+ }
+
+ private void SetSingleMemberValue(object instance, object value)
+ {
+ EnsureWritable();
+
+ try
+ {
+ this._member.SetValue(instance, value);
+ }
+ catch (TargetInvocationException exception)
+ { // Member threw an exception. Avoid letting this
+ // leak out as a 'raw' unhandled exception, instead,
+ // we'll add some context and rethrow.
+
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportThrewException,
+ this._member.GetDisplayName()),
+ Definition.ToElement(),
+ exception.InnerException);
+ }
+ }
+
+ private void EnsureWritable()
+ {
+ if (!this._member.CanWrite)
+ { // Property does not have a setter, or
+ // field is marked as read-only.
+
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportNotWritable,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportNotWritable,
+ this._member.GetDisplayName()),
+ Definition.ToElement());
+ }
+ }
+
+ private void SetCollectionMemberValue(object instance, IEnumerable values)
+ {
+ Assumes.NotNull(values);
+
+ ICollection<object> collection = null;
+ Type itemType = CollectionServices.GetCollectionElementType(this.ImportType.ActualType);
+ if (itemType != null)
+ {
+ collection = GetNormalizedCollection(itemType, instance);
+ }
+
+ EnsureCollectionIsWritable(collection);
+ PopulateCollection(collection, values);
+ }
+
+ private ICollection<object> GetNormalizedCollection(Type itemType, object instance)
+ {
+ Assumes.NotNull(itemType);
+
+ object collectionObject = null;
+
+ if (this._member.CanRead)
+ {
+ try
+ {
+ collectionObject = this._member.GetValue(instance);
+ }
+ catch (TargetInvocationException exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionGetThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionGetThrewException,
+ this._member.GetDisplayName()),
+ this.Definition.ToElement(),
+ exception.InnerException);
+ }
+ }
+
+ if (collectionObject == null)
+ {
+ ConstructorInfo constructor = this.ImportType.ActualType.GetConstructor(Type.EmptyTypes);
+
+ // If it contains a default public constructor create a new instance.
+ if (constructor != null)
+ {
+ try
+ {
+ collectionObject = constructor.SafeInvoke();
+ }
+ catch (TargetInvocationException exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionConstructionThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionConstructionThrewException,
+ this._member.GetDisplayName(),
+ this.ImportType.ActualType.FullName),
+ this.Definition.ToElement(),
+ exception.InnerException);
+ }
+
+ SetSingleMemberValue(instance, collectionObject);
+ }
+ }
+
+ if (collectionObject == null)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionNull,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionNull,
+ this._member.GetDisplayName()),
+ this.Definition.ToElement());
+ }
+
+ return CollectionServices.GetCollectionWrapper(itemType, collectionObject);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
+ private void EnsureCollectionIsWritable(ICollection<object> collection)
+ {
+ bool isReadOnly = true;
+
+ try
+ {
+ if (collection != null)
+ {
+ isReadOnly = collection.IsReadOnly;
+ }
+ }
+ catch (Exception exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionIsReadOnlyThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionIsReadOnlyThrewException,
+ this._member.GetDisplayName(),
+ collection.GetType().FullName),
+ this.Definition.ToElement(),
+ exception);
+ }
+
+ if (isReadOnly)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionNotWritable,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionNotWritable,
+ this._member.GetDisplayName()),
+ this.Definition.ToElement());
+ }
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
+ private void PopulateCollection(ICollection<object> collection, IEnumerable values)
+ {
+ Assumes.NotNull(collection, values);
+
+ try
+ {
+ collection.Clear();
+ }
+ catch (Exception exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionClearThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionClearThrewException,
+ this._member.GetDisplayName(),
+ collection.GetType().FullName),
+ this.Definition.ToElement(),
+ exception);
+ }
+
+ foreach (object value in values)
+ {
+ try
+ {
+ collection.Add(value);
+ }
+ catch (Exception exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportCollectionAddThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportCollectionAddThrewException,
+ this._member.GetDisplayName(),
+ collection.GetType().FullName),
+ this.Definition.ToElement(),
+ exception);
+ }
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs
new file mode 100644
index 0000000..0b1d15f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ImportingParameter.cs
@@ -0,0 +1,16 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ImportingParameter : ImportingItem
+ {
+ public ImportingParameter(ContractBasedImportDefinition definition, ImportType importType)
+ : base(definition, importType)
+ {
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs
new file mode 100644
index 0000000..f59e3c6
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/LazyMemberInfo.cs
@@ -0,0 +1,207 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ public struct LazyMemberInfo
+ {
+ private readonly MemberTypes _memberType;
+ private MemberInfo[] _accessors;
+ private readonly Func<MemberInfo[]> _accessorsCreator;
+
+ public LazyMemberInfo(MemberInfo member)
+ {
+ Requires.NotNull(member, "member");
+ EnsureSupportedMemberType(member.MemberType, "member");
+
+ this._accessorsCreator = null;
+ this._memberType = member.MemberType;
+
+ switch(this._memberType)
+ {
+ case MemberTypes.Property:
+ PropertyInfo property = (PropertyInfo)member;
+ Assumes.NotNull(property);
+ this._accessors = new MemberInfo[] { property.GetGetMethod(true), property.GetSetMethod(true) };
+ break;
+ case MemberTypes.Event:
+ EventInfo event_ = (EventInfo)member;
+ this._accessors = new MemberInfo[] { event_.GetRaiseMethod(true), event_.GetAddMethod(true), event_.GetRemoveMethod(true) };
+ break;
+ default:
+ this._accessors = new MemberInfo[] { member };
+ break;
+ }
+ }
+
+ public LazyMemberInfo(MemberTypes memberType, params MemberInfo[] accessors)
+ {
+ EnsureSupportedMemberType(memberType, "memberType");
+ Requires.NotNull(accessors, "accessors");
+
+ string errorMessage;
+ if (!LazyMemberInfo.AreAccessorsValid(memberType, accessors, out errorMessage))
+ {
+ throw new ArgumentException(errorMessage, "accessors");
+ }
+
+ this._memberType = memberType;
+ this._accessors = accessors;
+ this._accessorsCreator = null;
+ }
+
+ public LazyMemberInfo(MemberTypes memberType, Func<MemberInfo[]> accessorsCreator)
+ {
+ EnsureSupportedMemberType(memberType, "memberType");
+ Requires.NotNull(accessorsCreator, "accessorsCreator");
+
+ this._memberType = memberType;
+ this._accessors = null;
+ this._accessorsCreator = accessorsCreator;
+ }
+
+ public MemberTypes MemberType
+ {
+ get { return this._memberType; }
+ }
+
+ public MemberInfo[] GetAccessors()
+ {
+ if ((this._accessors == null) && (this._accessorsCreator != null))
+ {
+ MemberInfo[] accessors = this._accessorsCreator.Invoke();
+
+ string errorMessage;
+ if (!LazyMemberInfo.AreAccessorsValid(this.MemberType, accessors, out errorMessage))
+ {
+ throw new InvalidOperationException(errorMessage);
+ }
+
+ this._accessors = accessors;
+ }
+
+ return this._accessors;
+ }
+
+ public override int GetHashCode()
+ {
+ if (this._accessorsCreator != null)
+ {
+ return this.MemberType.GetHashCode() ^ this._accessorsCreator.GetHashCode();
+ }
+ else
+ {
+ Assumes.NotNull(this._accessors);
+ Assumes.NotNull(this._accessors[0]);
+ return this.MemberType.GetHashCode() ^ this._accessors[0].GetHashCode();
+ }
+ }
+
+ public override bool Equals(object obj)
+ {
+ LazyMemberInfo that = (LazyMemberInfo)obj;
+
+ // Difefrent member types mean different members
+ if (this._memberType != that._memberType)
+ {
+ return false;
+ }
+
+ // if any of the lazy memebers create accessors in a delay-loaded fashion, we simply compare the creators
+ if ((this._accessorsCreator != null) || (that._accessorsCreator != null))
+ {
+ return object.Equals(this._accessorsCreator, that._accessorsCreator);
+ }
+
+ // we are dealing with explicitly passed accessors in both cases
+ Assumes.NotNull(this._accessors);
+ Assumes.NotNull(that._accessors);
+ return this._accessors.SequenceEqual(that._accessors);
+ }
+
+ public static bool operator ==(LazyMemberInfo left, LazyMemberInfo right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(LazyMemberInfo left, LazyMemberInfo right)
+ {
+ return !left.Equals(right);
+ }
+
+ private static void EnsureSupportedMemberType(MemberTypes memberType, string argument)
+ {
+ MemberTypes supportedTypes = MemberTypes.TypeInfo | MemberTypes.NestedType | MemberTypes.Constructor | MemberTypes.Field | MemberTypes.Method | MemberTypes.Property | MemberTypes.Event;
+ Requires.IsInMembertypeSet(memberType, argument, supportedTypes);
+ }
+
+ private static bool AreAccessorsValid(MemberTypes memberType, MemberInfo[] accessors, out string errorMessage)
+ {
+ errorMessage = string.Empty;
+ if (accessors == null)
+ {
+ errorMessage = Strings.LazyMemberInfo_AccessorsNull;
+ return false;
+ }
+
+ if (accessors.All(accessor => accessor == null))
+ {
+ errorMessage = Strings.LazyMemberInfo_NoAccessors;
+ return false;
+ }
+
+ switch (memberType)
+ {
+ case MemberTypes.Property:
+ if (accessors.Length != 2)
+ {
+ errorMessage = Strings.LazyMemberInfo_InvalidPropertyAccessors_Cardinality;
+ return false;
+ }
+
+ if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
+ {
+ errorMessage = Strings.LazyMemberinfo_InvalidPropertyAccessors_AccessorType;
+ return false;
+ }
+
+ break;
+
+ case MemberTypes.Event:
+ if (accessors.Length != 3)
+ {
+ errorMessage = Strings.LazyMemberInfo_InvalidEventAccessors_Cardinality;
+ return false;
+ }
+
+ if (accessors.Where(accessor => (accessor != null) && (accessor.MemberType != MemberTypes.Method)).Any())
+ {
+ errorMessage = Strings.LazyMemberinfo_InvalidPropertyAccessors_AccessorType;
+ return false;
+ }
+
+ break;
+
+ default:
+ if (
+ (accessors.Length != 1) ||
+ ((accessors.Length == 1) && (accessors[0].MemberType != memberType)))
+ {
+ errorMessage = string.Format(CultureInfo.CurrentCulture, Strings.LazyMemberInfo_InvalidAccessorOnSimpleMember, memberType);
+ return false;
+ }
+
+ break;
+ }
+ return true;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs
new file mode 100644
index 0000000..517dd59
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorExportDefinition.cs
@@ -0,0 +1,62 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class PartCreatorExportDefinition : ExportDefinition
+ {
+ private readonly ExportDefinition _productDefinition;
+ private IDictionary<string, object> _metadata;
+
+ public PartCreatorExportDefinition(ExportDefinition productDefinition)
+ : base()
+ {
+ this._productDefinition = productDefinition;
+ }
+
+ public override string ContractName
+ {
+ get
+ {
+ return CompositionConstants.PartCreatorContractName;
+ }
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ if (this._metadata == null)
+ {
+ var metadata = new Dictionary<string, object>(this._productDefinition.Metadata);
+ metadata[CompositionConstants.ExportTypeIdentityMetadataName] = CompositionConstants.PartCreatorTypeIdentity;
+ metadata[CompositionConstants.ProductDefinitionMetadataName] = this._productDefinition;
+
+ this._metadata = metadata.AsReadOnly();
+ }
+ return this._metadata;
+ }
+ }
+
+ internal static bool IsProductConstraintSatisfiedBy(ImportDefinition productImportDefinition, ExportDefinition exportDefinition)
+ {
+ object productValue = null;
+ if (exportDefinition.Metadata.TryGetValue(CompositionConstants.ProductDefinitionMetadataName, out productValue))
+ {
+ ExportDefinition productDefinition = productValue as ExportDefinition;
+
+ if (productDefinition != null)
+ {
+ return productImportDefinition.IsConstraintSatisfiedBy(productDefinition);
+ }
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs
new file mode 100644
index 0000000..0aa6480
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorMemberImportDefinition.cs
@@ -0,0 +1,48 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq.Expressions;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class PartCreatorMemberImportDefinition : ReflectionMemberImportDefinition, IPartCreatorImportDefinition
+ {
+ private readonly ContractBasedImportDefinition _productImportDefinition;
+
+ public PartCreatorMemberImportDefinition(
+ LazyMemberInfo importingLazyMember,
+ ICompositionElement origin,
+ ContractBasedImportDefinition productImportDefinition)
+ : base(importingLazyMember, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity,
+ productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, productImportDefinition.IsRecomposable, CreationPolicy.Any, origin)
+ {
+ Assumes.NotNull(productImportDefinition);
+ this._productImportDefinition = productImportDefinition;
+ }
+
+ public ContractBasedImportDefinition ProductImportDefinition { get { return this._productImportDefinition; } }
+
+ public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
+ {
+ if (!base.IsConstraintSatisfiedBy(exportDefinition))
+ {
+ return false;
+ }
+
+ return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
+ }
+
+ public override Expression<Func<ExportDefinition, bool>> Constraint
+ {
+ get
+ {
+ return ConstraintServices.CreatePartCreatorConstraint(base.Constraint, this._productImportDefinition);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs
new file mode 100644
index 0000000..d12e4bd
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/PartCreatorParameterImportDefinition.cs
@@ -0,0 +1,48 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Linq.Expressions;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class PartCreatorParameterImportDefinition : ReflectionParameterImportDefinition, IPartCreatorImportDefinition
+ {
+ private readonly ContractBasedImportDefinition _productImportDefinition;
+
+ public PartCreatorParameterImportDefinition(
+ Lazy<ParameterInfo> importingLazyParameter,
+ ICompositionElement origin,
+ ContractBasedImportDefinition productImportDefinition)
+ : base(importingLazyParameter, CompositionConstants.PartCreatorContractName, CompositionConstants.PartCreatorTypeIdentity,
+ productImportDefinition.RequiredMetadata, productImportDefinition.Cardinality, CreationPolicy.Any, origin)
+ {
+ Assumes.NotNull(productImportDefinition);
+ this._productImportDefinition = productImportDefinition;
+ }
+
+ public ContractBasedImportDefinition ProductImportDefinition { get { return this._productImportDefinition; } }
+
+ public override bool IsConstraintSatisfiedBy(ExportDefinition exportDefinition)
+ {
+ if (!base.IsConstraintSatisfiedBy(exportDefinition))
+ {
+ return false;
+ }
+ return PartCreatorExportDefinition.IsProductConstraintSatisfiedBy(this._productImportDefinition, exportDefinition);
+ }
+
+ public override Expression<Func<ExportDefinition, bool>> Constraint
+ {
+ get
+ {
+ return ConstraintServices.CreatePartCreatorConstraint(base.Constraint, this._productImportDefinition);
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs
new file mode 100644
index 0000000..c4b15de
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePart.cs
@@ -0,0 +1,565 @@
+
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ // This
+ internal class ReflectionComposablePart : ComposablePart, ICompositionElement
+ {
+ private readonly ReflectionComposablePartDefinition _definition;
+ private readonly Dictionary<ImportDefinition, object> _importValues = new Dictionary<ImportDefinition, object>();
+ private readonly Dictionary<ImportDefinition, ImportingItem> _importsCache = new Dictionary<ImportDefinition, ImportingItem>();
+ private readonly Dictionary<ExportDefinition, ExportingMember> _exportsCache = new Dictionary<ExportDefinition, ExportingMember>();
+ private bool _invokeImportsSatisfied = true;
+ private bool _invokingImportsSatisfied = false;
+ private bool _initialCompositionComplete = false;
+ private volatile object _cachedInstance;
+ private object _lock = new object();
+
+ public ReflectionComposablePart(ReflectionComposablePartDefinition definition)
+ {
+ Requires.NotNull(definition, "definition");
+
+ this._definition = definition;
+ }
+
+ public ReflectionComposablePart(ReflectionComposablePartDefinition definition, object attributedPart)
+ {
+ Requires.NotNull(definition, "definition");
+ Requires.NotNull(attributedPart, "attributedPart");
+
+ this._definition = definition;
+
+ if (attributedPart is ValueType)
+ {
+ throw new ArgumentException(Strings.ArgumentValueType, "attributedPart");
+ }
+ this._cachedInstance = attributedPart;
+ }
+
+ protected virtual void EnsureRunning()
+ {
+ }
+
+ protected virtual void ReleaseInstanceIfNecessary(object instance)
+ {
+ }
+
+ protected object CachedInstance
+ {
+ get
+ {
+ lock (this._lock)
+ {
+ return this._cachedInstance;
+ }
+ }
+ }
+
+ public ReflectionComposablePartDefinition Definition
+ {
+ get
+ {
+ this.EnsureRunning();
+ return this._definition;
+ }
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ this.EnsureRunning();
+ return this.Definition.Metadata;
+ }
+ }
+
+ public sealed override IEnumerable<ImportDefinition> ImportDefinitions
+ {
+ get
+ {
+ this.EnsureRunning();
+ return this.Definition.ImportDefinitions;
+ }
+ }
+
+ public sealed override IEnumerable<ExportDefinition> ExportDefinitions
+ {
+ get
+ {
+ this.EnsureRunning();
+ return this.Definition.ExportDefinitions;
+ }
+ }
+
+
+ string ICompositionElement.DisplayName
+ {
+ get { return GetDisplayName(); }
+ }
+
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return Definition; }
+ }
+
+ // This is the ONLY method which is not executed under the ImportEngine composition lock.
+ // We need to protect all state that is accesses
+ public override object GetExportedValue(ExportDefinition definition)
+ {
+ // given the implementation of the ImportEngine, this iwll be called under a lock if the part is still being composed
+ // This is only called outside of the lock when the part is fully composed
+ // based on that we only protect:
+ // _exportsCache - and thus all calls to GetExportingMemberFromDefinition
+ // access to _importValues
+ // access to _initialCompositionComplete
+ // access to _instance
+ this.EnsureRunning();
+ Requires.NotNull(definition, "definition");
+
+ ExportingMember member = null;
+ lock (this._lock)
+ {
+ member = GetExportingMemberFromDefinition(definition);
+ if (member == null)
+ {
+ throw ExceptionBuilder.CreateExportDefinitionNotOnThisComposablePart("definition");
+ }
+ this.EnsureGettable();
+ }
+
+ return this.GetExportedValue(member);
+ }
+
+ public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports)
+ {
+ this.EnsureRunning();
+
+ Requires.NotNull(definition, "definition");
+ Requires.NotNull(exports, "exports");
+
+ ImportingItem item = GetImportingItemFromDefinition(definition);
+ if (item == null)
+ {
+ throw ExceptionBuilder.CreateImportDefinitionNotOnThisComposablePart("definition");
+ }
+
+ EnsureSettable(definition);
+
+ // Avoid walking over exports many times
+ Export[] exportsAsArray = exports.AsArray();
+ EnsureCardinality(definition, exportsAsArray);
+
+ SetImport(item, exportsAsArray);
+ }
+
+ public override void Activate()
+ {
+ this.EnsureRunning();
+
+ this.SetNonPrerequisiteImports();
+
+ // Whenever we are composed/recomposed notify the instance
+ this.NotifyImportSatisfied();
+
+ lock (this._lock)
+ {
+ this._initialCompositionComplete = true;
+ }
+ }
+
+ public override string ToString()
+ {
+ return this.GetDisplayName();
+ }
+
+ private object GetExportedValue(ExportingMember member)
+ {
+ object instance = null;
+ if (member.RequiresInstance)
+ { // Only activate the instance if we actually need to
+
+ instance = this.GetInstanceActivatingIfNeeded();
+ }
+
+ return member.GetExportedValue(instance, this._lock);
+ }
+
+ private void SetImport(ImportingItem item, Export[] exports)
+ {
+ object value = item.CastExportsToImportType(exports);
+
+ lock (this._lock)
+ {
+ this._invokeImportsSatisfied = true;
+ this._importValues[item.Definition] = value;
+ }
+ }
+
+ private object GetInstanceActivatingIfNeeded()
+ {
+ if (this._cachedInstance != null)
+ {
+ return this._cachedInstance;
+ }
+ else
+ {
+ ConstructorInfo constructor = null;
+ object[] arguments = null;
+ // determine whether activation is required, and collect necessary information for activation
+ // we need to do that under a lock
+ lock (this._lock)
+ {
+ if (!this.RequiresActivation())
+ {
+ return null;
+ }
+
+ constructor = this.Definition.GetConstructor();
+ if (constructor == null)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_PartConstructorMissing,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_PartConstructorMissing,
+ this.Definition.GetPartType().FullName),
+ this.Definition.ToElement());
+ }
+ arguments = this.GetConstructorArguments();
+ }
+
+ // create instance outside of the lock
+ object createdInstance = this.CreateInstance(constructor, arguments);
+
+ // set the created instance
+ lock (this._lock)
+ {
+ if (this._cachedInstance == null)
+ {
+ this._cachedInstance = createdInstance;
+ createdInstance = null;
+ }
+ }
+
+ // if the instance has been already set
+ if (createdInstance == null)
+ {
+ this.ReleaseInstanceIfNecessary(createdInstance);
+ }
+ }
+
+ return this._cachedInstance;
+ }
+
+ private object[] GetConstructorArguments()
+ {
+ ReflectionParameterImportDefinition[] parameterImports = this.ImportDefinitions.OfType<ReflectionParameterImportDefinition>().ToArray();
+ object[] arguments = new object[parameterImports.Length];
+
+ this.UseImportedValues(
+ parameterImports,
+ (import, definition, value) =>
+ {
+ if (definition.Cardinality == ImportCardinality.ZeroOrMore && !import.ImportType.IsAssignableCollectionType)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_ImportManyOnParameterCanOnlyBeAssigned,
+ this.Definition.GetPartType().FullName,
+ definition.ImportingLazyParameter.Value.Name),
+ this.Definition.ToElement());
+ }
+
+ arguments[definition.ImportingLazyParameter.Value.Position] = value;
+ },
+ true);
+
+ return arguments;
+ }
+
+ // alwayc called under a lock
+ private bool RequiresActivation()
+ {
+ // If we have any imports then we need activation
+ // (static imports are not supported)
+ if (this.ImportDefinitions.Any())
+ {
+ return true;
+ }
+
+ // If we have any instance exports, then we also
+ // need activation.
+ return this.ExportDefinitions.Any(definition =>
+ {
+ ExportingMember member = GetExportingMemberFromDefinition(definition);
+
+ return member.RequiresInstance;
+ });
+ }
+
+ // this is called under a lock
+ private void EnsureGettable()
+ {
+ // If we're already composed then we know that
+ // all pre-req imports have been satisfied
+ if (_initialCompositionComplete)
+ {
+ return;
+ }
+
+ // Make sure all pre-req imports have been set
+ foreach (ImportDefinition definition in ImportDefinitions.Where(definition => definition.IsPrerequisite))
+ {
+ if (!this._importValues.ContainsKey(definition))
+ {
+ throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture,
+ Strings.InvalidOperation_GetExportedValueBeforePrereqImportSet,
+ definition.ToElement().DisplayName));
+ }
+ }
+ }
+
+ private void EnsureSettable(ImportDefinition definition)
+ {
+ lock (this._lock)
+ {
+ if (this._initialCompositionComplete && !definition.IsRecomposable)
+ {
+ throw new InvalidOperationException(Strings.InvalidOperation_DefinitionCannotBeRecomposed);
+ }
+ }
+ }
+
+ private static void EnsureCardinality(ImportDefinition definition, Export[] exports)
+ {
+ Requires.NullOrNotNullElements(exports, "exports");
+
+ ExportCardinalityCheckResult result = ExportServices.CheckCardinality(definition, exports);
+
+ switch (result)
+ {
+ case ExportCardinalityCheckResult.NoExports:
+ throw new ArgumentException(Strings.Argument_ExportsEmpty, "exports");
+
+ case ExportCardinalityCheckResult.TooManyExports:
+ throw new ArgumentException(Strings.Argument_ExportsTooMany, "exports");
+
+ default:
+ Assumes.IsTrue(result == ExportCardinalityCheckResult.Match);
+ break;
+ }
+ }
+
+ private object CreateInstance(ConstructorInfo constructor, object[] arguments)
+ {
+ Exception exception = null;
+ object instance = null;
+
+ try
+ {
+ instance = constructor.SafeInvoke(arguments);
+ }
+ catch (TypeInitializationException ex)
+ {
+ exception = ex;
+ }
+ catch (TargetInvocationException ex)
+ {
+ exception = ex.InnerException;
+ }
+
+ if (exception != null)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_PartConstructorThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_PartConstructorThrewException,
+ Definition.GetPartType().FullName),
+ Definition.ToElement(),
+ exception);
+ }
+
+ return instance;
+ }
+
+ private void SetNonPrerequisiteImports()
+ {
+ IEnumerable<ImportDefinition> members = this.ImportDefinitions.Where(import => !import.IsPrerequisite);
+
+ // NOTE: Dev10 484204 The validation is turned off for post imports because of it broke declarative composition
+ this.UseImportedValues(members, SetExportedValueForImport, false);
+ }
+
+ private void SetExportedValueForImport(ImportingItem import, ImportDefinition definition, object value)
+ {
+ ImportingMember importMember = (ImportingMember)import;
+
+ object instance = this.GetInstanceActivatingIfNeeded();
+
+ importMember.SetExportedValue(instance, value);
+ }
+
+ private void UseImportedValues<TImportDefinition>(IEnumerable<TImportDefinition> definitions, Action<ImportingItem, TImportDefinition, object> useImportValue, bool errorIfMissing)
+ where TImportDefinition : ImportDefinition
+ {
+ var result = CompositionResult.SucceededResult;
+
+ foreach (var definition in definitions)
+ {
+ ImportingItem import = GetImportingItemFromDefinition(definition);
+
+ object value;
+ if (!TryGetImportValue(definition, out value))
+ {
+ if (!errorIfMissing)
+ {
+ continue;
+ }
+
+ if (definition.Cardinality == ImportCardinality.ExactlyOne)
+ {
+ var error = CompositionError.Create(
+ CompositionErrorId.ImportNotSetOnPart,
+ Strings.ImportNotSetOnPart,
+ this.Definition.GetPartType().FullName,
+ definition.ToString());
+ result = result.MergeError(error);
+ continue;
+ }
+ else
+ {
+ value = import.CastExportsToImportType(new Export[0]);
+ }
+ }
+
+ useImportValue(import, definition, value);
+ }
+
+ result.ThrowOnErrors();
+ }
+
+ private bool TryGetImportValue(ImportDefinition definition, out object value)
+ {
+ lock (this._lock)
+ {
+ if (this._importValues.TryGetValue(definition, out value))
+ {
+ this._importValues.Remove(definition);
+ return true;
+ }
+ }
+
+ value = null;
+ return false;
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
+ private void NotifyImportSatisfied()
+ {
+ if (this._invokeImportsSatisfied && !this._invokingImportsSatisfied)
+ {
+ IPartImportsSatisfiedNotification notify = this.GetInstanceActivatingIfNeeded() as IPartImportsSatisfiedNotification;
+ if (notify != null)
+ {
+ try
+ {
+ // Reentrancy on composition notifications is allowed, so set this first to avoid
+ // an infinte loop of notifications.
+ this._invokingImportsSatisfied = true;
+
+ notify.OnImportsSatisfied();
+ }
+ catch (Exception exception)
+ {
+ throw new ComposablePartException(
+ CompositionErrorId.ReflectionModel_PartOnImportsSatisfiedThrewException,
+ String.Format(CultureInfo.CurrentCulture,
+ Strings.ReflectionModel_PartOnImportsSatisfiedThrewException,
+ Definition.GetPartType().FullName),
+ Definition.ToElement(),
+ exception);
+ }
+ finally
+ {
+ this._invokingImportsSatisfied = false;
+ }
+
+ this._invokeImportsSatisfied = false;
+ }
+ }
+ }
+
+ // this is always called under a lock
+ private ExportingMember GetExportingMemberFromDefinition(ExportDefinition definition)
+ {
+ ExportingMember result;
+ if (!_exportsCache.TryGetValue(definition, out result))
+ {
+ result = GetExportingMember(definition);
+ if (result != null)
+ {
+ _exportsCache[definition] = result;
+ }
+ }
+
+ return result;
+ }
+
+ private ImportingItem GetImportingItemFromDefinition(ImportDefinition definition)
+ {
+ ImportingItem result;
+ if (!_importsCache.TryGetValue(definition, out result))
+ {
+ result = GetImportingItem(definition);
+ if (result != null)
+ {
+ _importsCache[definition] = result;
+ }
+ }
+
+ return result;
+ }
+
+ private static ImportingItem GetImportingItem(ImportDefinition definition)
+ {
+ ReflectionImportDefinition reflectionDefinition = definition as ReflectionImportDefinition;
+ if (reflectionDefinition != null)
+ {
+ return reflectionDefinition.ToImportingItem();
+ }
+
+ // Don't recognize it
+ return null;
+ }
+
+ private static ExportingMember GetExportingMember(ExportDefinition definition)
+ {
+ ReflectionMemberExportDefinition exportDefinition = definition as ReflectionMemberExportDefinition;
+ if (exportDefinition != null)
+ {
+ return exportDefinition.ToExportingMember();
+ }
+
+ // Don't recognize it
+ return null;
+ }
+
+ private string GetDisplayName()
+ {
+ return this.Definition.GetPartType().GetDisplayName();
+ }
+ }
+}
\ No newline at end of file
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs
new file mode 100644
index 0000000..a8e3c83
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionComposablePartDefinition.cs
@@ -0,0 +1,151 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Reflection;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionComposablePartDefinition : ComposablePartDefinition, ICompositionElement
+ {
+ private readonly IReflectionPartCreationInfo _creationInfo;
+
+ private volatile IEnumerable<ImportDefinition> _imports;
+ private volatile IEnumerable<ExportDefinition> _exports;
+ private volatile IDictionary<string, object> _metadata;
+ private volatile ConstructorInfo _constructor;
+ private object _lock = new object();
+
+ public ReflectionComposablePartDefinition(IReflectionPartCreationInfo creationInfo)
+ {
+ Assumes.NotNull(creationInfo);
+ this._creationInfo = creationInfo;
+ }
+
+ public Type GetPartType()
+ {
+ return this._creationInfo.GetPartType();
+ }
+
+ public Lazy<Type> GetLazyPartType()
+ {
+ return this._creationInfo.GetLazyPartType();
+ }
+
+ public ConstructorInfo GetConstructor()
+ {
+ if (this._constructor == null)
+ {
+ ConstructorInfo constructor = this._creationInfo.GetConstructor();
+ lock (this._lock)
+ {
+ if (this._constructor == null)
+ {
+ this._constructor = constructor;
+ }
+ }
+ }
+
+ return this._constructor;
+ }
+
+ public override IEnumerable<ExportDefinition> ExportDefinitions
+ {
+ get
+ {
+ if (this._exports == null)
+ {
+ ExportDefinition[] exports = this._creationInfo.GetExports().ToArray();
+ lock (this._lock)
+ {
+ if (this._exports == null)
+ {
+ this._exports = exports;
+ }
+ }
+ }
+ return this._exports;
+ }
+ }
+
+ public override IEnumerable<ImportDefinition> ImportDefinitions
+ {
+ get
+ {
+ if (this._imports == null)
+ {
+ ImportDefinition[] imports = this._creationInfo.GetImports().ToArray();
+ lock (this._lock)
+ {
+ if (this._imports == null)
+ {
+ this._imports = imports;
+ }
+ }
+ }
+ return this._imports;
+ }
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ if (this._metadata == null)
+ {
+ IDictionary<string, object> metadata = this._creationInfo.GetMetadata().AsReadOnly();
+ lock (this._lock)
+ {
+ if (this._metadata == null)
+ {
+ this._metadata = metadata;
+ }
+ }
+ }
+ return this._metadata;
+ }
+ }
+
+ internal bool IsDisposalRequired
+ {
+ get
+ {
+ return this._creationInfo.IsDisposalRequired;
+ }
+ }
+
+ [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
+ public override ComposablePart CreatePart()
+ {
+ if (this.IsDisposalRequired)
+ {
+ return new DisposableReflectionComposablePart(this);
+ }
+ else
+ {
+ return new ReflectionComposablePart(this);
+ }
+ }
+
+ string ICompositionElement.DisplayName
+ {
+ get { return this._creationInfo.DisplayName; }
+ }
+
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return this._creationInfo.Origin; }
+ }
+
+ public override string ToString()
+ {
+ return this._creationInfo.DisplayName;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs
new file mode 100644
index 0000000..b04edbc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionExtensions.cs
@@ -0,0 +1,134 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+using System.Collections.Generic;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal static class ReflectionExtensions
+ {
+ public static ReflectionMember ToReflectionMember(this LazyMemberInfo lazyMember)
+ {
+ MemberInfo[] accessors = lazyMember.GetAccessors();
+ MemberTypes memberType = lazyMember.MemberType;
+
+ switch (memberType)
+ {
+ case MemberTypes.Field:
+ Assumes.IsTrue(accessors.Length == 1);
+ return ((FieldInfo)accessors[0]).ToReflectionField();
+
+ case MemberTypes.Property:
+ Assumes.IsTrue(accessors.Length == 2);
+ return ReflectionExtensions.CreateReflectionProperty((MethodInfo)accessors[0], (MethodInfo)accessors[1]);
+
+ case MemberTypes.NestedType:
+ case MemberTypes.TypeInfo:
+ return ((Type)accessors[0]).ToReflectionType();
+
+ default:
+ Assumes.IsTrue(memberType == MemberTypes.Method);
+ return ((MethodInfo)accessors[0]).ToReflectionMethod();
+ }
+ }
+
+ public static LazyMemberInfo ToLazyMember(this ReflectionMember reflectionMember)
+ {
+ Assumes.NotNull(reflectionMember);
+
+ if (reflectionMember.ItemType == ReflectionItemType.Property)
+ {
+ ReflectionProperty reflectionProperty = reflectionMember as ReflectionProperty;
+ Assumes.NotNull(reflectionProperty);
+
+ MemberInfo[] accessors = new MemberInfo[] { reflectionProperty.UnderlyingGetMethod, reflectionProperty.UnderlyingSetMethod };
+ return new LazyMemberInfo(MemberTypes.Property, accessors);
+ }
+ else
+ {
+ return new LazyMemberInfo(reflectionMember.UnderlyingMember.MemberType, reflectionMember.UnderlyingMember);
+ }
+ }
+
+ public static LazyMemberInfo ToLazyMember(this MemberInfo member)
+ {
+ Assumes.NotNull(member);
+
+ if (member.MemberType == MemberTypes.Property)
+ {
+ PropertyInfo property = member as PropertyInfo;
+ Assumes.NotNull(property);
+
+ MemberInfo[] accessors = new MemberInfo[] { property.GetGetMethod(true), property.GetSetMethod(true)};
+ return new LazyMemberInfo(MemberTypes.Property, accessors);
+ }
+ else
+ {
+ return new LazyMemberInfo(member);
+ }
+ }
+
+ public static ReflectionWritableMember ToReflectionWriteableMember(this LazyMemberInfo lazyMember)
+ {
+ Assumes.IsTrue((lazyMember.MemberType == MemberTypes.Field) || (lazyMember.MemberType == MemberTypes.Property));
+
+ ReflectionWritableMember reflectionMember = lazyMember.ToReflectionMember() as ReflectionWritableMember;
+ Assumes.NotNull(reflectionMember);
+
+ return reflectionMember;
+ }
+
+
+ public static ReflectionProperty ToReflectionProperty(this PropertyInfo property)
+ {
+ Assumes.NotNull(property);
+ return CreateReflectionProperty(property.GetGetMethod(true), property.GetSetMethod(true));
+ }
+
+ public static ReflectionProperty CreateReflectionProperty(MethodInfo getMethod, MethodInfo setMethod)
+ {
+ Assumes.IsTrue(getMethod != null || setMethod != null);
+
+ return new ReflectionProperty(getMethod, setMethod);
+ }
+
+ public static ReflectionParameter ToReflectionParameter(this ParameterInfo parameter)
+ {
+ Assumes.NotNull(parameter);
+ return new ReflectionParameter(parameter);
+ }
+
+ public static ReflectionMethod ToReflectionMethod(this MethodInfo method)
+ {
+ Assumes.NotNull(method);
+ return new ReflectionMethod(method);
+ }
+
+ public static ReflectionField ToReflectionField(this FieldInfo field)
+ {
+ Assumes.NotNull(field);
+ return new ReflectionField(field);
+ }
+
+ public static ReflectionType ToReflectionType(this Type type)
+ {
+ Assumes.NotNull(type);
+ return new ReflectionType(type);
+ }
+
+ public static ReflectionWritableMember ToReflectionWritableMember(this MemberInfo member)
+ {
+ Assumes.NotNull(member);
+ if (member.MemberType == MemberTypes.Property)
+ {
+ return ((PropertyInfo)member).ToReflectionProperty();
+ }
+
+ return ((FieldInfo)member).ToReflectionField();
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs
new file mode 100644
index 0000000..1cac368
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionField.cs
@@ -0,0 +1,67 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionField : ReflectionWritableMember
+ {
+ private readonly FieldInfo _field;
+
+ public ReflectionField(FieldInfo field)
+ {
+ Assumes.NotNull(field);
+
+ this._field = field;
+ }
+
+ public FieldInfo UndelyingField
+ {
+ get { return this._field; }
+ }
+
+ public override MemberInfo UnderlyingMember
+ {
+ get { return this.UndelyingField; }
+ }
+
+ public override bool CanRead
+ {
+ get { return true; }
+ }
+
+ public override bool CanWrite
+ {
+ get { return !this.UndelyingField.IsInitOnly; }
+ }
+
+ public override bool RequiresInstance
+ {
+ get { return !this.UndelyingField.IsStatic; }
+ }
+
+ public override Type ReturnType
+ {
+ get { return this.UndelyingField.FieldType; }
+ }
+
+ public override ReflectionItemType ItemType
+ {
+ get { return ReflectionItemType.Field; }
+ }
+
+ public override object GetValue(object instance)
+ {
+ return this.UndelyingField.SafeGetValue(instance);
+ }
+
+ public override void SetValue(object instance, object value)
+ {
+ this.UndelyingField.SafeSetValue(instance, value);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs
new file mode 100644
index 0000000..0ab5ca4
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionImportDefinition.cs
@@ -0,0 +1,52 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal abstract class ReflectionImportDefinition : ContractBasedImportDefinition, ICompositionElement
+ {
+ private readonly ICompositionElement _origin;
+
+ public ReflectionImportDefinition(
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ bool isRecomposable,
+ bool isPrerequisite,
+ CreationPolicy requiredCreationPolicy,
+ ICompositionElement origin)
+ : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, isPrerequisite, requiredCreationPolicy)
+ {
+ this._origin = origin;
+ }
+
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return this._origin; }
+ }
+
+ public override string ToString()
+ {
+ return this.GetDisplayName();
+ }
+
+ public abstract ImportingItem ToImportingItem();
+
+ protected abstract string GetDisplayName();
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs
new file mode 100644
index 0000000..3d649af
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItem.cs
@@ -0,0 +1,16 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal abstract class ReflectionItem
+ {
+ public abstract string Name { get; }
+ public abstract string GetDisplayName();
+ public abstract Type ReturnType { get; }
+ public abstract ReflectionItemType ItemType { get; }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs
new file mode 100644
index 0000000..2e7eaf4
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionItemType.cs
@@ -0,0 +1,16 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal enum ReflectionItemType : int
+ {
+ Parameter = 0,
+ Field = 1,
+ Property = 2,
+ Method = 3,
+ Type = 4,
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs
new file mode 100644
index 0000000..c34abc5
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMember.cs
@@ -0,0 +1,42 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal abstract class ReflectionMember : ReflectionItem
+ {
+ public abstract bool CanRead
+ {
+ get;
+ }
+
+ public Type DeclaringType
+ {
+ get { return this.UnderlyingMember.DeclaringType; }
+ }
+
+ public override string Name
+ {
+ get { return this.UnderlyingMember.Name; }
+ }
+
+ public override string GetDisplayName()
+ {
+ return this.UnderlyingMember.GetDisplayName();
+ }
+
+ public abstract bool RequiresInstance
+ {
+ get;
+ }
+
+ public abstract MemberInfo UnderlyingMember { get; }
+
+ public abstract object GetValue(object instance);
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs
new file mode 100644
index 0000000..5f94b86
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberExportDefinition.cs
@@ -0,0 +1,89 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Hosting;
+using System.ComponentModel.Composition.Primitives;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionMemberExportDefinition : ExportDefinition, ICompositionElement
+ {
+ private readonly LazyMemberInfo _member;
+ private readonly ExportDefinition _exportDefinition;
+ private readonly ICompositionElement _origin;
+ private IDictionary<string, object> _metadata;
+
+ public ReflectionMemberExportDefinition(LazyMemberInfo member, ExportDefinition exportDefinition, ICompositionElement origin)
+ {
+ Assumes.NotNull(exportDefinition);
+
+ this._member = member;
+ this._exportDefinition = exportDefinition;
+ this._origin = origin;
+ }
+
+ public override string ContractName
+ {
+ get { return this._exportDefinition.ContractName; }
+ }
+
+ public LazyMemberInfo ExportingLazyMember
+ {
+ get { return this._member; }
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ if (this._metadata == null)
+ {
+ var metadata = this._exportDefinition.Metadata ?? MetadataServices.EmptyMetadata;
+ this._metadata = metadata.AsReadOnly();
+ }
+ return this._metadata;
+ }
+ }
+
+ string ICompositionElement.DisplayName
+ {
+ get { return this.GetDisplayName(); }
+ }
+
+ ICompositionElement ICompositionElement.Origin
+ {
+ get { return this._origin; }
+ }
+
+ public override string ToString()
+ {
+ return this.GetDisplayName();
+ }
+
+ public ExportingMember ToExportingMember()
+ {
+ return new ExportingMember(this, this.ToReflectionMember());
+ }
+
+ private ReflectionMember ToReflectionMember()
+ {
+ return this.ExportingLazyMember.ToReflectionMember();
+ }
+
+ private string GetDisplayName()
+ {
+ return string.Format(CultureInfo.CurrentCulture,
+ "{0} (ContractName=\"{1}\")", // NOLOC
+ this.ToReflectionMember().GetDisplayName(),
+ this.ContractName);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs
new file mode 100644
index 0000000..6a0558f
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs
@@ -0,0 +1,56 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using Microsoft.Internal.Collections;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionMemberImportDefinition : ReflectionImportDefinition
+ {
+ private LazyMemberInfo _importingLazyMember;
+
+ public ReflectionMemberImportDefinition(
+ LazyMemberInfo importingLazyMember,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ bool isRecomposable,
+ CreationPolicy requiredCreationPolicy,
+ ICompositionElement origin)
+ : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, false, requiredCreationPolicy, origin)
+ {
+ Assumes.NotNull(contractName);
+
+ this._importingLazyMember = importingLazyMember;
+ }
+
+ public override ImportingItem ToImportingItem()
+ {
+ ReflectionWritableMember member = this.ImportingLazyMember.ToReflectionWriteableMember();
+ return new ImportingMember(this, member, new ImportType(member.ReturnType, this.Cardinality));
+ }
+
+ public LazyMemberInfo ImportingLazyMember
+ {
+ get { return this._importingLazyMember; }
+ }
+
+ protected override string GetDisplayName()
+ {
+ return string.Format(
+ CultureInfo.CurrentCulture,
+ "{0} (ContractName=\"{1}\")", // NOLOC
+ this.ImportingLazyMember.ToReflectionMember().GetDisplayName(),
+ this.ContractName);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs
new file mode 100644
index 0000000..a4893bc
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionMethod.cs
@@ -0,0 +1,70 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.Hosting;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+using System.ComponentModel.Composition.Primitives;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal partial class ReflectionMethod : ReflectionMember
+ {
+ private readonly MethodInfo _method;
+
+ public ReflectionMethod(MethodInfo method)
+ {
+ Assumes.NotNull(method);
+
+ this._method = method;
+ }
+
+ public MethodInfo UnderlyingMethod
+ {
+ get { return this._method; }
+ }
+
+ public override MemberInfo UnderlyingMember
+ {
+ get { return this.UnderlyingMethod; }
+ }
+
+ public override bool CanRead
+ {
+ get { return true; }
+ }
+
+ public override bool RequiresInstance
+ {
+ get { return !this.UnderlyingMethod.IsStatic; }
+ }
+
+ public override Type ReturnType
+ {
+ get { return this.UnderlyingMethod.ReturnType; }
+ }
+
+ public override ReflectionItemType ItemType
+ {
+ get { return ReflectionItemType.Method; }
+ }
+
+ public override object GetValue(object instance)
+ {
+ return SafeCreateExportedDelegate(instance, _method);
+ }
+#if !SILVERLIGHT
+ [System.Security.SecuritySafeCritical]
+#endif
+ private static ExportedDelegate SafeCreateExportedDelegate(object instance, MethodInfo method)
+ {
+ // We demand member access in place of the [SecurityCritical]
+ // attribute on ExportDelegate constructor
+ ReflectionInvoke.DemandMemberAccessIfNeeded(method);
+
+ return new ExportedDelegate(instance, method);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs
new file mode 100644
index 0000000..61657e8
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionModelServices.cs
@@ -0,0 +1,444 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
+using System.Linq;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+#if !SILVERLIGHT
+ [System.Security.SecurityCritical]
+#endif
+ public static class ReflectionModelServices
+ {
+ public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition)
+ {
+ Requires.NotNull(partDefinition, "partDefinition");
+
+ ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition;
+ if (reflectionPartDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()),
+ "partDefinition");
+ }
+
+ return reflectionPartDefinition.GetLazyPartType();
+ }
+
+ public static bool IsDisposalRequired(ComposablePartDefinition partDefinition)
+ {
+ Requires.NotNull(partDefinition, "partDefinition");
+
+ ReflectionComposablePartDefinition reflectionPartDefinition = partDefinition as ReflectionComposablePartDefinition;
+ if (reflectionPartDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidPartDefinition, partDefinition.GetType()),
+ "partDefinition");
+ }
+
+ return reflectionPartDefinition.IsDisposalRequired;
+ }
+
+ public static LazyMemberInfo GetExportingMember(ExportDefinition exportDefinition)
+ {
+ Requires.NotNull(exportDefinition, "exportDefinition");
+
+ ReflectionMemberExportDefinition reflectionExportDefinition = exportDefinition as ReflectionMemberExportDefinition;
+ if (reflectionExportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidExportDefinition, exportDefinition.GetType()),
+ "exportDefinition");
+ }
+
+ return reflectionExportDefinition.ExportingLazyMember;
+ }
+
+ public static LazyMemberInfo GetImportingMember(ImportDefinition importDefinition)
+ {
+ Requires.NotNull(importDefinition, "importDefinition");
+
+ ReflectionMemberImportDefinition reflectionMemberImportDefinition = importDefinition as ReflectionMemberImportDefinition;
+ if (reflectionMemberImportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidMemberImportDefinition, importDefinition.GetType()),
+ "importDefinition");
+ }
+
+ return reflectionMemberImportDefinition.ImportingLazyMember;
+ }
+
+ public static Lazy<ParameterInfo> GetImportingParameter(ImportDefinition importDefinition)
+ {
+ Requires.NotNull(importDefinition, "importDefinition");
+
+ ReflectionParameterImportDefinition reflectionParameterImportDefinition = importDefinition as ReflectionParameterImportDefinition;
+ if (reflectionParameterImportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidParameterImportDefinition, importDefinition.GetType()),
+ "importDefinition");
+ }
+
+ return reflectionParameterImportDefinition.ImportingLazyParameter;
+ }
+
+ public static bool IsImportingParameter(ImportDefinition importDefinition)
+ {
+ Requires.NotNull(importDefinition, "importDefinition");
+
+ ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
+ if (reflectionImportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
+ "importDefinition");
+ }
+
+ return (importDefinition is ReflectionParameterImportDefinition);
+ }
+
+ internal static bool IsExportFactoryImportDefinition(ImportDefinition importDefinition)
+ {
+ Requires.NotNull(importDefinition, "importDefinition");
+
+ ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
+ if (reflectionImportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
+ "importDefinition");
+ }
+
+ return (importDefinition is IPartCreatorImportDefinition);
+ }
+
+ internal static ContractBasedImportDefinition GetPartCreatorProductImportDefinition(ImportDefinition importDefinition)
+ {
+ Requires.NotNull(importDefinition, "importDefinition");
+
+ IPartCreatorImportDefinition partCreatorImportDefinition = importDefinition as IPartCreatorImportDefinition;
+ if (partCreatorImportDefinition == null)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
+ "importDefinition");
+ }
+
+ return partCreatorImportDefinition.ProductImportDefinition;
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public static ComposablePartDefinition CreatePartDefinition(
+ Lazy<Type> partType,
+ bool isDisposalRequired,
+ Lazy<IEnumerable<ImportDefinition>> imports,
+ Lazy<IEnumerable<ExportDefinition>> exports,
+ Lazy<IDictionary<string, object>> metadata,
+ ICompositionElement origin)
+ {
+ Requires.NotNull(partType, "partType");
+
+ return new ReflectionComposablePartDefinition(
+ new ReflectionPartCreationInfo(
+ partType,
+ isDisposalRequired,
+ imports,
+ exports,
+ metadata,
+ origin));
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public static ExportDefinition CreateExportDefinition(
+ LazyMemberInfo exportingMember,
+ string contractName,
+ Lazy<IDictionary<string, object>> metadata,
+ ICompositionElement origin)
+ {
+ Requires.NotNullOrEmpty(contractName, "contractName");
+ Requires.IsInMembertypeSet(exportingMember.MemberType, "exportingMember", MemberTypes.Field | MemberTypes.Property | MemberTypes.NestedType | MemberTypes.TypeInfo | MemberTypes.Method);
+
+ return new ReflectionMemberExportDefinition(
+ exportingMember,
+ new LazyExportDefinition(contractName, metadata),
+ origin);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public static ContractBasedImportDefinition CreateImportDefinition(
+ LazyMemberInfo importingMember,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ bool isRecomposable,
+ CreationPolicy requiredCreationPolicy,
+ ICompositionElement origin)
+ {
+ return CreateImportDefinition(importingMember, contractName, requiredTypeIdentity, requiredMetadata, cardinality, isRecomposable, requiredCreationPolicy, false, origin);
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ internal static ContractBasedImportDefinition CreateImportDefinition(
+ LazyMemberInfo importingMember,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ bool isRecomposable,
+ CreationPolicy requiredCreationPolicy,
+ bool isExportFactory,
+ ICompositionElement origin)
+ {
+ Requires.NotNullOrEmpty(contractName, "contractName");
+ Requires.IsInMembertypeSet(importingMember.MemberType, "importingMember", MemberTypes.Property | MemberTypes.Field);
+
+ if (isExportFactory)
+ {
+ return new PartCreatorMemberImportDefinition(
+ importingMember,
+ origin,
+ new ContractBasedImportDefinition(
+ contractName,
+ requiredTypeIdentity,
+ requiredMetadata,
+ cardinality,
+ isRecomposable,
+ false,
+ CreationPolicy.NonShared));
+ }
+ else
+ {
+ return new ReflectionMemberImportDefinition(
+ importingMember,
+ contractName,
+ requiredTypeIdentity,
+ requiredMetadata,
+ cardinality,
+ isRecomposable,
+ requiredCreationPolicy,
+ origin);
+ }
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ public static ContractBasedImportDefinition CreateImportDefinition(
+ Lazy<ParameterInfo> parameter,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ CreationPolicy requiredCreationPolicy,
+ ICompositionElement origin)
+ {
+ return CreateImportDefinition(parameter, contractName, requiredTypeIdentity, requiredMetadata, cardinality, requiredCreationPolicy, false, origin);
+ }
+
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
+ internal static ContractBasedImportDefinition CreateImportDefinition(
+ Lazy<ParameterInfo> parameter,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string, Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ CreationPolicy requiredCreationPolicy,
+ bool isExportFactory,
+ ICompositionElement origin)
+ {
+ Requires.NotNull(parameter, "parameter");
+ Requires.NotNullOrEmpty(contractName, "contractName");
+
+ if (isExportFactory)
+ {
+ return new PartCreatorParameterImportDefinition(
+ parameter,
+ origin,
+ new ContractBasedImportDefinition(
+ contractName,
+ requiredTypeIdentity,
+ requiredMetadata,
+ cardinality,
+ false,
+ true,
+ CreationPolicy.NonShared));
+ }
+ else
+ {
+ return new ReflectionParameterImportDefinition(
+ parameter,
+ contractName,
+ requiredTypeIdentity,
+ requiredMetadata,
+ cardinality,
+ requiredCreationPolicy,
+ origin);
+ }
+ }
+ }
+ internal class ReflectionPartCreationInfo : IReflectionPartCreationInfo
+ {
+ private readonly Lazy<Type> _partType;
+ private readonly Lazy<IEnumerable<ImportDefinition>> _imports;
+ private readonly Lazy<IEnumerable<ExportDefinition>> _exports;
+ private readonly Lazy<IDictionary<string, object>> _metadata;
+ private readonly ICompositionElement _origin;
+ private ConstructorInfo _constructor;
+ private bool _isDisposalRequired;
+
+ public ReflectionPartCreationInfo(
+ Lazy<Type> partType,
+ bool isDisposalRequired,
+ Lazy<IEnumerable<ImportDefinition>> imports,
+ Lazy<IEnumerable<ExportDefinition>> exports,
+ Lazy<IDictionary<string, object>> metadata,
+ ICompositionElement origin)
+ {
+ Assumes.NotNull(partType);
+
+ this._partType = partType;
+ this._isDisposalRequired = isDisposalRequired;
+ this._imports = imports;
+ this._exports = exports;
+ this._metadata = metadata;
+ this._origin = origin;
+ }
+
+ public Type GetPartType()
+ {
+ return this._partType.GetNotNullValue("type");
+ }
+
+ public Lazy<Type> GetLazyPartType()
+ {
+ return this._partType;
+ }
+
+ public ConstructorInfo GetConstructor()
+ {
+ if (this._constructor == null)
+ {
+ ConstructorInfo[] constructors = null;
+ constructors = this.GetImports()
+ .OfType<ReflectionParameterImportDefinition>()
+ .Select(parameterImport => parameterImport.ImportingLazyParameter.Value.Member)
+ .OfType<ConstructorInfo>()
+ .Distinct()
+ .ToArray();
+
+ if (constructors.Length == 1)
+ {
+ this._constructor = constructors[0];
+ }
+ else if (constructors.Length == 0)
+ {
+ this._constructor = this.GetPartType().GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);
+ }
+ }
+ return this._constructor;
+ }
+
+ public bool IsDisposalRequired
+ {
+ get
+ {
+ return this._isDisposalRequired;
+ }
+ }
+
+ public IDictionary<string, object> GetMetadata()
+ {
+ return (this._metadata != null) ? this._metadata.Value : null;
+ }
+
+ public IEnumerable<ExportDefinition> GetExports()
+ {
+ if (this._exports == null)
+ {
+ yield break;
+ }
+
+ IEnumerable<ExportDefinition> exports = this._exports.Value;
+
+ if (exports == null)
+ {
+ yield break;
+ }
+
+ foreach (ExportDefinition export in exports)
+ {
+ ReflectionMemberExportDefinition reflectionExport = export as ReflectionMemberExportDefinition;
+ if (reflectionExport == null)
+ {
+ throw new InvalidOperationException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidExportDefinition, export.GetType()));
+ }
+ yield return reflectionExport;
+ }
+ }
+
+ public IEnumerable<ImportDefinition> GetImports()
+ {
+ if (this._imports == null)
+ {
+ yield break;
+ }
+
+ IEnumerable<ImportDefinition> imports = this._imports.Value;
+
+ if (imports == null)
+ {
+ yield break;
+ }
+
+ foreach (ImportDefinition import in imports)
+ {
+ ReflectionImportDefinition reflectionImport = import as ReflectionImportDefinition;
+ if (reflectionImport == null)
+ {
+ throw new InvalidOperationException(
+ string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidMemberImportDefinition, import.GetType()));
+ }
+ yield return reflectionImport;
+ }
+ }
+
+ public string DisplayName
+ {
+ get { return this.GetPartType().GetDisplayName(); }
+ }
+
+ public ICompositionElement Origin
+ {
+ get { return this._origin; }
+ }
+ }
+
+ internal class LazyExportDefinition : ExportDefinition
+ {
+ private readonly Lazy<IDictionary<string, object>> _metadata;
+
+ public LazyExportDefinition(string contractName, Lazy<IDictionary<string, object>> metadata)
+ : base(contractName, (IDictionary<string, object>)null)
+ {
+ this._metadata = metadata;
+ }
+
+ public override IDictionary<string, object> Metadata
+ {
+ get
+ {
+ return this._metadata.Value;
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs
new file mode 100644
index 0000000..0d5fbf3
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameter.cs
@@ -0,0 +1,52 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionParameter : ReflectionItem
+ {
+ private readonly ParameterInfo _parameter;
+
+ public ReflectionParameter(ParameterInfo parameter)
+ {
+ Assumes.NotNull(parameter);
+
+ this._parameter = parameter;
+ }
+
+ public ParameterInfo UnderlyingParameter
+ {
+ get { return this._parameter; }
+ }
+
+ public override string Name
+ {
+ get { return this.UnderlyingParameter.Name; }
+ }
+
+ public override string GetDisplayName()
+ {
+ return string.Format(
+ CultureInfo.CurrentCulture,
+ "{0} (Parameter=\"{1}\")", // NOLOC
+ this.UnderlyingParameter.Member.GetDisplayName(),
+ this.UnderlyingParameter.Name);
+ }
+
+ public override Type ReturnType
+ {
+ get { return this.UnderlyingParameter.ParameterType; }
+ }
+
+ public override ReflectionItemType ItemType
+ {
+ get { return ReflectionItemType.Parameter; }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs
new file mode 100644
index 0000000..42eadff
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionParameterImportDefinition.cs
@@ -0,0 +1,55 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Globalization;
+using System.Reflection;
+using Microsoft.Internal;
+using System.ComponentModel.Composition.ReflectionModel;
+using System.Collections.Generic;
+using System.ComponentModel.Composition.Primitives;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionParameterImportDefinition : ReflectionImportDefinition
+ {
+ private Lazy<ParameterInfo> _importingLazyParameter;
+
+ public ReflectionParameterImportDefinition(
+ Lazy<ParameterInfo> importingLazyParameter,
+ string contractName,
+ string requiredTypeIdentity,
+ IEnumerable<KeyValuePair<string,Type>> requiredMetadata,
+ ImportCardinality cardinality,
+ CreationPolicy requiredCreationPolicy,
+ ICompositionElement origin)
+ : base(contractName, requiredTypeIdentity, requiredMetadata, cardinality, false, true, requiredCreationPolicy, origin)
+ {
+ Assumes.NotNull(importingLazyParameter);
+
+ this._importingLazyParameter = importingLazyParameter;
+ }
+
+ public override ImportingItem ToImportingItem()
+ {
+ return new ImportingParameter(this, new ImportType(this.ImportingLazyParameter.GetNotNullValue("parameter").ParameterType, this.Cardinality));
+ }
+
+ public Lazy<ParameterInfo> ImportingLazyParameter
+ {
+ get { return this._importingLazyParameter; }
+ }
+
+ protected override string GetDisplayName()
+ {
+ ParameterInfo parameter = this.ImportingLazyParameter.GetNotNullValue("parameter");
+ return string.Format(
+ CultureInfo.CurrentCulture,
+ "{0} (Parameter=\"{1}\", ContractName=\"{2}\")", // NOLOC
+ parameter.Member.GetDisplayName(),
+ parameter.Name,
+ this.ContractName);
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs
new file mode 100644
index 0000000..6daa34b
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionProperty.cs
@@ -0,0 +1,124 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ // Instead of representing properties as an actual PropertyInfo, we need to
+ // represent them as two MethodInfo objects one for each accessor. This is so
+ // that cached attribute part can go from a metadata token -> XXXInfo without
+ // needing to walk all members of a particular type. Unfortunately, (probably
+ // because you never see one of them in an IL stream), Reflection does not allow
+ // you to go from a metadata token -> PropertyInfo like it does with types,
+ // fields, and methods.
+
+ internal class ReflectionProperty : ReflectionWritableMember
+ {
+ private readonly MethodInfo _getMethod;
+ private readonly MethodInfo _setMethod;
+
+ public ReflectionProperty(MethodInfo getMethod, MethodInfo setMethod)
+ {
+ Assumes.IsTrue(getMethod != null || setMethod != null);
+
+ this._getMethod = getMethod;
+ this._setMethod = setMethod;
+ }
+
+ public override MemberInfo UnderlyingMember
+ {
+ get { return this.UnderlyingGetMethod ?? this.UnderlyingSetMethod; }
+ }
+
+ public override bool CanRead
+ {
+ get { return this.UnderlyingGetMethod != null; }
+ }
+
+ public override bool CanWrite
+ {
+ get { return this.UnderlyingSetMethod != null; }
+ }
+
+ public MethodInfo UnderlyingGetMethod
+ {
+ get { return this._getMethod; }
+ }
+
+ public MethodInfo UnderlyingSetMethod
+ {
+ get { return this._setMethod; }
+ }
+
+ public override string Name
+ {
+ get
+ {
+ MethodInfo method = this.UnderlyingGetMethod ?? this.UnderlyingSetMethod;
+
+ string name = method.Name;
+
+ Assumes.IsTrue(name.Length > 4);
+
+ // Remove 'get_' or 'set_'
+ return name.Substring(4);
+ }
+ }
+
+ public override string GetDisplayName()
+ {
+ return ReflectionServices.GetDisplayName(this.DeclaringType, this.Name);
+ }
+
+ public override bool RequiresInstance
+ {
+ get
+ {
+ MethodInfo method = this.UnderlyingGetMethod ?? this.UnderlyingSetMethod;
+
+ return !method.IsStatic;
+ }
+ }
+
+ public override Type ReturnType
+ {
+ get
+ {
+ if (this.UnderlyingGetMethod != null)
+ {
+ return this.UnderlyingGetMethod.ReturnType;
+ }
+
+ ParameterInfo[] parameters = this.UnderlyingSetMethod.GetParameters();
+
+ Assumes.IsTrue(parameters.Length > 0);
+
+ return parameters[parameters.Length - 1].ParameterType;
+ }
+ }
+
+ public override ReflectionItemType ItemType
+ {
+ get { return ReflectionItemType.Property; }
+ }
+
+ public override object GetValue(object instance)
+ {
+ Assumes.NotNull(this._getMethod);
+
+ return this.UnderlyingGetMethod.SafeInvoke(instance);
+ }
+
+ public override void SetValue(object instance, object value)
+ {
+ Assumes.NotNull(this._setMethod);
+
+ this.UnderlyingSetMethod.SafeInvoke(instance, value);
+ }
+
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs
new file mode 100644
index 0000000..047333a
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionType.cs
@@ -0,0 +1,58 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.ComponentModel.Composition.AttributedModel;
+using System.Reflection;
+using Microsoft.Internal;
+using System.Threading;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal class ReflectionType : ReflectionMember
+ {
+ private Type _type;
+
+ public ReflectionType(Type type)
+ {
+ Assumes.NotNull(type);
+
+ this._type = type;
+ }
+
+ public override MemberInfo UnderlyingMember
+ {
+ get { return this._type; }
+ }
+
+ public Type UnderlyingType
+ {
+ get { return this._type; }
+ }
+
+ public override bool CanRead
+ {
+ get { return true; }
+ }
+
+ public override bool RequiresInstance
+ {
+ get { return true; }
+ }
+
+ public override Type ReturnType
+ {
+ get { return this._type; }
+ }
+
+ public override ReflectionItemType ItemType
+ {
+ get { return ReflectionItemType.Type; }
+ }
+
+ public override object GetValue(object instance)
+ {
+ return instance;
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs
new file mode 100644
index 0000000..b8cf56d
--- /dev/null
+++ b/System.ComponentModel.Composition/System/ComponentModel/Composition/ReflectionModel/ReflectionWritableMember.cs
@@ -0,0 +1,19 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Reflection;
+using Microsoft.Internal;
+
+namespace System.ComponentModel.Composition.ReflectionModel
+{
+ internal abstract class ReflectionWritableMember : ReflectionMember
+ {
+ public abstract bool CanWrite
+ {
+ get;
+ }
+
+ public abstract void SetValue(object instance, object value);
+ }
+}
diff --git a/System.ComponentModel.Composition/System/Lazy.cs b/System.ComponentModel.Composition/System/Lazy.cs
new file mode 100644
index 0000000..369e7d1
--- /dev/null
+++ b/System.ComponentModel.Composition/System/Lazy.cs
@@ -0,0 +1,80 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !CLR40
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using Microsoft.Internal;
+
+namespace System
+{
+ public class Lazy<T>
+ {
+ private T _value = default(T);
+ private volatile bool _isValueCreated = false;
+ private Func<T> _valueFactory = null;
+ private object _lock;
+
+ public Lazy()
+ : this(() => Activator.CreateInstance<T>())
+ {
+ }
+
+ public Lazy(bool isThreadSafe)
+ : this(() => Activator.CreateInstance<T>(), isThreadSafe)
+ {
+ }
+
+ public Lazy(Func<T> valueFactory):
+ this(valueFactory, true)
+ {
+ }
+
+ public Lazy(Func<T> valueFactory, bool isThreadSafe)
+ {
+ Requires.NotNull(valueFactory, "valueFactory");
+ if(isThreadSafe)
+ {
+ this._lock = new object();
+ }
+
+ this._valueFactory = valueFactory;
+ }
+
+
+ public T Value
+ {
+ get
+ {
+ if (!this._isValueCreated)
+ {
+ if(this._lock != null)
+ {
+ Monitor.Enter(this._lock);
+ }
+
+ try
+ {
+ T value = this._valueFactory.Invoke();
+ this._valueFactory = null;
+ Thread.MemoryBarrier();
+ this._value = value;
+ this._isValueCreated = true;
+ }
+ finally
+ {
+ if(this._lock != null)
+ {
+ Monitor.Exit(this._lock);
+ }
+ }
+ }
+ return this._value;
+ }
+ }
+ }
+}
+#endif
diff --git a/System.ComponentModel.Composition/System/LazyOfTTMetadata.cs b/System.ComponentModel.Composition/System/LazyOfTTMetadata.cs
new file mode 100644
index 0000000..24221c6
--- /dev/null
+++ b/System.ComponentModel.Composition/System/LazyOfTTMetadata.cs
@@ -0,0 +1,51 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace System
+{
+#if CLR40 && !SILVERLIGHT
+ [Serializable]
+#endif
+ public class Lazy<T, TMetadata> : Lazy<T>
+ {
+ private TMetadata _metadata;
+
+ public Lazy(Func<T> valueFactory, TMetadata metadata) :
+ base(valueFactory)
+ {
+ this._metadata = metadata;
+ }
+
+ public Lazy(TMetadata metadata) :
+ base()
+ {
+ this._metadata = metadata;
+ }
+
+
+ public Lazy(TMetadata metadata, bool isThreadSafe) :
+ base(isThreadSafe)
+ {
+ this._metadata = metadata;
+ }
+
+ public Lazy(Func<T> valueFactory, TMetadata metadata, bool isThreadSafe) :
+ base(valueFactory, isThreadSafe)
+ {
+ this._metadata = metadata;
+ }
+
+ public TMetadata Metadata
+ {
+ get
+ {
+ return this._metadata;
+ }
+ }
+ }
+}
diff --git a/System.ComponentModel.Composition/System/Tuple.cs b/System.ComponentModel.Composition/System/Tuple.cs
new file mode 100644
index 0000000..1ce2dea
--- /dev/null
+++ b/System.ComponentModel.Composition/System/Tuple.cs
@@ -0,0 +1,52 @@
+// -----------------------------------------------------------------------
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// -----------------------------------------------------------------------
+#if !CLR40
+using System;
+
+namespace System
+{
+ // This is a very minimalistic implementation of Tuple'2 that allows us
+ // to compile and work on versions of .Net eariler then 4.0.
+ public struct Tuple<TItem1, TItem2>
+ {
+ public Tuple(TItem1 item1, TItem2 item2)
+ {
+ this = new Tuple<TItem1, TItem2>();
+ this.Item1 = item1;
+ this.Item2 = item2;
+ }
+
+ public TItem1 Item1 { get; private set; }
+ public TItem2 Item2 { get; private set; }
+
+ public override bool Equals(object obj)
+ {
+ if (obj is Tuple<TItem1, TItem2>)
+ {
+ Tuple<TItem1, TItem2> that = (Tuple<TItem1, TItem2>)obj;
+ return object.Equals(this.Item1, that.Item1) && object.Equals(this.Item2, that.Item2);
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public override int GetHashCode()
+ {
+ return ((this.Item1 != null) ? this.Item1.GetHashCode() : 0) ^ ((this.Item2 != null) ? this.Item2.GetHashCode() : 0);
+ }
+
+ public static bool operator ==(Tuple<TItem1, TItem2> left, Tuple<TItem1, TItem2> right)
+ {
+ return left.Equals(right);
+ }
+
+ public static bool operator !=(Tuple<TItem1, TItem2> left, Tuple<TItem1, TItem2> right)
+ {
+ return !left.Equals(right);
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/Wix/Bitmaps/bannrbmp.bmp b/Wix/Bitmaps/bannrbmp.bmp
new file mode 100644
index 0000000..1085be5
Binary files /dev/null and b/Wix/Bitmaps/bannrbmp.bmp differ
diff --git a/Wix/Bitmaps/dlgbmp.bmp b/Wix/Bitmaps/dlgbmp.bmp
new file mode 100644
index 0000000..782a944
Binary files /dev/null and b/Wix/Bitmaps/dlgbmp.bmp differ
diff --git a/Wix/PintaWix.sln b/Wix/PintaWix.sln
new file mode 100644
index 0000000..46000f9
--- /dev/null
+++ b/Wix/PintaWix.sln
@@ -0,0 +1,19 @@
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PintaWix", "PintaWix.wixproj", "{8AF6F472-BEF2-4092-BD0F-A3017B2F5304}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8AF6F472-BEF2-4092-BD0F-A3017B2F5304}.Debug|x86.ActiveCfg = Debug|x86
+ {8AF6F472-BEF2-4092-BD0F-A3017B2F5304}.Debug|x86.Build.0 = Debug|x86
+ {8AF6F472-BEF2-4092-BD0F-A3017B2F5304}.Release|x86.ActiveCfg = Release|x86
+ {8AF6F472-BEF2-4092-BD0F-A3017B2F5304}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Wix/PintaWix.wixproj b/Wix/PintaWix.wixproj
new file mode 100644
index 0000000..e5aeeff
--- /dev/null
+++ b/Wix/PintaWix.wixproj
@@ -0,0 +1,52 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>3.0</ProductVersion>
+ <ProjectGuid>{8af6f472-bef2-4092-bd0f-a3017b2f5304}</ProjectGuid>
+ <SchemaVersion>2.0</SchemaVersion>
+ <OutputName>Pinta</OutputName>
+ <OutputType>Package</OutputType>
+ <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
+ <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
+ <Name>PintaWix</Name>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <OutputPath>bin\$(Configuration)\</OutputPath>
+ <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
+ <DefineConstants>Debug</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <OutputPath>bin\$(Configuration)\</OutputPath>
+ <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
+ </PropertyGroup>
+ <ItemGroup>
+ <Compile Include="Product.wxs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Bitmaps" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Bitmaps\bannrbmp.bmp" />
+ <Content Include="Bitmaps\dlgbmp.bmp" />
+ <Content Include="Bitmaps\Pinta.ico" />
+ <Content Include="license.rtf" />
+ </ItemGroup>
+ <ItemGroup>
+ <WixExtension Include="WixUIExtension">
+ <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath>
+ </WixExtension>
+ <WixExtension Include="WixNetFxExtension">
+ <HintPath>$(WixExtDir)\WixNetFxExtension.dll</HintPath>
+ </WixExtension>
+ </ItemGroup>
+ <Import Project="$(WixTargetsPath)" />
+ <!--
+ To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Wix.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
diff --git a/Wix/Product.wxs b/Wix/Product.wxs
new file mode 100644
index 0000000..0da18e0
--- /dev/null
+++ b/Wix/Product.wxs
@@ -0,0 +1,437 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?define ProductShortName = "Pinta" ?>
+<?define ProductVersion = "0.6.0" ?>
+<?define ProductVersionText = "0.6" ?>
+<?define Manufacturer = "Pinta Community" ?>
+<?define UpgradeCode = "C0BCDEDA-62E7-4A43-8435-58323E096912" ?>
+
+<?define BuildRoot= "..\bin" ?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="*" Name="$(var.ProductShortName) $(var.ProductVersionText)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
+ <Package InstallerVersion="200" Compressed="yes" />
+ <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
+
+ <!-- Ensure GTK# 2.12.9+ is installed -->
+ <Property Id="GTKSHARPVERSION">
+ <RegistrySearch Id="gsversion" Root="HKLM" Key="SOFTWARE\Novell\GtkSharp\Version" Type="raw" />
+ </Property>
+ <Condition Message="Gtk# version 2.12.9 or greater must be installed.">
+ <![CDATA[GTKSHARPVERSION >= "2.12.9" OR (GTKSHARPVERSION << "2.12.1" AND GTKSHARPVERSION <> "2.12.1") OR REMOVE ~= "ALL"]]>
+ </Condition>
+
+ <!-- Ensure .Net 3.5 is installed -->
+ <PropertyRef Id="NETFRAMEWORK35" />
+ <Condition Message="This setup requires the .NET Framework 3.5 to be installed.">
+ Installed OR NETFRAMEWORK35
+ </Condition>
+
+ <!-- Get the GTK# install directory -->
+ <Property Id="GTKSHARPPATH">
+ <RegistrySearch Id="gspath" Root="HKLM" Key="SOFTWARE\Novell\GtkSharp\InstallFolder" Type="raw" />
+ </Property>
+
+ <!-- Major upgrade -->
+ <Upgrade Id="$(var.UpgradeCode)">
+ <UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
+ <UpgradeVersion Minimum="0.0.0" Maximum="$(var.ProductVersion)" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" />
+ </Upgrade>
+
+ <Directory Id="TARGETDIR" Name="SourceDir">
+ <Directory Id="ProgramFilesFolder">
+ <Directory Id="INSTALLLOCATION" Name="Pinta">
+ <Component Id="ProductComponent" Guid="7D5ABDF1-2CCE-4A74-8AFE-A06237D783AB">
+ <!-- Executable with Start Menu Icon -->
+ <File Name="Pinta.exe" Source="$(var.BuildRoot)\Pinta.exe">
+ <Shortcut Id="pinta_shortcut" Directory="ProgramMenuDir" Name="$(var.ProductShortName)" Icon="Pinta.exe" IconIndex="0" Advertise="yes" />
+ </File>
+
+ <!-- Additional Assemblies -->
+ <File Name="Pinta.Core.dll" Source="$(var.BuildRoot)\Pinta.Core.dll" />
+ <File Name="Pinta.Gui.Widgets.dll" Source="$(var.BuildRoot)\Pinta.Gui.Widgets.dll" />
+ <File Name="Pinta.Resources.dll" Source="$(var.BuildRoot)\Pinta.Resources.dll" />
+ <File Name="ICSharpCode.SharpZipLib.dll" Source="$(var.BuildRoot)\ICSharpCode.SharpZipLib.dll" />
+ <File Name="System.ComponentModel.Composition.dll" Source="$(var.BuildRoot)\System.ComponentModel.Composition.dll" />
+
+ <!-- Debug Symbols -->
+ <File Name="Pinta.pdb" Source="$(var.BuildRoot)\Pinta.pdb" />
+ <File Name="Pinta.Core.pdb" Source="$(var.BuildRoot)\Pinta.Core.pdb" />
+ <File Name="Pinta.Gui.Widgets.pdb" Source="$(var.BuildRoot)\Pinta.Gui.Widgets.pdb" />
+ <File Name="Pinta.Resources.pdb" Source="$(var.BuildRoot)\Pinta.Resources.pdb" />
+ <File Name="System.ComponentModel.Composition.pdb" Source="$(var.BuildRoot)\System.ComponentModel.Composition.pdb" />
+
+ <!-- Program Menu Shortcut -->
+ <RemoveFolder Id='ProgramMenuDir' Directory="ProgramMenuDir" On='uninstall' />
+ </Component>
+
+ <!-- Extensions-->
+ <Directory Id="Extensions" Name="Extensions">
+ <Component Id="ExtensionsComp" Guid="A6C05439-FCFF-4155-8A99-65AE373B77A0">
+ <File Name="Pinta.Tools.dll" Source="$(var.BuildRoot)\Extensions\Pinta.Tools.dll" />
+ <File Name="Pinta.Effects.dll" Source="$(var.BuildRoot)\Extensions\Pinta.Effects.dll" />
+ <File Name="Pinta.Tools.pdb" Source="$(var.BuildRoot)\Extensions\Pinta.Tools.pdb" />
+ <File Name="Pinta.Effects.pdb" Source="$(var.BuildRoot)\Extensions\Pinta.Effects.pdb" />
+ </Component>
+ </Directory>
+
+ <!--
+ <Directory Id="locale" Name="locale">
+ <Directory Id="ar" Name="ar">
+ <Directory Id="LC_MESSAGES_AR" Name='LC_MESSAGES'>
+ <Component Id="ArTranslation" Guid="42CCCE42-11DD-4C9E-AFE7-4037F32F971D">
+ <File Id="pinta_ar" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ar\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="br" Name="br">
+ <Directory Id="LC_MESSAGES_BR" Name='LC_MESSAGES'>
+ <Component Id="BrTranslation" Guid="196B021E-309C-4A2E-94DA-AA17512A709B">
+ <File Id="pinta_br" Name="pinta.mo" Source="$(var.BuildRoot)\locale\br\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ca" Name='ca'>
+ <Directory Id="LC_MESSAGES_CA" Name='LC_MESSAGES'>
+ <Component Id="CaTranslation" Guid="0FF46F28-0348-48D9-9321-168077CAF1AE">
+ <File Id="pinta_ca" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ca\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="cs" Name='cs'>
+ <Directory Id="LC_MESSAGES_CS" Name='LC_MESSAGES'>
+ <Component Id="CsTranslation" Guid="E34F5B21-175F-4403-8FA7-A4A626F0A6D4">
+ <File Id="pinta_cs" Name="pinta.mo" Source="$(var.BuildRoot)\locale\cs\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="da" Name='da'>
+ <Directory Id="LC_MESSAGES_DA" Name='LC_MESSAGES'>
+ <Component Id="DaTranslation" Guid="3891256E-7A0C-4A26-872A-C7EBA14A87D8">
+ <File Id="pinta_da" Name="pinta.mo" Source="$(var.BuildRoot)\locale\da\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="de" Name='de'>
+ <Directory Id="LC_MESSAGES_DE" Name='LC_MESSAGES'>
+ <Component Id="DeTranslation" Guid="F98414D7-8AE0-461B-B9EB-219DCE5284C4">
+ <File Id="pinta_de" Name="pinta.mo" Source="$(var.BuildRoot)\locale\de\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="el" Name='el'>
+ <Directory Id="LC_MESSAGES_EL" Name='LC_MESSAGES'>
+ <Component Id="ElTranslation" Guid="E87E32A6-3546-41D8-8E91-2CFB12810254">
+ <File Id="pinta_el" Name="pinta.mo" Source="$(var.BuildRoot)\locale\el\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="en_gb" Name='en_GB'>
+ <Directory Id="LC_MESSAGES_EN_GB" Name='LC_MESSAGES'>
+ <Component Id="EnGbTranslation" Guid="32265FEE-4D87-42CF-9848-CE449F9944CF">
+ <File Id="pinta_en_gb" Name="pinta.mo" Source="$(var.BuildRoot)\locale\en_GB\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="es" Name='es'>
+ <Directory Id="LC_MESSAGES_ES" Name='LC_MESSAGES'>
+ <Component Id="EsTranslation" Guid="E5C85E52-046F-41EF-8DFF-576FE9DCF8A9">
+ <File Id="pinta_es" Name="pinta.mo" Source="$(var.BuildRoot)\locale\es\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="eu" Name='eu'>
+ <Directory Id="LC_MESSAGES_EU" Name='LC_MESSAGES'>
+ <Component Id="EuTranslation" Guid="65080F25-35D3-4D29-BE78-A204E6B669C6">
+ <File Id="pinta_eu" Name="pinta.mo" Source="$(var.BuildRoot)\locale\eu\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="fi" Name='fi'>
+ <Directory Id="LC_MESSAGES_FI" Name='LC_MESSAGES'>
+ <Component Id="FiTranslation" Guid="FD5A27FF-FE70-4CC4-9401-183E6EEAE79B">
+ <File Id="pinta_fi" Name="pinta.mo" Source="$(var.BuildRoot)\locale\fi\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="fo" Name='fo'>
+ <Directory Id="LC_MESSAGES_FO" Name='LC_MESSAGES'>
+ <Component Id="FoTranslation" Guid="E52FE762-D62C-4B20-BB9B-F29666A9FFD4">
+ <File Id="pinta_fo" Name="pinta.mo" Source="$(var.BuildRoot)\locale\fo\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="fr" Name='fr'>
+ <Directory Id="LC_MESSAGES_FR" Name='LC_MESSAGES'>
+ <Component Id="FrTranslation" Guid="7108526E-386E-4B4F-88DD-27A55DF5C322">
+ <File Id="pinta_fr" Name="pinta.mo" Source="$(var.BuildRoot)\locale\fr\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ga" Name='ga'>
+ <Directory Id="LC_MESSAGES_GA" Name='LC_MESSAGES'>
+ <Component Id="GaTranslation" Guid="404F60EE-DD26-4F01-A613-84477D9B06A7">
+ <File Id="pinta_ga" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ga\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="gl" Name='gl'>
+ <Directory Id="LC_MESSAGES_GL" Name='LC_MESSAGES'>
+ <Component Id="GlTranslation" Guid="7BB516E8-10B7-4D74-9E0F-831CFDE496EA">
+ <File Id="pinta_gl" Name="pinta.mo" Source="$(var.BuildRoot)\locale\gl\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="he" Name='he'>
+ <Directory Id="LC_MESSAGES_HE" Name='LC_MESSAGES'>
+ <Component Id="HeTranslation" Guid="9C765381-4B63-499F-82A5-208C0E6799D3">
+ <File Id="pinta_he" Name="pinta.mo" Source="$(var.BuildRoot)\locale\he\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="hr" Name='hr'>
+ <Directory Id="LC_MESSAGES_HR" Name='LC_MESSAGES'>
+ <Component Id="HrTranslation" Guid="BF9F0237-C18E-4FED-B108-03066087B0D5">
+ <File Id="pinta_hr" Name="pinta.mo" Source="$(var.BuildRoot)\locale\hr\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="hy" Name='hy'>
+ <Directory Id="LC_MESSAGES_HY" Name='LC_MESSAGES'>
+ <Component Id="HyTranslation" Guid="D88AA8FE-A4E0-4156-B96F-B122A9042702">
+ <File Id="pinta_hy" Name="pinta.mo" Source="$(var.BuildRoot)\locale\hy\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="id" Name='id'>
+ <Directory Id="LC_MESSAGES_ID" Name='LC_MESSAGES'>
+ <Component Id="IdTranslation" Guid="79B75681-4F09-4F3E-9FD7-055706B686DF">
+ <File Id="pinta_id" Name="pinta.mo" Source="$(var.BuildRoot)\locale\id\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="it" Name='it'>
+ <Directory Id="LC_MESSAGES_IT" Name='LC_MESSAGES'>
+ <Component Id="ItTranslation" Guid="B0C5EB19-C586-4980-941D-8DDC510A3FBA">
+ <File Id="pinta_it" Name="pinta.mo" Source="$(var.BuildRoot)\locale\it\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ja" Name='ja'>
+ <Directory Id="LC_MESSAGES_JA" Name='LC_MESSAGES'>
+ <Component Id="JaTranslation" Guid="67C2D595-1B88-477A-8FC2-9192EEC63690">
+ <File Id="pinta_ja" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ja\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ko" Name='ko'>
+ <Directory Id="LC_MESSAGES_KO" Name='LC_MESSAGES'>
+ <Component Id="KoTranslation" Guid="A9F2C3D8-9F48-4F1F-A262-94CAA8A7D982">
+ <File Id="pinta_ko" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ko\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="lt" Name='lt'>
+ <Directory Id="LC_MESSAGES_LT" Name='LC_MESSAGES'>
+ <Component Id="LtTranslation" Guid="DC609476-C501-421D-8958-06DF5E420142">
+ <File Id="pinta_lt" Name="pinta.mo" Source="$(var.BuildRoot)\locale\lt\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="nb" Name='nb'>
+ <Directory Id="LC_MESSAGES_NB" Name='LC_MESSAGES'>
+ <Component Id="NbTranslation" Guid="38C6EEB1-88CB-4ECA-BBDF-7F07C9114091">
+ <File Id="pinta_nb" Name="pinta.mo" Source="$(var.BuildRoot)\locale\nb\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="nl" Name='nl'>
+ <Directory Id="LC_MESSAGES_NL" Name='LC_MESSAGES'>
+ <Component Id="NlTranslation" Guid="F8FFA0A4-40A7-4A0E-8E75-ACBCAE53CE56">
+ <File Id="pinta_nl" Name="pinta.mo" Source="$(var.BuildRoot)\locale\nl\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="pl" Name='pl'>
+ <Directory Id="LC_MESSAGES_PL" Name='LC_MESSAGES'>
+ <Component Id="PlTranslation" Guid="5BEABE4B-B297-40F3-B211-EC43933BE52B">
+ <File Id="pinta_pl" Name="pinta.mo" Source="$(var.BuildRoot)\locale\pl\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="pt" Name='pt'>
+ <Directory Id="LC_MESSAGES_PT" Name='LC_MESSAGES'>
+ <Component Id="PtTranslation" Guid="4F2EAD1F-A276-47B2-B591-90BE77A9B87F">
+ <File Id="pinta_pt" Name="pinta.mo" Source="$(var.BuildRoot)\locale\pt\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="pt_BR" Name='pt_BR'>
+ <Directory Id="LC_MESSAGES_PT_BR" Name='LC_MESSAGES'>
+ <Component Id="PtBrTranslation" Guid="FD8FF383-5B2F-4302-951A-4B2E8923397B">
+ <File Id="pinta_ptbr" Name="pinta.mo" Source="$(var.BuildRoot)\locale\pt_BR\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ro" Name='ro'>
+ <Directory Id="LC_MESSAGES_RO" Name='LC_MESSAGES'>
+ <Component Id="RoTranslation" Guid="CA26C662-114D-48B9-889A-AE2710097BE2">
+ <File Id="pinta_ro" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ro\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="ru" Name='ru'>
+ <Directory Id="LC_MESSAGES_RU" Name='LC_MESSAGES'>
+ <Component Id="RuTranslation" Guid="BF208BE8-3987-4132-875C-EE097416D675">
+ <File Id="pinta_ru" Name="pinta.mo" Source="$(var.BuildRoot)\locale\ru\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="sk" Name='sk'>
+ <Directory Id="LC_MESSAGES_SK" Name='LC_MESSAGES'>
+ <Component Id="SkTranslation" Guid="8BCC12E8-8055-48F2-9DC9-5B8736C35482">
+ <File Id="pinta_sk" Name="pinta.mo" Source="$(var.BuildRoot)\locale\sk\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="sl" Name='sl'>
+ <Directory Id="LC_MESSAGES_SL" Name='LC_MESSAGES'>
+ <Component Id="SlTranslation" Guid="BFBAF55C-705A-470C-A99F-66D303E08D20">
+ <File Id="pinta_sl" Name="pinta.mo" Source="$(var.BuildRoot)\locale\sl\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="sr" Name='sr'>
+ <Directory Id="LC_MESSAGES_SR" Name='LC_MESSAGES'>
+ <Component Id="SrTranslation" Guid="9BBFC675-625D-4E39-B667-3BAAE01F1459">
+ <File Id="pinta_sr" Name="pinta.mo" Source="$(var.BuildRoot)\locale\sr\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="sv" Name='sv'>
+ <Directory Id="LC_MESSAGES_SV" Name='LC_MESSAGES'>
+ <Component Id="SvTranslation" Guid="1ADE1336-FED4-4011-A69F-6419CC77164A">
+ <File Id="pinta_sv" Name="pinta.mo" Source="$(var.BuildRoot)\locale\sv\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="th" Name='th'>
+ <Directory Id="LC_MESSAGES_TH" Name='LC_MESSAGES'>
+ <Component Id="ThTranslation" Guid="89E5EC81-7464-435E-A550-FC73473F7FAB">
+ <File Id="pinta_th" Name="pinta.mo" Source="$(var.BuildRoot)\locale\th\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="tr" Name='tr'>
+ <Directory Id="LC_MESSAGES_TR" Name='LC_MESSAGES'>
+ <Component Id="TrTranslation" Guid="A62ECF9D-7086-4F7B-B2B2-279D0BF90341">
+ <File Id="pinta_tr" Name="pinta.mo" Source="$(var.BuildRoot)\locale\tr\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="uk" Name='uk'>
+ <Directory Id="LC_MESSAGES_UK" Name='LC_MESSAGES'>
+ <Component Id="UkTranslation" Guid="6058E93D-C04E-460A-86CD-D25544660BB3">
+ <File Id="pinta_uk" Name="pinta.mo" Source="$(var.BuildRoot)\locale\uk\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="vi" Name='vi'>
+ <Directory Id="LC_MESSAGES_VI" Name='LC_MESSAGES'>
+ <Component Id="ViTranslation" Guid="9E9E81C1-2D97-4504-BD8B-060F38FA7C07">
+ <File Id="pinta_vi" Name="pinta.mo" Source="$(var.BuildRoot)\locale\vi\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="zh_CN" Name='zh_CN'>
+ <Directory Id="LC_MESSAGES_ZhCn" Name='LC_MESSAGES'>
+ <Component Id="ZhCnTranslation" Guid="C96196DA-C971-4C59-B924-A0354AC71C6A">
+ <File Id="pinta_zhcn" Name="pinta.mo" Source="$(var.BuildRoot)\locale\zh_CN\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ <Directory Id="zh_TW" Name='zh_TW'>
+ <Directory Id="LC_MESSAGES_ZhTw" Name='LC_MESSAGES'>
+ <Component Id="ZhTwTranslation" Guid="827B9D1D-B2AE-4B46-9DD2-E42713B21FD4">
+ <File Id="pinta_zhtw" Name="pinta.mo" Source="$(var.BuildRoot)\locale\zh_TW\LC_MESSAGES\pinta.mo" />
+ </Component>
+ </Directory>
+ </Directory>
+ </Directory>-->
+ </Directory>
+
+ </Directory>
+
+ <Directory Id="ProgramMenuFolder" Name="PMenu">
+ <Directory Id="ProgramMenuDir" Name='$(var.ProductShortName)' />
+ </Directory>
+ </Directory>
+
+ <Feature Id="ProductFeature" Title="Pint" Level="1">
+ <ComponentRef Id="ProductComponent" />
+ <ComponentRef Id="ExtensionsComp" />
+ <!--<ComponentRef Id="ArTranslation" />
+ <ComponentRef Id="BrTranslation" />
+ <ComponentRef Id="CaTranslation" />
+ <ComponentRef Id="CsTranslation" />
+ <ComponentRef Id="DaTranslation" />
+ <ComponentRef Id="DeTranslation" />
+ <ComponentRef Id="ElTranslation" />
+ <ComponentRef Id="EnGbTranslation" />
+ <ComponentRef Id="EsTranslation" />
+ <ComponentRef Id="EuTranslation" />
+ <ComponentRef Id="FiTranslation" />
+ <ComponentRef Id="FoTranslation" />
+ <ComponentRef Id="FrTranslation" />
+ <ComponentRef Id="GaTranslation" />
+ <ComponentRef Id="GlTranslation" />
+ <ComponentRef Id="HeTranslation" />
+ <ComponentRef Id="HrTranslation" />
+ <ComponentRef Id="HyTranslation" />
+ <ComponentRef Id="IdTranslation" />
+ <ComponentRef Id="ItTranslation" />
+ <ComponentRef Id="JaTranslation" />
+ <ComponentRef Id="KoTranslation" />
+ <ComponentRef Id="LtTranslation" />
+ <ComponentRef Id="NbTranslation" />
+ <ComponentRef Id="NlTranslation" />
+ <ComponentRef Id="PlTranslation" />
+ <ComponentRef Id="PtTranslation" />
+ <ComponentRef Id="PtBrTranslation" />
+ <ComponentRef Id="RoTranslation" />
+ <ComponentRef Id="RuTranslation" />
+ <ComponentRef Id="SkTranslation" />
+ <ComponentRef Id="SlTranslation" />
+ <ComponentRef Id="SrTranslation" />
+ <ComponentRef Id="SvTranslation" />
+ <ComponentRef Id="ThTranslation" />
+ <ComponentRef Id="TrTranslation" />
+ <ComponentRef Id="UkTranslation" />
+ <ComponentRef Id="ViTranslation" />
+ <ComponentRef Id="ZhCnTranslation" />
+ <ComponentRef Id="ZhTwTranslation" />-->
+ </Feature>
+
+ <!-- Sequences -->
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallValidate" />
+ </InstallExecuteSequence>
+
+ <InstallUISequence>
+ <!-- Because we have a launch condition that uses the results of FindRelatedProducts, put it first. -->
+ <LaunchConditions After="FindRelatedProducts" />
+ </InstallUISequence>
+
+ <!-- This enables the license screen and where to install screen -->
+ <Property Id="WIXUI_INSTALLDIR">INSTALLLOCATION</Property>
+ <UIRef Id="WixUI_InstallDir"/>
+
+ <!-- Specify the license to display and graphics to use in our GUI -->
+ <WixVariable Id="WixUILicenseRtf" Value="license.rtf" />
+ <WixVariable Id="WixUIBannerBmp" Value="Bitmaps\bannrbmp.bmp" />
+ <WixVariable Id="WixUIDialogBmp" Value="Bitmaps\dlgbmp.bmp" />
+
+ <!-- This is for the icon that is shown in the Add/Remove Programs dialog and menu shortcut -->
+ <Icon Id="Pinta.exe" SourceFile="Bitmaps\Pinta.ico" />
+ <Property Id="ARPPRODUCTICON" Value="Pinta.exe" />
+ </Product>
+</Wix>
diff --git a/Wix/license.rtf b/Wix/license.rtf
new file mode 100644
index 0000000..c7a6120
Binary files /dev/null and b/Wix/license.rtf differ
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644
index ddc677f..0000000
--- a/aclocal.m4
+++ /dev/null
@@ -1,774 +0,0 @@
-# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-m4_ifndef([AC_AUTOCONF_VERSION],
- [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
-[m4_warning([this file was generated for autoconf 2.65.
-You have another version of autoconf. It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
-# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
-#
-# Copyright © 2004 Scott James Remnant <scott at netsplit.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# PKG_PROG_PKG_CONFIG([MIN-VERSION])
-# ----------------------------------
-AC_DEFUN([PKG_PROG_PKG_CONFIG],
-[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
-m4_pattern_allow([^PKG_CONFIG(_PATH)?$])
-AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=m4_default([$1], [0.9.0])
- AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version])
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- PKG_CONFIG=""
- fi
-
-fi[]dnl
-])# PKG_PROG_PKG_CONFIG
-
-# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# Check to see whether a particular set of modules exists. Similar
-# to PKG_CHECK_MODULES(), but does not set variables or print errors.
-#
-#
-# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-# this or PKG_CHECK_MODULES is called, or make sure to call
-# PKG_CHECK_EXISTS manually
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_EXISTS],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-if test -n "$PKG_CONFIG" && \
- AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
- m4_ifval([$2], [$2], [:])
-m4_ifvaln([$3], [else
- $3])dnl
-fi])
-
-
-# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
-# ---------------------------------------------
-m4_define([_PKG_CONFIG],
-[if test -n "$$1"; then
- pkg_cv_[]$1="$$1"
- elif test -n "$PKG_CONFIG"; then
- PKG_CHECK_EXISTS([$3],
- [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`],
- [pkg_failed=yes])
- else
- pkg_failed=untried
-fi[]dnl
-])# _PKG_CONFIG
-
-# _PKG_SHORT_ERRORS_SUPPORTED
-# -----------------------------
-AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi[]dnl
-])# _PKG_SHORT_ERRORS_SUPPORTED
-
-
-# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
-# [ACTION-IF-NOT-FOUND])
-#
-#
-# Note that if there is a possibility the first call to
-# PKG_CHECK_MODULES might not happen, you should be sure to include an
-# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
-#
-#
-# --------------------------------------------------------------
-AC_DEFUN([PKG_CHECK_MODULES],
-[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
-AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
-AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
-
-pkg_failed=no
-AC_MSG_CHECKING([for $1])
-
-_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
-_PKG_CONFIG([$1][_LIBS], [libs], [$2])
-
-m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
-and $1[]_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.])
-
-if test $pkg_failed = yes; then
- _PKG_SHORT_ERRORS_SUPPORTED
- if test $_pkg_short_errors_supported = yes; then
- $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
- else
- $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
-
- ifelse([$4], , [AC_MSG_ERROR(dnl
-[Package requirements ($2) were not met:
-
-$$1_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-_PKG_TEXT
-])],
- [AC_MSG_RESULT([no])
- $4])
-elif test $pkg_failed = untried; then
- ifelse([$4], , [AC_MSG_FAILURE(dnl
-[The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-_PKG_TEXT
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
- [$4])
-else
- $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
- $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
- AC_MSG_RESULT([yes])
- ifelse([$3], , :, [$3])
-fi[]dnl
-])# PKG_CHECK_MODULES
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-# (This private macro should not be called outside this file.)
-AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
-dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
-dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.1], [],
- [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too. Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.1])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
- [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
-
-# AM_AUX_DIR_EXPAND -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory. The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run. This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-# fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-# fails if $ac_aux_dir is absolute,
-# fails when called from a subdirectory in a VPATH build with
-# a relative $ac_aux_dir
-#
-# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
-# are both prefixed by $srcdir. In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
-# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-# MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH. The drawback is that using absolute paths prevent a
-# configured tree to be moved without reconfiguration.
-
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-])
-
-# Do all the work for Automake. -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 16
-
-# This macro actually does too much. Some checks are only needed if
-# your package does certain things. But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out. PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition. After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
-dnl Autoconf wants to disallow AM_ names. We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
- # is not polluted with repeated "-I."
- AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
- # test to see if srcdir already configured
- if test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
- fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
- if (cygpath --version) >/dev/null 2>/dev/null; then
- CYGPATH_W='cygpath -w'
- else
- CYGPATH_W=echo
- fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
-dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
- [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
-])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
- [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
-])
-
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated. The stamp files are numbered to have different names.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_arg=$1
-_am_stamp_count=1
-for _am_header in $config_headers :; do
- case $_am_header in
- $_am_arg | $_am_arg:* )
- break ;;
- * )
- _am_stamp_count=`expr $_am_stamp_count + 1` ;;
- esac
-done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
- *)
- install_sh="\${SHELL} $am_aux_dir/install-sh"
- esac
-fi
-AC_SUBST(install_sh)])
-
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot. For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
- am__leading_dot=.
-else
- am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
-# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 6
-
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
-
-
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([missing])dnl
-if test x"${MISSING+set}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
- *)
- MISSING="\${SHELL} $am_aux_dir/missing" ;;
- esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
-else
- am_missing_run=
- AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
- [[\\/$]]* | ?:[[\\/]]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
-
-# Helper functions for option handling. -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# ------------------------------
-# Set option NAME. Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_RUN_LOG(COMMAND)
-# -------------------
-# Run COMMAND, save the exit status in ac_status, and log it.
-# (This has been adapted from Autoconf's _AC_RUN_LOG macro.)
-AC_DEFUN([AM_RUN_LOG],
-[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD
- ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
- (exit $ac_status); }])
-
-# Check to make sure that the build environment is sane. -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 5
-
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name. Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
- *[[\\\"\#\$\&\'\`$am_lf]]*)
- AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
- *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
- AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
-esac
-
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$[*]" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$[*]" != "X $srcdir/configure conftest.file" \
- && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
-
- test "$[2]" = conftest.file
- )
-then
- # Ok.
- :
-else
- AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries. This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
- AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
-
-# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# _AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball. -*- Autoconf -*-
-
-# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-# tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-# $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
- [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
- [m4_case([$1], [ustar],, [pax],,
- [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- AM_RUN_LOG([$_am_tar --version]) && break
- done
- am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x $1 -w "$$tardir"'
- am__tar_='pax -L -x $1 -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
- am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
- am__untar='cpio -i -H $1 -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
-
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_$1}" && break
-
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
- rm -rf conftest.dir
- if test -s conftest.tar; then
- AM_RUN_LOG([$am__untar <conftest.tar])
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
diff --git a/autogen.sh b/autogen.sh
new file mode 100755
index 0000000..c90d3a8
--- /dev/null
+++ b/autogen.sh
@@ -0,0 +1,141 @@
+#! /bin/sh
+
+# Compares software version numbers
+# 10 means EQUAL
+# 11 means GREATER THAN
+# 9 means LESS THAN
+check_version() {
+ test -z "$1" && return 1
+ local ver1=$1
+ while test `echo $ver1 | egrep -c [^0123456789.]` -gt 0 ; do
+ char=`echo $ver1 | sed 's/.*\([^0123456789.]\).*/\1/'`
+ char_dec=`echo -n "$char" | od -b | head -1 | awk {'print $2'}`
+ ver1=`echo $ver1 | sed "s/$char/.$char_dec/g"`
+ done
+ test -z "$2" && return 1
+ local ver2=$2
+ while test `echo $ver2 | egrep -c [^0123456789.]` -gt 0 ; do
+ char=`echo $ver2 | sed 's/.*\([^0123456789.]\).*/\1/'`
+ char_dec=`echo -n "$char" | od -b | head -1 | awk {'print $2'}`
+ ver2=`echo $ver2 | sed "s/$char/.$char_dec/g"`
+ done
+
+ ver1=`echo $ver1 | sed 's/\.\./.0/g'`
+ ver2=`echo $ver2 | sed 's/\.\./.0/g'`
+
+ do_version_check "$ver1" "$ver2"
+}
+
+do_version_check() {
+
+ test "$1" -eq "$2" && return 10
+
+ ver1front=`echo $1 | cut -d "." -f -1`
+ ver1back=`echo $1 | cut -d "." -f 2-`
+ ver2front=`echo $2 | cut -d "." -f -1`
+ ver2back=`echo $2 | cut -d "." -f 2-`
+
+ if test "$ver1front" != "$1" || test "$ver2front" != "$2" ; then
+ test "$ver1front" -gt "$ver2front" && return 11
+ test "$ver1front" -lt "$ver2front" && return 9
+
+ test "$ver1front" -eq "$1" || test -z "$ver1back" && ver1back=0
+ test "$ver2front" -eq "$2" || test -z "$ver2back" && ver2back=0
+ do_version_check "$ver1back" "$ver2back"
+ return $?
+ else
+ test "$1" -gt "$2" && return 11 || return 9
+ fi
+}
+
+PROJECT=Pinta
+FILE=
+CONFIGURE=configure.ac
+
+: ${AUTOCONF=autoconf}
+: ${AUTOHEADER=autoheader}
+: ${AUTOMAKE=automake}
+: ${ACLOCAL=aclocal}
+: ${MONO=mono}
+: ${XBUILD=xbuild}
+
+DIE=0
+
+($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have autoconf installed to compile $PROJECT."
+ echo "Download the appropriate package for your distribution,"
+ echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
+ DIE=1
+}
+
+($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have automake installed to compile $PROJECT."
+ echo "Get ftp://sourceware.cygnus.com/pub/automake/automake-1.4.tar.gz"
+ echo "(or a newer version if it is available)"
+ DIE=1
+}
+
+($MONO --version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have mono runtime installed to compile $PROJECT."
+ DIE=1
+}
+
+($XBUILD /version) < /dev/null > /dev/null 2>&1 || {
+ echo
+ echo "You must have mono-xbuild installed to compile $PROJECT."
+ DIE=1
+}
+
+if test "$DIE" -eq 1; then
+ exit 1
+fi
+
+xbuild_version=`xbuild /version | grep '^XBuild' | egrep -o '([0-9]+\.?){2,}'`
+check_version "$xbuild_version" "2.4" 2> /dev/null
+if test $? -eq 9; then
+ echo
+ echo "A newer version of XBuild is required to build $PROJECT ( >= 2.4 )"
+ exit 1
+fi
+
+mono_version=`xbuild /version | grep '^Mono' | egrep -o '([0-9]+\.?){2,}'`
+check_version "$xbuild_version" "2.4" 2> /dev/null
+if test $? -eq 9; then
+ echo
+ echo "A newer version of Mono is required to run $PROJECT ( >= 2.4 )"
+ exit 1
+fi
+
+#Check directoy
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+ORIGDIR=`pwd`
+cd $srcdir
+TEST_TYPE=-f
+aclocalinclude="-I . $ACLOCAL_FLAGS"
+
+test $TEST_TYPE $FILE || {
+ echo "You must run this script in the top-level $PROJECT directory"
+ exit 1
+}
+
+if test -z "$*"; then
+ echo "I am going to run ./configure with no arguments - if you wish "
+ echo "to pass any to it, please specify them on the $0 command line."
+fi
+
+echo "Running $ACLOCAL $aclocalinclude ..."
+$ACLOCAL $aclocalinclude
+
+echo "Running $AUTOMAKE --gnu $am_opt ..."
+$AUTOMAKE --add-missing --gnu $am_opt
+
+echo "Running $AUTOCONF ..."
+$AUTOCONF
+
+echo Running $srcdir/configure $conf_flags "$@" ...
+$srcdir/configure $conf_flags "$@"
diff --git a/configure b/configure
deleted file mode 100755
index ec2081b..0000000
--- a/configure
+++ /dev/null
@@ -1,4062 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for pinta 0.7.
-#
-#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-#
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in #((
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test "x$CONFIG_SHELL" = x; then
- as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-"
- as_required="as_fn_return () { (exit \$1); }
-as_fn_success () { as_fn_return 0; }
-as_fn_failure () { as_fn_return 1; }
-as_fn_ret_success () { return 0; }
-as_fn_ret_failure () { return 1; }
-
-exitcode=0
-as_fn_success || { exitcode=1; echo as_fn_success failed.; }
-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-
-else
- exitcode=1; echo positional parameters were not saved.
-fi
-test x\$exitcode = x0 || exit 1"
- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1"
- if (eval "$as_required") 2>/dev/null; then :
- as_have_required=yes
-else
- as_have_required=no
-fi
- if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_found=false
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- as_found=:
- case $as_dir in #(
- /*)
- for as_base in sh bash ksh sh5; do
- # Try only shells that exist, to save several forks.
- as_shell=$as_dir/$as_base
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
- CONFIG_SHELL=$as_shell as_have_required=yes
- if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
- break 2
-fi
-fi
- done;;
- esac
- as_found=false
-done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
- CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
-IFS=$as_save_IFS
-
-
- if test "x$CONFIG_SHELL" != x; then :
- # We cannot yet assume a decent shell, so we have to provide a
- # neutralization value for shells without unset; and this also
- # works around shells that cannot unset nonexistent variables.
- BASH_ENV=/dev/null
- ENV=/dev/null
- (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
- if test x$as_have_required = xno; then :
- $as_echo "$0: This script requires a shell more modern than all"
- $as_echo "$0: the shells that I found on your system."
- if test x${ZSH_VERSION+set} = xset ; then
- $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
- $as_echo "$0: be upgraded to zsh 4.3.4 or later."
- else
- $as_echo "$0: Please tell bug-autoconf at gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
- fi
- exit 1
-fi
-fi
-fi
-SHELL=${CONFIG_SHELL-/bin/sh}
-export SHELL
-# Unset more variables known to interfere with behavior of common tools.
-CLICOLOR_FORCE= GREP_OPTIONS=
-unset CLICOLOR_FORCE GREP_OPTIONS
-
-## --------------------- ##
-## M4sh Shell Functions. ##
-## --------------------- ##
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
-else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
-else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
-
-
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
- fi
- $as_echo "$as_me: error: $1" >&2
- as_fn_exit $as_status
-} # as_fn_error
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-
- as_lineno_1=$LINENO as_lineno_1a=$LINENO
- as_lineno_2=$LINENO as_lineno_2a=$LINENO
- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
- case `echo 'xy\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -p'
- fi
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-
-# Identity of this package.
-PACKAGE_NAME='pinta'
-PACKAGE_TARNAME='pinta'
-PACKAGE_VERSION='0.7'
-PACKAGE_STRING='pinta 0.7'
-PACKAGE_BUGREPORT=''
-PACKAGE_URL=''
-
-ac_default_prefix=/usr
-ac_subst_vars='LTLIBOBJS
-LIBOBJS
-MONO_CAIRO_LIBS
-MONO_CAIRO_CFLAGS
-GTK_SHARP_20_LIBS
-GTK_SHARP_20_CFLAGS
-GLIB_SHARP_20_LIBS
-GLIB_SHARP_20_CFLAGS
-MONO_LIBS
-MONO_CFLAGS
-MONO
-XBUILD
-PKG_CONFIG
-am__untar
-am__tar
-AMTAR
-am__leading_dot
-SET_MAKE
-AWK
-mkdir_p
-MKDIR_P
-INSTALL_STRIP_PROGRAM
-STRIP
-install_sh
-MAKEINFO
-AUTOHEADER
-AUTOMAKE
-AUTOCONF
-ACLOCAL
-VERSION
-PACKAGE
-CYGPATH_W
-am__isrc
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_URL
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-'
- ac_precious_vars='build_alias
-host_alias
-target_alias
-PKG_CONFIG
-MONO_CFLAGS
-MONO_LIBS
-GLIB_SHARP_20_CFLAGS
-GLIB_SHARP_20_LIBS
-GTK_SHARP_20_CFLAGS
-GTK_SHARP_20_LIBS
-MONO_CAIRO_CFLAGS
-MONO_CAIRO_LIBS'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
- ac_prev=
- continue
- fi
-
- case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
- datadir=$ac_optarg ;;
-
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
-
- -enable-* | --enable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=\$ac_optarg ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=\$ac_optarg ;;
-
- -without-* | --without-*)
- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=no ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) as_fn_error "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information."
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- case $ac_envvar in #(
- '' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error "invalid variable name: \`$ac_envvar'" ;;
- esac
- eval $ac_envvar=\$ac_optarg
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error "missing argument to $ac_option"
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) as_fn_error "unrecognized options: $ac_unrecognized_opts" ;;
- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
- esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
-do
- eval ac_val=\$$ac_var
- # Remove trailing slashes.
- case $ac_val in
- */ )
- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
- eval $ac_var=\$ac_val;;
- esac
- # Be sure to have absolute directory names.
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
- esac
- as_fn_error "expected an absolute directory name for --$ac_var: $ac_val"
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error "working directory cannot be determined"
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error "pwd does not report name of working directory"
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_myself" : 'X\(//\)[^/]' \| \
- X"$as_myself" : 'X\(//\)$' \| \
- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error "cannot find sources ($ac_unique_file) in $srcdir"
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error "$ac_msg"
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures pinta 0.7 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/pinta]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
-_ACEOF
-
- cat <<\_ACEOF
-
-Program names:
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM run sed PROGRAM on installed program names
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
- case $ac_init_help in
- short | recursive ) echo "Configuration of pinta 0.7:";;
- esac
- cat <<\_ACEOF
-
-Some influential environment variables:
- PKG_CONFIG path to pkg-config utility
- MONO_CFLAGS C compiler flags for MONO, overriding pkg-config
- MONO_LIBS linker flags for MONO, overriding pkg-config
- GLIB_SHARP_20_CFLAGS
- C compiler flags for GLIB_SHARP_20, overriding pkg-config
- GLIB_SHARP_20_LIBS
- linker flags for GLIB_SHARP_20, overriding pkg-config
- GTK_SHARP_20_CFLAGS
- C compiler flags for GTK_SHARP_20, overriding pkg-config
- GTK_SHARP_20_LIBS
- linker flags for GTK_SHARP_20, overriding pkg-config
- MONO_CAIRO_CFLAGS
- C compiler flags for MONO_CAIRO, overriding pkg-config
- MONO_CAIRO_LIBS
- linker flags for MONO_CAIRO, overriding pkg-config
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to the package provider.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" ||
- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
- continue
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
- else
- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
- done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
- cat <<\_ACEOF
-pinta configure 0.7
-generated by GNU Autoconf 2.65
-
-Copyright (C) 2009 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit
-fi
-
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by pinta $as_me 0.7, which was
-generated by GNU Autoconf 2.65. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
- done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *\'*)
- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
- 2)
- as_fn_append ac_configure_args1 " '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- as_fn_append ac_configure_args " '$ac_arg'"
- ;;
- esac
- done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
- esac ;;
- esac
- done
- (set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
- *)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-)
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- cat confdefs.h
- echo
- fi
- test "$ac_signal" != 0 &&
- $as_echo "$as_me: caught signal $ac_signal"
- $as_echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-$as_echo "/* confdefs.h */" > confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
- ac_site_file1=$prefix/share/config.site
- ac_site_file2=$prefix/etc/config.site
-else
- ac_site_file1=$ac_default_prefix/share/config.site
- ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
- test "x$ac_site_file" = xNONE && continue
- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special files
- # actually), so we avoid doing that. DJGPP emulates it as a regular file.
- if test /dev/null != "$cache_file" && test -f "$cache_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
- esac
- fi
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
- case $ac_old_set,$ac_new_set in
- set,)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- ac_cache_corrupted=:
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
- eval $ac_var=\$ac_old_val
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) as_fn_append ac_configure_args " '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-am__api_version='1.11'
-
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
- for ac_t in install-sh install.sh shtool; do
- if test -f "$ac_dir/$ac_t"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/$ac_t -c"
- break 2
- fi
- done
-done
-if test -z "$ac_aux_dir"; then
- as_fn_error "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in #((
- ./ | .// | /[cC]/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- fi
- done
- done
- ;;
-esac
-
- done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- INSTALL=$ac_install_sh
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
-$as_echo_n "checking whether build environment is sane... " >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name. Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
- *[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error "unsafe absolute working directory name" "$LINENO" 5;;
-esac
-case $srcdir in
- *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
-esac
-
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments. Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
- if test "$*" = "X"; then
- # -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
- fi
- rm -f conftest.file
- if test "$*" != "X $srcdir/configure conftest.file" \
- && test "$*" != "X conftest.file $srcdir/configure"; then
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- as_fn_error "ls -t appears to fail. Make sure there is not a broken
-alias in your environment" "$LINENO" 5
- fi
-
- test "$2" = conftest.file
- )
-then
- # Ok.
- :
-else
- as_fn_error "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-test "$program_prefix" != NONE &&
- program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-if test x"${MISSING+set}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
- *)
- MISSING="\${SHELL} $am_aux_dir/missing" ;;
- esac
-fi
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
- am_missing_run="$MISSING --run "
-else
- am_missing_run=
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
-
-if test x"${install_sh}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
- *)
- install_sh="\${SHELL} $am_aux_dir/install-sh"
- esac
-fi
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
- ac_ct_STRIP=$STRIP
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_STRIP="strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
-else
- STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
-$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in mkdir gmkdir; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
- case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
- 'mkdir (GNU coreutils) '* | \
- 'mkdir (coreutils) '* | \
- 'mkdir (fileutils) '4.1*)
- ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
- break 3;;
- esac
- done
- done
- done
-IFS=$as_save_IFS
-
-fi
-
- test -d ./--version && rmdir ./--version
- if test "${ac_cv_path_mkdir+set}" = set; then
- MKDIR_P="$ac_cv_path_mkdir -p"
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for MKDIR_P within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- MKDIR_P="$ac_install_sh -d"
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
-$as_echo "$MKDIR_P" >&6; }
-
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
- [\\/$]* | ?:[\\/]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-
-for ac_prog in gawk mawk nawk awk
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AWK"; then
- ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_AWK="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$AWK" && break
-done
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
- @echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
- *@@@%%%=?*=@@@%%%*)
- eval ac_cv_prog_make_${ac_make}_set=yes;;
- *)
- eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- SET_MAKE=
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
- am__leading_dot=.
-else
- am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
- # is not polluted with repeated "-I."
- am__isrc=' -I$(srcdir)'
- # test to see if srcdir already configured
- if test -f $srcdir/config.status; then
- as_fn_error "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
- fi
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
- if (cygpath --version) >/dev/null 2>/dev/null; then
- CYGPATH_W='cygpath -w'
- else
- CYGPATH_W=echo
- fi
-fi
-
-
-# Define the identity of the package.
- PACKAGE='pinta'
- VERSION='0.7'
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
-# Some tools Automake needs.
-
-ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-
-
-AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
-
-
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
-
-
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
-
-
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to create a ustar tar archive" >&5
-$as_echo_n "checking how to create a ustar tar archive... " >&6; }
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar plaintar pax cpio none'
-_am_tools=${am_cv_prog_tar_ustar-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- { echo "$as_me:$LINENO: $_am_tar --version" >&5
- ($_am_tar --version) >&5 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && break
- done
- am__tar="$_am_tar --format=ustar -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=ustar -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x ustar -w "$$tardir"'
- am__tar_='pax -L -x ustar -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H ustar -L'
- am__tar_='find "$tardir" -print | cpio -o -H ustar -L'
- am__untar='cpio -i -H ustar -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
-
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_ustar}" && break
-
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- { echo "$as_me:$LINENO: tardir=conftest.dir && eval $am__tar_ >conftest.tar" >&5
- (tardir=conftest.dir && eval $am__tar_ >conftest.tar) >&5 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
- rm -rf conftest.dir
- if test -s conftest.tar; then
- { echo "$as_me:$LINENO: $am__untar <conftest.tar" >&5
- ($am__untar <conftest.tar) >&5 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-
-if test "${am_cv_prog_tar_ustar+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- am_cv_prog_tar_ustar=$_am_tool
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_tar_ustar" >&5
-$as_echo "$am_cv_prog_tar_ustar" >&6; }
-
-
-
-
-
-
-
-
-
-# Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test "x$PKG_CONFIG" = "xno"; then
- as_fn_error "You need to install pkg-config" "$LINENO" 5
-fi
-
-# Extract the first word of "xbuild", so it can be a program name with args.
-set dummy xbuild; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_XBUILD+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $XBUILD in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_XBUILD="$XBUILD" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_XBUILD="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_XBUILD" && ac_cv_path_XBUILD="no"
- ;;
-esac
-fi
-XBUILD=$ac_cv_path_XBUILD
-if test -n "$XBUILD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XBUILD" >&5
-$as_echo "$XBUILD" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-# Extract the first word of "mono", so it can be a program name with args.
-set dummy mono; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_MONO+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $MONO in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_MONO="$MONO" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_MONO="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_MONO" && ac_cv_path_MONO="no"
- ;;
-esac
-fi
-MONO=$ac_cv_path_MONO
-if test -n "$MONO"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MONO" >&5
-$as_echo "$MONO" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-if test "x$XBUILD" = "xno"; then
- as_fn_error "XBuild not found" "$LINENO" 5
-fi
-
-if test "x$MONO" = "xno"; then
- as_fn_error "No mono runtime found" "$LINENO" 5
-fi
-
-# Check Mono version
-MONO_MINIMUM_VERSION=2.6.7
-
-
-if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args.
-set dummy ${ac_tool_prefix}pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_path_PKG_CONFIG"; then
- ac_pt_PKG_CONFIG=$PKG_CONFIG
- # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- case $ac_pt_PKG_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-if test -n "$ac_pt_PKG_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
-$as_echo "$ac_pt_PKG_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
- fi
-else
- PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
-fi
-
-fi
-if test -n "$PKG_CONFIG"; then
- _pkg_min_version=0.9.0
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
-$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
- if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- PKG_CONFIG=""
- fi
-
-fi
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MONO" >&5
-$as_echo_n "checking for MONO... " >&6; }
-
-if test -n "$MONO_CFLAGS"; then
- pkg_cv_MONO_CFLAGS="$MONO_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_MINIMUM_VERSION\""; } >&5
- ($PKG_CONFIG --exists --print-errors "mono >= $MONO_MINIMUM_VERSION") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_MONO_CFLAGS=`$PKG_CONFIG --cflags "mono >= $MONO_MINIMUM_VERSION" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$MONO_LIBS"; then
- pkg_cv_MONO_LIBS="$MONO_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mono >= \$MONO_MINIMUM_VERSION\""; } >&5
- ($PKG_CONFIG --exists --print-errors "mono >= $MONO_MINIMUM_VERSION") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_MONO_LIBS=`$PKG_CONFIG --libs "mono >= $MONO_MINIMUM_VERSION" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- MONO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mono >= $MONO_MINIMUM_VERSION" 2>&1`
- else
- MONO_PKG_ERRORS=`$PKG_CONFIG --print-errors "mono >= $MONO_MINIMUM_VERSION" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$MONO_PKG_ERRORS" >&5
-
- as_fn_error "Package requirements (mono >= $MONO_MINIMUM_VERSION) were not met:
-
-$MONO_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables MONO_CFLAGS
-and MONO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" "$LINENO" 5
-elif test $pkg_failed = untried; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables MONO_CFLAGS
-and MONO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details." "$LINENO" 5; }
-else
- MONO_CFLAGS=$pkg_cv_MONO_CFLAGS
- MONO_LIBS=$pkg_cv_MONO_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- :
-fi
-
-
-
-
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB_SHARP_20" >&5
-$as_echo_n "checking for GLIB_SHARP_20... " >&6; }
-
-if test -n "$GLIB_SHARP_20_CFLAGS"; then
- pkg_cv_GLIB_SHARP_20_CFLAGS="$GLIB_SHARP_20_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-sharp-2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "glib-sharp-2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GLIB_SHARP_20_CFLAGS=`$PKG_CONFIG --cflags "glib-sharp-2.0" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$GLIB_SHARP_20_LIBS"; then
- pkg_cv_GLIB_SHARP_20_LIBS="$GLIB_SHARP_20_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-sharp-2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "glib-sharp-2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GLIB_SHARP_20_LIBS=`$PKG_CONFIG --libs "glib-sharp-2.0" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- GLIB_SHARP_20_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-sharp-2.0" 2>&1`
- else
- GLIB_SHARP_20_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-sharp-2.0" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$GLIB_SHARP_20_PKG_ERRORS" >&5
-
- as_fn_error "Package requirements (glib-sharp-2.0) were not met:
-
-$GLIB_SHARP_20_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables GLIB_SHARP_20_CFLAGS
-and GLIB_SHARP_20_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" "$LINENO" 5
-elif test $pkg_failed = untried; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables GLIB_SHARP_20_CFLAGS
-and GLIB_SHARP_20_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details." "$LINENO" 5; }
-else
- GLIB_SHARP_20_CFLAGS=$pkg_cv_GLIB_SHARP_20_CFLAGS
- GLIB_SHARP_20_LIBS=$pkg_cv_GLIB_SHARP_20_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- :
-fi
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTK_SHARP_20" >&5
-$as_echo_n "checking for GTK_SHARP_20... " >&6; }
-
-if test -n "$GTK_SHARP_20_CFLAGS"; then
- pkg_cv_GTK_SHARP_20_CFLAGS="$GTK_SHARP_20_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-sharp-2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "gtk-sharp-2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GTK_SHARP_20_CFLAGS=`$PKG_CONFIG --cflags "gtk-sharp-2.0" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$GTK_SHARP_20_LIBS"; then
- pkg_cv_GTK_SHARP_20_LIBS="$GTK_SHARP_20_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-sharp-2.0\""; } >&5
- ($PKG_CONFIG --exists --print-errors "gtk-sharp-2.0") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_GTK_SHARP_20_LIBS=`$PKG_CONFIG --libs "gtk-sharp-2.0" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- GTK_SHARP_20_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gtk-sharp-2.0" 2>&1`
- else
- GTK_SHARP_20_PKG_ERRORS=`$PKG_CONFIG --print-errors "gtk-sharp-2.0" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$GTK_SHARP_20_PKG_ERRORS" >&5
-
- as_fn_error "Package requirements (gtk-sharp-2.0) were not met:
-
-$GTK_SHARP_20_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables GTK_SHARP_20_CFLAGS
-and GTK_SHARP_20_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" "$LINENO" 5
-elif test $pkg_failed = untried; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables GTK_SHARP_20_CFLAGS
-and GTK_SHARP_20_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details." "$LINENO" 5; }
-else
- GTK_SHARP_20_CFLAGS=$pkg_cv_GTK_SHARP_20_CFLAGS
- GTK_SHARP_20_LIBS=$pkg_cv_GTK_SHARP_20_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- :
-fi
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MONO_CAIRO" >&5
-$as_echo_n "checking for MONO_CAIRO... " >&6; }
-
-if test -n "$MONO_CAIRO_CFLAGS"; then
- pkg_cv_MONO_CAIRO_CFLAGS="$MONO_CAIRO_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mono-cairo\""; } >&5
- ($PKG_CONFIG --exists --print-errors "mono-cairo") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_MONO_CAIRO_CFLAGS=`$PKG_CONFIG --cflags "mono-cairo" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-if test -n "$MONO_CAIRO_LIBS"; then
- pkg_cv_MONO_CAIRO_LIBS="$MONO_CAIRO_LIBS"
- elif test -n "$PKG_CONFIG"; then
- if test -n "$PKG_CONFIG" && \
- { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"mono-cairo\""; } >&5
- ($PKG_CONFIG --exists --print-errors "mono-cairo") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- pkg_cv_MONO_CAIRO_LIBS=`$PKG_CONFIG --libs "mono-cairo" 2>/dev/null`
-else
- pkg_failed=yes
-fi
- else
- pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
- _pkg_short_errors_supported=yes
-else
- _pkg_short_errors_supported=no
-fi
- if test $_pkg_short_errors_supported = yes; then
- MONO_CAIRO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "mono-cairo" 2>&1`
- else
- MONO_CAIRO_PKG_ERRORS=`$PKG_CONFIG --print-errors "mono-cairo" 2>&1`
- fi
- # Put the nasty error message in config.log where it belongs
- echo "$MONO_CAIRO_PKG_ERRORS" >&5
-
- as_fn_error "Package requirements (mono-cairo) were not met:
-
-$MONO_CAIRO_PKG_ERRORS
-
-Consider adjusting the PKG_CONFIG_PATH environment variable if you
-installed software in a non-standard prefix.
-
-Alternatively, you may set the environment variables MONO_CAIRO_CFLAGS
-and MONO_CAIRO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-" "$LINENO" 5
-elif test $pkg_failed = untried; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "The pkg-config script could not be found or is too old. Make sure it
-is in your PATH or set the PKG_CONFIG environment variable to the full
-path to pkg-config.
-
-Alternatively, you may set the environment variables MONO_CAIRO_CFLAGS
-and MONO_CAIRO_LIBS to avoid the need to call pkg-config.
-See the pkg-config man page for more details.
-
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.
-See \`config.log' for more details." "$LINENO" 5; }
-else
- MONO_CAIRO_CFLAGS=$pkg_cv_MONO_CAIRO_CFLAGS
- MONO_CAIRO_LIBS=$pkg_cv_MONO_CAIRO_LIBS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- :
-fi
-
-ac_config_files="$ac_config_files Makefile pinta"
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
- esac ;;
- esac
- done
-
- (set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes: double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \.
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-) |
- sed '
- /^ac_cv_env_/b end
- t clear
- :clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
- if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-as_write_fail=0
-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in #((
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-
-# as_fn_error ERROR [LINENO LOG_FD]
-# ---------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with status $?, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$?; test $as_status -eq 0 && as_status=1
- if test "$3"; then
- as_lineno=${as_lineno-"$2"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $1" >&$3
- fi
- $as_echo "$as_me: error: $1" >&2
- as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
-else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
-else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
-
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
- case `echo 'xy\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -p'
- fi
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in #(
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-_ASEOF
-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# Save the log message, to keep $0 and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by pinta $as_me 0.7, which was
-generated by GNU Autoconf 2.65. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# Files that config.status was made for.
-config_files="$ac_config_files"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration. Unless the files
-and actions are specified as TAGs, all are instantiated by default.
-
-Usage: $0 [OPTION]... [TAG]...
-
- -h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
- --config print configuration, then exit
- -q, --quiet, --silent
- do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
-
-Configuration files:
-$config_files
-
-Report bugs to the package provider."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
-ac_cs_version="\\
-pinta config.status 0.7
-configured by $0, generated by GNU Autoconf 2.65,
- with options \\"\$ac_cs_config\\"
-
-Copyright (C) 2009 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-MKDIR_P='$MKDIR_P'
-AWK='$AWK'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- *)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- $as_echo "$ac_cs_version"; exit ;;
- --config | --confi | --conf | --con | --co | --c )
- $as_echo "$ac_cs_config"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- as_fn_append CONFIG_FILES " '$ac_optarg'"
- ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
- $as_echo "$ac_cs_usage"; exit ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) as_fn_error "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
-
- *) as_fn_append ac_config_targets " $1"
- ac_need_defaults=false ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
- shift
- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
- CONFIG_SHELL='$SHELL'
- export CONFIG_SHELL
- exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
- case $ac_config_target in
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "pinta") CONFIG_FILES="$CONFIG_FILES pinta" ;;
-
- *) as_fn_error "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
- esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
- trap 'as_fn_exit 1' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} || as_fn_error "cannot create a temporary directory in ." "$LINENO" 5
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
- eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\r'
-else
- ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
-_ACEOF
-
-
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- . ./conf$$subs.sh ||
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
-
- ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
- if test $ac_delim_n = $ac_delim_num; then
- break
- elif $ac_last_try; then
- as_fn_error "could not make $CONFIG_STATUS" "$LINENO" 5
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\)..*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\)..*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
- N
- s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
- for (key in S) S_is_set[key] = 1
- FS = ""
-
-}
-{
- line = $ 0
- nfields = split(line, field, "@")
- substed = 0
- len = length(field[1])
- for (i = 2; i < nfields; i++) {
- key = field[i]
- keylen = length(key)
- if (S_is_set[key]) {
- value = S[key]
- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
- len += length(value) + length(field[++i])
- substed = 1
- } else
- len += 1 + keylen
- }
-
- print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
- cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || as_fn_error "could not setup config files machinery" "$LINENO" 5
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-
-eval set X " :F $CONFIG_FILES "
-shift
-for ac_tag
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) as_fn_error "invalid tag \`$ac_tag'" "$LINENO" 5;;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- as_fn_error "cannot find input file: \`$ac_f'" "$LINENO" 5;;
- esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- as_fn_append ac_file_inputs " '$ac_f'"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input='Generated from '`
- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
- `' by configure.'
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
- fi
- # Neutralize special characters interpreted by sed in replacement strings.
- case $configure_input in #(
- *\&* | *\|* | *\\* )
- ac_sed_conf_input=`$as_echo "$configure_input" |
- sed 's/[\\\\&|]/\\\\&/g'`;; #(
- *) ac_sed_conf_input=$configure_input;;
- esac
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || as_fn_error "could not create $ac_file" "$LINENO" 5 ;;
- esac
- ;;
- esac
-
- ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- as_dir="$ac_dir"; as_fn_mkdir_p
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
-
- case $INSTALL in
- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
- esac
- ac_MKDIR_P=$MKDIR_P
- case $MKDIR_P in
- [\\/$]* | ?:[\\/]* ) ;;
- */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
- esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-ac_sed_dataroot='
-/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
- esac \
- || as_fn_error "could not create $ac_file" "$LINENO" 5
- ;;
-
-
-
- esac
-
-done # for ac_tag
-
-
-as_fn_exit 0
-_ACEOF
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
- as_fn_error "write failure creating $CONFIG_STATUS" "$LINENO" 5
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit $?
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
-
-cat <<EOF
-
-${PACKAGE}-${VERSION}
-
- Build Environment
- Install Prefix: ${prefix}
- XBuild Path: ${XBUILD}
- Mono Runtime: ${MONO}
- Launch Script: ${prefix}/bin/${PACKAGE}
- Installation Directory: ${prefix}/lib/${PACKAGE}/
-
-EOF
diff --git a/configure.ac b/configure.ac
index 40aa2bf..e50658e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@ if test "x$MONO" = "xno"; then
fi
# Check Mono version
-MONO_MINIMUM_VERSION=2.6.7
+MONO_MINIMUM_VERSION=2.8
PKG_CHECK_MODULES(MONO, mono >= $MONO_MINIMUM_VERSION)
AC_SUBST(XBUILD)
diff --git a/install-sh b/install-sh
deleted file mode 100755
index 6781b98..0000000
--- a/install-sh
+++ /dev/null
@@ -1,520 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2009-04-28.21; # UTC
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# 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
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" "" $nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
- doit_exec=exec
-else
- doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
- test "$posix_glob" != "?" || {
- if (set -f) 2>/dev/null; then
- posix_glob=
- else
- posix_glob=:
- fi
- }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
- --help display this help and exit.
- --version display version info and exit.
-
- -c (ignored)
- -C install only if different (preserve the last data modification time)
- -d create directories instead of installing files.
- -g GROUP $chgrpprog installed files to GROUP.
- -m MODE $chmodprog installed files to MODE.
- -o USER $chownprog installed files to USER.
- -s $stripprog installed files.
- -t DIRECTORY install into DIRECTORY.
- -T report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
- RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
- case $1 in
- -c) ;;
-
- -C) copy_on_change=true;;
-
- -d) dir_arg=true;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift;;
-
- --help) echo "$usage"; exit $?;;
-
- -m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
-
- -o) chowncmd="$chownprog $2"
- shift;;
-
- -s) stripcmd=$stripprog;;
-
- -t) dst_arg=$2
- shift;;
-
- -T) no_target_directory=true;;
-
- --version) echo "$0 $scriptversion"; exit $?;;
-
- --) shift
- break;;
-
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
-
- *) break;;
- esac
- shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
- # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dst_arg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dst_arg"
- shift # fnord
- fi
- shift # arg
- dst_arg=$arg
- done
-fi
-
-if test $# -eq 0; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call `install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
-
-if test -z "$dir_arg"; then
- trap '(exit $?); exit' 1 2 13 15
-
- # Set umask so as not to create temps with too-generous modes.
- # However, 'strip' requires both read and write access to temps.
- case $mode in
- # Optimize common cases.
- *644) cp_umask=133;;
- *755) cp_umask=22;;
-
- *[0-7])
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw='% 200'
- fi
- cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
- *)
- if test -z "$stripcmd"; then
- u_plus_rw=
- else
- u_plus_rw=,u+rw
- fi
- cp_umask=$mode$u_plus_rw;;
- esac
-fi
-
-for src
-do
- # Protect names starting with `-'.
- case $src in
- -*) src=./$src;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- dstdir=$dst
- test -d "$dstdir"
- dstdir_status=$?
- else
-
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dst_arg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
-
- dst=$dst_arg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst;;
- esac
-
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dst_arg: Is a directory" >&2
- exit 1
- fi
- dstdir=$dst
- dst=$dstdir/`basename "$src"`
- dstdir_status=0
- else
- # Prefer dirname, but fall back on a substitute if dirname fails.
- dstdir=`
- (dirname "$dst") 2>/dev/null ||
- expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$dst" : 'X\(//\)[^/]' \| \
- X"$dst" : 'X\(//\)$' \| \
- X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
- echo X"$dst" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'
- `
-
- test -d "$dstdir"
- dstdir_status=$?
- fi
- fi
-
- obsolete_mkdir_used=false
-
- if test $dstdir_status != 0; then
- case $posix_mkdir in
- '')
- # Create intermediate dirs using mode 755 as modified by the umask.
- # This is like FreeBSD 'install' as of 1997-10-28.
- umask=`umask`
- case $stripcmd.$umask in
- # Optimize common cases.
- *[2367][2367]) mkdir_umask=$umask;;
- .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
- *[0-7])
- mkdir_umask=`expr $umask + 22 \
- - $umask % 100 % 40 + $umask % 20 \
- - $umask % 10 % 4 + $umask % 2
- `;;
- *) mkdir_umask=$umask,go-w;;
- esac
-
- # With -d, create the new directory with the user-specified mode.
- # Otherwise, rely on $mkdir_umask.
- if test -n "$dir_arg"; then
- mkdir_mode=-m$mode
- else
- mkdir_mode=
- fi
-
- posix_mkdir=false
- case $umask in
- *[123567][0-7][0-7])
- # POSIX mkdir -p sets u+wx bits regardless of umask, which
- # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
- ;;
- *)
- tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
- trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
- if (umask $mkdir_umask &&
- exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
- then
- if test -z "$dir_arg" || {
- # Check for POSIX incompatibilities with -m.
- # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
- # other-writeable bit of parent directory when it shouldn't.
- # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
- ls_ld_tmpdir=`ls -ld "$tmpdir"`
- case $ls_ld_tmpdir in
- d????-?r-*) different_mode=700;;
- d????-?--*) different_mode=755;;
- *) false;;
- esac &&
- $mkdirprog -m$different_mode -p -- "$tmpdir" && {
- ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
- test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
- }
- }
- then posix_mkdir=:
- fi
- rmdir "$tmpdir/d" "$tmpdir"
- else
- # Remove any dirs left behind by ancient mkdir implementations.
- rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
- fi
- trap '' 0;;
- esac;;
- esac
-
- if
- $posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
- )
- then :
- else
-
- # The umask is ridiculous, or mkdir does not conform to POSIX,
- # or it failed possibly due to a race condition. Create the
- # directory the slow way, step by step, checking for races as we go.
-
- case $dstdir in
- /*) prefix='/';;
- -*) prefix='./';;
- *) prefix='';;
- esac
-
- eval "$initialize_posix_glob"
-
- oIFS=$IFS
- IFS=/
- $posix_glob set -f
- set fnord $dstdir
- shift
- $posix_glob set +f
- IFS=$oIFS
-
- prefixes=
-
- for d
- do
- test -z "$d" && continue
-
- prefix=$prefix$d
- if test -d "$prefix"; then
- prefixes=
- else
- if $posix_mkdir; then
- (umask=$mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
- # Don't fail if two instances are running concurrently.
- test -d "$prefix" || exit 1
- else
- case $prefix in
- *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
- *) qprefix=$prefix;;
- esac
- prefixes="$prefixes '$qprefix'"
- fi
- fi
- prefix=$prefix/
- done
-
- if test -n "$prefixes"; then
- # Don't fail if two instances are running concurrently.
- (umask $mkdir_umask &&
- eval "\$doit_exec \$mkdirprog $prefixes") ||
- test -d "$dstdir" || exit 1
- obsolete_mkdir_used=true
- fi
- fi
- fi
-
- if test -n "$dir_arg"; then
- { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
- { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
- test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
- else
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
- # Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
- { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
- { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
- { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
- # If -C, don't bother to copy if it wouldn't change the file.
- if $copy_on_change &&
- old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
- new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
-
- eval "$initialize_posix_glob" &&
- $posix_glob set -f &&
- set X $old && old=:$2:$4:$5:$6 &&
- set X $new && new=:$2:$4:$5:$6 &&
- $posix_glob set +f &&
-
- test "$old" = "$new" &&
- $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
- then
- rm -f "$dsttmp"
- else
- # Rename the file to the real destination.
- $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
- {
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- test ! -f "$dst" ||
- $doit $rmcmd -f "$dst" 2>/dev/null ||
- { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
- { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
- } ||
- { echo "$0: cannot unlink or rename $dst" >&2
- (exit 1); exit 1
- }
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dst"
- }
- fi || exit 1
-
- trap '' 0
- fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/missing b/missing
deleted file mode 100755
index 28055d2..0000000
--- a/missing
+++ /dev/null
@@ -1,376 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2009-04-28.21; # UTC
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- autom4te touch the output file, or create a stub one
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
-
-Send bug reports to <bug-automake at gnu.org>."
- exit $?
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing $scriptversion (GNU Automake)"
- exit $?
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
-esac
-
-# normalize program name to check for.
-program=`echo "$1" | sed '
- s/^gnu-//; t
- s/^gnu//; t
- s/^g//; t'`
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program). This is about non-GNU programs, so use $1 not
-# $program.
-case $1 in
- lex*|yacc*)
- # Not GNU programs, they don't have --version.
- ;;
-
- tar*)
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- exit 1
- fi
- ;;
-
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $program in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case $f in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te*)
- echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison*|yacc*)
- echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if test $# -ne 1; then
- eval LASTARG="\${$#}"
- case $LASTARG in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if test ! -f y.tab.h; then
- echo >y.tab.h
- fi
- if test ! -f y.tab.c; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex*|flex*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if test $# -ne 1; then
- eval LASTARG="\${$#}"
- case $LASTARG in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if test ! -f lex.yy.c; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit $?
- fi
- ;;
-
- makeinfo*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -z "$file"; then
- # ... or it is the one specified with @setfilename ...
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '
- /^@setfilename/{
- s/.* \([^ ]*\) *$/\1/
- p
- q
- }' $infile`
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
- fi
- # If the file does not exist, the user really needs makeinfo;
- # let's fail without touching anything.
- test -f $file || exit 1
- touch $file
- ;;
-
- tar*)
- shift
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case $firstarg in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case $firstarg in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
-
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End:
diff --git a/po/messages-ar.po b/po/messages-ar.po
index add2b45..658e746 100644
--- a/po/messages-ar.po
+++ b/po/messages-ar.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-12 12:58+0000\n"
-"Last-Translator: xDev <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:37+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Arabic <ar at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -913,6 +913,7 @@ msgstr "المساهمون السابقون"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" daifallah https://launchpad.net/~daif\n"
" xDev https://launchpad.net/~mf393"
diff --git a/po/messages-br.po b/po/messages-br.po
index 42bdd5a..a88775e 100644
--- a/po/messages-br.po
+++ b/po/messages-br.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-04 23:41+0000\n"
+"PO-Revision-Date: 2011-03-04 17:14+0000\n"
"Last-Translator: Alan <Unknown>\n"
"Language-Team: Breton <br at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -482,6 +482,8 @@ msgstr "Gomenn"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Klikañ a-gleiz da ziverkañ betek boull, klikañ a-zehou da ziverkañ ha lakaat "
+"al liv eilvedel. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -626,7 +628,7 @@ msgstr "Marzekaat war an tu dehou"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Stil an destenn"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -634,19 +636,19 @@ msgstr "Reizh"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Reizh ha trolinenn"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Tevder an drolinenn"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Moanaat tevder an drolinenn"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Tevaat tevder an drolinenn"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -941,6 +943,7 @@ msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" Alan https://launchpad.net/~alan-m.\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Skolajidi Diwan https://launchpad.net/~gireg-konan"
#: Pinta/Dialogs/AboutDialog.cs:123
@@ -1266,7 +1269,7 @@ msgstr "Zoum bihanaat"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Ment peurvat"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1274,7 +1277,7 @@ msgstr "Zoumañ da framm an diuzad"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Ment reizh"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1336,7 +1339,7 @@ msgstr "Pegañ war ur skeudenn nevez"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Dilemel an diuzad"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1352,7 +1355,7 @@ msgstr "Diuzañ pep tra"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Diziuzañ pep tra"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-ca.po b/po/messages-ca.po
index d551ae8..d495ae7 100644
--- a/po/messages-ca.po
+++ b/po/messages-ca.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-28 23:49+0000\n"
+"PO-Revision-Date: 2011-03-03 18:28+0000\n"
"Last-Translator: tot3lmon <tot3lmon at gmail.com>\n"
"Language-Team: Catalan <ca at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-cs.po b/po/messages-cs.po
index 79f07ae..6cf53f7 100644
--- a/po/messages-cs.po
+++ b/po/messages-cs.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-06 11:10+0000\n"
+"PO-Revision-Date: 2011-03-07 15:34+0000\n"
"Last-Translator: schunka <Unknown>\n"
"Language-Team: Czech <cs at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -476,7 +476,7 @@ msgstr "Guma"
#: Pinta.Tools/EraserTool.cs:47
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
-msgstr ""
+msgstr "Levým kliknutím mažete do průhledna, pravým do sekundární barvy. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -620,7 +620,7 @@ msgstr "Zarovnat doprava"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Styl textu"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -628,19 +628,19 @@ msgstr "Normální"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Normální a ohraničený"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Šířka ohraničení"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Zmenšit šířku ohraničení"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Zvětšit šířku ohraničení"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -1255,7 +1255,7 @@ msgstr "Oddálit"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Přizpůsobit"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1263,7 +1263,7 @@ msgstr "Přiblížit na výběr"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Normální velikost"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1325,7 +1325,7 @@ msgstr "Vložit do nového obrázku"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Smazat výběr"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1341,7 +1341,7 @@ msgstr "Vybrat vše"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Zrušit výběr"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-da.po b/po/messages-da.po
index 2ef8684..d982ca8 100644
--- a/po/messages-da.po
+++ b/po/messages-da.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-de.po b/po/messages-de.po
index 9afe2b7..3961298 100644
--- a/po/messages-de.po
+++ b/po/messages-de.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-19 09:40+0000\n"
-"Last-Translator: Johannes Rössel <Unknown>\n"
+"PO-Revision-Date: 2011-03-27 00:16+0000\n"
+"Last-Translator: Benedict Etzel <Unknown>\n"
"Language-Team: German <de at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -36,11 +36,11 @@ msgstr "Sepia"
#: Pinta.Effects/Adjustments/PosterizeEffect.cs:26
#: Pinta.Effects/gtk-gui/Pinta.Effects.PosterizeDialog.cs:26
msgid "Posterize"
-msgstr "Posterisieren"
+msgstr "Tonwerttrennung"
#: Pinta.Effects/Adjustments/BlackAndWhiteEffect.cs:26
msgid "Black and White"
-msgstr "Schwarz-Weiß"
+msgstr "Schwarz/Weiß"
#: Pinta.Effects/Adjustments/CurvesEffect.cs:28
#: Pinta.Effects/gtk-gui/Pinta.Effects.CurvesDialog.cs:46
@@ -324,7 +324,7 @@ msgstr "Hintergrundfarbe wählen"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:112
msgid "Choose Palette Color"
-msgstr ""
+msgstr "Palettenfarbe wählen"
#: Pinta.Tools/RectangleSelectTool.cs:38
msgid "Rectangle Select"
@@ -409,7 +409,7 @@ msgstr "Kegelförmiger Verlauf"
#: Pinta.Tools/FloodTool.cs:73
msgid "Flood Mode"
-msgstr ""
+msgstr "Füllmodus"
#: Pinta.Tools/FloodTool.cs:80
msgid "Contiguous"
@@ -437,7 +437,7 @@ msgstr ""
#: Pinta.Tools/PaintBrushTool.cs:64
msgid "Type"
-msgstr ""
+msgstr "Typ"
#: Pinta.Tools/PencilTool.cs:48 Pinta.Tools/ColorPickerTool.cs:120
msgid "Pencil"
@@ -628,35 +628,35 @@ msgstr "Rechtsbündig"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Textstil"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
-msgstr ""
+msgstr "Normal"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Normal und Kontur"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Konturbreite"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Konturbreite verringern"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Konturbreite erhöhen"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
-msgstr "Pinsel Breite"
+msgstr "Pinselbreite"
#: Pinta.Tools/ShapeTool.cs:104 Pinta.Tools/BaseBrushTool.cs:75
msgid "Decrease brush size"
-msgstr "Pinsel Breite verringern"
+msgstr "Pinselbreite verringern"
#: Pinta.Tools/ShapeTool.cs:118 Pinta.Tools/BaseBrushTool.cs:89
msgid "Increase brush size"
@@ -664,7 +664,7 @@ msgstr "Pinsel Breite vergrößern"
#: Pinta.Tools/ShapeTool.cs:131 Pinta.Tools/FreeformShapeTool.cs:71
msgid "Fill Style"
-msgstr ""
+msgstr "Füllstil"
#: Pinta.Tools/ShapeTool.cs:138 Pinta.Tools/FreeformShapeTool.cs:78
msgid "Outline Shape"
@@ -680,15 +680,15 @@ msgstr "Umrandung und Füllung"
#: Pinta.Tools/Brushes/CircleBrush.cs:38
msgid "Circles"
-msgstr ""
+msgstr "Kreise"
#: Pinta.Tools/Brushes/GridBrush.cs:38
msgid "Grid"
-msgstr ""
+msgstr "Gitter"
#: Pinta.Tools/Brushes/SquaresBrush.cs:40
msgid "Squares"
-msgstr ""
+msgstr "Quadrate"
#: Pinta.Tools/Brushes/SplatterBrush.cs:38
msgid "Splatter"
@@ -811,11 +811,11 @@ msgstr "Schwebend"
#: Pinta/DialogHandlers.cs:109
msgid "Take Screenshot"
-msgstr ""
+msgstr "Bildschirmfoto aufnehmen"
#: Pinta/DialogHandlers.cs:110
msgid "Delay before taking a screenshot (seconds):"
-msgstr ""
+msgstr "Verzögerung vor Aufnahme eines Bildschirmfotos (Sekunden):"
#: Pinta/DialogHandlers.cs:158
#, csharp-format
@@ -832,11 +832,11 @@ msgstr "Schließen ohne zu speichern"
#: Pinta/DialogHandlers.cs:193
msgid "Resize Palette"
-msgstr ""
+msgstr "Neue Palettengröße festlegen"
#: Pinta/DialogHandlers.cs:194
msgid "New palette size:"
-msgstr ""
+msgstr "Neue Palettengröße:"
#: Pinta/DialogHandlers.cs:223 Pinta.Core/Actions/EditActions.cs:70
msgid "Paste Into New Layer"
@@ -900,12 +900,15 @@ msgstr "Fehler"
#, csharp-format
msgid "A file named \"{0}\" already exists. Do you want to replace it?"
msgstr ""
+"Eine Datei namens \"{0}\" existiert bereits. Möchten Sie sie überschreiben?"
#: Pinta/DialogHandlers.cs:634
#, csharp-format
msgid ""
"The file already exists in \"{1}\". Replacing it will overwrite its contents."
msgstr ""
+"Die Datei existiert bereits in \"{1}\". Eine Ersetzung wird ihren Inhalt "
+"überschreiben."
#: Pinta/Dialogs/JpegCompressionDialog.cs:38
msgid "JPEG Quality"
@@ -941,6 +944,7 @@ msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" Andre https://launchpad.net/~ajx\n"
+" Benedict Etzel https://launchpad.net/~benedict-etzel\n"
" Francisco Camenforte Torres https://launchpad.net/~fct\n"
" Hanh Pham https://launchpad.net/~joel-nohnn\n"
" Johannes Rössel https://launchpad.net/~joey-muhkuhsaft\n"
@@ -1066,7 +1070,7 @@ msgstr ""
#: Pinta.Core/Managers/LivePreviewManager.cs:220
msgid "Rendering Effect"
-msgstr ""
+msgstr "Rendereffekt"
#: Pinta.Core/Managers/WorkspaceManager.cs:91
#, csharp-format
@@ -1280,11 +1284,11 @@ msgstr "Größe an Auswahl anpassen"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Normale Größe"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
-msgstr ""
+msgstr "Werkzeugleiste"
#: Pinta.Core/Actions/ViewActions.cs:69
msgid "Pixel Grid"
@@ -1342,7 +1346,7 @@ msgstr "In neues Bild einfügen"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Auswahl entfernen"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1358,11 +1362,11 @@ msgstr "Alles auswählen"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Auswahl aufheben"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
-msgstr ""
+msgstr "Auf Standardwert zurücksetzen"
#: Pinta.Core/Actions/EditActions.cs:81
msgid "Set Number of Colors"
@@ -1390,6 +1394,9 @@ msgid ""
"Could not open palette file: {0}.\n"
"Please verify that you are trying to open a valid GIMP or Paint.NET palette."
msgstr ""
+"Konnte Palettendatei nicht öffnen: {0}.\n"
+"Bitte stellen Sie sicher dass Sie eine gültige GIMP oder Paint.NET-Palette "
+"öffnen."
#: Pinta.Core/Actions/EditActions.cs:359
msgid "Save Palette File"
@@ -1425,7 +1432,7 @@ msgstr ""
#: Pinta.Core/Classes/BaseTool.cs:242
msgid "Overwrite"
-msgstr ""
+msgstr "Überschreiben"
#: Pinta.Core/Classes/BaseTool.cs:256
msgid "Antialiasing On"
@@ -1535,7 +1542,7 @@ msgstr "Fragmente"
#: TileEffect dialog
msgid "Ink Outline"
-msgstr ""
+msgstr "Tintenkontur"
#: AddNoiseEffect dialog
#: OutlineEffect dialog
@@ -1575,7 +1582,7 @@ msgstr "Qualität"
#: TileEffect dialog
#: RedEyeRemoveData dialog
msgid "Rotation"
-msgstr "Drehung"
+msgstr "Rotation"
#: CloudsEffect dialog
msgid "Saturation percentage"
diff --git a/po/messages-el.po b/po/messages-el.po
index 23d5393..3134b0d 100644
--- a/po/messages-el.po
+++ b/po/messages-el.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-16 10:57+0000\n"
-"Last-Translator: Νιάνιος Ρωμανός <Unknown>\n"
+"PO-Revision-Date: 2011-03-05 08:48+0000\n"
+"Last-Translator: Spiros Anthis <Unknown>\n"
"Language-Team: Greek <el at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -316,15 +316,15 @@ msgstr ""
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:75
msgid "Choose Primary Color"
-msgstr ""
+msgstr "Επιλέξτε Πρωτεύον Χρώμα"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:89
msgid "Choose Secondary Color"
-msgstr ""
+msgstr "Επιλέξτε Δευτερεύον Χρώμα"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:112
msgid "Choose Palette Color"
-msgstr ""
+msgstr "Επιλογή Χρώματος Παλέττας"
#: Pinta.Tools/RectangleSelectTool.cs:38
msgid "Rectangle Select"
@@ -350,7 +350,7 @@ msgstr ""
#: Pinta.Tools/MagicWandTool.cs:54
msgid "Click to select region of similar color."
-msgstr ""
+msgstr "Κλικ για επιλογή περιοχής ίδιου χρώματος"
#: Pinta.Tools/RectangleTool.cs:38
msgid "Rectangle"
@@ -394,7 +394,7 @@ msgstr ""
#: Pinta.Tools/GradientTool.cs:177
msgid "Radial Gradient"
-msgstr ""
+msgstr "Ακτινική Διαβάθμιση"
#: Pinta.Tools/GradientTool.cs:178
msgid "Conical Gradient"
@@ -406,11 +406,11 @@ msgstr ""
#: Pinta.Tools/FloodTool.cs:80
msgid "Contiguous"
-msgstr ""
+msgstr "Συνεχόμενη"
#: Pinta.Tools/FloodTool.cs:81
msgid "Global"
-msgstr ""
+msgstr "Καθολική"
#: Pinta.Tools/FloodTool.cs:92 Pinta.Tools/RecolorTool.cs:73
msgid "Tolerance"
@@ -425,10 +425,12 @@ msgid ""
"Left click to draw with primary color, right click to draw with secondary "
"color."
msgstr ""
+"Αριστερό κλικ για σχεδίαση με πρωτεύον χρώμα, δεξί κλικ για σχεδίαση με "
+"δευτερεύον χρώμα"
#: Pinta.Tools/PaintBrushTool.cs:64
msgid "Type"
-msgstr ""
+msgstr "Τύπος"
#: Pinta.Tools/PencilTool.cs:48 Pinta.Tools/ColorPickerTool.cs:120
msgid "Pencil"
@@ -553,7 +555,7 @@ msgstr ""
#: Pinta.Tools/EllipseTool.cs:38
msgid "Ellipse"
-msgstr ""
+msgstr "Έλλειψη"
#: Pinta.Tools/EllipseTool.cs:44
msgid ""
@@ -593,7 +595,7 @@ msgstr "Αριστερή στοίχιση"
#: Pinta.Tools/TextTool/TextTool.cs:143
msgid "Center Align"
-msgstr ""
+msgstr "Στοίχιση Στο Κέντρο"
#: Pinta.Tools/TextTool/TextTool.cs:150
msgid "Right Align"
@@ -601,11 +603,11 @@ msgstr "Δεξιά στοίχιση"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Στυλ Κειμένου"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
-msgstr ""
+msgstr "Κανονικό"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
@@ -637,7 +639,7 @@ msgstr ""
#: Pinta.Tools/ShapeTool.cs:131 Pinta.Tools/FreeformShapeTool.cs:71
msgid "Fill Style"
-msgstr ""
+msgstr "Στυλ Γεμίσματος"
#: Pinta.Tools/ShapeTool.cs:138 Pinta.Tools/FreeformShapeTool.cs:78
msgid "Outline Shape"
@@ -645,7 +647,7 @@ msgstr ""
#: Pinta.Tools/ShapeTool.cs:139 Pinta.Tools/FreeformShapeTool.cs:79
msgid "Fill Shape"
-msgstr ""
+msgstr "Σχήμα Γεμίσματος"
#: Pinta.Tools/ShapeTool.cs:140 Pinta.Tools/FreeformShapeTool.cs:80
msgid "Fill and Outline Shape"
@@ -657,11 +659,11 @@ msgstr ""
#: Pinta.Tools/Brushes/GridBrush.cs:38
msgid "Grid"
-msgstr ""
+msgstr "Πλέγμα"
#: Pinta.Tools/Brushes/SquaresBrush.cs:40
msgid "Squares"
-msgstr ""
+msgstr "Τετράγωνα"
#: Pinta.Tools/Brushes/SplatterBrush.cs:38
msgid "Splatter"
@@ -687,7 +689,7 @@ msgstr ""
#: Pinta.Tools/FreeformShapeTool.cs:53
msgid "Freeform Shape"
-msgstr ""
+msgstr "Ελεύθερο Σχήμα"
#: Pinta/MainWindow.cs:146 Pinta.Core/Actions/HelpActions.cs:53
msgid "About"
@@ -695,7 +697,7 @@ msgstr "Σχετικά με..."
#: Pinta/MainWindow.cs:371 Pinta/MainWindow.cs:387
msgid "..."
-msgstr ""
+msgstr "..."
#: Pinta/MainWindow.cs:456
msgid "_File"
@@ -781,7 +783,7 @@ msgstr "Ελεύθερα μετακινούμενη"
#: Pinta/DialogHandlers.cs:109
msgid "Take Screenshot"
-msgstr ""
+msgstr "Λήψη στιγμιότυπου οθόνης"
#: Pinta/DialogHandlers.cs:110
msgid "Delay before taking a screenshot (seconds):"
@@ -806,7 +808,7 @@ msgstr ""
#: Pinta/DialogHandlers.cs:194
msgid "New palette size:"
-msgstr ""
+msgstr "Νέο Μέγεθος Παλέττας"
#: Pinta/DialogHandlers.cs:223 Pinta.Core/Actions/EditActions.cs:70
msgid "Paste Into New Layer"
@@ -878,11 +880,11 @@ msgstr ""
#: Pinta/Dialogs/JpegCompressionDialog.cs:38
msgid "JPEG Quality"
-msgstr ""
+msgstr "Ποιότητα JPEG"
#: Pinta/Dialogs/JpegCompressionDialog.cs:46
msgid "Quality: "
-msgstr ""
+msgstr "Ποιότητα: "
#: Pinta/Dialogs/VersionInformationTabPage.cs:44
msgid "Title"
@@ -912,7 +914,7 @@ msgstr ""
" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Petros Kyladitis https://launchpad.net/~multipetros\n"
" Psychorat https://launchpad.net/~dougy-giro1\n"
-" spiros anthis https://launchpad.net/~sugaraddicted\n"
+" Spiros Anthis https://launchpad.net/~sugaraddicted\n"
" Νιάνιος Ρωμανός https://launchpad.net/~romanos-nianios"
#: Pinta/Dialogs/AboutDialog.cs:123
@@ -1102,7 +1104,7 @@ msgstr "Στείλτε αναφορά σφάλματος"
#: Pinta.Core/Actions/HelpActions.cs:52
msgid "Translate This Application"
-msgstr ""
+msgstr "Μεταφράστε Αυτή Την Εφαρμογή"
#: Pinta.Core/Actions/WindowActions.cs:45
msgid "Save All"
@@ -1110,7 +1112,7 @@ msgstr "Αποθήκευση όλων"
#: Pinta.Core/Actions/WindowActions.cs:46
msgid "Close All"
-msgstr ""
+msgstr "Κλείσιμο Όλων"
#: Pinta.Core/Actions/FileActions.cs:54
msgid "New..."
@@ -1204,7 +1206,7 @@ msgstr "Μετακίνηση Στρώματος Κάτω"
#: Pinta.Core/Actions/LayerActions.cs:74
msgid "Layer Properties..."
-msgstr ""
+msgstr "Ιδιότητες Επιπέδου"
#: Pinta.Core/Actions/LayerActions.cs:179
msgid "Import From File"
@@ -1238,7 +1240,7 @@ msgstr "Σμίκρυνση"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Καλύτερο Ταίριασμα"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1246,7 +1248,7 @@ msgstr "Εστίαση στην επιλογή"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Κανονικό Μέγεθος"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1308,7 +1310,7 @@ msgstr "Επικόλληση Σε Νέα Εικόνα"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Διαγραφή Επιλογής"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1324,7 +1326,7 @@ msgstr "Επιλογή Όλων"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Αποεπιλογή Όλων"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
@@ -1363,11 +1365,11 @@ msgstr ""
#: Pinta.Core/Actions/EditActions.cs:365
msgid "Paint.NET palette (*.txt)"
-msgstr ""
+msgstr "Παλέττα Paint.NET (*.txt)"
#: Pinta.Core/Actions/EditActions.cs:370
msgid "GIMP palette (*.gpl)"
-msgstr ""
+msgstr "Παλέττα Gimp (*.gpl)"
#: Pinta.Core/Classes/Document.cs:298
msgid "Layer"
@@ -1391,7 +1393,7 @@ msgstr ""
#: Pinta.Core/Classes/BaseTool.cs:242
msgid "Overwrite"
-msgstr ""
+msgstr "Αντικατάσταση"
#: Pinta.Core/Classes/BaseTool.cs:256
msgid "Antialiasing On"
@@ -1521,7 +1523,7 @@ msgstr "Μετατόπιση"
#: MedianEffect dialog
msgid "Pencil Tip Size"
-msgstr ""
+msgstr "Μέγεθος Μύτης Μολυβιού"
#: CloudsEffect dialog
msgid "Percentile"
diff --git a/po/messages-en_GB.po b/po/messages-en_GB.po
index a01b677..155fffc 100644
--- a/po/messages-en_GB.po
+++ b/po/messages-en_GB.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-11-04 20:01+0000\n"
-"Last-Translator: nsx98 <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:33+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: English (United Kingdom) <en_GB at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -925,6 +925,7 @@ msgstr ""
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" nsx98 https://launchpad.net/~nsx98"
#: Pinta/Dialogs/AboutDialog.cs:123
diff --git a/po/messages-es.po b/po/messages-es.po
index b013457..8954302 100644
--- a/po/messages-es.po
+++ b/po/messages-es.po
@@ -8,18 +8,18 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-07 22:06+0000\n"
+"PO-Revision-Date: 2011-03-08 10:04+0000\n"
"Last-Translator: Fitoschido <fitoschido at gmail.com>\n"
"Language-Team: Spanish <es at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
-msgstr "Autonivel"
+msgstr "Nivel automático"
#: Pinta.Effects/Adjustments/InvertColorsEffect.cs:26
msgid "Invert Colors"
@@ -150,7 +150,7 @@ msgstr "Fragmento"
#: Pinta.Effects/Effects/MotionBlurEffect.cs:34
#: Pinta.Effects/Effects/ZoomBlurEffect.cs:34
msgid "Blurs"
-msgstr "Difuminados"
+msgstr "Desenfoques"
#: Pinta.Effects/Effects/CloudsEffect.cs:30
msgid "Clouds"
@@ -194,11 +194,11 @@ msgstr "Detección de bordes"
#: Pinta.Effects/Effects/EmbossEffect.cs:34
#: Pinta.Effects/Effects/OutlineEffect.cs:37
msgid "Stylize"
-msgstr "Estilizado"
+msgstr "Estilizar"
#: Pinta.Effects/Effects/RadialBlurEffect.cs:26
msgid "Radial Blur"
-msgstr "Difuminado radial"
+msgstr "Desenfoque radial"
#: Pinta.Effects/Effects/FrostedGlassEffect.cs:26
msgid "Frosted Glass"
@@ -211,7 +211,7 @@ msgstr "Cristal congelado"
#: Pinta.Effects/Effects/BulgeEffect.cs:34
#: Pinta.Effects/Effects/TwistEffect.cs:34
msgid "Distort"
-msgstr "Distorsión"
+msgstr "Distorsionar"
#: Pinta.Effects/Effects/OilPaintingEffect.cs:26
msgid "Oil Painting"
@@ -241,15 +241,15 @@ msgstr "Boceto en tinta"
#: Pinta.Effects/Effects/MedianEffect.cs:29
msgid "Median"
-msgstr "Mediana"
+msgstr "Valor medio"
#: Pinta.Effects/Effects/EmbossEffect.cs:26
msgid "Emboss"
-msgstr "Realce"
+msgstr "Bajorrelieve"
#: Pinta.Effects/Effects/GaussianBlurEffect.cs:26
msgid "Gaussian Blur"
-msgstr "Difuminado gaussiano"
+msgstr "Desenfoque gaussiano"
#: Pinta.Effects/Effects/SharpenEffect.cs:26
msgid "Sharpen"
@@ -269,7 +269,7 @@ msgstr "Pixelar"
#: Pinta.Effects/Effects/MotionBlurEffect.cs:26
msgid "Motion Blur"
-msgstr "Difuminado de movimiento"
+msgstr "Desenfoque de movimiento"
#: Pinta.Effects/Effects/PolarInversionEffect.cs:26
msgid "Polar Inversion"
@@ -281,7 +281,7 @@ msgstr "Abultar"
#: Pinta.Effects/Effects/ZoomBlurEffect.cs:26
msgid "Zoom Blur"
-msgstr "Difuminado de zoom"
+msgstr "Desenfoque por zoom"
#: Pinta.Effects/Effects/PencilSketchEffect.cs:33
msgid "Pencil Sketch"
@@ -312,7 +312,7 @@ msgstr "Ruido aleatorio"
#: Pinta.Gui.Widgets/gtk-gui/Pinta.Gui.Widgets.ReseedButtonWidget.cs:65
msgid "Reseed"
-msgstr "Reiniciar semilla"
+msgstr "Reinicializar"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:75
msgid "Choose Primary Color"
@@ -414,7 +414,7 @@ msgstr "Modo de llenado"
#: Pinta.Tools/FloodTool.cs:80
msgid "Contiguous"
-msgstr "Contigua"
+msgstr "Contiguo"
#: Pinta.Tools/FloodTool.cs:81
msgid "Global"
@@ -449,8 +449,8 @@ msgid ""
"Left click to draw freeform, one-pixel wide lines with the primary color, "
"right click to use the secondary color."
msgstr ""
-"Clic con botón izquierdo para dibujar libremente líneas de un píxel de "
-"grosor con color primario, clic con botón derecho para usar color secundario."
+"Clic para dibujar libremente líneas de un píxel de grosor con color "
+"primario, clic con botón derecho para usar el color secundario."
#: Pinta.Tools/EllipseSelectTool.cs:38
msgid "Ellipse Select"
@@ -483,6 +483,8 @@ msgstr "Goma de borrar"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Clic para borrar a transparente, clic derecho para borrar con el color "
+"secundario. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -603,7 +605,7 @@ msgstr ""
#: Pinta.Tools/TextTool/TextTool.cs:77
msgid "Font"
-msgstr "Fuente"
+msgstr "Tipografía"
#: Pinta.Tools/TextTool/TextTool.cs:112
msgid "Bold"
@@ -631,7 +633,7 @@ msgstr "Alinear a la derecha"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Estilo de texto"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -639,19 +641,19 @@ msgstr "Normal"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Normal y contorneado"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Ancho de contorno"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Reducir tamaño de contorneado"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Aumentar tamaño de contorneado"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -671,7 +673,7 @@ msgstr "Estilo de llenado"
#: Pinta.Tools/ShapeTool.cs:138 Pinta.Tools/FreeformShapeTool.cs:78
msgid "Outline Shape"
-msgstr "Perfilar forma"
+msgstr "Contornear forma"
#: Pinta.Tools/ShapeTool.cs:139 Pinta.Tools/FreeformShapeTool.cs:79
msgid "Fill Shape"
@@ -679,7 +681,7 @@ msgstr "Rellenar forma"
#: Pinta.Tools/ShapeTool.cs:140 Pinta.Tools/FreeformShapeTool.cs:80
msgid "Fill and Outline Shape"
-msgstr "Rellenar y perfilar forma"
+msgstr "Rellenar y contornear forma"
#: Pinta.Tools/Brushes/CircleBrush.cs:38
msgid "Circles"
@@ -751,7 +753,7 @@ msgstr "_Capas"
#: Pinta/MainWindow.cs:464
msgid "_Adjustments"
-msgstr "A_justes"
+msgstr "Ajus_tes"
#: Pinta/MainWindow.cs:465
msgid "Effe_cts"
@@ -813,7 +815,7 @@ msgstr "Flotante"
#: Pinta/DialogHandlers.cs:109
msgid "Take Screenshot"
-msgstr "Tomar captura de pantalla"
+msgstr "Capturar pantalla"
#: Pinta/DialogHandlers.cs:110
msgid "Delay before taking a screenshot (seconds):"
@@ -822,7 +824,7 @@ msgstr "Tiempo de retraso antes de tomar la captura (segs):"
#: Pinta/DialogHandlers.cs:158
#, csharp-format
msgid "Save the changes to image \"{0}\" before closing?"
-msgstr "¿Guardar los cambios en la imagen \"{0}\" antes de cerrar?"
+msgstr "¿Guardar los cambios en la imagen «{0}» antes de cerrar?"
#: Pinta/DialogHandlers.cs:159
msgid "If you don't save, all changes will be permanently lost."
@@ -854,15 +856,15 @@ msgstr "Renombrar capa"
#: Pinta/DialogHandlers.cs:330
msgid "Hide Layer"
-msgstr "Ocultar Capa"
+msgstr "Ocultar capa"
#: Pinta/DialogHandlers.cs:330
msgid "Show Layer"
-msgstr "Mostrar Capa"
+msgstr "Mostrar capa"
#: Pinta/DialogHandlers.cs:335 Pinta/gtk-gui/Pinta.LayerPropertiesDialog.cs:44
msgid "Layer Properties"
-msgstr "Propiedades de capa"
+msgstr "Propiedades de la capa"
#: Pinta/DialogHandlers.cs:415 Pinta.Core/Actions/LayerActions.cs:156
msgid "Open Image File"
@@ -870,7 +872,7 @@ msgstr "Abrir archivo de imagen"
#: Pinta/DialogHandlers.cs:423
msgid "Image files"
-msgstr "Ficheros de imagen"
+msgstr "Archivos de imagen"
#: Pinta/DialogHandlers.cs:427 Pinta.Core/Actions/EditActions.cs:330
msgid "All files"
@@ -900,7 +902,7 @@ msgstr "Error"
#: Pinta/DialogHandlers.cs:633
#, csharp-format
msgid "A file named \"{0}\" already exists. Do you want to replace it?"
-msgstr "Un archivo llamado «{0}» ya existe. ¿Desea reemplazarlo?"
+msgstr "Ya existe un archivo llamado «{0}». ¿Quiere reemplazarlo?"
#: Pinta/DialogHandlers.cs:634
#, csharp-format
@@ -933,11 +935,11 @@ msgstr "Ruta"
#: Pinta/Dialogs/AboutDialog.cs:101
msgid "Contributors to this Release"
-msgstr "Contribuidores de esta versión"
+msgstr "Contribuyentes de esta versión"
#: Pinta/Dialogs/AboutDialog.cs:111
msgid "Previous Contributors"
-msgstr "Contribuidores anteriores"
+msgstr "Contribuyentes anteriores"
#: Pinta/Dialogs/AboutDialog.cs:120
msgid "translator-credits"
@@ -974,7 +976,7 @@ msgstr "Licencia"
#: Pinta/Dialogs/AboutPintaTabPage.cs:50
msgid "Released under the MIT X11 License."
-msgstr "Publicado bajo licencia MIT X11."
+msgstr "Publicado bajo la licencia MIT X11."
#: Pinta/Dialogs/AboutPintaTabPage.cs:57
msgid "Copyright"
@@ -982,7 +984,7 @@ msgstr "Copyright"
#: Pinta/Dialogs/AboutPintaTabPage.cs:57
msgid "by Pinta contributors"
-msgstr "de los contribuidores de Pinta"
+msgstr "de los contribuyentes de Pinta"
#: Pinta/gtk-gui/Pinta.LayerPropertiesDialog.cs:62
msgid "Name:"
@@ -1035,7 +1037,7 @@ msgstr "Altura:"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:245
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:216
msgid "Maintain aspect ratio"
-msgstr "Mantener las proporciones"
+msgstr "Mantener relación de aspecto"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:530
msgid "Anchor:"
@@ -1049,7 +1051,7 @@ msgstr "Redimensionar la imagen"
#: Pinta/gtk-gui/Pinta.NewImageDialog.cs:48
#: Pinta.Core/Managers/WorkspaceManager.cs:159
msgid "New Image"
-msgstr "Nueva imagen"
+msgstr "Imagen nueva"
#: Pinta/gtk-gui/Pinta.NewImageDialog.cs:58
msgid "New Image Size "
@@ -1131,7 +1133,7 @@ msgstr "Sitio web de Pinta"
#: Pinta.Core/Actions/HelpActions.cs:51
msgid "File a Bug"
-msgstr "Informar de un fallo"
+msgstr "Informar de un error"
#: Pinta.Core/Actions/HelpActions.cs:52
msgid "Translate This Application"
@@ -1192,7 +1194,7 @@ msgstr "Abrir"
#: Pinta.Core/Actions/LayerActions.cs:64
#: Pinta.Core/Actions/LayerActions.cs:283
msgid "Add New Layer"
-msgstr "Añadir nueva capa"
+msgstr "Añadir capa nueva"
#: Pinta.Core/Actions/LayerActions.cs:65
#: Pinta.Core/Actions/LayerActions.cs:266
@@ -1271,7 +1273,7 @@ msgstr "Reducir"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Ajuste óptimo"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1279,7 +1281,7 @@ msgstr "Ampliar a selección"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Tamaño normal"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1341,7 +1343,7 @@ msgstr "Pegar en una imagen nueva"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Eliminar selección"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1357,7 +1359,7 @@ msgstr "Seleccionar todo"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Deseleccionar todo"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
@@ -1431,11 +1433,11 @@ msgstr "Sobreescribir"
#: Pinta.Core/Classes/BaseTool.cs:256
msgid "Antialiasing On"
-msgstr "Suavizado habilitado"
+msgstr "Antialias activado"
#: Pinta.Core/Classes/BaseTool.cs:257
msgid "Antialiasing Off"
-msgstr "Suavizado deshabilitado"
+msgstr "Antialias desactivado"
#: Pinta.Core/ImageFormats/FormatDescriptor.cs:67
#, csharp-format
@@ -1467,7 +1469,7 @@ msgstr "Ángulo"
#: CloudsEffect dialog
msgid "Antialias"
-msgstr "Suavizado"
+msgstr "Antialias"
#: GlowEffect dialog
msgid "Blend Mode"
@@ -1618,7 +1620,7 @@ msgid ""
msgstr ""
"Use calidad baja para previsualizaciones, imágenes pequeñas y ángulos "
"cortos. Use calidad alta para trabajos finales, imágenes grandes y ángulos "
-"largos."
+"grandes."
#: RedEyeRemoveEffect dialog
msgid "Hint: For best results, first use selection tools to select each eye."
diff --git a/po/messages-eu.po b/po/messages-eu.po
index 6f28b0b..d5b9ca4 100644
--- a/po/messages-eu.po
+++ b/po/messages-eu.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-11 22:24+0000\n"
+"PO-Revision-Date: 2011-03-03 21:11+0000\n"
"Last-Translator: Asier Sarasua Garmendia <Unknown>\n"
"Language-Team: Basque <eu at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -482,6 +482,8 @@ msgstr "Borragoma"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Ezkerreko klik gardenera ezabatzeko, eskuineko klik bigarren mailako "
+"kolorera ezabatzeko. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -628,7 +630,7 @@ msgstr "Eskuinean lerrokatua"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Testu-estiloa"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -636,19 +638,19 @@ msgstr "Normala"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Normala eta ingerada"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Ingerada-zabalera"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Txikitu ingeradaren tamaina"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Handitu ingeradaren tamaina"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -942,7 +944,8 @@ msgstr "Aurretik ekarpenak egin dituztenak"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
-" Asier Sarasua Garmendia https://launchpad.net/~asarasuagarmendia"
+" Asier Sarasua Garmendia https://launchpad.net/~asarasuagarmendia\n"
+" Jonathan Pobst https://launchpad.net/~jpobst"
#: Pinta/Dialogs/AboutDialog.cs:123
msgid "Translated by:"
@@ -1267,7 +1270,7 @@ msgstr "Txikiagotu"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Egokiena"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1275,7 +1278,7 @@ msgstr "Zooma hautapenera"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Tamaina normala"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1337,7 +1340,7 @@ msgstr "Itsatsi irudi berrian"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Ezabatu hautapena"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1353,7 +1356,7 @@ msgstr "Hautatu dena"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Desautatu dena"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-fi.po b/po/messages-fi.po
index 9c76d06..9f55462 100644
--- a/po/messages-fi.po
+++ b/po/messages-fi.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-fo.po b/po/messages-fo.po
index ed2cbd1..d7bfe29 100644
--- a/po/messages-fo.po
+++ b/po/messages-fo.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-11-08 19:16+0000\n"
-"Last-Translator: Gunleif Joensen <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:23+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Føroyabólkurin\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
"Language: fo\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
@@ -919,7 +919,8 @@ msgstr "Fyrrverandi stuðlar"
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
-" Gunleif Joensen https://launchpad.net/~gunleif"
+" Gunleif Joensen https://launchpad.net/~gunleif\n"
+" Jonathan Pobst https://launchpad.net/~jpobst"
#: Pinta/Dialogs/AboutDialog.cs:123
msgid "Translated by:"
diff --git a/po/messages-fr.po b/po/messages-fr.po
index e1841f9..e2fd5af 100644
--- a/po/messages-fr.po
+++ b/po/messages-fr.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-03 13:02+0000\n"
+"PO-Revision-Date: 2011-03-03 17:57+0000\n"
"Last-Translator: fred.lavigne <fred.taff at gmail.com>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-ga.po b/po/messages-ga.po
index 72c084d..a3ef051 100644
--- a/po/messages-ga.po
+++ b/po/messages-ga.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-07 16:42+0000\n"
-"Last-Translator: Seanan <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:07+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Irish <ga at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-gl.po b/po/messages-gl.po
index aa1f3db..0bffd0a 100644
--- a/po/messages-gl.po
+++ b/po/messages-gl.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-11-03 18:37+0000\n"
-"Last-Translator: Manuel Xosé Lemos <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:24+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Galician <gl at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-he.po b/po/messages-he.po
index 6ec3c66..b31cd4a 100644
--- a/po/messages-he.po
+++ b/po/messages-he.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-07 09:03+0000\n"
+"PO-Revision-Date: 2011-03-03 05:53+0000\n"
"Last-Translator: Yaron <sh.yaron at gmail.com>\n"
"Language-Team: Hebrew <he at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -475,6 +475,8 @@ msgstr "מוחק"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"יש ללחוץ עם לחצן העבר השמאלי כדי למחוק לצבע שקוף, עם מקש ימני כדי למחוק לצבע "
+"המשני: "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -617,7 +619,7 @@ msgstr "יישור לימין"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "סגנון הטקסט"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -625,19 +627,19 @@ msgstr "רגיל"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "רגיל ומתאר"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "עובי המתאר"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "הקטנת עובי המתאר"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "עיבוי המתאר"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -1251,7 +1253,7 @@ msgstr "התרחקות"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "ההתאמה הטובה ביותר"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1259,7 +1261,7 @@ msgstr "תקריב על הבחירה"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "גודל רגיל"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1321,7 +1323,7 @@ msgstr "הדבקה לתמונה חדשה"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "מחיקת הבחירה"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1337,7 +1339,7 @@ msgstr "בחירת הכול"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "ביטול בחירת הכול"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-hr.po b/po/messages-hr.po
index 7be7419..1a620f2 100644
--- a/po/messages-hr.po
+++ b/po/messages-hr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-hu.po b/po/messages-hu.po
index 1f9fda7..a5ae332 100644
--- a/po/messages-hu.po
+++ b/po/messages-hu.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-26 20:12+0000\n"
-"Last-Translator: Vizion-HUN <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:51+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Hungarian <hu at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -915,6 +915,7 @@ msgstr ""
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Vizion-HUN https://launchpad.net/~vizler-k"
#: Pinta/Dialogs/AboutDialog.cs:123
diff --git a/po/messages-hy.po b/po/messages-hy.po
index e81f2b9..c901dbd 100644
--- a/po/messages-hy.po
+++ b/po/messages-hy.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-16 09:48+0000\n"
-"Last-Translator: Vardan Gevorgyan <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:17+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Armenian <hy at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -909,6 +909,7 @@ msgstr ""
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Vardan Gevorgyan https://launchpad.net/~vgevorgyan"
#: Pinta/Dialogs/AboutDialog.cs:123
diff --git a/po/messages-id.po b/po/messages-id.po
index 8a2a08d..7b7a81c 100644
--- a/po/messages-id.po
+++ b/po/messages-id.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-10-27 02:39+0000\n"
+"PO-Revision-Date: 2011-03-03 18:32+0000\n"
"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Indonesian <permataharahap at gmail.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
"X-Poedit-Country: INDONESIA\n"
"X-Poedit-Language: Indonesian\n"
diff --git a/po/messages-it.po b/po/messages-it.po
index 5e2bf3a..2d745e4 100644
--- a/po/messages-it.po
+++ b/po/messages-it.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-13 17:41+0000\n"
-"Last-Translator: Valeria De Luca <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:22+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Italian <it at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-ja.po b/po/messages-ja.po
index cc8f9ce..0c38565 100644
--- a/po/messages-ja.po
+++ b/po/messages-ja.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-18 05:29+0000\n"
-"Last-Translator: Yutaka Aiko <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:38+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Japanese <ja at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-ko.po b/po/messages-ko.po
index a34b03a..924c8e8 100644
--- a/po/messages-ko.po
+++ b/po/messages-ko.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-lt.po b/po/messages-lt.po
index e73a285..40581d2 100644
--- a/po/messages-lt.po
+++ b/po/messages-lt.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-nb.po b/po/messages-nb.po
index 4b9ca8a..9039558 100644
--- a/po/messages-nb.po
+++ b/po/messages-nb.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-nl.po b/po/messages-nl.po
index e64dea2..4d318ca 100644
--- a/po/messages-nl.po
+++ b/po/messages-nl.po
@@ -8,22 +8,22 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-27 01:07+0000\n"
-"Last-Translator: Harry Slieker <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:40+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Dutch <nl at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
-msgstr "Automatisch Niveaus Bepalen"
+msgstr "Automatisch niveaus bepalen"
#: Pinta.Effects/Adjustments/InvertColorsEffect.cs:26
msgid "Invert Colors"
-msgstr "Kleuren Omkeren"
+msgstr "Kleuren omkeren"
#: Pinta.Effects/Adjustments/LevelsEffect.cs:24
msgid "Levels"
@@ -57,11 +57,11 @@ msgstr "Tint / Verzadiging"
#: Pinta.Effects/gtk-gui/Pinta.Effects.LevelsDialog.cs:103
msgid "Levels Adjustment"
-msgstr "Niveaus Aanpassen"
+msgstr "Niveaus aanpassen"
#: Pinta.Effects/gtk-gui/Pinta.Effects.LevelsDialog.cs:130
msgid "Input Histogram"
-msgstr "Invoer Histogram"
+msgstr "Invoerhistogram"
#: Pinta.Effects/gtk-gui/Pinta.Effects.LevelsDialog.cs:172
msgid "Input"
@@ -73,7 +73,7 @@ msgstr "Uitvoer"
#: Pinta.Effects/gtk-gui/Pinta.Effects.LevelsDialog.cs:413
msgid "Output Histogram"
-msgstr "Uitvoer Histogram"
+msgstr "Uitvoerhistogram"
#: Pinta.Effects/gtk-gui/Pinta.Effects.LevelsDialog.cs:456
msgid "Auto"
@@ -127,11 +127,11 @@ msgstr "Blauw "
#: Pinta.Effects/gtk-gui/Pinta.Effects.CurvesDialog.cs:187
msgid "Tip: Right-click to remove control points."
-msgstr "Tip: Rechtermuisklik om controlepunten te verwijderen"
+msgstr "Tip: Rechtermuisklik om controlepunten te verwijderen."
#: Pinta.Effects/Effects/ReduceNoiseEffect.cs:29
msgid "Reduce Noise"
-msgstr "Ruis Verminderen"
+msgstr "Ruis verminderen"
#: Pinta.Effects/Effects/ReduceNoiseEffect.cs:37
#: Pinta.Effects/Effects/MedianEffect.cs:37
@@ -168,7 +168,7 @@ msgstr "Ontfocussen"
#: Pinta.Effects/Effects/RedEyeRemoveEffect.cs:29
msgid "Red Eye Removal"
-msgstr "Rode Ogen Verwijderen"
+msgstr "Rode ogen verwijderen"
#: Pinta.Effects/Effects/RedEyeRemoveEffect.cs:37
#: Pinta.Effects/Effects/GlowEffect.cs:39
@@ -179,7 +179,7 @@ msgstr "Foto"
#: Pinta.Effects/Effects/MandelbrotFractalEffect.cs:26
msgid "Mandelbrot Fractal"
-msgstr "Mandelbrot Fractal"
+msgstr "Mandelbrot fractal"
#: Pinta.Effects/Effects/GlowEffect.cs:31
msgid "Glow"
@@ -187,7 +187,7 @@ msgstr "Gloed"
#: Pinta.Effects/Effects/EdgeDetectEffect.cs:29
msgid "Edge Detect"
-msgstr "Randen Detecteren"
+msgstr "Randen detecteren"
#: Pinta.Effects/Effects/EdgeDetectEffect.cs:37
#: Pinta.Effects/Effects/ReliefEffect.cs:33
@@ -198,7 +198,7 @@ msgstr "Stileren"
#: Pinta.Effects/Effects/RadialBlurEffect.cs:26
msgid "Radial Blur"
-msgstr "Radiale Vervaging"
+msgstr "Radiale vervaging"
#: Pinta.Effects/Effects/FrostedGlassEffect.cs:26
msgid "Frosted Glass"
@@ -225,11 +225,11 @@ msgstr "Artistiek"
#: Pinta.Effects/Effects/JuliaFractalEffect.cs:26
msgid "Julia Fractal"
-msgstr "Julia Fractal"
+msgstr "Julia-fractal"
#: Pinta.Effects/Effects/SoftenPortraitEffect.cs:59
msgid "Soften Portrait"
-msgstr "Portret Verzachten"
+msgstr "\"Portret verzachten"
#: Pinta.Effects/Effects/ReliefEffect.cs:45
msgid "Relief"
@@ -249,7 +249,7 @@ msgstr "Emboss"
#: Pinta.Effects/Effects/GaussianBlurEffect.cs:26
msgid "Gaussian Blur"
-msgstr "Gaussians Vervagen"
+msgstr "Gaussiaans vervagen"
#: Pinta.Effects/Effects/SharpenEffect.cs:26
msgid "Sharpen"
@@ -257,7 +257,7 @@ msgstr "Verscherpen"
#: Pinta.Effects/Effects/AddNoiseEffect.cs:30
msgid "Add Noise"
-msgstr "Ruis Toevoegen"
+msgstr "Ruis toevoegen"
#: Pinta.Effects/Effects/TileEffect.cs:26
msgid "Tile Reflection"
@@ -273,7 +273,7 @@ msgstr "Bewegingsvervaging"
#: Pinta.Effects/Effects/PolarInversionEffect.cs:26
msgid "Polar Inversion"
-msgstr "Polaire Inversie"
+msgstr "Polaire inversie"
#: Pinta.Effects/Effects/BulgeEffect.cs:26
msgid "Bulge"
@@ -308,7 +308,7 @@ msgstr "label"
#: Pinta.Gui.Widgets/gtk-gui/Pinta.Gui.Widgets.ReseedButtonWidget.cs:38
msgid "Random Noise"
-msgstr "Willekeurige Ruis"
+msgstr "Willekeurige ruis"
#: Pinta.Gui.Widgets/gtk-gui/Pinta.Gui.Widgets.ReseedButtonWidget.cs:65
msgid "Reseed"
@@ -316,15 +316,15 @@ msgstr "Hergenereren"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:75
msgid "Choose Primary Color"
-msgstr "Primaire Kleur Kiezen"
+msgstr "Primaire kleur kiezen"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:89
msgid "Choose Secondary Color"
-msgstr "Secundaire Kleur Kiezen"
+msgstr "Secundaire kleur kiezen"
#: Pinta.Gui.Widgets/Widgets/ColorPaletteWidget.cs:112
msgid "Choose Palette Color"
-msgstr "Paletkleur Kiezen"
+msgstr "Paletkleur kiezen"
#: Pinta.Tools/RectangleSelectTool.cs:38
msgid "Rectangle Select"
@@ -368,7 +368,7 @@ msgstr ""
#: Pinta.Tools/MoveSelectionTool.cs:42
msgid "Move Selection"
-msgstr "Selectie Verplaatsen"
+msgstr "Selectie verplaatsen"
#: Pinta.Tools/MoveSelectionTool.cs:48
msgid "Drag the selection to move selection outline."
@@ -388,23 +388,23 @@ msgstr ""
#: Pinta.Tools/GradientTool.cs:174
msgid "Linear Gradient"
-msgstr "Lineaire Gradiënt"
+msgstr "Lineaire gradiënt"
#: Pinta.Tools/GradientTool.cs:175
msgid "Linear Reflected Gradient"
-msgstr "Lineair Gereflecteerde Gradiënt"
+msgstr "Lineair gereflecteerde gradiënt"
#: Pinta.Tools/GradientTool.cs:176
msgid "Linear Diamond Gradient"
-msgstr "Lineaire Diamant Gradiënt"
+msgstr "Lineaire diamantgradiënt"
#: Pinta.Tools/GradientTool.cs:177
msgid "Radial Gradient"
-msgstr "Radiale Gradiënt"
+msgstr "Radiale gradiënt"
#: Pinta.Tools/GradientTool.cs:178
msgid "Conical Gradient"
-msgstr "Conische Gradiënt"
+msgstr "Conische gradiënt"
#: Pinta.Tools/FloodTool.cs:73
msgid "Flood Mode"
@@ -479,6 +479,8 @@ msgstr "Gum"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Linkermuisklik om te verwijderen en transparant te maken, rechtermuisklik om "
+"te verwijderen en secundaire kleur te gebruiken. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -543,7 +545,7 @@ msgstr "Hoekradius van rechthoek vergroten"
#: Pinta.Core/HistoryItems/FinishPixelsHistoryItem.cs:64
#: Pinta.Core/Actions/EditActions.cs:255
msgid "Move Selected Pixels"
-msgstr "Geselecteerde Pixels Verplaatsen"
+msgstr "Geselecteerde pixels verplaatsen"
#: Pinta.Tools/MoveSelectedTool.cs:48
msgid "Drag the selection to move selected content."
@@ -609,7 +611,7 @@ msgstr "Onderstreept"
#: Pinta.Tools/TextTool/TextTool.cs:135
msgid "Left Align"
-msgstr "Links Uitlijnen"
+msgstr "Links uitlijnen"
#: Pinta.Tools/TextTool/TextTool.cs:143
msgid "Center Align"
@@ -617,11 +619,11 @@ msgstr "Centreren"
#: Pinta.Tools/TextTool/TextTool.cs:150
msgid "Right Align"
-msgstr "Rechts Uitlijnen"
+msgstr "Rechts uitlijnen"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Tekststijl"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -629,19 +631,19 @@ msgstr "Normaal"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Standaard en omlijnd"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Lijndikte"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Verklein lijndikte"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Vergroot lijndikte"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -649,15 +651,15 @@ msgstr "Penceeldikte"
#: Pinta.Tools/ShapeTool.cs:104 Pinta.Tools/BaseBrushTool.cs:75
msgid "Decrease brush size"
-msgstr "Penceeldikte Verkleinen"
+msgstr "Penceeldikte verkleinen"
#: Pinta.Tools/ShapeTool.cs:118 Pinta.Tools/BaseBrushTool.cs:89
msgid "Increase brush size"
-msgstr "Penceeldikte Vergroten"
+msgstr "Penceeldikte vergroten"
#: Pinta.Tools/ShapeTool.cs:131 Pinta.Tools/FreeformShapeTool.cs:71
msgid "Fill Style"
-msgstr "Vulling Stijl"
+msgstr "Vullingstijl"
#: Pinta.Tools/ShapeTool.cs:138 Pinta.Tools/FreeformShapeTool.cs:78
msgid "Outline Shape"
@@ -669,7 +671,7 @@ msgstr "Opvullen"
#: Pinta.Tools/ShapeTool.cs:140 Pinta.Tools/FreeformShapeTool.cs:80
msgid "Fill and Outline Shape"
-msgstr "Opvullen en Omlijnen"
+msgstr "Opvullen en omlijnen"
#: Pinta.Tools/Brushes/CircleBrush.cs:38
msgid "Circles"
@@ -709,7 +711,7 @@ msgstr "Klik en sleep om een selectie te tekenen."
#: Pinta.Tools/FreeformShapeTool.cs:53
msgid "Freeform Shape"
-msgstr "Vrije Vorm"
+msgstr "Vrije vorm"
#: Pinta/MainWindow.cs:146 Pinta.Core/Actions/HelpActions.cs:53
msgid "About"
@@ -791,7 +793,7 @@ msgstr "Dock"
#: Pinta/DockLibrary/DockItemContainer.cs:194
#: Pinta/DockLibrary/DockItem.cs:502
msgid "Auto Hide"
-msgstr "Automatisch Verbergen"
+msgstr "Automatisch verbergen"
#: Pinta/DockLibrary/DockItem.cs:485
msgid "Dockable"
@@ -803,7 +805,7 @@ msgstr "Zwevend"
#: Pinta/DialogHandlers.cs:109
msgid "Take Screenshot"
-msgstr "Schermafdruk Maken"
+msgstr "Schermafdruk maken"
#: Pinta/DialogHandlers.cs:110
msgid "Delay before taking a screenshot (seconds):"
@@ -824,15 +826,15 @@ msgstr "Sluiten zonder opslaan"
#: Pinta/DialogHandlers.cs:193
msgid "Resize Palette"
-msgstr "Pas Paletgrootte aan"
+msgstr "Paletgrootte aanpassen"
#: Pinta/DialogHandlers.cs:194
msgid "New palette size:"
-msgstr "Nieuw Paletgrootte:"
+msgstr "Nieuw paletgrootte"
#: Pinta/DialogHandlers.cs:223 Pinta.Core/Actions/EditActions.cs:70
msgid "Paste Into New Layer"
-msgstr "Plak In Nieuwe Laag"
+msgstr "In nieuwe laag plakken"
#: Pinta/DialogHandlers.cs:320
msgid "Layer Opacity"
@@ -840,15 +842,15 @@ msgstr "Laagdekking"
#: Pinta/DialogHandlers.cs:325
msgid "Rename Layer"
-msgstr "Laag Hernoemen"
+msgstr "Laag hernoemen"
#: Pinta/DialogHandlers.cs:330
msgid "Hide Layer"
-msgstr "Laag Verbergen"
+msgstr "Laag verbergen"
#: Pinta/DialogHandlers.cs:330
msgid "Show Layer"
-msgstr "Laag Tonen"
+msgstr "Laag tonen"
#: Pinta/DialogHandlers.cs:335 Pinta/gtk-gui/Pinta.LayerPropertiesDialog.cs:44
msgid "Layer Properties"
@@ -856,7 +858,7 @@ msgstr "Laageigenschappen"
#: Pinta/DialogHandlers.cs:415 Pinta.Core/Actions/LayerActions.cs:156
msgid "Open Image File"
-msgstr "Open Afbeeldingsbestand"
+msgstr "Afbeeldingsbestand openen"
#: Pinta/DialogHandlers.cs:423
msgid "Image files"
@@ -864,7 +866,7 @@ msgstr "Afbeeldingsbestanden"
#: Pinta/DialogHandlers.cs:427 Pinta.Core/Actions/EditActions.cs:330
msgid "All files"
-msgstr "Alle Bestanden"
+msgstr "Alle bestanden"
#: Pinta/DialogHandlers.cs:480
msgid "Paste cancelled"
@@ -876,7 +878,7 @@ msgstr "Het klembord bevat geen afbeelding"
#: Pinta/DialogHandlers.cs:514
msgid "Save Image File"
-msgstr "Afbeelding Opslaan"
+msgstr "Afbeelding opslaan"
#: Pinta/DialogHandlers.cs:612
msgid "Pinta does not support saving images in this file format."
@@ -901,7 +903,7 @@ msgstr ""
#: Pinta/Dialogs/JpegCompressionDialog.cs:38
msgid "JPEG Quality"
-msgstr "JPEG Kwaliteit"
+msgstr "JPEG-kwaliteit"
#: Pinta/Dialogs/JpegCompressionDialog.cs:46
msgid "Quality: "
@@ -926,13 +928,14 @@ msgstr "Bijdragen aan deze release"
#: Pinta/Dialogs/AboutDialog.cs:111
msgid "Previous Contributors"
-msgstr "Voorgaande Bijdragen"
+msgstr "Voorgaande bijdragen"
#: Pinta/Dialogs/AboutDialog.cs:120
msgid "translator-credits"
msgstr ""
"Launchpad Contributions:\n"
" Harry Slieker https://launchpad.net/~harryslieker\n"
+" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Tijmen Rekmans https://launchpad.net/~tijmenr"
#: Pinta/Dialogs/AboutDialog.cs:123
@@ -986,17 +989,17 @@ msgstr "Dekking:"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:86
#: Pinta.Core/Classes/Document.cs:612
msgid "Resize Canvas"
-msgstr "Canvasgrootte Aanpassen"
+msgstr "Canvasgrootte aanpassen"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:105
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:75
msgid "By percentage:"
-msgstr "Met Percentage:"
+msgstr "Met percentage:"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:146
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:117
msgid "By absolute size:"
-msgstr "Met Absolute Grootte"
+msgstr "Tot absolute grootte"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:167
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:138
@@ -1022,7 +1025,7 @@ msgstr "Hoogte:"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:245
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:216
msgid "Maintain aspect ratio"
-msgstr "Verhoudingen behouden"
+msgstr "Verhouding handhaven"
#: Pinta/gtk-gui/Pinta.ResizeCanvasDialog.cs:530
msgid "Anchor:"
@@ -1031,16 +1034,16 @@ msgstr "Vastzetten:"
#: Pinta/gtk-gui/Pinta.ResizeImageDialog.cs:56
#: Pinta.Core/HistoryItems/ResizeHistoryItem.cs:43
msgid "Resize Image"
-msgstr "Formaat Wijzigen"
+msgstr "Formaat wijzigen"
#: Pinta/gtk-gui/Pinta.NewImageDialog.cs:48
#: Pinta.Core/Managers/WorkspaceManager.cs:159
msgid "New Image"
-msgstr "Nieuwe Afbeelding"
+msgstr "Nieuwe afbeelding"
#: Pinta/gtk-gui/Pinta.NewImageDialog.cs:58
msgid "New Image Size "
-msgstr "Nieuwe Afbeeldingsgrootte "
+msgstr "Nieuwe afbeeldingsgrootte "
#: Pinta/Main.cs:68
msgid "number of threads to use for rendering"
@@ -1052,12 +1055,12 @@ msgstr "OptieNaam"
#: Pinta.Core/Managers/LivePreviewManager.cs:220
msgid "Rendering Effect"
-msgstr "Render Effect"
+msgstr "Render-effect"
#: Pinta.Core/Managers/WorkspaceManager.cs:91
#, csharp-format
msgid "Unsaved Image {0}"
-msgstr "Niet Opgeslagen Bestand {0}"
+msgstr "Niet opgeslagen bestand {0}"
#: Pinta.Core/Managers/WorkspaceManager.cs:150
msgid "Background"
@@ -1065,7 +1068,7 @@ msgstr "Achtergrond"
#: Pinta.Core/Managers/WorkspaceManager.cs:177
msgid "Open Image"
-msgstr "Afbeelding Openen"
+msgstr "Afbeelding openen"
#: Pinta.Core/Managers/WorkspaceManager.cs:184
#, csharp-format
@@ -1084,49 +1087,49 @@ msgstr "Roteer 180°"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:54
msgid "Flip Image Horizontal"
-msgstr "Spiegel Afbeelding Horizontaal"
+msgstr "Afbeelding horizontaal spiegelen"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:58
msgid "Flip Image Vertical"
-msgstr "Spiegel Afbeelding Verticaal"
+msgstr "Afbeelding verticaal spiegelen"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:62
#: Pinta.Core/Actions/ImageActions.cs:63
msgid "Rotate 90° Clockwise"
-msgstr "Roteer 90° Rechtsom"
+msgstr "Roteer 90° rechtsom"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:66
#: Pinta.Core/Actions/ImageActions.cs:64
msgid "Rotate 90° Counter-Clockwise"
-msgstr "Roteer 90° Linksom"
+msgstr "Roteer 90° linksom"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:79
msgid "Flip Layer Horizontal"
-msgstr "Spiegel Laag Horizontaal"
+msgstr "Laag horizontaal spiegelen"
#: Pinta.Core/HistoryItems/InvertHistoryItem.cs:83
msgid "Flip Layer Vertical"
-msgstr "Spiegel Laag Verticaal"
+msgstr "Laag verticaal spiegelen"
#: Pinta.Core/HistoryItems/FinishPixelsHistoryItem.cs:43
msgid "Finish Pixels"
-msgstr "Pixels Beëindigen"
+msgstr "Pixels beëindigen"
#: Pinta.Core/Actions/HelpActions.cs:50
msgid "Pinta Website"
-msgstr "Pinta Website"
+msgstr "Pinta website"
#: Pinta.Core/Actions/HelpActions.cs:51
msgid "File a Bug"
-msgstr "Rapporteer een Bug"
+msgstr "Een bug rapporteren"
#: Pinta.Core/Actions/HelpActions.cs:52
msgid "Translate This Application"
-msgstr "Vertaal Deze Applicatie"
+msgstr "Deze applicatie vertalen"
#: Pinta.Core/Actions/WindowActions.cs:45
msgid "Save All"
-msgstr "Alles opslaan"
+msgstr "Sla alles op"
#: Pinta.Core/Actions/WindowActions.cs:46
msgid "Close All"
@@ -1138,7 +1141,7 @@ msgstr "Nieuw..."
#: Pinta.Core/Actions/FileActions.cs:55
msgid "New Screenshot..."
-msgstr "Nieuwe Schermafdruk..."
+msgstr "Nieuwe schermafdruk"
#: Pinta.Core/Actions/FileActions.cs:56 Pinta.Core/Actions/EditActions.cs:78
msgid "Open..."
@@ -1146,7 +1149,7 @@ msgstr "Openen..."
#: Pinta.Core/Actions/FileActions.cs:57
msgid "Open Recent"
-msgstr "Open Recent"
+msgstr "Recent openen"
#: Pinta.Core/Actions/FileActions.cs:64
msgid "Close"
@@ -1158,7 +1161,7 @@ msgstr "Opslaan"
#: Pinta.Core/Actions/FileActions.cs:66 Pinta.Core/Actions/EditActions.cs:79
msgid "Save As..."
-msgstr "Opslaan Als..."
+msgstr "Opslaan als..."
#: Pinta.Core/Actions/FileActions.cs:67
msgid "Print"
@@ -1179,34 +1182,34 @@ msgstr "Openen"
#: Pinta.Core/Actions/LayerActions.cs:64
#: Pinta.Core/Actions/LayerActions.cs:283
msgid "Add New Layer"
-msgstr "Voeg Nieuwe Laag Toe"
+msgstr "Nieuwe laag toevoegen"
#: Pinta.Core/Actions/LayerActions.cs:65
#: Pinta.Core/Actions/LayerActions.cs:266
msgid "Delete Layer"
-msgstr "Laag Verwijderen"
+msgstr "Laag verwijderen"
#: Pinta.Core/Actions/LayerActions.cs:66
#: Pinta.Core/Actions/LayerActions.cs:257
msgid "Duplicate Layer"
-msgstr "Laag Dupliceren"
+msgstr "Laag dupliceren"
#: Pinta.Core/Actions/LayerActions.cs:67
#: Pinta.Core/Actions/LayerActions.cs:235
msgid "Merge Layer Down"
-msgstr "Laag Omlaag Samenvoegen"
+msgstr "Laag omlaag samenvoegen"
#: Pinta.Core/Actions/LayerActions.cs:68
msgid "Import from File..."
-msgstr "Importeren Uit Bestand..."
+msgstr "Uit bestand importeren..."
#: Pinta.Core/Actions/LayerActions.cs:69 Pinta.Core/Actions/ImageActions.cs:61
msgid "Flip Horizontal"
-msgstr "Spiegel Horizontaal"
+msgstr "Horizontaal spiegelen"
#: Pinta.Core/Actions/LayerActions.cs:70 Pinta.Core/Actions/ImageActions.cs:62
msgid "Flip Vertical"
-msgstr "Spiegel Verticaal"
+msgstr "Verticaal spiegelen"
#: Pinta.Core/Actions/LayerActions.cs:71
msgid "Rotate / Zoom"
@@ -1215,16 +1218,16 @@ msgstr "Roteer / Zoom"
#: Pinta.Core/Actions/LayerActions.cs:72
#: Pinta.Core/Actions/LayerActions.cs:213
msgid "Move Layer Up"
-msgstr "Laag Omhoog Verplaatsen"
+msgstr "Laag omhoog verplaatsen"
#: Pinta.Core/Actions/LayerActions.cs:73
#: Pinta.Core/Actions/LayerActions.cs:224
msgid "Move Layer Down"
-msgstr "Laag Omlaag Verplaatsen"
+msgstr "Laag omlaag verplaatsen"
#: Pinta.Core/Actions/LayerActions.cs:74
msgid "Layer Properties..."
-msgstr "Laag Eigenschappen..."
+msgstr "Laageigenschappen..."
#: Pinta.Core/Actions/LayerActions.cs:179
msgid "Import From File"
@@ -1233,11 +1236,11 @@ msgstr "Importeer uit bestand"
#: Pinta.Core/Actions/ImageActions.cs:58
#: Pinta.Core/Actions/ImageActions.cs:181
msgid "Crop to Selection"
-msgstr "Bijsnijden tot Selectie"
+msgstr "Tot selectie bijsnijden"
#: Pinta.Core/Actions/ImageActions.cs:59
msgid "Resize..."
-msgstr "Formaat Wijzigen"
+msgstr "Formaat wijzigen..."
#: Pinta.Core/Actions/ImageActions.cs:60
msgid "Canvas Size..."
@@ -1246,7 +1249,7 @@ msgstr "Canvasgrootte..."
#: Pinta.Core/Actions/ImageActions.cs:66
#: Pinta.Core/Actions/ImageActions.cs:127
msgid "Flatten"
-msgstr "Plat Maken"
+msgstr "Plat maken"
#: Pinta.Core/Actions/ViewActions.cs:63
msgid "Zoom In"
@@ -1258,15 +1261,15 @@ msgstr "Uitzoomen"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Passend"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
-msgstr "Zoom naar Selectie"
+msgstr "Naar selectie zoomen"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Standaardgrootte"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1294,7 +1297,7 @@ msgstr "Centimeters"
#: Pinta.Core/Actions/ViewActions.cs:74
msgid "Fullscreen"
-msgstr "Volledig Scherm"
+msgstr "Volledig scherm"
#: Pinta.Core/Actions/ViewActions.cs:114
msgid "Ruler Units"
@@ -1308,7 +1311,7 @@ msgstr "Venster"
#: Pinta.Core/Actions/EditActions.cs:65
msgid "Undo"
-msgstr "Ongedaan Maken"
+msgstr "Ongedaan maken"
#: Pinta.Core/Actions/EditActions.cs:66
msgid "Redo"
@@ -1324,39 +1327,39 @@ msgstr "Kopiëren"
#: Pinta.Core/Actions/EditActions.cs:71
msgid "Paste Into New Image"
-msgstr "Plak Als Nieuwe Afbeelding"
+msgstr "Als nieuwe afbeelding plakken"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Selectie verwijderen"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
-msgstr "Selectie Vullen"
+msgstr "Selectie vullen"
#: Pinta.Core/Actions/EditActions.cs:74
msgid "Invert Selection"
-msgstr "Selectie Omkeren"
+msgstr "Selectie omkeren"
#: Pinta.Core/Actions/EditActions.cs:75 Pinta.Core/Actions/EditActions.cs:181
msgid "Select All"
-msgstr "Alles Selecteren"
+msgstr "Alles selecteren"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Alles deselecteren"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
-msgstr "Naar Standaard Terugzetten"
+msgstr "Naar standaard terugzetten"
#: Pinta.Core/Actions/EditActions.cs:81
msgid "Set Number of Colors"
-msgstr "Aantal Kleuren Instellen"
+msgstr "Aantal kleuren instellen"
#: Pinta.Core/Actions/EditActions.cs:212
msgid "Erase Selection"
-msgstr "Wis Selectie"
+msgstr "Wis selectie"
#: Pinta.Core/Actions/EditActions.cs:221
msgid "Deselect"
@@ -1364,7 +1367,7 @@ msgstr "Deselecteren"
#: Pinta.Core/Actions/EditActions.cs:319
msgid "Open Palette File"
-msgstr "Paletbestand Openen"
+msgstr "Paletbestand openen"
#: Pinta.Core/Actions/EditActions.cs:326
msgid "Palette files (*.txt, *.gpl)"
@@ -1381,7 +1384,7 @@ msgstr ""
#: Pinta.Core/Actions/EditActions.cs:359
msgid "Save Palette File"
-msgstr "Paletbestand Opslaan"
+msgstr "Paletbestand opslaan"
#: Pinta.Core/Actions/EditActions.cs:365
msgid "Paint.NET palette (*.txt)"
@@ -1409,7 +1412,7 @@ msgstr "Sneltoets"
#: Pinta.Core/Classes/BaseTool.cs:241
msgid "Normal Blending"
-msgstr "Standaard Menging"
+msgstr "Standaard menging"
#: Pinta.Core/Classes/BaseTool.cs:242
msgid "Overwrite"
@@ -1417,11 +1420,11 @@ msgstr "Overschrijven"
#: Pinta.Core/Classes/BaseTool.cs:256
msgid "Antialiasing On"
-msgstr "Antialias Aan"
+msgstr "Antialias aan"
#: Pinta.Core/Classes/BaseTool.cs:257
msgid "Antialiasing Off"
-msgstr "Antialias Uit"
+msgstr "Antialias uit"
#: Pinta.Core/ImageFormats/FormatDescriptor.cs:67
#, csharp-format
@@ -1523,7 +1526,7 @@ msgstr "Fragmenten"
#: TileEffect dialog
msgid "Ink Outline"
-msgstr "Inkt Omlijning"
+msgstr "Inktomlijning"
#: AddNoiseEffect dialog
#: OutlineEffect dialog
diff --git a/po/messages-pl.po b/po/messages-pl.po
index ebf8fc1..4f9c0e0 100644
--- a/po/messages-pl.po
+++ b/po/messages-pl.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-31 06:23+0000\n"
-"Last-Translator: jacek <Unknown>\n"
+"PO-Revision-Date: 2011-03-20 20:12+0000\n"
+"Last-Translator: Patryk Wychowaniec <patryk1303 at gmail.com>\n"
"Language-Team: Polish <pl at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -634,7 +634,7 @@ msgstr "Wyrównanie do prawej"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Styl napisu"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -1284,7 +1284,7 @@ msgstr "Pomniejsz"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Dopasuj"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1354,7 +1354,7 @@ msgstr "Wklej do nowego obrazu"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Usuń zaznaczone"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
diff --git a/po/messages-pt.po b/po/messages-pt.po
index 597348a..e3b1282 100644
--- a/po/messages-pt.po
+++ b/po/messages-pt.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-17 15:21+0000\n"
-"Last-Translator: Sérgio Marques <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:38+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: European Portuguese <pt_BR at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-pt_BR.po b/po/messages-pt_BR.po
index 597cbf0..5fbfdd2 100644
--- a/po/messages-pt_BR.po
+++ b/po/messages-pt_BR.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-16 19:51+0000\n"
+"PO-Revision-Date: 2011-03-06 02:21+0000\n"
"Last-Translator: José Humberto Melo <Unknown>\n"
"Language-Team: Brazilian Portuguese <pt_BR at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -23,7 +23,7 @@ msgstr "Níveis Automáticos"
#: Pinta.Effects/Adjustments/InvertColorsEffect.cs:26
msgid "Invert Colors"
-msgstr "Inverter cores"
+msgstr "Inverter as Cores"
#: Pinta.Effects/Adjustments/LevelsEffect.cs:24
msgid "Levels"
@@ -482,6 +482,8 @@ msgstr "Borracha"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Botão esquerdo do mouse para apagar a transparência, botão direito para "
+"apagar a cor secundária. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -628,7 +630,7 @@ msgstr "Alinhar à direita"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Estilo do Texto"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -636,19 +638,19 @@ msgstr "Normal"
#: Pinta.Tools/TextTool/TextTool.cs:170
msgid "Normal and Outline"
-msgstr ""
+msgstr "Normal e Contorno"
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "Largura do contorno"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "Diminuir o tamanho do contorno"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "Aumentar o tamanho do contorno"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -1279,7 +1281,7 @@ msgstr "Afastar"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Melhor Ajuste"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1287,7 +1289,7 @@ msgstr "Ampliar para Seleção"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Tamanho Normal"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1349,7 +1351,7 @@ msgstr "Colar em Nova Imagem"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Apagar Seleção"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1365,7 +1367,7 @@ msgstr "Selecionar tudo"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Desmarcar Todos"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-ro.po b/po/messages-ro.po
index 88cdb28..0d07bbf 100644
--- a/po/messages-ro.po
+++ b/po/messages-ro.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-26 22:09+0000\n"
+"PO-Revision-Date: 2011-03-03 17:33+0000\n"
"Last-Translator: ciplogic <ciprian.mustiata at yahoo.com>\n"
"Language-Team: Romanian <ro at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-ru.po b/po/messages-ru.po
index 6eab194..69082c3 100644
--- a/po/messages-ru.po
+++ b/po/messages-ru.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-10 15:41+0000\n"
-"Last-Translator: Nikita Putko <Unknown>\n"
+"PO-Revision-Date: 2011-03-29 16:23+0000\n"
+"Last-Translator: jeder <Unknown>\n"
"Language-Team: Russian <ru at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -482,6 +482,8 @@ msgstr "Ластик"
msgid ""
"Left click to erase to transparent, right click to erase to secondary color. "
msgstr ""
+"Левая кнопка мыши стирает до прозрачного фона, правая кнопка стирает цветом "
+"фона. "
#: Pinta.Tools/PanTool.cs:38
msgid "Pan"
@@ -627,7 +629,7 @@ msgstr "По правому краю"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "Стиль текста"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -944,6 +946,8 @@ msgstr ""
" Jonathan Pobst https://launchpad.net/~jpobst\n"
" Maia Kozheva https://launchpad.net/~sikon\n"
" Nikita Putko https://launchpad.net/~ktototam98\n"
+" Stepan Kislan https://launchpad.net/~stepa87\n"
+" jeder https://launchpad.net/~i-jeder\n"
" ma$terok https://launchpad.net/~m-shein"
#: Pinta/Dialogs/AboutDialog.cs:123
@@ -1269,7 +1273,7 @@ msgstr "Мельче"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "Уместить в окне"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1277,11 +1281,11 @@ msgstr "По размеру выделения"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "Исходный размер"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
-msgstr "Панель инструментов"
+msgstr "Стандартная панель"
#: Pinta.Core/Actions/ViewActions.cs:69
msgid "Pixel Grid"
@@ -1339,7 +1343,7 @@ msgstr "Вставить как новое изображение"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "Удалить выделение"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1355,7 +1359,7 @@ msgstr "Выделить всё"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "Снять выбор"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-sk.po b/po/messages-sk.po
index dc92f1d..0fd94c3 100644
--- a/po/messages-sk.po
+++ b/po/messages-sk.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-sl.po b/po/messages-sl.po
index 588db9a..f1ae5ff 100644
--- a/po/messages-sl.po
+++ b/po/messages-sl.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -720,7 +720,7 @@ msgstr "O programu"
#: Pinta/MainWindow.cs:371 Pinta/MainWindow.cs:387
msgid "..."
-msgstr "..."
+msgstr " ..."
#: Pinta/MainWindow.cs:456
msgid "_File"
diff --git a/po/messages-sr.po b/po/messages-sr.po
index 4fe9538..eb6b029 100644
--- a/po/messages-sr.po
+++ b/po/messages-sr.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-sv.po b/po/messages-sv.po
index 7462fa3..af7754a 100644
--- a/po/messages-sv.po
+++ b/po/messages-sv.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-20 18:46+0000\n"
-"Last-Translator: Phoenix <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:44+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Swedish <sv at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-th.po b/po/messages-th.po
index 96b663a..92c29b8 100644
--- a/po/messages-th.po
+++ b/po/messages-th.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-tr.po b/po/messages-tr.po
index e9c43c5..48c63bb 100644
--- a/po/messages-tr.po
+++ b/po/messages-tr.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-02-20 12:03+0000\n"
-"Last-Translator: Yalçın Can <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 17:36+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Turkish <tr at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-uk.po b/po/messages-uk.po
index 22e4d12..5f0fecf 100644
--- a/po/messages-uk.po
+++ b/po/messages-uk.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2011-01-10 20:20+0000\n"
-"Last-Translator: ma$terok <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:02+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Ukrainian <uk at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-vi.po b/po/messages-vi.po
index 79bad90..b8f9dae 100644
--- a/po/messages-vi.po
+++ b/po/messages-vi.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-10-28 01:52+0000\n"
-"Last-Translator: Nguyen Quang Chien <Unknown>\n"
+"PO-Revision-Date: 2011-03-03 18:36+0000\n"
+"Last-Translator: Jonathan Pobst <Unknown>\n"
"Language-Team: Vietnamese <vi at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
diff --git a/po/messages-zh_CN.po b/po/messages-zh_CN.po
index 20bd6a3..873b1a5 100644
--- a/po/messages-zh_CN.po
+++ b/po/messages-zh_CN.po
@@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: pinta\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL at ADDRESS>\n"
"POT-Creation-Date: 2011-02-28 17:08-0600\n"
-"PO-Revision-Date: 2010-12-16 06:28+0000\n"
-"Last-Translator: 英华 <wantinghard at gmail.com>\n"
+"PO-Revision-Date: 2011-03-10 11:11+0000\n"
+"Last-Translator: Xhacker Liu <liu.dongyuan at gmail.com>\n"
"Language-Team: Chinese (Simplified) <zh_CN at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
@@ -601,7 +601,7 @@ msgstr "右对齐"
#: Pinta.Tools/TextTool/TextTool.cs:162
msgid "Text Style"
-msgstr ""
+msgstr "文本样式"
#: Pinta.Tools/TextTool/TextTool.cs:169 Pinta.Tools/Brushes/PlainBrush.cs:38
msgid "Normal"
@@ -613,15 +613,15 @@ msgstr ""
#: Pinta.Tools/TextTool/TextTool.cs:179
msgid "Outline width"
-msgstr ""
+msgstr "描边宽度"
#: Pinta.Tools/TextTool/TextTool.cs:184
msgid "Decrease outline size"
-msgstr ""
+msgstr "减少描边宽度"
#: Pinta.Tools/TextTool/TextTool.cs:201
msgid "Increase outline size"
-msgstr ""
+msgstr "增加描边宽度"
#: Pinta.Tools/ShapeTool.cs:99 Pinta.Tools/BaseBrushTool.cs:70
msgid "Brush width"
@@ -695,7 +695,7 @@ msgstr "关于"
#: Pinta/MainWindow.cs:371 Pinta/MainWindow.cs:387
msgid "..."
-msgstr ""
+msgstr "..."
#: Pinta/MainWindow.cs:456
msgid "_File"
@@ -846,7 +846,7 @@ msgstr "全部文件"
#: Pinta/DialogHandlers.cs:480
msgid "Paste cancelled"
-msgstr ""
+msgstr "取消粘贴"
#: Pinta/DialogHandlers.cs:481
msgid "The clipboard does not contain an image"
@@ -1025,7 +1025,7 @@ msgstr "渲染使用的线程数"
#: Pinta/Options.cs:486
msgid "OptionName"
-msgstr ""
+msgstr "选项名"
#: Pinta.Core/Managers/LivePreviewManager.cs:220
msgid "Rendering Effect"
@@ -1201,7 +1201,7 @@ msgstr "降低图层"
#: Pinta.Core/Actions/LayerActions.cs:74
msgid "Layer Properties..."
-msgstr ""
+msgstr "图层属性..."
#: Pinta.Core/Actions/LayerActions.cs:179
msgid "Import From File"
@@ -1235,7 +1235,7 @@ msgstr "缩小"
#: Pinta.Core/Actions/ViewActions.cs:65
msgid "Best Fit"
-msgstr ""
+msgstr "最适大小"
#: Pinta.Core/Actions/ViewActions.cs:66
msgid "Zoom to Selection"
@@ -1243,7 +1243,7 @@ msgstr "缩放至选择部分"
#: Pinta.Core/Actions/ViewActions.cs:67
msgid "Normal Size"
-msgstr ""
+msgstr "普通大小"
#: Pinta.Core/Actions/ViewActions.cs:68
msgid "Toolbar"
@@ -1305,7 +1305,7 @@ msgstr "粘贴到新图像"
#: Pinta.Core/Actions/EditActions.cs:72
msgid "Delete Selection"
-msgstr ""
+msgstr "删除选区"
#: Pinta.Core/Actions/EditActions.cs:73 Pinta.Core/Actions/EditActions.cs:172
msgid "Fill Selection"
@@ -1321,7 +1321,7 @@ msgstr "全选"
#: Pinta.Core/Actions/EditActions.cs:76
msgid "Deselect All"
-msgstr ""
+msgstr "全部不选"
#: Pinta.Core/Actions/EditActions.cs:80
msgid "Reset to Default"
diff --git a/po/messages-zh_TW.po b/po/messages-zh_TW.po
index 7ffc0bb..cf14097 100644
--- a/po/messages-zh_TW.po
+++ b/po/messages-zh_TW.po
@@ -14,8 +14,8 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2011-03-02 22:24+0000\n"
-"X-Generator: Launchpad (build 12486)\n"
+"X-Launchpad-Export-Date: 2011-03-29 21:32+0000\n"
+"X-Generator: Launchpad (build 12684)\n"
#: Pinta.Effects/Adjustments/AutoLevelEffect.cs:26
msgid "Auto Level"
--
pinta
More information about the Pkg-cli-apps-commits
mailing list