mono-addins-1.0/0000775000175000017500000000000012136524044015605 5ustar00directhexdirecthex00000000000000mono-addins-1.0/policy.config.in0000664000175000017500000000056512136523632020710 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/README0000664000175000017500000000131412136523632016466 0ustar00directhexdirecthex00000000000000 Mono.Addins is a generic framework for creating extensible applications, and for creating libraries which extend those applications. For for information about the library, see: http://www.mono-project.com/Mono.Addins Building -------- To build the library execute: ./configure make Options: --prefix=/path/to/prefix Install to the specified prefix --enable-gui Include GUI support (requires gtk#) --enable-tests Include NUnit tests (requires nunit) Building the samples -------------------- cd to the Samples directory and run make. Running the NUnit tests ----------------------- To run the NUnit tests, you need to configure the build with --enable-tests, cd to Tests, and run 'make test'. mono-addins-1.0/mautil/0000775000175000017500000000000012136524044017100 5ustar00directhexdirecthex00000000000000mono-addins-1.0/mautil/AssemblyInfo.cs0000664000175000017500000000205312136523632022024 0ustar00directhexdirecthex00000000000000using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.*")] // The following attributes specify the key for the sign of your assembly. See the // .NET Framework documentation for more information about signing. // This is not required, if you don't want signing let these attributes like they're. [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] mono-addins-1.0/mautil/Makefile.am0000664000175000017500000000052112136523632021134 0ustar00directhexdirecthex00000000000000 ASSEMBLY = ../bin/mautil.exe ASSEMBLY_WRAPPER = mautil ASSEMBLY_WRAPPER_IN = mautil.in $(ASSEMBLY): csproj_build include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include programfilesdir = $(libdir)/mono/mono-addins programfiles_DATA = $(ASSEMBLY) $(build_datafiles) man_MANS = mautil.1 EXTRA_DIST += $(man_MANS) mono-addins-1.0/mautil/mautil.in0000664000175000017500000000020112136523632020716 0ustar00directhexdirecthex00000000000000#!/bin/sh prefix="@prefix@" exec_prefix="@exec_prefix@" libdir="@libdir@/mono/@PACKAGE@" exec mono ${libdir}/"mautil.exe" "$@"mono-addins-1.0/mautil/Makefile.in0000664000175000017500000005107012136523721021151 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mautil.in $(top_srcdir)/Makefile.include \ $(top_srcdir)/xbuild.include ChangeLog subdir = ./mautil 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mautil CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(programfilesdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(pkgconfig_DATA) $(programfiles_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/mautil.exe ASSEMBLY_WRAPPER = mautil ASSEMBLY_WRAPPER_IN = mautil.in pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) EXTRA_DIST = $(wildcard $(ALL_FILES)) $(man_MANS) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) ALL_CSPROJ = $(wildcard *.csproj) MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_FALSE@PROFILE_NAME = DebugNotGui @ENABLE_GUI_TRUE@PROFILE_NAME = Debug XBUILD = xbuild XBUILD_VERBOSITY = quiet XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES := $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES := $(wildcard $(ALL_FILES)) programfilesdir = $(libdir)/mono/mono-addins programfiles_DATA = $(ASSEMBLY) $(build_datafiles) man_MANS = mautil.1 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./mautil/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./mautil/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mautil: $(top_builddir)/config.status $(srcdir)/mautil.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-man1: $(man_MANS) @$(NORMAL_INSTALL) @list1=''; \ list2='$(man_MANS)'; \ test -n "$(man1dir)" \ && test -n "`echo $$list1$$list2`" \ || exit 0; \ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ { for i in $$list1; do echo "$$i"; done; \ if test -n "$$list2"; then \ for i in $$list2; do echo "$$i"; done \ | sed -n '/\.1[a-z]*$$/p'; \ fi; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) install-programfilesDATA: $(programfiles_DATA) @$(NORMAL_INSTALL) @list='$(programfiles_DATA)'; test -n "$(programfilesdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(programfilesdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(programfilesdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(programfilesdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(programfilesdir)" || exit $$?; \ done uninstall-programfilesDATA: @$(NORMAL_UNINSTALL) @list='$(programfiles_DATA)'; test -n "$(programfilesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(programfilesdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(programfilesdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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: distclean-am -rm -f Makefile 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-man install-pkgconfigDATA \ install-programfilesDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 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 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: uninstall-binSCRIPTS uninstall-man \ uninstall-pkgconfigDATA uninstall-programfilesDATA uninstall-man: uninstall-man1 .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS 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-man1 install-pdf \ install-pdf-am install-pkgconfigDATA install-programfilesDATA \ 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 uninstall-binSCRIPTS \ uninstall-man uninstall-man1 uninstall-pkgconfigDATA \ uninstall-programfilesDATA $(ASSEMBLY): csproj_build $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/mautil/Main.cs0000664000175000017500000000741612136523632020325 0ustar00directhexdirecthex00000000000000// project created on 16/07/2006 at 13:33 using System; using System.Diagnostics; using Mono.Addins; using Mono.Addins.Setup; namespace mautil { class MainClass { public static int Main(string[] args) { if (args.Length == 0 || args [0] == "--help" || args [0] == "help") { Console.WriteLine ("Mono.Addins Setup Utility"); Console.WriteLine ("Usage: mautil [options] [arguments]"); Console.WriteLine (); Console.WriteLine ("Options:"); Console.WriteLine (" --path (-p) Specify the startup path of the application"); Console.WriteLine (" --registry (-reg) Specify the add-in registry path"); Console.WriteLine (" --addinspath (-ap) Specify the default add-ins path of the application"); Console.WriteLine (" The path can be absolute or relative to the registry path"); Console.WriteLine (" --cachepath (-cp) Specify add-in cache path for the application"); Console.WriteLine (" The path can be absolute or relative to the registry path"); Console.WriteLine (" --package (-pkg) Specify the package name of the application"); Console.WriteLine (" -v Verbose output. Use multiple times to increase log level"); } int ppos = 0; int verbose = 1; string path = null; string startupPath = null; string addinsPath = null; string databasePath = null; string package = null; bool toolParam = true; while (toolParam && ppos < args.Length) { if (args [ppos] == "-reg" || args [ppos] == "--registry") { if (ppos + 1 >= args.Length) { Console.WriteLine ("Registry path not provided."); return 1; } path = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-p" || args [ppos] == "--path") { if (ppos + 1 >= args.Length) { Console.WriteLine ("Startup path not provided."); return 1; } startupPath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-ap" || args [ppos] == "--addinspath") { if (ppos + 1 >= args.Length) { Console.WriteLine ("Add-ins path not provided."); return 1; } addinsPath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-cp" || args [ppos] == "--cachepath") { if (ppos + 1 >= args.Length) { Console.WriteLine ("Add-ins cache path not provided."); return 1; } databasePath = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-pkg" || args [ppos] == "--package") { if (ppos + 1 >= args.Length) { Console.WriteLine ("Package name not provided."); return 1; } package = args [ppos + 1]; ppos += 2; } else if (args [ppos] == "-v") { verbose++; ppos++; } else toolParam = false; } AddinRegistry reg; if (package != null) { if (startupPath != null || path != null || addinsPath != null || databasePath != null) { Console.WriteLine ("The --registry, --path, --cachepath and --addinspath options\ncan't be used when --package is specified."); return 1; } Application app = SetupService.GetExtensibleApplication (package); if (app == null) { Console.WriteLine ("The package could not be found or does not provide add-in registry information."); return 1; } reg = app.Registry; } else { if (startupPath == null) startupPath = Environment.CurrentDirectory; reg = path != null ? new AddinRegistry (path, startupPath, addinsPath, databasePath) : AddinRegistry.GetGlobalRegistry (); } try { SetupTool setupTool = new SetupTool (reg); setupTool.VerboseOutputLevel = verbose; return setupTool.Run (args, ppos); } catch (Exception ex) { Console.WriteLine (ex); return -1; } finally { reg.Dispose (); } } } }mono-addins-1.0/mautil/policy.0.5.config0000664000175000017500000000053312136524036022071 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/mautil/policy.0.3.config0000664000175000017500000000053312136524036022067 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/mautil/obj/0000775000175000017500000000000012136524044017652 5ustar00directhexdirecthex00000000000000mono-addins-1.0/mautil/obj/Debug/0000775000175000017500000000000012136524044020700 5ustar00directhexdirecthex00000000000000mono-addins-1.0/mautil/obj/Debug/mautil.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000024212136524040030342 0ustar00directhexdirecthex00000000000000/tmp/mono-addins/bin/mautil.exe.mdb /tmp/mono-addins/bin/mautil.exe /tmp/mono-addins/mautil/obj/Debug/mautil.exe /tmp/mono-addins/mautil/obj/Debug/mautil.exe.mdb mono-addins-1.0/mautil/ChangeLog0000664000175000017500000000440612136523632020660 0ustar00directhexdirecthex000000000000002010-05-25 Lluis Sanchez Gual * mautil.csproj: Add Debug and Release configurations. 2010-03-26 Lluis Sanchez Gual * mautil.csproj: Flush. 2009-11-13 Lluis Sanchez Gual * Main.cs: Allow specifying multiple levels of verbosity. 2009-08-21 Lluis Sanchez Gual * Main.cs: Track api changes. 2009-08-20 Lluis Sanchez Gual * Main.cs: Track api changes. * Makefile.am: Build using gmcs. 2009-08-19 Lluis Sanchez Gual * mautil.csproj: Update target framework to 2.0. 2009-06-17 Lluis Sanchez Gual * Main.cs: Added arguments which allows specifying the add-in registry location using a package name. 2009/02/06 Lluis Sanchez Gual * mautil.csproj: Updated. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Respect custom libdir during ./configure. Fixes bug #443205. Patch by Diego Pettenò. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-11-04 Lluis Sanchez Gual * Makefile.am: Dist fix. 2008-08-22 Lluis Sanchez Gual * mautil.csproj, mautil.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-07-01 Lluis Sanchez Gual * Makefile.am, mautil.1: Man page for mautil. Patch by Tim Retout. * mautil.mdp: Updated. 2008-04-10 Lluis Sanchez Gual * mautil.csproj: Fix project file. 2008-01-17 Lluis Sanchez Gual * mautil.csproj: Add missing project file. 2007-12-15 Wade Berrier * Makefile.am: install path for mautil.exe doesn't need DESTDIR (somehow...?) 2007-12-15 Lluis Sanchez Gual * mautil.in, Makefile.am: Install mautil in /usr/lib/mono/mono-addins. 2007-12-03 Lluis Sanchez Gual * Main.cs: Added parameter for setting the startup path. 2007-10-29 Lluis Sanchez Gual * mautil.mdp: Update paths. 2007-07-24 Lluis Sanchez Gual * Main.cs: Fixed endless loop when the -v arg is specified before other arguments. mono-addins-1.0/mautil/mautil.csproj0000664000175000017500000000536412136524015021623 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 {EA2F08DC-8289-4A89-A405-1A70D8B4C569} Exe mautil 2.0 mautil True full True ..\bin prompt 4 True rb /home/lluis/work/monodevelop/main/build/AddIns/NUnit none True ..\bin prompt 4 True {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Mono.Addins {A85C9721-C054-4BD8-A1F3-0227615F0A36} Mono.Addins.Setup mono-addins-1.0/mautil/policy.0.6.config0000664000175000017500000000053312136524037022073 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/mautil/policy.0.4.config0000664000175000017500000000053312136524036022070 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/mautil/mautil.10000664000175000017500000000536012136523632020463 0ustar00directhexdirecthex00000000000000.\" .\" man page for mautil .\" .\" Copyright (C) 2008 Tim Retout .\" .\" Permission is hereby granted, free of charge, to any person obtaining .\" a copy of this software and associated documentation files (the .\" "Software"), to deal in the Software without restriction, including .\" without limitation the rights to use, copy, modify, merge, publish, .\" distribute, sublicense, and/or sell copies of the Software, and to .\" permit persons to whom the Software is furnished to do so, subject to .\" the following conditions: .\" .\" The above copyright notice and this permission notice shall be .\" included in all copies or substantial portions of the Software. .\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, .\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND .\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE .\" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION .\" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION .\" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .\" .TH MAUTIL "1" "May 2008" "Mono.Addins" "User Commands" .SH NAME mautil \- Mono.Addins Setup Utility .SH SYNOPSIS .B mautil [\fIoptions\fR] \fI \fR[\fIarguments\fR] .SH DESCRIPTION The .B mautil tool works with Mono.Addins repositories and packages. .SH OPTIONS .TP .BR \-\-registry ", " \-reg Specify add\-in registry path .TP .BR \-\-path ", " \-p Specify startup path .TP \fB\-v\fR Verbose output .SS "Add-in commands:" .TP .BR install ", " i Installs add\-ins. .TP .BR uninstall ", " u Uninstalls add\-ins. .TP .BR check\-install ", " ci Checks installed add\-ins. .TP .BR update ", " up Updates installed add\-ins. .TP .BR list ", " l Lists installed add\-ins. .TP .BR list\-av ", " la Lists add\-ins available in registered repositories. .TP .BR list\-update ", " lu Lists available add\-in updates. .SS "Repository Commands:" .TP .BR rep\-add ", " ra Registers repositories. .TP .BR rep\-remove ", " rr Unregisters repositories. .TP .BR rep\-update ", " ru Updates the lists of available addins. .TP .BR rep\-list ", " rl Lists registered repositories. .SS "Add-in Registry Commands:" .TP .BR reg\-update ", " rgu Updates the add\-in registry. .TP .BR reg\-build ", " rgb Rebuilds the add\-in registry. .TP .BR info Prints information about an add\-in. .SS "Packaging Commands:" .TP .BR rep\-build ", " rb Creates a repository index file for a directory structure. .TP .BR pack ", " p Creates a package from an add\-in configuration file. .TP .BR help ", " h Shows help about a command. .SS "Debug Commands:" .TP .BR dump\-file Prints the contents of a registry file. .SH "SEE ALSO" .BR mono (1). mono-addins-1.0/mautil/policy.0.2.config0000664000175000017500000000053312136524036022066 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/configure.ac0000664000175000017500000000614312136523632020101 0ustar00directhexdirecthex00000000000000dnl Warning: This is an automatically generated file, do not edit! dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.54]) AC_INIT([mono-addins], [1.0]) AM_INIT_AUTOMAKE([foreign tar-ustar]) AM_MAINTAINER_MODE dnl pkg-config AC_PATH_PROG(PKG_CONFIG, pkg-config, no) if test "x$PKG_CONFIG" = "xno"; then AC_MSG_ERROR([You need to install pkg-config]) fi API_VERSION=1.0.0.0 AC_SUBST(API_VERSION) POLICY_VERSIONS="0.2 0.3 0.4 0.5 0.6" AC_SUBST(POLICY_VERSIONS) AC_PROG_INSTALL AC_PATH_PROG(MCS, gmcs, no) if test "x$MCS" = "xno"; then AC_MSG_ERROR([mcs Not found]) fi AC_PATH_PROG(GACUTIL, gacutil, no) if test "x$GACUTIL" = "xno" ; then AC_MSG_ERROR([No gacutil tool found]) fi AC_PATH_PROG(AL, al, no) if test "x$AL" = "xno" ; then AC_MSG_ERROR([No al tool found. You need to install either the mono or .Net SDK.]) fi GACUTIL_FLAGS='/package mono-addins /root $(DESTDIR)$(libdir)' GACUTIL_POLICY_FLAGS='/root $(DESTDIR)$(libdir)' AC_SUBST(GACUTIL) AC_SUBST(GACUTIL_FLAGS) AC_SUBST(GACUTIL_POLICY_FLAGS) AC_ARG_ENABLE(gui, AC_HELP_STRING([--enable-gui], [enable support for GTK dependent libraries [default=yes]]), enable_gui=${enableval}, enable_gui=yes) AM_CONDITIONAL(ENABLE_GUI, test x$enable_gui = xyes) AC_ARG_ENABLE(tests, AC_HELP_STRING([--enable-tests], [build unit tests [default=no]]), enable_tests=${enableval}, enable_tests=no) AM_CONDITIONAL(ENABLE_TESTS, test x$enable_tests = xyes) AC_ARG_ENABLE(docs, AC_HELP_STRING([--enable-docs], [build documentation [default=no]]), enable_docs=${enableval}, enable_docs=no) AM_CONDITIONAL(ENABLE_DOCS, test x$enable_docs = xyes) if test "x$enable_gui" = "xyes"; then PKG_CHECK_MODULES([GTK_SHARP_20], [gtk-sharp-2.0]) fi if test "x$enable_tests" = "xyes"; then PKG_CHECK_MODULES([MONO_NUNIT], [mono-nunit]) fi if test "x$enable_docs" = "xyes"; then PKG_CHECK_MODULES([MONODOC], [monodoc]) fi AC_SUBST(MONO_NUNIT_LIBS) MONO_ADDINS_DEFAULT_LIB='Mono.Addins.dll' MONO_ADDINS_SETUP_DEFAULT_LIB='Mono.Addins.Setup.dll' MONO_ADDINS_GUI_DEFAULT_LIB='Mono.Addins.Gui.dll' MONO_ADDINS_MSBUILD_DEFAULT_LIB='Mono.Addins.MSBuild.dll' AC_SUBST(MONO_ADDINS_DEFAULT_LIB) AC_SUBST(MONO_ADDINS_GUI_DEFAULT_LIB) AC_SUBST(MONO_ADDINS_SETUP_DEFAULT_LIB) AC_SUBST(MONO_ADDINS_MSBUILD_DEFAULT_LIB) AC_CONFIG_FILES([ ./mono-addins.spec ./Mono.Addins/mono-addins.pc ./Mono.Addins.Gui/mono-addins-gui.pc ./Mono.Addins.Setup/mono-addins-setup.pc ./Mono.Addins.MSBuild/mono-addins-msbuild.pc ./Makefile ./policy.config ./Mono.Addins.Gui/Makefile ./Mono.Addins.Setup/Makefile ./Mono.Addins/Makefile ./Mono.Addins.CecilReflector/Makefile ./Mono.Addins.MSBuild/Makefile ./mautil/Makefile ./mautil/mautil ./docs/Makefile ./Test/HelloWorldExtension/Makefile ./Test/FileContentExtension/Makefile ./Test/UnitTests/Makefile ./Test/CommandExtension/Makefile ./Test/SystemInfoExtension/Makefile ./Test/FileExtender/Makefile ./Test/Makefile ]) AC_OUTPUT echo "" echo "Configuration summary" echo "" echo " * Installation prefix = $prefix" echo " * gui support: $enable_gui" echo " * unit tests: $enable_tests" echo " * documentation: $enable_docs" echo "" mono-addins-1.0/Makefile.am0000664000175000017500000000442412136523632017647 0ustar00directhexdirecthex00000000000000 SUBDIRS = Mono.Addins Mono.Addins.CecilReflector Mono.Addins.Setup Mono.Addins.MSBuild Mono.Addins.Gui mautil Test docs EXTRA_DIST = COPYING mono-addins.snk Mono.Addins.sln SRC_PACKAGE_DIR=Mono.Addins-source-@VERSION@ BIN_PACKAGE_DIR=Mono.Addins-binary-@VERSION@ src-zip: rm -rf $(SRC_PACKAGE_DIR) rm -f $(SRC_PACKAGE_DIR).zip mkdir $(SRC_PACKAGE_DIR) mdtool project-export Mono.Addins.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR) -p:mautil -p:Mono.Addins -p:Mono.Addins.CecilReflector -p:Mono.Addins.Setup mdtool project-export Samples/HelloWorld/HelloWorld.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/HelloWorld mdtool project-export Samples/HelloWorldWithManifest/HelloWorldWithManifest.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/HelloWorldWithManifest mdtool project-export Samples/TextEditorSWF/TextEditorSWF.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/TextEditorSWF cp support/README-src $(SRC_PACKAGE_DIR)/README.txt cp AUTHORS $(SRC_PACKAGE_DIR)/AUTHORS.txt cp COPYING $(SRC_PACKAGE_DIR)/COPYING.txt cp mono-addins.snk $(SRC_PACKAGE_DIR)/mono-addins.snk unix2dos $(SRC_PACKAGE_DIR)/README.txt unix2dos $(SRC_PACKAGE_DIR)/AUTHORS.txt unix2dos $(SRC_PACKAGE_DIR)/COPYING.txt rm -rf $(SRC_PACKAGE_DIR)/Test rm -f $(SRC_PACKAGE_DIR)/configure.ac cd $(SRC_PACKAGE_DIR) && for fi in `find . -name Makefile.am`; do rm $$fi; done cd $(SRC_PACKAGE_DIR) && zip -r ../$(SRC_PACKAGE_DIR).zip * bin-zip: rm -rf $(BIN_PACKAGE_DIR) rm -f $(BIN_PACKAGE_DIR).zip mkdir $(BIN_PACKAGE_DIR) cp support/README-bin $(BIN_PACKAGE_DIR)/README.txt cp AUTHORS $(BIN_PACKAGE_DIR)/AUTHORS.txt cp COPYING $(BIN_PACKAGE_DIR)/COPYING.txt unix2dos $(BIN_PACKAGE_DIR)/README.txt unix2dos $(BIN_PACKAGE_DIR)/AUTHORS.txt unix2dos $(BIN_PACKAGE_DIR)/COPYING.txt cp bin/mautil.exe $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.dll $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.xml $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.Setup.dll $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.Setup.xml $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.CecilReflector.dll $(BIN_PACKAGE_DIR) cp support/ICSharpCode.SharpZipLib.license.txt $(BIN_PACKAGE_DIR) cp support/ICSharpCode.SharpZipLib.dll $(BIN_PACKAGE_DIR) cd $(BIN_PACKAGE_DIR) && zip -r ../$(BIN_PACKAGE_DIR).zip * mono-addins-1.0/mono-addins.spec.in0000664000175000017500000000212112136523632021274 0ustar00directhexdirecthex00000000000000%define _libdir %{_prefix}/lib Name: mono-addins Version: @VERSION@ Release: 0 License: X11/MIT BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch Url: http://www.mono-project.com Source0: http://ftp.novell.com/pub/mono/sources/%{name}/%{name}-%{version}.tar.bz2 BuildRequires: gtk-sharp2 BuildRequires: mono-devel BuildRequires: pkg-config Summary: Mono Addins Framework Group: Development/Languages/Mono %description Mono.Addins is a generic framework for creating extensible applications, and for creating libraries which extend those applications. %files %defattr(-, root, root) %{_bindir}/mautil %{_datadir}/pkgconfig/*.pc %{_libdir}/mono/gac/*Mono.Addins* %{_libdir}/mono/mono-addins %{_libdir}/mono/xbuild/Mono.Addins.targets %{_mandir}/man1/mautil.1%ext_man %prep %setup -q %build %configure make %install make install DESTDIR=%{buildroot} mkdir -p %{buildroot}%{_datadir}/pkgconfig mv %{buildroot}%{_libdir}/pkgconfig/*.pc %{buildroot}%{_datadir}/pkgconfig %clean rm -rf %{buildroot} %changelog mono-addins-1.0/Mono.Addins.Setup/0000775000175000017500000000000012136524043021014 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Setup/AssemblyInfo.cs0000664000175000017500000000116512136523632023744 0ustar00directhexdirecthex00000000000000using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("Mono.Addins.Setup")] [assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.0.0")] mono-addins-1.0/Mono.Addins.Setup/Makefile.am0000664000175000017500000000046312136523632023056 0ustar00directhexdirecthex00000000000000ASSEMBLY = ../bin/Mono.Addins.Setup.dll ASSEMBLY_NAME=Mono.Addins.Setup PC_FILES_IN = mono-addins-setup.pc.in install-data-local: gac-install uninstall-local: gac-uninstall include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include CLEANFILES += $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) mono-addins-1.0/Mono.Addins.Setup/mono-addins-setup.pc.in0000664000175000017500000000043012136523632025313 0ustar00directhexdirecthex00000000000000prefix=${pcfiledir}/../.. exec_prefix=${prefix} pkglibdir=${prefix}/lib/mono/@PACKAGE@ Libraries=${pkglibdir}/@MONO_ADDINS_SETUP_DEFAULT_LIB@ Name: Mono.Addins.Setup Description: Version: @VERSION@ Requires: mono-addins Libs: -r:${pkglibdir}/@MONO_ADDINS_SETUP_DEFAULT_LIB@ mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/0000775000175000017500000000000012136524044024225 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/ConsoleAddinInstaller.cs0000664000175000017500000001050412136523632030776 0ustar00directhexdirecthex00000000000000// // ConsoleAddinInstaller.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Setup { /// /// An IAddinInstaller implementation which interacts with the user through the console /// public class ConsoleAddinInstaller: IAddinInstaller { bool prompt; bool repoUpdated; int logLevel = 1; /// /// Initializes a new instance of the class. /// public ConsoleAddinInstaller () { } /// /// Gets or sets whether the installer can ask questions to the user /// public bool UserPrompt { get { return prompt; } set { prompt = value; if (prompt && logLevel == 0) logLevel = 1; } } /// /// Log level (0:normal, 1+:verbose); /// public int LogLevel { get { return logLevel; } set { logLevel = value; } } void IAddinInstaller.InstallAddins (AddinRegistry reg, string message, string[] addinIds) { if (logLevel > 0) { if (message != null && message.Length > 0) { Console.WriteLine (message); } else { Console.WriteLine ("Additional extensions are required to perform this operation."); } } ArrayList entries = new ArrayList (); SetupService setup = new SetupService (reg); string idNotFound; do { idNotFound = null; foreach (string id in addinIds) { string name = Addin.GetIdName (id); string version = Addin.GetIdVersion (id); AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin (name, version); if (ares.Length == 0) { idNotFound = id; entries.Clear (); break; } else entries.Add (ares[0]); } if (idNotFound != null) { if (repoUpdated) throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); if (prompt) { Console.WriteLine ("The add-in '" + idNotFound + "' could not be found in the registered repositories."); Console.WriteLine ("The repository indices may be outdated."); if (!Confirm ("Do you wan't to update them now?")) throw new InstallException ("Add-in '" + idNotFound + "' not found in the registered add-in repositories"); } setup.Repositories.UpdateAllRepositories (new ConsoleProgressStatus (logLevel)); repoUpdated = true; } } while (idNotFound != null); if (logLevel > 0) { Console.WriteLine ("The following add-ins will be installed:"); foreach (AddinRepositoryEntry addin in entries) Console.WriteLine (" - " + addin.Addin.Name + " v" + addin.Addin.Version); if (prompt) { if (!Confirm ("Do you want to continue with the installation?")) throw new InstallException ("Installation cancelled"); } } setup.Install (new ConsoleProgressStatus (logLevel), (AddinRepositoryEntry[]) entries.ToArray (typeof(AddinRepositoryEntry))); } bool Confirm (string msg) { string res; do { Console.Write (msg + " (Y/n): "); res = Console.ReadLine (); if (res.Length > 0 && res.ToLower()[0] == 'n') return false; } while (res.Length > 0 && res.ToLower()[0] != 'y'); return true; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/Repository.cs0000664000175000017500000001232712136523632026742 0ustar00directhexdirecthex00000000000000// // Repository.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Xml; using System.Xml.Serialization; using System.IO; using System.Net; using System.Threading; namespace Mono.Addins.Setup { internal class Repository { RepositoryEntryCollection repositories; RepositoryEntryCollection addins; string name; internal string url; public string Name { get { return name; } set { name = value; } } public string Url { get { return url; } set { url = value; } } internal string CachedFilesDir { get; set; } [XmlElement ("Repository", Type = typeof(ReferenceRepositoryEntry))] public RepositoryEntryCollection Repositories { get { if (repositories == null) repositories = new RepositoryEntryCollection (this); return repositories; } } [XmlElement ("Addin", Type = typeof(PackageRepositoryEntry))] public RepositoryEntryCollection Addins { get { if (addins == null) addins = new RepositoryEntryCollection (this); return addins; } } public RepositoryEntry FindEntry (string url) { if (Repositories != null) { foreach (RepositoryEntry e in Repositories) if (e.Url == url) return e; } if (Addins != null) { foreach (RepositoryEntry e in Addins) if (e.Url == url) return e; } return null; } public void AddEntry (RepositoryEntry entry) { entry.owner = this; if (entry is ReferenceRepositoryEntry) { Repositories.Add (entry); } else { Addins.Add (entry); } } public void RemoveEntry (RepositoryEntry entry) { if (entry is PackageRepositoryEntry) Addins.Remove (entry); else Repositories.Remove (entry); } public IAsyncResult BeginDownloadSupportFile (string name, AsyncCallback cb, object state) { FileAsyncResult res = new FileAsyncResult (); res.AsyncState = state; res.Callback = cb; string cachedFile = Path.Combine (CachedFilesDir, Path.GetFileName (name)); if (File.Exists (cachedFile)) { res.FilePath = cachedFile; res.CompletedSynchronously = true; res.SetDone (); return res; } Uri u = new Uri (new Uri (Url), name); if (u.Scheme == "file") { res.FilePath = u.AbsolutePath; res.CompletedSynchronously = true; res.SetDone (); return res; } else { HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create (u); res.FilePath = cachedFile; res.Request = req; req.BeginGetResponse (OnGotResponse, res); } return res; } void OnGotResponse (IAsyncResult ares) { FileAsyncResult res = (FileAsyncResult) ares.AsyncState; try { WebResponse resp = res.Request.EndGetResponse (ares); string dir = Path.GetDirectoryName (res.FilePath); lock (this) { if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); } byte[] buffer = new byte [8092]; using (var s = resp.GetResponseStream ()) { using (var f = File.OpenWrite (res.FilePath)) { int nr = 0; while ((nr = s.Read (buffer, 0, buffer.Length)) > 0) f.Write (buffer, 0, nr); } } } catch (Exception ex) { res.Error = ex; } res.SetDone (); } public Stream EndDownloadSupportFile (IAsyncResult ares) { FileAsyncResult res = ares as FileAsyncResult; if (res == null) throw new InvalidOperationException ("Invalid IAsyncResult instance"); if (res.Error != null) throw res.Error; return File.OpenRead (res.FilePath); } } class FileAsyncResult: IAsyncResult { ManualResetEvent done; public string FilePath; public HttpWebRequest Request; public AsyncCallback Callback; public Exception Error; public void SetDone () { lock (this) { IsCompleted = true; if (done != null) done.Set (); } if (Callback != null) Callback (this); } public object AsyncState { get; set; } public WaitHandle AsyncWaitHandle { get { lock (this) { if (done == null) done = new ManualResetEvent (IsCompleted); } return done; } } public bool CompletedSynchronously { get; set; } public bool IsCompleted { get; set; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositoryReaderWriter.cs0000664000175000017500000007346012136523632031267 0ustar00directhexdirecthex00000000000000// It is automatically generated using System; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Text; using System.Collections; using System.Globalization; namespace Mono.Addins.Setup { internal class RepositoryReader : XmlSerializationReader { static readonly System.Reflection.MethodInfo fromBinHexStringMethod = typeof (XmlConvert).GetMethod ("FromBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (string)}, null); static byte [] FromBinHexString (string input) { return input == null ? null : (byte []) fromBinHexStringMethod.Invoke (null, new object [] {input}); } public object ReadRoot_Repository () { Reader.MoveToContent(); if (Reader.LocalName != "Repository" || Reader.NamespaceURI != "") throw CreateUnknownNodeException(); return ReadObject_Repository (true, true); } public Mono.Addins.Setup.Repository ReadObject_Repository (bool isNullable, bool checkType) { Mono.Addins.Setup.Repository ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "Repository" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.Repository) Activator.CreateInstance(typeof(Mono.Addins.Setup.Repository), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b0=false, b1=false, b2=false, b3=false; Mono.Addins.Setup.RepositoryEntryCollection o5; o5 = ob.@Repositories; Mono.Addins.Setup.RepositoryEntryCollection o7; o7 = ob.@Addins; int n4=0, n6=0; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Addin" && Reader.NamespaceURI == "" && !b3) { if (((object)o7) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Setup.RepositoryEntryCollection"); o7.Add (ReadObject_PackageRepositoryEntry (false, true)); n6++; } else if (Reader.LocalName == "Repository" && Reader.NamespaceURI == "" && !b2) { if (((object)o5) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Setup.RepositoryEntryCollection"); o5.Add (ReadObject_ReferenceRepositoryEntry (false, true)); n4++; } else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b0) { b0 = true; string s8 = Reader.ReadElementString (); ob.@Name = s8; } else if (Reader.LocalName == "Url" && Reader.NamespaceURI == "" && !b1) { b1 = true; string s9 = Reader.ReadElementString (); ob.@Url = s9; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Setup.PackageRepositoryEntry ReadObject_PackageRepositoryEntry (bool isNullable, bool checkType) { Mono.Addins.Setup.PackageRepositoryEntry ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "PackageRepositoryEntry" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.PackageRepositoryEntry) Activator.CreateInstance(typeof(Mono.Addins.Setup.PackageRepositoryEntry), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b10=false, b11=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Addin" && Reader.NamespaceURI == "" && !b11) { b11 = true; ob.@Addin = ReadObject_AddinInfo (false, true); } else if (Reader.LocalName == "Url" && Reader.NamespaceURI == "" && !b10) { b10 = true; string s12 = Reader.ReadElementString (); ob.@Url = s12; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Setup.ReferenceRepositoryEntry ReadObject_ReferenceRepositoryEntry (bool isNullable, bool checkType) { Mono.Addins.Setup.ReferenceRepositoryEntry ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "ReferenceRepositoryEntry" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.ReferenceRepositoryEntry) Activator.CreateInstance(typeof(Mono.Addins.Setup.ReferenceRepositoryEntry), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b13=false, b14=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Url" && Reader.NamespaceURI == "" && !b13) { b13 = true; string s15 = Reader.ReadElementString (); ob.@Url = s15; } else if (Reader.LocalName == "LastModified" && Reader.NamespaceURI == "" && !b14) { b14 = true; string s16 = Reader.ReadElementString (); ob.@LastModified = XmlConvert.ToDateTime (s16, XmlDateTimeSerializationMode.RoundtripKind); } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Setup.AddinInfo ReadObject_AddinInfo (bool isNullable, bool checkType) { Mono.Addins.Setup.AddinInfo ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "AddinInfo" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.AddinInfo) Activator.CreateInstance(typeof(Mono.Addins.Setup.AddinInfo), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b17=false, b18=false, b19=false, b20=false, b21=false, b22=false, b23=false, b24=false, b25=false, b26=false, b27=false, b28=false, b29=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Version" && Reader.NamespaceURI == "" && !b20) { b20 = true; string s30 = Reader.ReadElementString (); ob.@Version = s30; } else if (Reader.LocalName == "Dependencies" && Reader.NamespaceURI == "" && !b27) { if (((object)ob.@Dependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n31 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "AssemblyDependency" && Reader.NamespaceURI == "") { if (((object)ob.@Dependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@Dependencies.Add (ReadObject_AssemblyDependency (false, true)); n31++; } else if (Reader.LocalName == "NativeDependency" && Reader.NamespaceURI == "") { if (((object)ob.@Dependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@Dependencies.Add (ReadObject_NativeReference (false, true)); n31++; } else if (Reader.LocalName == "AddinDependency" && Reader.NamespaceURI == "") { if (((object)ob.@Dependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@Dependencies.Add (ReadObject_AddinReference (false, true)); n31++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b27 = true; } else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b19) { b19 = true; string s32 = Reader.ReadElementString (); ob.@Name = s32; } else if (Reader.LocalName == "BaseVersion" && Reader.NamespaceURI == "" && !b21) { b21 = true; string s33 = Reader.ReadElementString (); ob.@BaseVersion = s33; } else if (Reader.LocalName == "Id" && Reader.NamespaceURI == "" && !b17) { b17 = true; string s34 = Reader.ReadElementString (); ob.@LocalId = s34; } else if (Reader.LocalName == "Url" && Reader.NamespaceURI == "" && !b24) { b24 = true; string s35 = Reader.ReadElementString (); ob.@Url = s35; } else if (Reader.LocalName == "Copyright" && Reader.NamespaceURI == "" && !b23) { b23 = true; string s36 = Reader.ReadElementString (); ob.@Copyright = s36; } else if (Reader.LocalName == "Description" && Reader.NamespaceURI == "" && !b25) { b25 = true; string s37 = Reader.ReadElementString (); ob.@Description = s37; } else if (Reader.LocalName == "Author" && Reader.NamespaceURI == "" && !b22) { b22 = true; string s38 = Reader.ReadElementString (); ob.@Author = s38; } else if (Reader.LocalName == "OptionalDependencies" && Reader.NamespaceURI == "" && !b28) { if (((object)ob.@OptionalDependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n39 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "AssemblyDependency" && Reader.NamespaceURI == "") { if (((object)ob.@OptionalDependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@OptionalDependencies.Add (ReadObject_AssemblyDependency (false, true)); n39++; } else if (Reader.LocalName == "NativeDependency" && Reader.NamespaceURI == "") { if (((object)ob.@OptionalDependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@OptionalDependencies.Add (ReadObject_NativeReference (false, true)); n39++; } else if (Reader.LocalName == "AddinDependency" && Reader.NamespaceURI == "") { if (((object)ob.@OptionalDependencies) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Description.DependencyCollection"); ob.@OptionalDependencies.Add (ReadObject_AddinReference (false, true)); n39++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b28 = true; } else if (Reader.LocalName == "Properties" && Reader.NamespaceURI == "" && !b29) { if (((object)ob.@Properties) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Setup.AddinPropertyCollectionImpl"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n40 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Property" && Reader.NamespaceURI == "") { if (((object)ob.@Properties) == null) throw CreateReadOnlyCollectionException ("Mono.Addins.Setup.AddinPropertyCollectionImpl"); ob.@Properties.Add (ReadObject_AddinProperty (false, true)); n40++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b29 = true; } else if (Reader.LocalName == "Namespace" && Reader.NamespaceURI == "" && !b18) { b18 = true; string s41 = Reader.ReadElementString (); ob.@Namespace = s41; } else if (Reader.LocalName == "Category" && Reader.NamespaceURI == "" && !b26) { b26 = true; string s42 = Reader.ReadElementString (); ob.@Category = s42; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Description.AssemblyDependency ReadObject_AssemblyDependency (bool isNullable, bool checkType) { Mono.Addins.Description.AssemblyDependency ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "AssemblyDependency" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Description.AssemblyDependency) Activator.CreateInstance(typeof(Mono.Addins.Description.AssemblyDependency), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b43=false, b44=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Package" && Reader.NamespaceURI == "" && !b44) { b44 = true; string s45 = Reader.ReadElementString (); ob.@Package = s45; } else if (Reader.LocalName == "FullName" && Reader.NamespaceURI == "" && !b43) { b43 = true; string s46 = Reader.ReadElementString (); ob.@FullName = s46; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Description.NativeDependency ReadObject_NativeReference (bool isNullable, bool checkType) { Mono.Addins.Description.NativeDependency ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "NativeReference" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Description.NativeDependency) Activator.CreateInstance(typeof(Mono.Addins.Description.NativeDependency), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { UnknownNode (ob); } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Description.AddinDependency ReadObject_AddinReference (bool isNullable, bool checkType) { Mono.Addins.Description.AddinDependency ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "AddinReference" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Description.AddinDependency) Activator.CreateInstance(typeof(Mono.Addins.Description.AddinDependency), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b47=false, b48=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Version" && Reader.NamespaceURI == "" && !b48) { b48 = true; string s49 = Reader.ReadElementString (); ob.@Version = s49; } else if (Reader.LocalName == "AddinId" && Reader.NamespaceURI == "" && !b47) { b47 = true; string s50 = Reader.ReadElementString (); ob.@AddinId = s50; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Description.AddinProperty ReadObject_AddinProperty (bool isNullable, bool checkType) { Mono.Addins.Description.AddinProperty ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "AddinProperty" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Description.AddinProperty) Activator.CreateInstance(typeof(Mono.Addins.Description.AddinProperty), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (Reader.LocalName == "name" && Reader.NamespaceURI == "") { ob.@Name = Reader.Value; } else if (Reader.LocalName == "locale" && Reader.NamespaceURI == "") { ob.@Locale = Reader.Value; } else if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { UnknownNode (ob); } else if (Reader.NodeType == System.Xml.XmlNodeType.Text || Reader.NodeType == System.Xml.XmlNodeType.CDATA) { ob.@Value = ReadString (ob.@Value); } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } protected override void InitCallbacks () { } protected override void InitIDs () { } } internal class RepositoryWriter : XmlSerializationWriter { const string xmlNamespace = "http://www.w3.org/2000/xmlns/"; static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof (XmlConvert).GetMethod ("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (byte [])}, null); static string ToBinHexString (byte [] input) { return input == null ? null : (string) toBinHexStringMethod.Invoke (null, new object [] {input}); } public void WriteRoot_Repository (object o) { WriteStartDocument (); Mono.Addins.Setup.Repository ob = (Mono.Addins.Setup.Repository) o; TopLevelElement (); WriteObject_Repository (ob, "Repository", "", true, false, true); } void WriteObject_Repository (Mono.Addins.Setup.Repository ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.Repository)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("Repository", ""); WriteElementString ("Name", "", ob.@Name); WriteElementString ("Url", "", ob.@Url); if (ob.@Repositories != null) { for (int n51 = 0; n51 < ob.@Repositories.Count; n51++) { WriteObject_ReferenceRepositoryEntry (((Mono.Addins.Setup.ReferenceRepositoryEntry) ob.@Repositories[n51]), "Repository", "", false, false, true); } } if (ob.@Addins != null) { for (int n52 = 0; n52 < ob.@Addins.Count; n52++) { WriteObject_PackageRepositoryEntry (((Mono.Addins.Setup.PackageRepositoryEntry) ob.@Addins[n52]), "Addin", "", false, false, true); } } if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_ReferenceRepositoryEntry (Mono.Addins.Setup.ReferenceRepositoryEntry ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.ReferenceRepositoryEntry)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("ReferenceRepositoryEntry", ""); WriteElementString ("Url", "", ob.@Url); WriteElementString ("LastModified", "", XmlConvert.ToString (ob.@LastModified, XmlDateTimeSerializationMode.RoundtripKind)); if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_PackageRepositoryEntry (Mono.Addins.Setup.PackageRepositoryEntry ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.PackageRepositoryEntry)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("PackageRepositoryEntry", ""); WriteElementString ("Url", "", ob.@Url); WriteObject_AddinInfo (ob.@Addin, "Addin", "", false, false, true); if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_AddinInfo (Mono.Addins.Setup.AddinInfo ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.AddinInfo)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("AddinInfo", ""); WriteElementString ("Id", "", ob.@LocalId); WriteElementString ("Namespace", "", ob.@Namespace); WriteElementString ("Name", "", ob.@Name); WriteElementString ("Version", "", ob.@Version); WriteElementString ("BaseVersion", "", ob.@BaseVersion); WriteElementString ("Author", "", ob.@Author); WriteElementString ("Copyright", "", ob.@Copyright); WriteElementString ("Url", "", ob.@Url); WriteElementString ("Description", "", ob.@Description); WriteElementString ("Category", "", ob.@Category); if (ob.@Dependencies != null) { WriteStartElement ("Dependencies", "", ob.@Dependencies); for (int n53 = 0; n53 < ob.@Dependencies.Count; n53++) { if (((object)ob.@Dependencies[n53]) == null) { } else if (ob.@Dependencies[n53].GetType() == typeof(Mono.Addins.Description.AssemblyDependency)) { WriteObject_AssemblyDependency (((Mono.Addins.Description.AssemblyDependency) ob.@Dependencies[n53]), "AssemblyDependency", "", false, false, true); } else if (ob.@Dependencies[n53].GetType() == typeof(Mono.Addins.Description.NativeDependency)) { WriteObject_NativeReference (((Mono.Addins.Description.NativeDependency) ob.@Dependencies[n53]), "NativeDependency", "", false, false, true); } else if (ob.@Dependencies[n53].GetType() == typeof(Mono.Addins.Description.AddinDependency)) { WriteObject_AddinReference (((Mono.Addins.Description.AddinDependency) ob.@Dependencies[n53]), "AddinDependency", "", false, false, true); } else throw CreateUnknownTypeException (ob.@Dependencies[n53]); } WriteEndElement (ob.@Dependencies); } if (ob.@OptionalDependencies != null) { WriteStartElement ("OptionalDependencies", "", ob.@OptionalDependencies); for (int n54 = 0; n54 < ob.@OptionalDependencies.Count; n54++) { if (((object)ob.@OptionalDependencies[n54]) == null) { } else if (ob.@OptionalDependencies[n54].GetType() == typeof(Mono.Addins.Description.AssemblyDependency)) { WriteObject_AssemblyDependency (((Mono.Addins.Description.AssemblyDependency) ob.@OptionalDependencies[n54]), "AssemblyDependency", "", false, false, true); } else if (ob.@OptionalDependencies[n54].GetType() == typeof(Mono.Addins.Description.NativeDependency)) { WriteObject_NativeReference (((Mono.Addins.Description.NativeDependency) ob.@OptionalDependencies[n54]), "NativeDependency", "", false, false, true); } else if (ob.@OptionalDependencies[n54].GetType() == typeof(Mono.Addins.Description.AddinDependency)) { WriteObject_AddinReference (((Mono.Addins.Description.AddinDependency) ob.@OptionalDependencies[n54]), "AddinDependency", "", false, false, true); } else throw CreateUnknownTypeException (ob.@OptionalDependencies[n54]); } WriteEndElement (ob.@OptionalDependencies); } if (ob.@Properties != null) { WriteStartElement ("Properties", "", ob.@Properties); for (int n55 = 0; n55 < ob.@Properties.Count; n55++) { WriteObject_AddinProperty (ob.@Properties[n55], "Property", "", false, false, true); } WriteEndElement (ob.@Properties); } if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_AssemblyDependency (Mono.Addins.Description.AssemblyDependency ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Description.AssemblyDependency)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("AssemblyDependency", ""); WriteElementString ("FullName", "", ob.@FullName); WriteElementString ("Package", "", ob.@Package); if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_NativeReference (Mono.Addins.Description.NativeDependency ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Description.NativeDependency)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("NativeReference", ""); if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_AddinReference (Mono.Addins.Description.AddinDependency ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Description.AddinDependency)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("AddinReference", ""); WriteElementString ("AddinId", "", ob.@AddinId); WriteElementString ("Version", "", ob.@Version); if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_AddinProperty (Mono.Addins.Description.AddinProperty ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Description.AddinProperty)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("AddinProperty", ""); WriteAttribute ("name", "", ob.@Name); WriteAttribute ("locale", "", ob.@Locale); WriteValue (ob.@Value); if (writeWrappingElem) WriteEndElement (ob); } protected override void InitCallbacks () { } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/SetupTool.cs0000664000175000017500000011414012136523632026515 0ustar00directhexdirecthex00000000000000// // mdsetup.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Collections; using Mono.Addins; using Mono.Addins.Setup.ProgressMonitoring; using Mono.Addins.Setup; using System.IO; using Mono.Addins.Description; using System.Linq; namespace Mono.Addins.Setup { /// /// A command line add-in manager. /// /// /// This class can be used to provide an add-in management command line tool to applications. /// public class SetupTool { Hashtable options = new Hashtable (); string[] arguments; string applicationName = "Mono"; SetupService service; AddinRegistry registry; ArrayList commands = new ArrayList (); string setupAppName = ""; int uniqueId = 0; int verbose = 1; /// /// Creates a new instance /// /// /// Add-in registry to manage. /// public SetupTool (AddinRegistry registry) { this.registry = registry; service = new SetupService (registry); CreateCommands (); } /// /// Display name of the host application /// public string ApplicationName { get { return applicationName; } set { applicationName = value; } } /// /// Default add-in namespace of the application (optional). If set, only add-ins that belong to that namespace /// will be shown in add-in lists. /// public string ApplicationNamespace { get { return service.ApplicationNamespace; } set { service.ApplicationNamespace = value; } } /// /// Enables or disables verbose output /// public bool VerboseOutput { get { return verbose > 1; } set { verbose = value ? 2 : 1; } } /// /// Sets or gets the verbose output level (0: normal output, 1:verbose, 2+:extra verbose) /// public int VerboseOutputLevel { get { return verbose; } set { verbose = value; } } /// /// Runs the command line tool. /// /// /// Array that contains the command line arguments /// /// /// Index of the arguments array that has the first argument for the management tool /// /// /// 0 if it succeeds. != 0 otherwise /// public int Run (string[] args, int firstArgumentIndex) { string[] aa = new string [args.Length - firstArgumentIndex]; Array.Copy (args, firstArgumentIndex, aa, 0, aa.Length); return Run (aa); } /// /// Runs the command line tool. /// /// /// Command line arguments /// /// /// 0 if it succeeds. != 0 otherwise /// public int Run (string[] args) { if (args.Length == 0) { PrintHelp (); return 0; } string[] parms = new string [args.Length - 1]; Array.Copy (args, 1, parms, 0, args.Length - 1); try { ReadOptions (parms); if (HasOption ("v")) verbose++; return RunCommand (args [0], parms); } catch (InstallException ex) { Console.WriteLine (ex.Message); return -1; } } int RunCommand (string cmd, string[] parms) { SetupCommand cc = FindCommand (cmd); if (cc != null) { cc.Handler (parms); return 0; } else { Console.WriteLine ("Unknown command: " + cmd); return 1; } } void Install (string[] args) { bool prompt = !args.Any (a => a == "-y"); var addins = args.Where (a => a != "-y"); if (!addins.Any ()) { PrintHelp ("install"); return; } PackageCollection packs = new PackageCollection (); foreach (string arg in addins) { if (File.Exists (arg)) { packs.Add (AddinPackage.FromFile (arg)); } else { string aname = Addin.GetIdName (GetFullId (arg)); string aversion = Addin.GetIdVersion (arg); if (aversion.Length == 0) aversion = null; AddinRepositoryEntry[] ads = service.Repositories.GetAvailableAddin (aname, aversion); if (ads.Length == 0) throw new InstallException ("The addin '" + arg + "' is not available for install."); packs.Add (AddinPackage.FromRepository (ads[ads.Length-1])); } } Install (packs, prompt); } void CheckInstall (string[] args) { if (args.Length < 1) { PrintHelp ("check-install"); return; } PackageCollection packs = new PackageCollection (); for (int n=0; n a == "-y"); var addins = args.Where (a => a != "-y"); if (!addins.Any ()) throw new InstallException ("The add-in id is required."); if (addins.Count () > 1) throw new InstallException ("Only one add-in id can be provided."); string id = addins.First (); Addin ads = registry.GetAddin (GetFullId (id)); if (ads == null) throw new InstallException ("The add-in '" + id + "' is not installed."); if (!ads.Description.CanUninstall) throw new InstallException ("The add-in '" + id + "' is protected and can't be uninstalled."); if (prompt) { Console.WriteLine ("The following add-ins will be uninstalled:"); Console.WriteLine (" - " + ads.Description.Name); foreach (Addin si in service.GetDependentAddins (id, true)) Console.WriteLine (" - " + si.Description.Name); Console.WriteLine (); Console.Write ("Are you sure you want to continue? (y/N): "); string res = Console.ReadLine (); if (res != "y" && res != "Y") return; } service.Uninstall (new ConsoleProgressStatus (verbose), ads.Id); } bool IsHidden (Addin ainfo) { return service.ApplicationNamespace != null && !(ainfo.Namespace + ".").StartsWith (service.ApplicationNamespace + ".") || ainfo.Description.IsHidden; } bool IsHidden (AddinHeader ainfo) { return service.ApplicationNamespace != null && !(ainfo.Namespace + ".").StartsWith (service.ApplicationNamespace + "."); } string GetId (AddinHeader ainfo) { if (service.ApplicationNamespace != null && (ainfo.Namespace + ".").StartsWith (service.ApplicationNamespace + ".")) return ainfo.Id.Substring (service.ApplicationNamespace.Length + 1); else return ainfo.Id; } string GetFullId (string id) { if (service.ApplicationNamespace != null) return service.ApplicationNamespace + "." + id; else return id; } void ListInstalled (string[] args) { IList alist = args; bool showAll = alist.Contains ("-a"); Console.WriteLine ("Installed add-ins:"); ArrayList list = new ArrayList (); list.AddRange (registry.GetAddins ()); if (alist.Contains ("-r")) list.AddRange (registry.GetAddinRoots ()); foreach (Addin addin in list) { if (!showAll && IsHidden (addin)) continue; Console.Write (" - " + addin.Name + " " + addin.Version); if (showAll) Console.Write (" (" + addin.AddinFile + ")"); Console.WriteLine (); } } void ListAvailable (string[] args) { bool showAll = args.Length > 0 && args [0] == "-a"; Console.WriteLine ("Available add-ins:"); AddinRepositoryEntry[] addins = service.Repositories.GetAvailableAddins (); foreach (PackageRepositoryEntry addin in addins) { if (!showAll && IsHidden (addin.Addin)) continue; Console.WriteLine (" - " + GetId (addin.Addin) + " (" + addin.Repository.Name + ")"); } } void ListUpdates (string[] args) { bool showAll = args.Length > 0 && args [0] == "-a"; Console.WriteLine ("Looking for updates..."); service.Repositories.UpdateAllRepositories (null); Console.WriteLine ("Available add-in updates:"); AddinRepositoryEntry[] addins = service.Repositories.GetAvailableAddins (); bool found = false; foreach (PackageRepositoryEntry addin in addins) { Addin sinfo = registry.GetAddin (addin.Addin.Id); if (!showAll && IsHidden (sinfo)) continue; if (sinfo != null && Addin.CompareVersions (sinfo.Version, addin.Addin.Version) == 1) { Console.WriteLine (" - " + addin.Addin.Id + " " + addin.Addin.Version + " (" + addin.Repository.Name + ")"); found = true; } } if (!found) Console.WriteLine ("No updates found."); } void Update (string [] args) { bool showAll = args.Length > 0 && args [0] == "-a"; Console.WriteLine ("Looking for updates..."); service.Repositories.UpdateAllRepositories (null); PackageCollection packs = new PackageCollection (); AddinRepositoryEntry[] addins = service.Repositories.GetAvailableAddins (); foreach (PackageRepositoryEntry addin in addins) { Addin sinfo = registry.GetAddin (addin.Addin.Id); if (!showAll && IsHidden (sinfo)) continue; if (sinfo != null && Addin.CompareVersions (sinfo.Version, addin.Addin.Version) == 1) packs.Add (AddinPackage.FromRepository (addin)); } if (packs.Count > 0) Install (packs, true); else Console.WriteLine ("No updates found."); } void UpdateAvailableAddins (string[] args) { service.Repositories.UpdateAllRepositories (new ConsoleProgressStatus (verbose)); } void AddRepository (string[] args) { foreach (string rep in args) service.Repositories.RegisterRepository (new ConsoleProgressStatus (verbose), rep); } string GetRepositoryUrl (string url) { AddinRepository[] reps = GetRepositoryList (); int nr; if (int.TryParse (url, out nr)) { if (nr < 0 || nr >= reps.Length) throw new InstallException ("Invalid repository number."); return reps[nr].Url; } else { if (!service.Repositories.ContainsRepository (url)) throw new InstallException ("Repository not registered."); return url; } } void RemoveRepository (string[] args) { foreach (string rep in args) { service.Repositories.RemoveRepository (GetRepositoryUrl (rep)); } } void EnableRepository (string[] args) { foreach (string rep in args) service.Repositories.SetRepositoryEnabled (GetRepositoryUrl(rep), true); } void DisableRepository (string[] args) { foreach (string rep in args) service.Repositories.SetRepositoryEnabled (GetRepositoryUrl(rep), false); } AddinRepository[] GetRepositoryList () { AddinRepository[] reps = service.Repositories.GetRepositories (); Array.Sort (reps, (r1,r2) => r1.Title.CompareTo(r2.Title)); return reps; } void ListRepositories (string[] args) { AddinRepository[] reps = GetRepositoryList (); if (reps.Length == 0) { Console.WriteLine ("No repositories have been registered."); return; } int n = 0; Console.WriteLine ("Registered repositories:"); foreach (RepositoryRecord rep in reps) { string num = n.ToString (); Console.Write (num + ") "); if (!rep.Enabled) Console.Write ("(Disabled) "); Console.WriteLine (rep.Title); if (rep.Title != rep.Url) Console.WriteLine (new string (' ', num.Length + 2) + rep.Url); n++; } } void BuildRepository (string[] args) { if (args.Length < 1) throw new InstallException ("A directory name is required."); service.BuildRepository (new ConsoleProgressStatus (verbose), args[0]); } void BuildPackage (string[] args) { if (args.Length < 1) throw new InstallException ("A file name is required."); service.BuildPackage (new ConsoleProgressStatus (verbose), GetOption ("d", "."), GetArguments ()); } void PrintLibraries (string[] args) { if (GetArguments ().Length < 1) throw new InstallException ("An add-in id is required."); bool refFormat = HasOption ("r"); System.Text.StringBuilder sb = new System.Text.StringBuilder (); foreach (string id in GetArguments ()) { Addin addin = service.Registry.GetAddin (id); if (addin != null) { foreach (string asm in addin.Description.MainModule.Assemblies) { string file = Path.Combine (addin.Description.BasePath, asm); if (sb.Length > 0) sb.Append (' '); if (refFormat) sb.Append ("-r:"); sb.Append (file); } } } Console.WriteLine (sb); } void PrintApplications (string[] args) { foreach (Application app in SetupService.GetExtensibleApplications ()) { string line = app.Name; if (!string.IsNullOrEmpty (app.Description)) line += " - " + app.Description; Console.WriteLine (line); } } void UpdateRegistry (string[] args) { registry.Update (new ConsoleProgressStatus (verbose)); } void RepairRegistry (string[] args) { registry.Rebuild (new ConsoleProgressStatus (verbose)); } void DumpRegistryFile (string[] args) { if (args.Length < 1) throw new InstallException ("A file name is required."); registry.DumpFile (args[0]); } void PrintAddinInfo (string[] args) { bool generateXml = false; bool generateAll = false; bool pickNamespace = false; bool extensionModel = true; ArrayList addins = new ArrayList (); ArrayList namespaces = new ArrayList (); foreach (string a in args) { if (pickNamespace) { namespaces.Add (a); pickNamespace = false; continue; } if (a == "--xml") { generateXml = true; continue; } if (a == "--namespace" || a == "-n") { pickNamespace = true; continue; } if (a == "--all") { generateAll = true; continue; } if (a == "--full") { extensionModel = false; continue; } AddinDescription desc = null; if (File.Exists (args[0])) desc = registry.GetAddinDescription (new Mono.Addins.ConsoleProgressStatus (verbose), args[0]); else { Addin addin = registry.GetAddin (args [0]); if (addin != null) desc = addin.Description; } if (desc == null) throw new InstallException (string.Format ("Add-in '{0}' not found.", a)); if (desc != null) addins.Add (desc); } if (generateAll) { ArrayList list = new ArrayList (); list.AddRange (registry.GetAddinRoots ()); list.AddRange (registry.GetAddins ()); foreach (Addin addin in list) { if (namespaces.Count > 0) { foreach (string ns in namespaces) { if (addin.Id.StartsWith (ns + ".")) { addins.Add (addin.Description); break; } } } else { addins.Add (addin.Description); } } } if (addins.Count == 0) throw new InstallException ("A file name or add-in ID is required."); if (generateXml) { XmlTextWriter tw = new XmlTextWriter (Console.Out); tw.Formatting = Formatting.Indented; tw.WriteStartElement ("Addins"); foreach (AddinDescription desc in addins) { if (extensionModel && desc.ExtensionPoints.Count == 0) continue; PrintAddinXml (tw, desc); } tw.Close (); } else { foreach (AddinDescription des in addins) PrintAddin (des); } } void PrintAddinXml (XmlWriter tw, AddinDescription desc) { tw.WriteStartElement ("Addin"); tw.WriteAttributeString ("name", desc.Name); tw.WriteAttributeString ("addinId", desc.LocalId); tw.WriteAttributeString ("fullId", desc.AddinId); tw.WriteAttributeString ("id", "addin_" + uniqueId); uniqueId++; if (desc.Namespace.Length > 0) tw.WriteAttributeString ("namespace", desc.Namespace); tw.WriteAttributeString ("isroot", desc.IsRoot.ToString ()); tw.WriteAttributeString ("version", desc.Version); if (desc.CompatVersion.Length > 0) tw.WriteAttributeString ("compatVersion", desc.CompatVersion); if (desc.Author.Length > 0) tw.WriteAttributeString ("author", desc.Author); if (desc.Category.Length > 0) tw.WriteAttributeString ("category", desc.Category); if (desc.Copyright.Length > 0) tw.WriteAttributeString ("copyright", desc.Copyright); if (desc.Url.Length > 0) tw.WriteAttributeString ("url", desc.Url); if (desc.Description.Length > 0) tw.WriteElementString ("Description", desc.Description); if (desc.ExtensionPoints.Count > 0) { ArrayList list = new ArrayList (); Hashtable visited = new Hashtable (); foreach (ExtensionPoint ep in desc.ExtensionPoints) { tw.WriteStartElement ("ExtensionPoint"); tw.WriteAttributeString ("path", ep.Path); if (ep.Name.Length > 0) tw.WriteAttributeString ("name", ep.Name); else tw.WriteAttributeString ("name", ep.Path); if (ep.Description.Length > 0) tw.WriteElementString ("Description", ep.Description); PrintExtensionNodeSetXml (tw, desc, ep.NodeSet, list, visited); tw.WriteEndElement (); } for (int n=0; n 0) tw.WriteElementString ("Description", nt.Description); if (nt.Attributes.Count > 0) { tw.WriteStartElement ("Attributes"); foreach (NodeTypeAttribute att in nt.Attributes) { tw.WriteStartElement ("Attribute"); tw.WriteAttributeString ("name", att.Name); tw.WriteAttributeString ("type", att.Type); tw.WriteAttributeString ("required", att.Required.ToString ()); tw.WriteAttributeString ("localizable", att.Localizable.ToString ()); if (att.Description.Length > 0) tw.WriteElementString ("Description", att.Description); tw.WriteEndElement (); } tw.WriteEndElement (); } if (nt.NodeTypes.Count > 0 || nt.NodeSets.Count > 0) { tw.WriteStartElement ("ChildNodes"); PrintExtensionNodeSetXml (tw, desc, nt, list, visited); tw.WriteEndElement (); } tw.WriteEndElement (); } } tw.WriteEndElement (); } void PrintExtensionNodeSetXml (XmlWriter tw, AddinDescription desc, ExtensionNodeSet nset, ArrayList list, Hashtable visited) { foreach (ExtensionNodeType nt in nset.GetAllowedNodeTypes ()) { tw.WriteStartElement ("ExtensionNode"); tw.WriteAttributeString ("name", nt.Id); string id = RegisterNodeXml (nt, list, visited); tw.WriteAttributeString ("id", id.ToString ()); if (nt.Description.Length > 0) tw.WriteElementString ("Description", nt.Description); tw.WriteEndElement (); } } string RegisterNodeXml (ExtensionNodeType nt, ArrayList list, Hashtable visited) { string key = nt.Id + " " + nt.TypeName; if (visited.Contains (key)) return (string) visited [key]; string k = "ntype_" + uniqueId; uniqueId++; visited [key] = k; list.Add (nt); return k; } void PrintAddin (AddinDescription desc) { Console.WriteLine (); Console.WriteLine ("Addin Header"); Console.WriteLine ("------------"); Console.WriteLine (); Console.WriteLine ("Name: " + desc.Name); Console.WriteLine ("Id: " + desc.LocalId); if (desc.Namespace.Length > 0) Console.WriteLine ("Namespace: " + desc.Namespace); Console.Write ("Version: " + desc.Version); if (desc.CompatVersion.Length > 0) Console.WriteLine (" (compatible with: " + desc.CompatVersion + ")"); else Console.WriteLine (); if (desc.AddinFile.Length > 0) Console.WriteLine ("File: " + desc.AddinFile); if (desc.Author.Length > 0) Console.WriteLine ("Author: " + desc.Author); if (desc.Category.Length > 0) Console.WriteLine ("Category: " + desc.Category); if (desc.Copyright.Length > 0) Console.WriteLine ("Copyright: " + desc.Copyright); if (desc.Url.Length > 0) Console.WriteLine ("Url: " + desc.Url); if (desc.Description.Length > 0) { Console.WriteLine (); Console.WriteLine ("Description: \n" + desc.Description); } if (desc.ExtensionPoints.Count > 0) { Console.WriteLine (); Console.WriteLine ("Extenstion Points"); Console.WriteLine ("-----------------"); foreach (ExtensionPoint ep in desc.ExtensionPoints) PrintExtensionPoint (desc, ep); } } void PrintExtensionPoint (AddinDescription desc, ExtensionPoint ep) { Console.WriteLine (); Console.WriteLine ("* Extension Point: " + ep.Path); if (ep.Description.Length > 0) Console.WriteLine (ep.Description); ArrayList list = new ArrayList (); Hashtable visited = new Hashtable (); Console.WriteLine (); Console.WriteLine (" Extension nodes:"); GetNodes (desc, ep.NodeSet, list, new Hashtable ()); foreach (ExtensionNodeType nt in list) Console.WriteLine (" - " + nt.Id + ": " + nt.Description); Console.WriteLine (); Console.WriteLine (" Node description:"); string sind = " "; for (int n=0; n 0) { Console.WriteLine (nsind + "Attributes:"); foreach (NodeTypeAttribute att in nt.Attributes) { string req = att.Required ? " (required)" : ""; Console.WriteLine (nsind + " " + att.Name + " (" + att.Type + "): " + att.Description + req); } } if (nt.NodeTypes.Count > 0 || nt.NodeSets.Count > 0) { Console.WriteLine (nsind + "Child nodes:"); ArrayList newList = new ArrayList (); GetNodes (desc, nt, newList, new Hashtable ()); list.AddRange (newList); foreach (ExtensionNodeType cnt in newList) Console.WriteLine (" " + cnt.Id + ": " + cnt.Description); } } Console.WriteLine (); } void GetNodes (AddinDescription desc, ExtensionNodeSet nset, ArrayList list, Hashtable visited) { if (visited.Contains (nset)) return; visited.Add (nset, nset); foreach (ExtensionNodeType nt in nset.NodeTypes) { if (!visited.Contains (nt.Id + " " + nt.TypeName)) { list.Add (nt); visited.Add (nt.Id + " " + nt.TypeName, nt); } } foreach (string nsid in nset.NodeSets) { ExtensionNodeSet rset = desc.ExtensionNodeSets [nsid]; if (rset != null) GetNodes (desc, rset, list, visited); } } string[] GetArguments () { return arguments; } bool HasOption (string key) { return options.Contains (key); } string GetOption (string key, string defValue) { object val = options [key]; if (val == null || val == (object) this) return defValue; else return (string) val; } void ReadOptions (string[] args) { options = new Hashtable (); ArrayList list = new ArrayList (); foreach (string arg in args) { if (arg.StartsWith ("-")) { int i = arg.IndexOf (':'); if (i == -1) options [arg.Substring (1)] = this; else options [arg.Substring (1, i-1)] = arg.Substring (i+1); } else list.Add (arg); } arguments = (string[]) list.ToArray (typeof(string)); } /// /// Adds a custom command to the add-in manager /// /// /// Category under which the command has to be shown in the help text /// /// /// Name of the command /// /// /// Short name of the command (it's an alias of the normal name) /// /// /// Formal description of the arguments that the command accepts. For example: "[addin-id|addin-file] [--xml] [--all] [--full] [--namespace ]" /// /// /// Short description of the command /// /// /// Long description of the command /// /// /// Delegate to be invoked to run the command /// public void AddCommand (string category, string command, string shortName, string arguments, string description, string longDescription, SetupCommandHandler handler) { SetupCommand cmd = new SetupCommand (category, command, shortName, handler); cmd.Usage = arguments; cmd.Description = description; cmd.LongDescription = longDescription; int lastCatPos = -1; for (int n=0; n /// Prints help about the add-in management tool, or about a specific command /// /// /// Optional command name and arguments /// public void PrintHelp (params string[] parms) { if (parms.Length == 0) { string lastCat = null; foreach (SetupCommand cmd in commands) { if (cmd.Command == "help") continue; if (lastCat != cmd.Category) { Console.WriteLine (); Console.WriteLine (cmd.Category + ":"); lastCat = cmd.Category; } string cc = cmd.CommandDesc; if (cc.Length < 16) cc += new string (' ', 16 - cc.Length); Console.WriteLine (" " + cc + " " + cmd.Description); } Console.WriteLine (); Console.WriteLine ("Run '" + setupAppName + "help ' to get help about a specific command."); Console.WriteLine (); return; } else { Console.WriteLine (); SetupCommand cmd = FindCommand (parms [0]); if (cmd != null) { Console.WriteLine ("{0}: {1}", cmd.CommandDesc, cmd.Description); Console.WriteLine (); Console.WriteLine ("Usage: {0}{1}", setupAppName, cmd.Usage); Console.WriteLine (); TextFormatter fm = new TextFormatter (); fm.Wrap = WrappingType.Word; fm.Append (cmd.LongDescription); Console.WriteLine (fm.ToString ()); } else Console.WriteLine ("Unknown command: " + parms [0]); Console.WriteLine (); } } void CreateCommands () { SetupCommand cmd; string cat = "Add-in commands"; cmd = new SetupCommand (cat, "install", "i", new SetupCommandHandler (Install)); cmd.Description = "Installs add-ins."; cmd.Usage = "[-y] [package-name|package-file] ..."; cmd.AppendDesc ("Installs an add-in or set of addins. The command argument is a list"); cmd.AppendDesc ("of files and/or package names. If a package name is provided"); cmd.AppendDesc ("the package will be looked up in the registered repositories."); cmd.AppendDesc ("A specific add-in version can be specified by appending it to."); cmd.AppendDesc ("the package name using '/' as a separator, like in this example:"); cmd.AppendDesc ("MonoDevelop.SourceEditor/0.9.1\n"); cmd.AppendDesc ("-y: Don't ask for confirmation."); commands.Add (cmd); cmd = new SetupCommand (cat, "uninstall", "u", new SetupCommandHandler (Uninstall)); cmd.Description = "Uninstalls add-ins."; cmd.Usage = "[-y] "; cmd.AppendDesc ("Uninstalls an add-in. The command argument is the name"); cmd.AppendDesc ("of the add-in to uninstall.\n"); cmd.AppendDesc ("-y: Don't ask for confirmation."); commands.Add (cmd); cmd = new SetupCommand (cat, "check-install", "ci", new SetupCommandHandler (CheckInstall)); cmd.Description = "Checks installed add-ins."; cmd.Usage = "[package-name|package-file] ..."; cmd.AppendDesc ("Checks if a package is installed. If it is not, it looks for"); cmd.AppendDesc ("the package in the registered repositories, and if found"); cmd.AppendDesc ("the package is downloaded and installed, including all"); cmd.AppendDesc ("needed dependencies."); commands.Add (cmd); cmd = new SetupCommand (cat, "update", "up", new SetupCommandHandler (Update)); cmd.Description = "Updates installed add-ins."; cmd.AppendDesc ("Downloads and installs available updates for installed add-ins."); commands.Add (cmd); cmd = new SetupCommand (cat, "list", "l", new SetupCommandHandler (ListInstalled)); cmd.Description = "Lists installed add-ins."; cmd.AppendDesc ("Prints a list of all installed add-ins."); commands.Add (cmd); cmd = new SetupCommand (cat, "list-av", "la", new SetupCommandHandler (ListAvailable)); cmd.Description = "Lists add-ins available in registered repositories."; cmd.AppendDesc ("Prints a list of add-ins available to install in the"); cmd.AppendDesc ("registered repositories."); commands.Add (cmd); cmd = new SetupCommand (cat, "list-update", "lu", new SetupCommandHandler (ListUpdates)); cmd.Description = "Lists available add-in updates."; cmd.AppendDesc ("Prints a list of available add-in updates in the registered repositories."); commands.Add (cmd); cat = "Repository Commands"; cmd = new SetupCommand (cat, "rep-add", "ra", new SetupCommandHandler (AddRepository)); cmd.Description = "Registers repositories."; cmd.Usage = " ..."; cmd.AppendDesc ("Registers an add-in repository. Several URLs can be provided."); commands.Add (cmd); cmd = new SetupCommand (cat, "rep-remove", "rr", new SetupCommandHandler (RemoveRepository)); cmd.Description = "Unregisters repositories."; cmd.Usage = " ..."; cmd.AppendDesc ("Unregisters an add-in repository. Several URLs can be provided."); cmd.AppendDesc ("Instead of an url, a repository number can be used (repository numbers are"); cmd.AppendDesc ("shown by the rep-list command."); commands.Add (cmd); cmd = new SetupCommand (cat, "rep-enable", "re", new SetupCommandHandler (EnableRepository)); cmd.Description = "Enables repositories."; cmd.Usage = " ..."; cmd.AppendDesc ("Enables an add-in repository which has been disabled. Several URLs can be"); cmd.AppendDesc ("provided. Instead of an url, a repository number can be used (repository"); cmd.AppendDesc ("numbers are shown by the rep-list command."); commands.Add (cmd); cmd = new SetupCommand (cat, "rep-disable", "rd", new SetupCommandHandler (DisableRepository)); cmd.Description = "Disables repositories."; cmd.Usage = " ..."; cmd.AppendDesc ("Disables an add-in repository. Several URLs can be provided"); cmd.AppendDesc ("When a repository is disabled, it will be ignored when using the update and"); cmd.AppendDesc ("install commands."); cmd.AppendDesc ("Instead of an url, a repository number can be used (repository numbers are"); cmd.AppendDesc ("shown by the rep-list command."); commands.Add (cmd); cmd = new SetupCommand (cat, "rep-update", "ru", new SetupCommandHandler (UpdateAvailableAddins)); cmd.Description = "Updates the lists of available addins."; cmd.AppendDesc ("Updates the lists of addins available in all registered repositories."); commands.Add (cmd); cmd = new SetupCommand (cat, "rep-list", "rl", new SetupCommandHandler (ListRepositories)); cmd.Description = "Lists registered repositories."; cmd.AppendDesc ("Shows a list of all registered repositories."); commands.Add (cmd); cat = "Add-in Registry Commands"; cmd = new SetupCommand (cat, "reg-update", "rgu", new SetupCommandHandler (UpdateRegistry)); cmd.Description = "Updates the add-in registry."; cmd.AppendDesc ("Looks for changes in add-in directories and updates the registry."); cmd.AppendDesc ("New add-ins will be added and deleted add-ins will be removed."); commands.Add (cmd); cmd = new SetupCommand (cat, "reg-build", "rgb", new SetupCommandHandler (RepairRegistry)); cmd.Description = "Rebuilds the add-in registry."; cmd.AppendDesc ("Regenerates the add-in registry"); commands.Add (cmd); cmd = new SetupCommand (cat, "info", null, new SetupCommandHandler (PrintAddinInfo)); cmd.Usage = "[addin-id|addin-file] [--xml] [--all] [--full] [--namespace ]"; cmd.Description = "Prints information about add-ins."; cmd.AppendDesc ("Prints information about add-ins. Options:\n"); cmd.AppendDesc (" --xml: Dump the information using an XML format.\n"); cmd.AppendDesc (" --all: Dump information from all add-ins.\n"); cmd.AppendDesc (" --full: Include add-ins which don't define extension points.\n"); cmd.AppendDesc (" --namespace ns: Include only add-ins from the specified 'ns' namespace."); commands.Add (cmd); cat = "Packaging Commands"; cmd = new SetupCommand (cat, "rep-build", "rb", new SetupCommandHandler (BuildRepository)); cmd.Description = "Creates a repository index file for a directory structure."; cmd.Usage = ""; cmd.AppendDesc ("Scans the provided directory and generates a set of index files with entries"); cmd.AppendDesc ("for all add-in packages found in the directory tree. The resulting file"); cmd.AppendDesc ("structure is an add-in repository that can be published in a web site or a"); cmd.AppendDesc ("shared directory."); commands.Add (cmd); cmd = new SetupCommand (cat, "pack", "p", new SetupCommandHandler (BuildPackage)); cmd.Description = "Creates a package from an add-in configuration file."; cmd.Usage = " [-d:output-directory]"; cmd.AppendDesc ("Creates an add-in package (.mpack file) which includes all files "); cmd.AppendDesc ("needed to deploy an add-in. The command parameter is the path to"); cmd.AppendDesc ("the add-in's configuration file."); commands.Add (cmd); cmd = new SetupCommand (cat, "help", "h", new SetupCommandHandler (PrintHelp)); cmd.Description = "Shows help about a command."; cmd.Usage = ""; commands.Add (cmd); cat = "Build Commands"; cmd = new SetupCommand (cat, "libraries", "libs", new SetupCommandHandler (PrintLibraries)); cmd.Description = "Lists add-in assemblies."; cmd.Usage = "[-r] ..."; cmd.AppendDesc ("Prints a list of assemblies exported by the add-in or add-ins provided"); cmd.AppendDesc ("as arguments. This list of assemblies can be used as references for"); cmd.AppendDesc ("building add-ins that depend on them. If the -r option is specified,"); cmd.AppendDesc ("each assembly is prefixed with '-r:'."); commands.Add (cmd); cmd = new SetupCommand (cat, "applications", "apps", new SetupCommandHandler (PrintApplications)); cmd.Description = "Lists extensible applications."; cmd.AppendDesc ("Prints a list of registered extensible applications."); commands.Add (cmd); cat = "Debug Commands"; cmd = new SetupCommand (cat, "dump-file", null, new SetupCommandHandler (DumpRegistryFile)); cmd.Description = "Prints the contents of a registry file."; cmd.Usage = ""; cmd.AppendDesc ("Prints the contents of a registry file for debugging."); commands.Add (cmd); } } class SetupCommand { string usage; public SetupCommand (string cat, string cmd, string shortCmd, SetupCommandHandler handler) { Category = cat; Command = cmd; ShortCommand = shortCmd; Handler = handler; } public void AppendDesc (string s) { LongDescription += s + " "; } public string Category; public string Command; public string ShortCommand; public SetupCommandHandler Handler; public string Usage { get { return usage != null ? Command + " " + usage : Command; } set { usage = value; } } public string CommandDesc { get { if (ShortCommand != null && ShortCommand.Length > 0) return Command + " (" + ShortCommand + ")"; else return Command; } } public string Description = ""; public string LongDescription = ""; } /// /// A command handler /// public delegate void SetupCommandHandler (string[] args); } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinSystemConfiguration.cs0000664000175000017500000000403512136523632031534 0ustar00directhexdirecthex00000000000000// // AddinSystemConfiguration.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Specialized; using System.Xml; using System.Xml.Serialization; namespace Mono.Addins.Setup { internal class AddinSystemConfiguration { ArrayList repositories = new ArrayList (); int repositoryIdCount = 0; StringCollection disabledAddins = new StringCollection (); StringCollection addinPaths = new StringCollection (); [XmlArrayItem ("Repository", typeof(RepositoryRecord))] public ArrayList Repositories { get { return repositories; } } public int RepositoryIdCount { get { return repositoryIdCount; } set { repositoryIdCount = value; } } [XmlArrayItem ("Addin")] public StringCollection DisabledAddins { get { return disabledAddins; } } [XmlArrayItem ("Addin")] public StringCollection AddinPaths { get { return addinPaths; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinSystemConfigurationSerializer.cs0000664000175000017500000000421712136523632033570 0ustar00directhexdirecthex00000000000000// // AddinSystemConfigurationSerializer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Text; using System.Collections; using System.Globalization; namespace Mono.Addins.Setup { internal class AddinSystemConfigurationSerializer : XmlSerializer { protected override void Serialize (object o, XmlSerializationWriter writer) { AddinSystemConfigurationWriter xsWriter = writer as AddinSystemConfigurationWriter; xsWriter.WriteRoot_AddinSystemConfiguration (o); } protected override object Deserialize (XmlSerializationReader reader) { AddinSystemConfigurationReader xsReader = reader as AddinSystemConfigurationReader; return xsReader.ReadRoot_AddinSystemConfiguration (); } protected override XmlSerializationWriter CreateWriter () { return new AddinSystemConfigurationWriter (); } protected override XmlSerializationReader CreateReader () { return new AddinSystemConfigurationReader (); } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/SetupService.cs0000664000175000017500000006523412136523632027211 0ustar00directhexdirecthex00000000000000// // SetupService.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.IO; using System.Collections; using System.Collections.Generic; using ICSharpCode.SharpZipLib.Zip; using Mono.Addins.Description; using Mono.Addins.Setup.ProgressMonitoring; using Microsoft.Win32; using System.Diagnostics; using Mono.PkgConfig; namespace Mono.Addins.Setup { /// /// Provides tools for managing add-ins /// /// /// This class can be used to manage the add-ins of an application. It allows installing and uninstalling /// add-ins, taking into account add-in dependencies. It provides methods for installing add-ins from on-line /// repositories and tools for generating those repositories. /// public class SetupService { RepositoryRegistry repositories; string applicationNamespace; string installDirectory; AddinStore store; AddinSystemConfiguration config; const string addinFilesDir = "_addin_files"; AddinRegistry registry; /// /// Initializes a new instance /// /// /// If the add-in manager is initialized (AddinManager.Initialize has been called), then this instance /// will manage the add-in registry of the initialized engine. /// public SetupService () { if (AddinManager.IsInitialized) registry = AddinManager.Registry; else registry = AddinRegistry.GetGlobalRegistry (); repositories = new RepositoryRegistry (this); store = new AddinStore (this); } /// /// Initializes a new instance /// /// /// Add-in registry to manage /// public SetupService (AddinRegistry registry) { this.registry = registry; repositories = new RepositoryRegistry (this); store = new AddinStore (this); } /// /// The add-in registry being managed /// public AddinRegistry Registry { get { return registry; } } internal string RepositoryCachePath { get { return Path.Combine (registry.RegistryPath, "repository-cache"); } } string RootConfigFile { get { return Path.Combine (registry.RegistryPath, "addins-setup.config"); } } /// /// Default add-in namespace of the application (optional). If set, only add-ins that belong to that namespace /// will be shown in add-in lists. /// public string ApplicationNamespace { get { return applicationNamespace; } set { applicationNamespace = value; } } /// /// Directory where to install add-ins. If not specified, the 'addins' subdirectory of the /// registry location is used. /// public string InstallDirectory { get { if (installDirectory != null && installDirectory.Length > 0) return installDirectory; else return registry.DefaultAddinsFolder; } set { installDirectory = value; } } /// /// Returns a RepositoryRegistry which can be used to manage on-line repository references /// public RepositoryRegistry Repositories { get { return repositories; } } internal AddinStore Store { get { return store; } } /// /// Resolves add-in dependencies. /// /// /// Progress monitor where to show progress status /// /// /// List of add-ins to check /// /// /// Packages that need to be installed. /// /// /// Packages that need to be uninstalled. /// /// /// Add-in dependencies that could not be resolved. /// /// /// True if all dependencies could be resolved. /// /// /// This method can be used to get a list of all packages that have to be installed in order to install /// an add-in or set of add-ins. The list of packages to install will include the package that provides the /// add-in, and all packages that provide the add-in dependencies. In some cases, packages may need to /// be installed (for example, when an installed add-in needs to be upgraded). /// public bool ResolveDependencies (IProgressStatus statusMonitor, AddinRepositoryEntry[] addins, out PackageCollection resolved, out PackageCollection toUninstall, out DependencyCollection unresolved) { return store.ResolveDependencies (statusMonitor, addins, out resolved, out toUninstall, out unresolved); } /// /// Resolves add-in dependencies. /// /// /// Progress monitor where to show progress status /// /// /// Packages that need to be installed. /// /// /// Packages that need to be uninstalled. /// /// /// Add-in dependencies that could not be resolved. /// /// /// True if all dependencies could be resolved. /// /// /// This method can be used to get a list of all packages that have to be installed in order to satisfy /// the dependencies of a package or set of packages. The 'packages' argument must have the list of packages /// to be resolved. When resolving dependencies, if there is any additional package that needs to be installed, /// it will be added to the same 'packages' collection. In some cases, packages may need to /// be installed (for example, when an installed add-in needs to be upgraded). Those packages will be added /// to the 'toUninstall' collection. Packages that could not be resolved are added to the 'unresolved' /// collection. /// public bool ResolveDependencies (IProgressStatus statusMonitor, PackageCollection packages, out PackageCollection toUninstall, out DependencyCollection unresolved) { return store.ResolveDependencies (statusMonitor, packages, out toUninstall, out unresolved); } /// /// Installs add-in packages /// /// /// Progress monitor where to show progress status /// /// /// Paths to the packages to install /// /// /// True if the installation succeeded /// public bool Install (IProgressStatus statusMonitor, params string[] files) { return store.Install (statusMonitor, files); } /// /// Installs add-in packages from on-line repositories /// /// /// Progress monitor where to show progress status /// /// /// References to the add-ins to be installed /// /// /// True if the installation succeeded /// public bool Install (IProgressStatus statusMonitor, params AddinRepositoryEntry[] addins) { return store.Install (statusMonitor, addins); } /// /// Installs add-in packages /// /// /// Progress monitor where to show progress status /// /// /// Packages to install /// /// /// True if the installation succeeded /// public bool Install (IProgressStatus statusMonitor, PackageCollection packages) { return store.Install (statusMonitor, packages); } /// /// Uninstalls an add-in. /// /// /// Progress monitor where to show progress status /// /// /// Full identifier of the add-in to uninstall. /// public void Uninstall (IProgressStatus statusMonitor, string id) { store.Uninstall (statusMonitor, id); } /// /// Uninstalls a set of add-ins /// /// /// Progress monitor where to show progress status /// /// /// Full identifiers of the add-ins to uninstall. /// public void Uninstall (IProgressStatus statusMonitor, IEnumerable ids) { store.Uninstall (statusMonitor, ids); } /// /// Gets information about an add-in /// /// /// The add-in /// /// /// Add-in header data /// public static AddinHeader GetAddinHeader (Addin addin) { return AddinInfo.ReadFromDescription (addin.Description); } /// /// Gets a list of add-ins which depend on an add-in /// /// /// Full identifier of an add-in. /// /// /// When set to True, dependencies will be gathered recursivelly /// /// /// List of dependent add-ins. /// /// /// This methods returns a list of add-ins which have the add-in identified by 'id' as a direct /// (or indirect if recursive=True) dependency. /// public Addin[] GetDependentAddins (string id, bool recursive) { return store.GetDependentAddins (id, recursive); } /// /// Packages an add-in /// /// /// Progress monitor where to show progress status /// /// /// Directory where to generate the package /// /// /// Paths to the add-ins to be packaged. Paths can be either the main assembly of an add-in, or an add-in /// manifest (.addin or .addin.xml). /// /// /// This method can be used to create a package for an add-in, which can then be pushed to an on-line /// repository. The package will include the main assembly or manifest of the add-in and any external /// file declared in the add-in metadata. /// public string[] BuildPackage (IProgressStatus statusMonitor, string targetDirectory, params string[] filePaths) { List outFiles = new List (); foreach (string file in filePaths) { string f = BuildPackageInternal (statusMonitor, targetDirectory, file); if (f != null) outFiles.Add (f); } return outFiles.ToArray (); } string BuildPackageInternal (IProgressStatus monitor, string targetDirectory, string filePath) { AddinDescription conf = registry.GetAddinDescription (monitor, filePath); if (conf == null) { monitor.ReportError ("Could not read add-in file: " + filePath, null); return null; } string basePath = Path.GetDirectoryName (filePath); if (targetDirectory == null) targetDirectory = basePath; // Generate the file name string name; if (conf.LocalId.Length == 0) name = Path.GetFileNameWithoutExtension (filePath); else name = conf.LocalId; name = Addin.GetFullId (conf.Namespace, name, conf.Version); name = name.Replace (',','_').Replace (".__", "."); string outFilePath = Path.Combine (targetDirectory, name) + ".mpack"; ZipOutputStream s = new ZipOutputStream (File.Create (outFilePath)); s.SetLevel(5); // Generate a stripped down description of the add-in in a file, since the complete // description may be declared as assembly attributes XmlDocument doc = new XmlDocument (); doc.PreserveWhitespace = false; doc.LoadXml (conf.SaveToXml ().OuterXml); CleanDescription (doc.DocumentElement); MemoryStream ms = new MemoryStream (); XmlTextWriter tw = new XmlTextWriter (ms, System.Text.Encoding.UTF8); tw.Formatting = Formatting.Indented; doc.WriteTo (tw); tw.Flush (); byte[] data = ms.ToArray (); ZipEntry infoEntry = new ZipEntry ("addin.info"); s.PutNextEntry (infoEntry); s.Write (data, 0, data.Length); // Now add the add-in files ArrayList list = new ArrayList (); if (!conf.AllFiles.Contains (Path.GetFileName (filePath))) list.Add (Path.GetFileName (filePath)); foreach (string f in conf.AllFiles) { list.Add (f); } foreach (var prop in conf.Properties) { try { if (File.Exists (Path.Combine (basePath, prop.Value))) list.Add (prop.Value); } catch { // Ignore errors } } monitor.Log ("Creating package " + Path.GetFileName (outFilePath)); foreach (string file in list) { string fp = Path.Combine (basePath, file); using (FileStream fs = File.OpenRead (fp)) { byte[] buffer = new byte [fs.Length]; fs.Read (buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry (file); s.PutNextEntry (entry); s.Write (buffer, 0, buffer.Length); } } s.Finish(); s.Close(); return outFilePath; } void CleanDescription (XmlElement parent) { ArrayList todelete = new ArrayList (); foreach (XmlNode nod in parent.ChildNodes) { XmlElement elem = nod as XmlElement; if (elem == null) { todelete.Add (nod); continue; } if (elem.LocalName == "Module") CleanDescription (elem); else if (elem.LocalName != "Dependencies" && elem.LocalName != "Runtime" && elem.LocalName != "Header") todelete.Add (elem); } foreach (XmlNode e in todelete) parent.RemoveChild (e); } /// /// Generates an on-line repository /// /// /// Progress monitor where to show progress status /// /// /// Path to the directory that contains the add-ins and that is going to be published /// /// /// This method generates the index files required to publish a directory as an online repository /// of add-ins. /// public void BuildRepository (IProgressStatus statusMonitor, string path) { string mainPath = Path.Combine (path, "main.mrep"); ArrayList allAddins = new ArrayList (); Repository rootrep = (Repository) AddinStore.ReadObject (mainPath, typeof(Repository)); if (rootrep == null) rootrep = new Repository (); IProgressMonitor monitor = ProgressStatusMonitor.GetProgressMonitor (statusMonitor); BuildRepository (monitor, rootrep, path, "root.mrep", allAddins); AddinStore.WriteObject (mainPath, rootrep); GenerateIndexPage (rootrep, allAddins, path); monitor.Log.WriteLine ("Updated main.mrep"); } void BuildRepository (IProgressMonitor monitor, Repository rootrep, string rootPath, string relFilePath, ArrayList allAddins) { DateTime lastModified = DateTime.MinValue; string mainFile = Path.Combine (rootPath, relFilePath); string mainPath = Path.GetDirectoryName (mainFile); string supportFileDir = Path.Combine (mainPath, addinFilesDir); if (File.Exists (mainFile)) lastModified = File.GetLastWriteTime (mainFile); Repository mainrep = (Repository) AddinStore.ReadObject (mainFile, typeof(Repository)); if (mainrep == null) { mainrep = new Repository (); } ReferenceRepositoryEntry repEntry = (ReferenceRepositoryEntry) rootrep.FindEntry (relFilePath); DateTime rootLastModified = repEntry != null ? repEntry.LastModified : DateTime.MinValue; bool modified = false; monitor.Log.WriteLine ("Checking directory: " + mainPath); foreach (string file in Directory.GetFiles (mainPath, "*.mpack")) { DateTime date = File.GetLastWriteTime (file); string fname = Path.GetFileName (file); PackageRepositoryEntry entry = (PackageRepositoryEntry) mainrep.FindEntry (fname); if (entry != null && date > rootLastModified) { mainrep.RemoveEntry (entry); DeleteSupportFiles (supportFileDir, entry.Addin); entry = null; } if (entry == null) { entry = new PackageRepositoryEntry (); AddinPackage p = (AddinPackage) Package.FromFile (file); entry.Addin = (AddinInfo) p.Addin; entry.Url = fname; entry.Addin.Properties.SetPropertyValue ("DownloadSize", new FileInfo (file).Length.ToString ()); ExtractSupportFiles (supportFileDir, file, entry.Addin); mainrep.AddEntry (entry); modified = true; monitor.Log.WriteLine ("Added addin: " + fname); } allAddins.Add (entry); } ArrayList toRemove = new ArrayList (); foreach (PackageRepositoryEntry entry in mainrep.Addins) { if (!File.Exists (Path.Combine (mainPath, entry.Url))) { toRemove.Add (entry); modified = true; } } foreach (PackageRepositoryEntry entry in toRemove) { DeleteSupportFiles (supportFileDir, entry.Addin); mainrep.RemoveEntry (entry); } if (modified) { AddinStore.WriteObject (mainFile, mainrep); monitor.Log.WriteLine ("Updated " + relFilePath); lastModified = File.GetLastWriteTime (mainFile); } if (repEntry != null) { if (repEntry.LastModified < lastModified) repEntry.LastModified = lastModified; } else if (modified) { repEntry = new ReferenceRepositoryEntry (); repEntry.LastModified = lastModified; repEntry.Url = relFilePath; rootrep.AddEntry (repEntry); } foreach (string dir in Directory.GetDirectories (mainPath)) { if (Path.GetFileName (dir) == addinFilesDir) continue; string based = dir.Substring (rootPath.Length + 1); BuildRepository (monitor, rootrep, rootPath, Path.Combine (based, "main.mrep"), allAddins); } } void DeleteSupportFiles (string targetDir, AddinInfo ainfo) { foreach (var prop in ainfo.Properties) { if (prop.Value.StartsWith (addinFilesDir + Path.DirectorySeparatorChar)) { string file = Path.Combine (targetDir, Path.GetFileName (prop.Value)); if (File.Exists (file)) File.Delete (file); } } if (Directory.Exists (targetDir) && Directory.GetFileSystemEntries (targetDir).Length == 0) Directory.Delete (targetDir, true); } void ExtractSupportFiles (string targetDir, string file, AddinInfo ainfo) { Random r = new Random (); ZipFile zfile = new ZipFile (file); foreach (var prop in ainfo.Properties) { ZipEntry ze = zfile.GetEntry (prop.Value); if (ze != null) { string fname; do { fname = Path.Combine (targetDir, r.Next().ToString ("x") + Path.GetExtension (prop.Value)); } while (File.Exists (fname)); if (!Directory.Exists (targetDir)) Directory.CreateDirectory (targetDir); using (var f = File.OpenWrite (fname)) { using (Stream s = zfile.GetInputStream (ze)) { byte[] buffer = new byte [8092]; int nr = 0; while ((nr = s.Read (buffer, 0, buffer.Length)) > 0) f.Write (buffer, 0, nr); } } prop.Value = Path.Combine (addinFilesDir, Path.GetFileName (fname)); } } } void GenerateIndexPage (Repository rep, ArrayList addins, string basePath) { StreamWriter sw = new StreamWriter (Path.Combine (basePath, "index.html")); sw.WriteLine (""); sw.WriteLine ("

Add-in Repository

"); if (rep.Name != null && rep.Name != "") sw.WriteLine ("

" + rep.Name + "

"); sw.WriteLine ("

This is a list of add-ins available in this repository.

"); sw.WriteLine (""); foreach (PackageRepositoryEntry entry in addins) { sw.WriteLine (""); } sw.WriteLine ("
Add-inVersionDescription
" + entry.Addin.Name + "" + entry.Addin.Version + "" + entry.Addin.Description + "
"); sw.WriteLine (""); sw.Close (); } internal AddinSystemConfiguration Configuration { get { if (config == null) { config = (AddinSystemConfiguration) AddinStore.ReadObject (RootConfigFile, typeof(AddinSystemConfiguration)); if (config == null) config = new AddinSystemConfiguration (); } return config; } } internal void SaveConfiguration () { if (config != null) { AddinStore.WriteObject (RootConfigFile, config); } } internal void ResetConfiguration () { if (File.Exists (RootConfigFile)) File.Delete (RootConfigFile); ResetAddinInfo (); } internal void ResetAddinInfo () { if (Directory.Exists (RepositoryCachePath)) Directory.Delete (RepositoryCachePath, true); } /// /// Gets a reference to an extensible application /// /// /// Name of the application /// /// /// The Application object. Null if not found. /// public static Application GetExtensibleApplication (string name) { return GetExtensibleApplication (name, null); } /// /// Gets a reference to an extensible application /// /// /// Name of the application /// /// /// Custom paths where to look for the application. /// /// /// The Application object. Null if not found. /// public static Application GetExtensibleApplication (string name, IEnumerable searchPaths) { AddinsPcFileCache pcc = GetAddinsPcFileCache (searchPaths); PackageInfo pi = pcc.GetPackageInfoByName (name, searchPaths); if (pi != null) return new Application (pi); else return null; } /// /// Gets a lis of all known extensible applications /// /// /// A list of applications. /// public static Application[] GetExtensibleApplications () { return GetExtensibleApplications (null); } /// /// Gets a lis of all known extensible applications /// /// /// Custom paths where to look for applications. /// /// /// A list of applications. /// public static Application[] GetExtensibleApplications (IEnumerable searchPaths) { List list = new List (); AddinsPcFileCache pcc = GetAddinsPcFileCache (searchPaths); foreach (PackageInfo pinfo in pcc.GetPackages (searchPaths)) { if (pinfo.IsValidPackage) list.Add (new Application (pinfo)); } return list.ToArray (); } static AddinsPcFileCache pcFileCache; static AddinsPcFileCache GetAddinsPcFileCache (IEnumerable searchPaths) { if (pcFileCache == null) { pcFileCache = new AddinsPcFileCache (); if (searchPaths != null) pcFileCache.Update (searchPaths); else pcFileCache.Update (); } return pcFileCache; } } class AddinsPcFileCacheContext: IPcFileCacheContext { public bool IsCustomDataComplete (string pcfile, PackageInfo pkg) { return true; } public void StoreCustomData (Mono.PkgConfig.PcFile pcfile, PackageInfo pkg) { } public void ReportError (string message, System.Exception ex) { Console.WriteLine (message); Console.WriteLine (ex); } } class AddinsPcFileCache: PcFileCache { public AddinsPcFileCache (): base (new AddinsPcFileCacheContext ()) { } protected override string CacheDirectory { get { string path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); path = Path.Combine (path, "mono.addins"); return path; } } protected override void ParsePackageInfo (PcFile file, PackageInfo pinfo) { string rootPath = file.GetVariable ("MonoAddinsRoot"); string regPath = file.GetVariable ("MonoAddinsRegistry"); string addinsPath = file.GetVariable ("MonoAddinsInstallPath"); string databasePath = file.GetVariable ("MonoAddinsCachePath"); string testCmd = file.GetVariable ("MonoAddinsTestCommand"); if (string.IsNullOrEmpty (rootPath) || string.IsNullOrEmpty (regPath)) return; pinfo.SetData ("MonoAddinsRoot", rootPath); pinfo.SetData ("MonoAddinsRegistry", regPath); pinfo.SetData ("MonoAddinsInstallPath", addinsPath); pinfo.SetData ("MonoAddinsCachePath", databasePath); pinfo.SetData ("MonoAddinsTestCommand", testCmd); } } /// /// A registered extensible application /// public class Application { AddinRegistry registry; string description; string name; string testCommand; string startupPath; string registryPath; string addinsPath; string databasePath; internal Application (PackageInfo pinfo) { name = pinfo.Name; description = pinfo.Description; startupPath = pinfo.GetData ("MonoAddinsRoot"); registryPath = pinfo.GetData ("MonoAddinsRegistry"); addinsPath = pinfo.GetData ("MonoAddinsInstallPath"); databasePath = pinfo.GetData ("MonoAddinsCachePath"); testCommand = pinfo.GetData ("MonoAddinsTestCommand"); } /// /// Add-in registry of the application /// public AddinRegistry Registry { get { if (registry == null) registry = new AddinRegistry (RegistryPath, StartupPath, AddinsPath, AddinCachePath); return registry; } } /// /// Description of the application /// public string Description { get { return description; } } /// /// Name of the application /// public string Name { get { return name; } } /// /// Path to the add-in registry /// public string RegistryPath { get { return registryPath; } } /// /// Path to the directory that contains the main executable assembly of the application /// public string StartupPath { get { return startupPath; } } /// /// Command to be used to execute the application in add-in development mode. /// public string TestCommand { get { return testCommand; } } /// /// Path to the default add-ins directory for the aplpication /// public string AddinsPath { get { return addinsPath; } } /// /// Path to the add-in cache for the application /// public string AddinCachePath { get { return databasePath; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/PackageCollection.cs0000664000175000017500000000530212136523632030125 0ustar00directhexdirecthex00000000000000// // PackageCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Xml; using System.Xml.Serialization; using System.Collections.Specialized; namespace Mono.Addins.Setup { /// /// A collection of packages /// public class PackageCollection: CollectionBase { /// /// Initializes a new instance of the class. /// public PackageCollection () { } /// /// Copy constructor /// /// /// Collection where to copy from /// public PackageCollection (ICollection col) { AddRange (col); } /// /// Gets a package /// /// /// Package index /// public Package this [int n] { get { return (Package) List [n]; } } /// /// Adds a package /// /// /// A package /// public void Add (Package p) { List.Add (p); } /// /// Checks if a package is present in the collection /// /// /// The package /// /// /// True if the package is preent /// public bool Contains (Package p) { return List.Contains (p); } /// /// Adds a list of packages to the collection /// /// /// The list of packages to add /// public void AddRange (ICollection col) { foreach (Package p in col) Add (p); } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinPackage.cs0000664000175000017500000002717712136523632027067 0ustar00directhexdirecthex00000000000000// // AddinPackage.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Reflection; using System.Diagnostics; using System.Collections.Specialized; using System.Net; using ICSharpCode.SharpZipLib.Zip; using Mono.Addins; using Mono.Addins.Description; using System.Collections.Generic; using System.Linq; namespace Mono.Addins.Setup { internal class AddinPackage: Package { AddinInfo info; string packFile; string url; string tempFolder; bool disablingOnUninstall; bool uninstallingLoaded; string configFile; bool installed; Addin iaddin; public AddinHeader Addin { get { return info; } } public override string Name { get { return info.Name + " v" + info.Version; } } public static AddinPackage PackageFromRepository (AddinRepositoryEntry repAddin) { AddinPackage pack = new AddinPackage (); pack.info = (AddinInfo) repAddin.Addin; pack.url = new Uri (new Uri (repAddin.RepositoryUrl), repAddin.Url).ToString (); return pack; } public static AddinPackage PackageFromFile (string file) { AddinPackage pack = new AddinPackage (); pack.info = ReadAddinInfo (file); pack.packFile = file; return pack; } public static AddinPackage FromInstalledAddin (Addin sinfo) { AddinPackage pack = new AddinPackage (); pack.info = AddinInfo.ReadFromDescription (sinfo.Description); return pack; } static AddinInfo ReadAddinInfo (string file) { ZipFile zfile = new ZipFile (file); foreach (ZipEntry ze in zfile) { if (ze.Name == "addin.info") { using (Stream s = zfile.GetInputStream (ze)) { return AddinInfo.ReadFromAddinFile (new StreamReader (s)); } } } throw new InstallException ("Addin configuration file not found in package."); } internal override bool IsUpgradeOf (Package p) { AddinPackage ap = p as AddinPackage; if (ap == null) return false; return info.SupportsVersion (ap.info.Version); } public override bool Equals (object ob) { AddinPackage ap = ob as AddinPackage; if (ap == null) return false; return ap.info.Id == info.Id && ap.info.Version == info.Version; } public override int GetHashCode () { return (info.Id + info.Version).GetHashCode (); } internal override void PrepareInstall (IProgressMonitor monitor, AddinStore service) { if (service.Registry.IsRegisteredForUninstall (info.Id)) throw new InstallException ("The addin " + info.Name + " v" + info.Version + " is scheduled for uninstallation. Please restart the application before trying to install it again."); if (service.Registry.GetAddin (Mono.Addins.Addin.GetFullId (info.Namespace, info.Id, info.Version), true) != null) throw new InstallException ("The addin " + info.Name + " v" + info.Version + " is already installed."); if (url != null) packFile = service.DownloadFile (monitor, url); tempFolder = CreateTempFolder (); // Extract the files using (FileStream fs = new FileStream (packFile, FileMode.Open, FileAccess.Read)) { ZipFile zip = new ZipFile (fs); foreach (ZipEntry entry in zip) { string path = Path.Combine (tempFolder, entry.Name); string dir = Path.GetDirectoryName (path); if (!Directory.Exists (dir)) Directory.CreateDirectory (dir); byte[] buffer = new byte [8192]; int n=0; Stream inStream = zip.GetInputStream (entry); Stream outStream = null; try { outStream = File.Create (path); while ((n = inStream.Read (buffer, 0, buffer.Length)) > 0) outStream.Write (buffer, 0, n); } finally { inStream.Close (); if (outStream != null) outStream.Close (); } } } foreach (string s in Directory.GetFiles (tempFolder)) { if (Path.GetFileName (s) == "addin.info") { configFile = s; break; } } if (configFile == null) throw new InstallException ("Add-in information file not found in package."); } internal override void CommitInstall (IProgressMonitor monitor, AddinStore service) { service.RegisterAddin (monitor, info, tempFolder); installed = true; } internal override void RollbackInstall (IProgressMonitor monitor, AddinStore service) { if (installed) { iaddin = service.Registry.GetAddin (info.Id); if (iaddin != null) CommitUninstall (monitor, service); } } internal override void EndInstall (IProgressMonitor monitor, AddinStore service) { if (url != null && packFile != null) File.Delete (packFile); if (tempFolder != null) Directory.Delete (tempFolder, true); } internal override void Resolve (IProgressMonitor monitor, AddinStore service, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection installedRequired, DependencyCollection unresolved) { Addin ia = service.Registry.GetAddin (Mono.Addins.Addin.GetIdName (info.Id)); if (ia != null) { Package p = AddinPackage.FromInstalledAddin (ia); if (!toUninstall.Contains (p)) toUninstall.Add (p); if (!info.SupportsVersion (ia.Version)) { // This addin breaks the api of the currently installed one, // it has to be removed, together with all dependencies Addin[] ainfos = service.GetDependentAddins (info.Id, true); foreach (Addin ainfo in ainfos) { p = AddinPackage.FromInstalledAddin (ainfo); if (!toUninstall.Contains (p)) toUninstall.Add (p); } } } foreach (Dependency dep in info.Dependencies) { service.ResolveDependency (monitor, dep, this, toInstall, toUninstall, installedRequired, unresolved); } } internal override void PrepareUninstall (IProgressMonitor monitor, AddinStore service) { iaddin = service.Registry.GetAddin (info.Id, true); if (iaddin == null) throw new InstallException (string.Format ("The add-in '{0}' is not installed.", info.Name)); AddinDescription conf = iaddin.Description; if (!File.Exists (iaddin.AddinFile)) { monitor.ReportWarning (string.Format ("The add-in '{0}' is scheduled for uninstalling, but the add-in file could not be found.", info.Name)); return; } // The add-in is a core application add-in. It can't be uninstalled, so it will be disabled. if (!service.IsUserAddin (iaddin.AddinFile)) { disablingOnUninstall = true; return; } // If the add-in assemblies are loaded, or if there is any file with a write lock, delay the uninstallation HashSet files = new HashSet (GetInstalledFiles (conf)); if (AddinManager.CheckAssembliesLoaded (files) || files.Any (f => HasWriteLock (f))) { uninstallingLoaded = true; return; } if (!service.HasWriteAccess (iaddin.AddinFile)) throw new InstallException (AddinStore.GetUninstallErrorNoRoot (info)); foreach (string path in GetInstalledFiles (conf)) { if (!service.HasWriteAccess (path)) throw new InstallException (AddinStore.GetUninstallErrorNoRoot (info)); } tempFolder = CreateTempFolder (); CopyAddinFiles (monitor, conf, iaddin.AddinFile, tempFolder); } bool HasWriteLock (string file) { if (!File.Exists (file)) return false; try { File.OpenWrite (file).Close (); return false; } catch { return true; } } IEnumerable GetInstalledFiles (AddinDescription conf) { string basePath = Path.GetDirectoryName (conf.AddinFile); foreach (string relPath in conf.AllFiles) { string afile = Path.Combine (basePath, relPath); if (File.Exists (afile)) yield return afile; } foreach (var p in conf.Properties) { string file; try { file = Path.Combine (basePath, p.Value); if (!File.Exists (file)) file = null; } catch { file = null; } if (file != null) yield return file; } } internal override void CommitUninstall (IProgressMonitor monitor, AddinStore service) { if (disablingOnUninstall) { disablingOnUninstall = false; service.Registry.DisableAddin (info.Id); return; } AddinDescription conf = iaddin.Description; string basePath = Path.GetDirectoryName (conf.AddinFile); if (uninstallingLoaded) { List files = new List (); files.Add (iaddin.AddinFile); foreach (string f in GetInstalledFiles (conf)) files.Add (f); service.Registry.RegisterForUninstall (info.Id, files); return; } if (tempFolder == null) return; monitor.Log.WriteLine ("Uninstalling " + info.Name + " v" + info.Version); foreach (string path in GetInstalledFiles (conf)) File.Delete (path); File.Delete (iaddin.AddinFile); RecDeleteDir (monitor, basePath); monitor.Log.WriteLine ("Done"); } void RecDeleteDir (IProgressMonitor monitor, string path) { if (Directory.GetFiles (path).Length != 0) return; foreach (string dir in Directory.GetDirectories (path)) RecDeleteDir (monitor, dir); try { Directory.Delete (path); } catch { monitor.ReportWarning ("Directory " + path + " could not be deleted."); } } internal override void RollbackUninstall (IProgressMonitor monitor, AddinStore service) { disablingOnUninstall = false; if (tempFolder != null) { AddinDescription conf = iaddin.Description; string configFile = Path.Combine (tempFolder, Path.GetFileName (iaddin.AddinFile)); string addinDir = Path.GetDirectoryName (iaddin.AddinFile); CopyAddinFiles (monitor, conf, configFile, addinDir); } } internal override void EndUninstall (IProgressMonitor monitor, AddinStore service) { if (tempFolder != null) Directory.Delete (tempFolder, true); tempFolder = null; } void CopyAddinFiles (IProgressMonitor monitor, AddinDescription conf, string configFile, string destPath) { if (!Directory.Exists (destPath)) Directory.CreateDirectory (destPath); string dfile = Path.Combine (destPath, Path.GetFileName (configFile)); if (File.Exists (dfile)) File.Delete (dfile); File.Copy (configFile, dfile); string basePath = Path.GetDirectoryName (configFile); foreach (string relPath in conf.AllFiles) { string path = Path.Combine (basePath, relPath); if (!File.Exists (path)) continue; string destf = Path.Combine (destPath, Path.GetDirectoryName (relPath)); if (!Directory.Exists (destf)) Directory.CreateDirectory (destf); dfile = Path.Combine (destPath, relPath); if (File.Exists (dfile)) File.Delete (dfile); File.Copy (path, dfile); } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/ReferenceRepositoryEntry.cs0000664000175000017500000000266312136523632031605 0ustar00directhexdirecthex00000000000000// // ReferenceRepositoryEntry.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Setup { internal class ReferenceRepositoryEntry: RepositoryEntry { DateTime lastModified; public DateTime LastModified { get { return lastModified; } set { lastModified = value; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositoryRegistry.cs0000664000175000017500000005625212136523632030500 0ustar00directhexdirecthex00000000000000// // RepositoryRegistry.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Linq; using System.IO; using System.Collections; using Mono.Addins.Setup.ProgressMonitoring; using System.Collections.Generic; namespace Mono.Addins.Setup { /// /// A registry of on-line repositories /// /// /// This class can be used to manage on-line repository subscriptions. /// public class RepositoryRegistry { ArrayList repoList; SetupService service; internal RepositoryRegistry (SetupService service) { this.service = service; } /// /// Subscribes to an on-line repository /// /// /// Progress monitor where to show progress status and log /// /// /// URL of the repository /// /// /// A repository reference /// /// /// The repository index is not downloaded by default. It can be downloaded /// by calling UpdateRepository. /// public AddinRepository RegisterRepository (IProgressStatus monitor, string url) { return RegisterRepository (monitor, url, false); } /// /// Subscribes to an on-line repository /// /// /// Progress monitor where to show progress status and log /// /// /// URL of the repository /// /// /// When set to True, the repository index will be downloaded. /// /// /// A repository reference /// public AddinRepository RegisterRepository (IProgressStatus monitor, string url, bool updateNow) { if (string.IsNullOrEmpty (url)) throw new ArgumentException ("Emtpy url"); if (!url.EndsWith (".mrep")) { if (url [url.Length - 1] != '/') url += "/"; url = url + "main.mrep"; } RepositoryRecord rr = FindRepositoryRecord (url); if (rr != null) return rr; rr = RegisterRepository (url, false); try { if (updateNow) { UpdateRepository (monitor, url); rr = FindRepositoryRecord (url); Repository rep = rr.GetCachedRepository (); if (rep != null) rr.Name = rep.Name; } service.SaveConfiguration (); return rr; } catch (Exception ex) { if (monitor != null) monitor.ReportError ("The repository could not be registered", ex); if (ContainsRepository (url)) RemoveRepository (url); return null; } } internal RepositoryRecord RegisterRepository (string url, bool isReference) { RepositoryRecord rr = FindRepositoryRecord (url); if (rr != null) { if (rr.IsReference && !isReference) { rr.IsReference = false; service.SaveConfiguration (); } return rr; } rr = new RepositoryRecord (); rr.Url = url; rr.IsReference = isReference; string name = service.RepositoryCachePath; if (!Directory.Exists (name)) Directory.CreateDirectory (name); string host = new Uri (url).Host; if (host.Length == 0) host = "repo"; name = Path.Combine (name, host); rr.File = name + "_" + service.Configuration.RepositoryIdCount + ".mrep"; rr.Id = "rep" + service.Configuration.RepositoryIdCount; service.Configuration.Repositories.Add (rr); service.Configuration.RepositoryIdCount++; service.SaveConfiguration (); repoList = null; return rr; } internal RepositoryRecord FindRepositoryRecord (string url) { foreach (RepositoryRecord rr in service.Configuration.Repositories) if (rr.Url == url) return rr; return null; } /// /// Removes an on-line repository subscription. /// /// /// URL of the repository. /// public void RemoveRepository (string url) { RepositoryRecord rep = FindRepositoryRecord (url); if (rep == null) return; // Nothing to do foreach (RepositoryRecord rr in service.Configuration.Repositories) { if (rr == rep) continue; Repository newRep = rr.GetCachedRepository (); if (newRep == null) continue; foreach (ReferenceRepositoryEntry re in newRep.Repositories) { if (re.Url == url) { // The repository can't be removed because there is another // repository depending on it. Just mark it as a reference. rep.IsReference = true; return; } } } // There are no other repositories referencing this one, so we can safely delete Repository delRep = rep.GetCachedRepository (); service.Configuration.Repositories.Remove (rep); rep.ClearCachedRepository (); if (delRep != null) { foreach (ReferenceRepositoryEntry re in delRep.Repositories) RemoveRepository (new Uri (new Uri (url), re.Url).ToString ()); } service.SaveConfiguration (); repoList = null; } /// /// Enables or disables a repository /// /// /// URL of the repository /// /// /// 'true' if the repository has to be enabled. /// /// /// Disabled repositories are ignored when calling UpdateAllRepositories. /// public void SetRepositoryEnabled (string url, bool enabled) { RepositoryRecord rep = FindRepositoryRecord (url); if (rep == null) return; // Nothing to do rep.Enabled = enabled; Repository crep = rep.GetCachedRepository (); if (crep != null) { foreach (RepositoryEntry re in crep.Repositories) SetRepositoryEnabled (new Uri (new Uri (url), re.Url).ToString (), enabled); } service.SaveConfiguration (); } /// /// Checks if a repository is already subscribed. /// /// /// URL of the repository /// /// /// True if the repository is already subscribed. /// public bool ContainsRepository (string url) { return FindRepositoryRecord (url) != null; } ArrayList RepositoryList { get { if (repoList == null) { ArrayList list = new ArrayList (); foreach (RepositoryRecord rep in service.Configuration.Repositories) { if (!rep.IsReference) list.Add (rep); } repoList = list; } return repoList; } } /// /// Gets a list of subscribed repositories /// /// /// A list of repositories. /// public AddinRepository[] GetRepositories () { return (AddinRepository[]) RepositoryList.ToArray (typeof(AddinRepository)); } /// /// Updates the add-in index of all subscribed repositories. /// /// /// Progress monitor where to show progress status and log /// public void UpdateAllRepositories (IProgressStatus monitor) { UpdateRepository (monitor, (string)null); } /// /// Updates the add-in index of the provided repository /// /// /// Progress monitor where to show progress status and log /// /// /// URL of the repository /// public void UpdateRepository (IProgressStatus statusMonitor, string url) { repoList = null; IProgressMonitor monitor = ProgressStatusMonitor.GetProgressMonitor (statusMonitor); monitor.BeginTask ("Updating repositories", service.Configuration.Repositories.Count); try { int num = service.Configuration.Repositories.Count; for (int n=0; n /// Gets a list of available add-in updates. /// /// /// A list of add-in references. /// /// /// The list is generated by looking at the add-ins currently installed and checking if there is any /// add-in with a newer version number in any of the subscribed repositories. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableUpdates () { return GetAvailableAddin (null, null, null, true, RepositorySearchFlags.None); } /// /// Gets a list of available add-in updates. /// /// /// Search flags /// /// /// A list of add-in references. /// /// /// The list is generated by looking at the add-ins currently installed and checking if there is any /// add-in with a newer version number in any of the subscribed repositories. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableUpdates (RepositorySearchFlags flags) { return GetAvailableAddin (null, null, null, true, flags); } /// /// Gets a list of available add-in updates in a specific repository. /// /// /// The repository URL /// /// /// A list of add-in references. /// /// /// The list is generated by looking at the add-ins currently installed and checking if there is any /// add-in with a newer version number in the provided repository. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableUpdates (string repositoryUrl) { return GetAvailableAddin (repositoryUrl, null, null, true, RepositorySearchFlags.None); } #pragma warning disable 1591 [Obsolete ("Use GetAvailableAddinUpdates (id) instead")] public AddinRepositoryEntry[] GetAvailableUpdates (string id, string version) { return GetAvailableAddin (null, id, version, true, RepositorySearchFlags.None); } [Obsolete ("Use GetAvailableAddinUpdates (repositoryUrl, id) instead")] public AddinRepositoryEntry[] GetAvailableUpdates (string repositoryUrl, string id, string version) { return GetAvailableAddin (repositoryUrl, id, version, true, RepositorySearchFlags.None); } #pragma warning restore 1591 /// /// Gets a list of available updates for an add-in. /// /// /// Identifier of the add-in. /// /// /// List of updates for the specified add-in. /// /// /// The list is generated by checking if there is any /// add-in with a newer version number in any of the subscribed repositories. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddinUpdates (string id) { return GetAvailableAddin (null, id, null, true, RepositorySearchFlags.None); } /// /// Gets a list of available updates for an add-in. /// /// /// Identifier of the add-in. /// /// /// Search flags. /// /// /// List of updates for the specified add-in. /// /// /// The list is generated by checking if there is any /// add-in with a newer version number in any of the subscribed repositories. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddinUpdates (string id, RepositorySearchFlags flags) { return GetAvailableAddin (null, id, null, true, flags); } /// /// Gets a list of available updates for an add-in in a specific repository /// /// /// Identifier of the add-in. /// /// /// Identifier of the add-in. /// /// /// List of updates for the specified add-in. /// /// /// The list is generated by checking if there is any /// add-in with a newer version number in the provided repository. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddinUpdates (string repositoryUrl, string id) { return GetAvailableAddin (repositoryUrl, id, null, true, RepositorySearchFlags.None); } /// /// Gets a list of available updates for an add-in in a specific repository /// /// /// Identifier of the add-in. /// /// /// Identifier of the add-in. /// /// /// Search flags. /// /// /// List of updates for the specified add-in. /// /// /// The list is generated by checking if there is any /// add-in with a newer version number in the provided repository. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddinUpdates (string repositoryUrl, string id, RepositorySearchFlags flags) { return GetAvailableAddin (repositoryUrl, id, null, true, flags); } /// /// Gets a list of all available add-ins /// /// /// A list of add-ins /// /// /// This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddins () { return GetAvailableAddin (null, null, null, false, RepositorySearchFlags.None); } /// /// Gets a list of all available add-ins /// /// /// The available addins. /// /// /// Search flags. /// /// /// This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddins (RepositorySearchFlags flags) { return GetAvailableAddin (null, null, null, false, flags); } /// /// Gets a list of all available add-ins in a repository /// /// /// A repository URL /// /// /// A list of add-ins /// /// /// This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddins (string repositoryUrl) { return GetAvailableAddin (repositoryUrl, null, null); } /// /// Gets a list of all available add-ins in a repository /// /// /// A repository URL /// /// /// Search flags. /// /// /// A list of add-ins /// /// /// This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddins (string repositoryUrl, RepositorySearchFlags flags) { return GetAvailableAddin (repositoryUrl, null, null, false, flags); } /// /// Checks if an add-in is available to be installed /// /// /// Identifier of the add-in /// /// /// Version of the add-in (optional, it can be null) /// /// /// A list of add-ins /// /// /// List of references to add-ins available in on-line repositories. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddin (string id, string version) { return GetAvailableAddin (null, id, version); } /// /// Checks if an add-in is available to be installed from a repository /// /// /// A repository URL /// /// /// Identifier of the add-in /// /// /// Version of the add-in (optional, it can be null) /// /// /// A list of add-ins /// /// /// List of references to add-ins available in the repository. This method uses cached /// information from on-line repositories. Make sure you call UpdateRepository or UpdateAllRepositories /// before using this method to ensure that the latest information is available. /// public AddinRepositoryEntry[] GetAvailableAddin (string repositoryUrl, string id, string version) { return GetAvailableAddin (repositoryUrl, id, version, false, RepositorySearchFlags.None); } PackageRepositoryEntry[] GetAvailableAddin (string repositoryUrl, string id, string version, bool updates, RepositorySearchFlags flags) { List list = new List (); IEnumerable ee; if (repositoryUrl != null) { ArrayList repos = new ArrayList (); GetRepositoryTree (repositoryUrl, repos); ee = repos; } else ee = service.Configuration.Repositories; foreach (RepositoryRecord rr in ee) { if (!rr.Enabled) continue; Repository rep = rr.GetCachedRepository(); if (rep == null) continue; foreach (PackageRepositoryEntry addin in rep.Addins) { if ((id == null || Addin.GetIdName (addin.Addin.Id) == id) && (version == null || addin.Addin.Version == version)) { if (updates) { Addin ainfo = service.Registry.GetAddin (Addin.GetIdName (addin.Addin.Id)); if (ainfo == null || Addin.CompareVersions (ainfo.Version, addin.Addin.Version) <= 0) continue; } list.Add (addin); } } } if ((flags & RepositorySearchFlags.LatestVersionsOnly) != 0) FilterOldVersions (list); // Old versions are returned first list.Sort (); return list.ToArray (); } void FilterOldVersions (List addins) { Dictionary versions = new Dictionary (); foreach (PackageRepositoryEntry a in addins) { string last; string id, version; Addin.GetIdParts (a.Addin.Id, out id, out version); if (!versions.TryGetValue (id, out last) || Addin.CompareVersions (last, version) > 0) versions [id] = version; } for (int n=0; n /// No special search options /// None, /// /// Only the latest version of every add-in is included in the search /// LatestVersionsOnly = 1, } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/PcFileCache.cs0000664000175000017500000004017212136523632026650 0ustar00directhexdirecthex00000000000000// // PcFileCache.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Text; using System.Xml; using System.IO; using System.Collections.Generic; namespace Mono.PkgConfig { internal interface IPcFileCacheContext where TP:PackageInfo, new() { // In the implementation of this method, the host application can extract // information from the pc file and store it in the PackageInfo object void StoreCustomData (PcFile pcfile, TP pkg); // Should return false if the provided package does not have required // custom data bool IsCustomDataComplete (string pcfile, TP pkg); // Called to report errors void ReportError (string message, Exception ex); } internal interface IPcFileCacheContext: IPcFileCacheContext { } internal abstract class PcFileCache: PcFileCache { public PcFileCache (IPcFileCacheContext ctx): base (ctx) { } } internal abstract class PcFileCache where TP:PackageInfo, new() { const string CACHE_VERSION = "2"; Dictionary infos = new Dictionary (); Dictionary> filesByFolder = new Dictionary> (); string cacheFile; bool hasChanges; IPcFileCacheContext ctx; IEnumerable defaultPaths; public PcFileCache (IPcFileCacheContext ctx) { this.ctx = ctx; try { string path = CacheDirectory; if (!Directory.Exists (path)) Directory.CreateDirectory (path); cacheFile = Path.Combine (path, "pkgconfig-cache-" + CACHE_VERSION + ".xml"); if (File.Exists (cacheFile)) Load (); } catch (Exception ex) { ctx.ReportError ("pc file cache could not be loaded.", ex); } } protected abstract string CacheDirectory { get; } // Updates the pkg-config index, using the default search directories public void Update () { Update (GetDefaultPaths ()); } // Updates the pkg-config index, looking for .pc files in the provided directories public void Update (IEnumerable pkgConfigDirs) { foreach (string pcdir in pkgConfigDirs) { foreach (string pcfile in Directory.GetFiles (pcdir, "*.pc")) GetPackageInfo (pcfile); } Save (); } public IEnumerable GetPackages () { return GetPackages (null); } public IEnumerable GetPackages (IEnumerable pkgConfigDirs) { if (pkgConfigDirs == null) pkgConfigDirs = GetDefaultPaths (); foreach (string sp in pkgConfigDirs) { List list; if (filesByFolder.TryGetValue (Path.GetFullPath (sp), out list)) { foreach (TP p in list) yield return p; } } } public TP GetPackageInfoByName (string name) { return GetPackageInfoByName (name, null); } public TP GetPackageInfoByName (string name, IEnumerable pkgConfigDirs) { foreach (TP p in GetPackages (pkgConfigDirs)) if (p.Name == name) return p; return null; } // Returns information about a .pc file public TP GetPackageInfo (string file) { TP info, oldInfo = null; file = Path.GetFullPath (file); DateTime wtime = File.GetLastWriteTime (file); lock (infos) { if (infos.TryGetValue (file, out info)) { if (info.LastWriteTime == wtime) return info; oldInfo = info; } } try { info = ParsePackageInfo (file); } catch (Exception ex) { ctx.ReportError ("Error while parsing .pc file", ex); info = new TP (); } lock (infos) { if (!info.IsValidPackage) info = new TP (); // Create a default empty instance info.LastWriteTime = wtime; Add (file, info, oldInfo); hasChanges = true; } return info; } void Add (string file, TP info, TP replacedInfo) { infos [file] = info; string dir = Path.GetFullPath (Path.GetDirectoryName (file)); List list; if (!filesByFolder.TryGetValue (dir, out list)) { list = new List (); filesByFolder [dir] = list; } if (replacedInfo != null) { int i = list.IndexOf (replacedInfo); if (i != -1) { list [i] = info; return; } } list.Add (info); } FileStream OpenFile (FileAccess access) { int retries = 6; FileMode mode = access == FileAccess.Read ? FileMode.Open : FileMode.Create; Exception lastException = null; while (retries > 0) { try { return new FileStream (cacheFile, mode, access, FileShare.None); } catch (Exception ex) { // the file may be locked by another app. Wait a bit and try again lastException = ex; System.Threading.Thread.Sleep (200); retries--; } } ctx.ReportError ("File could not be opened: " + cacheFile, lastException); return null; } void Load () { // The serializer can't be used because this file is reused in xbuild using (FileStream fs = OpenFile (FileAccess.Read)) { if (fs == null) return; XmlTextReader xr = new XmlTextReader (fs); xr.MoveToContent (); xr.ReadStartElement (); xr.MoveToContent (); while (xr.NodeType == XmlNodeType.Element) ReadPackage (xr); } } public void Save () { // The serializer can't be used because this file is reused in xbuild lock (infos) { if (!hasChanges) return; using (FileStream fs = OpenFile (FileAccess.Write)) { if (fs == null) return; XmlTextWriter tw = new XmlTextWriter (new StreamWriter (fs)); tw.Formatting = Formatting.Indented; tw.WriteStartElement ("PcFileCache"); foreach (KeyValuePair file in infos) { WritePackage (tw, file.Key, file.Value); } tw.WriteEndElement (); // PcFileCache tw.Flush (); hasChanges = false; } } } void WritePackage (XmlTextWriter tw, string file, TP pinfo) { tw.WriteStartElement ("File"); tw.WriteAttributeString ("path", file); tw.WriteAttributeString ("lastWriteTime", XmlConvert.ToString (pinfo.LastWriteTime, XmlDateTimeSerializationMode.Local)); if (pinfo.IsValidPackage) { if (pinfo.Name != null) tw.WriteAttributeString ("name", pinfo.Name); if (pinfo.Version != null) tw.WriteAttributeString ("version", pinfo.Version); if (!string.IsNullOrEmpty (pinfo.Description)) tw.WriteAttributeString ("description", pinfo.Description); if (pinfo.CustomData != null) { foreach (KeyValuePair cd in pinfo.CustomData) tw.WriteAttributeString (cd.Key, cd.Value); } WritePackageContent (tw, file, pinfo); } tw.WriteEndElement (); // File } protected virtual void WritePackageContent (XmlTextWriter tw, string file, TP pinfo) { } void ReadPackage (XmlReader tr) { TP pinfo = new TP (); string file = null; tr.MoveToFirstAttribute (); do { switch (tr.LocalName) { case "path": file = tr.Value; break; case "lastWriteTime": pinfo.LastWriteTime = XmlConvert.ToDateTime (tr.Value, XmlDateTimeSerializationMode.Local); break; case "name": pinfo.Name = tr.Value; break; case "version": pinfo.Version = tr.Value; break; case "description": pinfo.Description = tr.Value; break; default: pinfo.SetData (tr.LocalName, tr.Value); break; } } while (tr.MoveToNextAttribute ()); tr.MoveToElement (); if (!tr.IsEmptyElement) { tr.ReadStartElement (); tr.MoveToContent (); ReadPackageContent (tr, pinfo); tr.MoveToContent (); tr.ReadEndElement (); } else tr.Read (); tr.MoveToContent (); if (!pinfo.IsValidPackage || ctx.IsCustomDataComplete (file, pinfo)) Add (file, pinfo, null); } protected virtual void ReadPackageContent (XmlReader tr, TP pinfo) { } public object SyncRoot { get { return infos; } } TP ParsePackageInfo (string pcfile) { PcFile file = new PcFile (); file.Load (pcfile); TP pinfo = new TP (); pinfo.Name = Path.GetFileNameWithoutExtension (file.FilePath); if (!file.HasErrors) { pinfo.Version = file.Version; pinfo.Description = file.Description; ParsePackageInfo (file, pinfo); ctx.StoreCustomData (file, pinfo); } return pinfo; } protected virtual void ParsePackageInfo (PcFile file, TP pinfo) { } IEnumerable GetDefaultPaths () { if (defaultPaths == null) { string pkgConfigPath = Environment.GetEnvironmentVariable ("PKG_CONFIG_PATH"); string pkgConfigDir = Environment.GetEnvironmentVariable ("PKG_CONFIG_LIBDIR"); defaultPaths = GetPkgconfigPaths (null, pkgConfigPath, pkgConfigDir); } return defaultPaths; } public IEnumerable GetPkgconfigPaths (string prefix, string pkgConfigPath, string pkgConfigLibdir) { char[] sep = new char[] { Path.PathSeparator }; string[] pkgConfigPaths = null; if (!String.IsNullOrEmpty (pkgConfigPath)) { pkgConfigPaths = pkgConfigPath.Split (sep, StringSplitOptions.RemoveEmptyEntries); if (pkgConfigPaths.Length == 0) pkgConfigPaths = null; } string[] pkgConfigLibdirs = null; if (!String.IsNullOrEmpty (pkgConfigLibdir)) { pkgConfigLibdirs = pkgConfigLibdir.Split (sep, StringSplitOptions.RemoveEmptyEntries); if (pkgConfigLibdirs.Length == 0) pkgConfigLibdirs = null; } if (prefix == null) prefix = PathUp (typeof (int).Assembly.Location, 4); IEnumerable paths = GetUnfilteredPkgConfigDirs (pkgConfigPaths, pkgConfigLibdirs, new string [] { prefix }); return NormaliseAndFilterPaths (paths, Environment.CurrentDirectory); } IEnumerable GetUnfilteredPkgConfigDirs (IEnumerable pkgConfigPaths, IEnumerable pkgConfigLibdirs, IEnumerable systemPrefixes) { if (pkgConfigPaths != null) { foreach (string dir in pkgConfigPaths) yield return dir; } if (pkgConfigLibdirs != null) { foreach (string dir in pkgConfigLibdirs) yield return dir; } else if (systemPrefixes != null) { string[] suffixes = new string [] { Path.Combine ("lib", "pkgconfig"), Path.Combine ("lib64", "pkgconfig"), Path.Combine ("libdata", "pkgconfig"), Path.Combine ("share", "pkgconfig"), }; foreach (string prefix in systemPrefixes) foreach (string suffix in suffixes) yield return Path.Combine (prefix, suffix); } } IEnumerable NormaliseAndFilterPaths (IEnumerable paths, string workingDirectory) { Dictionary filtered = new Dictionary (); foreach (string p in paths) { string path = p; if (!Path.IsPathRooted (path)) path = Path.Combine (workingDirectory, path); path = Path.GetFullPath (path); if (filtered.ContainsKey (path)) continue; filtered.Add (path,path); try { if (!Directory.Exists (path)) continue; } catch (IOException ex) { ctx.ReportError ("Error checking for directory '" + path + "'.", ex); } yield return path; } } static string PathUp (string path, int up) { if (up == 0) return path; for (int i = path.Length -1; i >= 0; i--) { if (path[i] == Path.DirectorySeparatorChar) { up--; if (up == 0) return path.Substring (0, i); } } return null; } } internal class PcFile { Dictionary variables = new Dictionary (); string filePath; string name; string description; string version; string libs; bool hasErrors; public string Description { get { return description; } set { description = value; } } public string FilePath { get { return filePath; } set { filePath = value; } } public bool HasErrors { get { return hasErrors; } set { hasErrors = value; } } public string Libs { get { return libs; } set { libs = value; } } public string Name { get { return name; } set { name = value; } } public string Version { get { return version; } set { version = value; } } public string GetVariable (string varName) { string val; variables.TryGetValue (varName, out val); return val; } public void Load (string pcfile) { FilePath = pcfile; variables.Add ("pcfiledir", Path.GetDirectoryName (pcfile)); using (StreamReader reader = new StreamReader (pcfile)) { string line; while ((line = reader.ReadLine ()) != null) { int i = line.IndexOf (':'); int j = line.IndexOf ('='); int k = System.Math.Min (i != -1 ? i : int.MaxValue, j != -1 ? j : int.MaxValue); if (k == int.MaxValue) continue; string var = line.Substring (0, k).Trim (); string value = line.Substring (k + 1).Trim (); value = Evaluate (value); if (k == j) { // Is variable variables [var] = value; } else { switch (var) { case "Name": Name = value; break; case "Description": Description = value; break; case "Version": Version = value; break; case "Libs": Libs = value; break; } } } } } string Evaluate (string value) { int i = value.IndexOf ("${"); if (i == -1) return value; StringBuilder sb = new StringBuilder (); int last = 0; while (i != -1 && i < value.Length) { sb.Append (value.Substring (last, i - last)); if (i == 0 || value [i - 1] != '$') { // Evaluate if var is not escaped i += 2; int n = value.IndexOf ('}', i); if (n == -1 || n == i) { // Closing bracket not found or empty name HasErrors = true; return value; } string rname = value.Substring (i, n - i); string rval; if (variables.TryGetValue (rname, out rval)) sb.Append (rval); else { HasErrors = true; return value; } i = n + 1; last = i; } else last = i++; if (i < value.Length - 1) i = value.IndexOf ("${", i); } sb.Append (value.Substring (last, value.Length - last)); return sb.ToString (); } } internal class PackageInfo { Dictionary customData; string name; string version; string description; DateTime lastWriteTime; public string Name { get { return name; } set { name = value; } } public string Version { get { return version; } set { version = value; } } public string Description { get { return description; } set { description = value; } } public string GetData (string name) { if (customData == null) return null; string res; customData.TryGetValue (name, out res); return res; } public void SetData (string name, string value) { if (customData == null) customData = new Dictionary (); customData [name] = value; } public void RemoveData (string name) { if (customData != null) customData.Remove (name); } internal Dictionary CustomData { get { return customData; } } internal DateTime LastWriteTime { get { return lastWriteTime; } set { lastWriteTime = value; } } internal bool HasCustomData { get { return customData != null && customData.Count > 0; } } internal protected virtual bool IsValidPackage { get { return HasCustomData; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/NativePackage.cs0000664000175000017500000000435412136523632027266 0ustar00directhexdirecthex00000000000000// // NativePackage.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2005 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Addins.Description; namespace Mono.Addins.Setup { internal class NativePackage: Package { public override string Name { get { return "Native package"; } } internal override void PrepareInstall (IProgressMonitor monitor, AddinStore service) { } internal override void CommitInstall (IProgressMonitor monitor, AddinStore service) { } internal override void RollbackInstall (IProgressMonitor monitor, AddinStore service) { } internal override void Resolve (IProgressMonitor monitor, AddinStore service, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection required, DependencyCollection unresolved) { } internal override void PrepareUninstall (IProgressMonitor monitor, AddinStore service) { } internal override void CommitUninstall (IProgressMonitor monitor, AddinStore service) { } internal override void RollbackUninstall (IProgressMonitor monitor, AddinStore service) { } internal override bool IsUpgradeOf (Package p) { return false; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinInfo.cs0000664000175000017500000002406612136523632026421 0ustar00directhexdirecthex00000000000000// // AddinInfo.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Collections; using System.Xml; using System.Xml.Serialization; using Mono.Addins.Description; namespace Mono.Addins.Setup { internal class AddinInfo: AddinHeader { string id = ""; string namspace = ""; string name = ""; string version = ""; string baseVersion = ""; string author = ""; string copyright = ""; string url = ""; string description = ""; string category = ""; DependencyCollection dependencies; DependencyCollection optionalDependencies; AddinPropertyCollectionImpl properties; public AddinInfo () { dependencies = new DependencyCollection (); optionalDependencies = new DependencyCollection (); properties = new AddinPropertyCollectionImpl (); } public string Id { get { return Addin.GetFullId (namspace, id, version); } } [XmlElement ("Id")] public string LocalId { get { return id; } set { id = value; } } public string Namespace { get { return namspace; } set { namspace = value; } } public string Name { get { string s = Properties.GetPropertyValue ("Name"); if (s.Length > 0) return s; if (name != null && name.Length > 0) return name; string sid = id; if (sid.StartsWith ("__")) sid = sid.Substring (2); return Addin.GetFullId (namspace, sid, null); } set { name = value; } } public string Version { get { return version; } set { version = value; } } public string BaseVersion { get { return baseVersion; } set { baseVersion = value; } } public string Author { get { string s = Properties.GetPropertyValue ("Author"); if (s.Length > 0) return s; return author; } set { author = value; } } public string Copyright { get { string s = Properties.GetPropertyValue ("Copyright"); if (s.Length > 0) return s; return copyright; } set { copyright = value; } } public string Url { get { string s = Properties.GetPropertyValue ("Url"); if (s.Length > 0) return s; return url; } set { url = value; } } public string Description { get { string s = Properties.GetPropertyValue ("Description"); if (s.Length > 0) return s; return description; } set { description = value; } } public string Category { get { string s = Properties.GetPropertyValue ("Category"); if (s.Length > 0) return s; return category; } set { category = value; } } [XmlArrayItem ("AddinDependency", typeof(AddinDependency))] [XmlArrayItem ("NativeDependency", typeof(NativeDependency))] [XmlArrayItem ("AssemblyDependency", typeof(AssemblyDependency))] public DependencyCollection Dependencies { get { return dependencies; } } [XmlArrayItem ("AddinDependency", typeof(AddinDependency))] [XmlArrayItem ("NativeDependency", typeof(NativeDependency))] [XmlArrayItem ("AssemblyDependency", typeof(AssemblyDependency))] public DependencyCollection OptionalDependencies { get { return optionalDependencies; } } [XmlArrayItem ("Property", typeof(AddinProperty))] public AddinPropertyCollectionImpl Properties { get { return properties; } } AddinPropertyCollection AddinHeader.Properties { get { return properties; } } public static AddinInfo ReadFromAddinFile (StreamReader r) { XmlDocument doc = new XmlDocument (); doc.Load (r); r.Close (); AddinInfo info = new AddinInfo (); info.id = doc.DocumentElement.GetAttribute ("id"); info.namspace = doc.DocumentElement.GetAttribute ("namespace"); info.name = doc.DocumentElement.GetAttribute ("name"); if (info.id == "") info.id = info.name; info.version = doc.DocumentElement.GetAttribute ("version"); info.author = doc.DocumentElement.GetAttribute ("author"); info.copyright = doc.DocumentElement.GetAttribute ("copyright"); info.url = doc.DocumentElement.GetAttribute ("url"); info.description = doc.DocumentElement.GetAttribute ("description"); info.category = doc.DocumentElement.GetAttribute ("category"); info.baseVersion = doc.DocumentElement.GetAttribute ("compatVersion"); AddinPropertyCollectionImpl props = new AddinPropertyCollectionImpl (); info.properties = props; ReadHeader (info, props, doc.DocumentElement); ReadDependencies (info.Dependencies, info.OptionalDependencies, doc.DocumentElement); return info; } static void ReadDependencies (DependencyCollection deps, DependencyCollection opDeps, XmlElement elem) { foreach (XmlElement dep in elem.SelectNodes ("Dependencies/Addin")) { AddinDependency adep = new AddinDependency (); adep.AddinId = dep.GetAttribute ("id"); string v = dep.GetAttribute ("version"); if (v.Length != 0) adep.Version = v; deps.Add (adep); } foreach (XmlElement dep in elem.SelectNodes ("Dependencies/Assembly")) { AssemblyDependency adep = new AssemblyDependency (); adep.FullName = dep.GetAttribute ("name"); adep.Package = dep.GetAttribute ("package"); deps.Add (adep); } foreach (XmlElement mod in elem.SelectNodes ("Module")) ReadDependencies (opDeps, opDeps, mod); } static void ReadHeader (AddinInfo info, AddinPropertyCollectionImpl properties, XmlElement elem) { elem = elem.SelectSingleNode ("Header") as XmlElement; if (elem == null) return; foreach (XmlNode xprop in elem.ChildNodes) { XmlElement prop = xprop as XmlElement; if (prop != null) { switch (prop.LocalName) { case "Id": info.id = prop.InnerText; break; case "Namespace": info.namspace = prop.InnerText; break; case "Version": info.version = prop.InnerText; break; case "CompatVersion": info.baseVersion = prop.InnerText; break; default: { AddinProperty aprop = new AddinProperty (); aprop.Name = prop.LocalName; if (prop.HasAttribute ("locale")) aprop.Locale = prop.GetAttribute ("locale"); aprop.Value = prop.InnerText; properties.Add (aprop); break; }} } } } internal static AddinInfo ReadFromDescription (AddinDescription description) { AddinInfo info = new AddinInfo (); info.id = description.LocalId; info.namspace = description.Namespace; info.name = description.Name; info.version = description.Version; info.author = description.Author; info.copyright = description.Copyright; info.url = description.Url; info.description = description.Description; info.category = description.Category; info.baseVersion = description.CompatVersion; info.properties = new AddinPropertyCollectionImpl (description.Properties); foreach (Dependency dep in description.MainModule.Dependencies) info.Dependencies.Add (dep); foreach (ModuleDescription mod in description.OptionalModules) { foreach (Dependency dep in mod.Dependencies) info.OptionalDependencies.Add (dep); } return info; } public bool SupportsVersion (string version) { if (Addin.CompareVersions (Version, version) > 0) return false; if (baseVersion == "") return true; return Addin.CompareVersions (BaseVersion, version) >= 0; } public int CompareVersionTo (AddinHeader other) { return Addin.CompareVersions (this.version, other.Version); } } /// /// Basic add-in information /// public interface AddinHeader { /// /// Full identifier of the add-in /// string Id { get; } /// /// Display name of the add-in /// string Name { get; } /// /// Namespace of the add-in /// string Namespace { get; } /// /// Version of the add-in /// string Version { get; } /// /// Version with which this add-in is compatible /// string BaseVersion { get; } /// /// Add-in author /// string Author { get; } /// /// Add-in copyright /// string Copyright { get; } /// /// Web page URL with more information about the add-in /// string Url { get; } /// /// Description of the add-in /// string Description { get; } /// /// Category of the add-in /// string Category { get; } /// /// Dependencies of the add-in /// DependencyCollection Dependencies { get; } /// /// Optional dependencies of the add-in /// DependencyCollection OptionalDependencies { get; } /// /// Custom properties specified in the add-in header /// AddinPropertyCollection Properties { get; } /// /// Compares the versions of two add-ins /// /// /// Another add-in /// /// /// Result of comparison /// int CompareVersionTo (AddinHeader other); } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/InstallException.cs0000664000175000017500000000343012136523632030043 0ustar00directhexdirecthex00000000000000// // InstallException.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Setup { /// /// An installation exception /// public class InstallException: Exception { /// /// Initializes the exception /// /// /// Error message /// public InstallException (string msg): base (msg) { } /// /// Initializes the exception /// /// /// Error message /// /// /// Inner exception /// public InstallException (string msg, Exception ex): base (msg, ex) { } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinStore.cs0000664000175000017500000004747112136523632026627 0ustar00directhexdirecthex00000000000000// // AddinStore.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Reflection; using System.Diagnostics; using System.Net; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using ICSharpCode.SharpZipLib.Zip; using Mono.Addins; using Mono.Addins.Setup.ProgressMonitoring; using Mono.Addins.Description; using Mono.Addins.Serialization; using System.Collections.Generic; using System.Linq; namespace Mono.Addins.Setup { internal class AddinStore { SetupService service; public AddinStore (SetupService service) { this.service = service; } internal void ResetCachedData () { } public AddinRegistry Registry { get { return service.Registry; } } public bool Install (IProgressStatus statusMonitor, params string[] files) { Package[] packages = new Package [files.Length]; for (int n=0; n ids) { IProgressMonitor monitor = ProgressStatusMonitor.GetProgressMonitor (statusMonitor); monitor.BeginTask ("Uninstalling add-ins", ids.Count ()); foreach (string id in ids) { bool rollback = false; ArrayList toUninstall = new ArrayList (); ArrayList uninstallPrepared = new ArrayList (); Addin ia = service.Registry.GetAddin (id); if (ia == null) throw new InstallException ("The add-in '" + id + "' is not installed."); toUninstall.Add (AddinPackage.FromInstalledAddin (ia)); Addin[] deps = GetDependentAddins (id, true); foreach (Addin dep in deps) toUninstall.Add (AddinPackage.FromInstalledAddin (dep)); monitor.BeginTask ("Deleting files", toUninstall.Count*2 + uninstallPrepared.Count + 1); // Prepare install foreach (Package mpack in toUninstall) { try { mpack.PrepareUninstall (monitor, this); monitor.Step (1); uninstallPrepared.Add (mpack); } catch (Exception ex) { ReportException (monitor, ex); rollback = true; break; } } // Commit install if (!rollback) { foreach (Package mpack in toUninstall) { try { mpack.CommitUninstall (monitor, this); monitor.Step (1); } catch (Exception ex) { ReportException (monitor, ex); rollback = true; break; } } } // Rollback if failed if (rollback) { monitor.BeginTask ("Rolling back uninstall", uninstallPrepared.Count); foreach (Package mpack in uninstallPrepared) { try { mpack.RollbackUninstall (monitor, this); } catch (Exception ex) { ReportException (monitor, ex); } } monitor.EndTask (); } monitor.Step (1); // Cleanup foreach (Package mpack in uninstallPrepared) { try { mpack.EndUninstall (monitor, this); monitor.Step (1); } catch (Exception ex) { monitor.Log.WriteLine (ex); } } monitor.EndTask (); monitor.Step (1); } // Update the extension maps service.Registry.Update (statusMonitor); monitor.EndTask (); service.SaveConfiguration (); ResetCachedData (); } public Addin[] GetDependentAddins (string id, bool recursive) { ArrayList list = new ArrayList (); FindDependentAddins (list, id, recursive); return (Addin[]) list.ToArray (typeof (Addin)); } void FindDependentAddins (ArrayList list, string id, bool recursive) { foreach (Addin iaddin in service.Registry.GetAddins ()) { if (list.Contains (iaddin)) continue; foreach (Dependency dep in iaddin.Description.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep != null && adep.AddinId == id) { list.Add (iaddin); if (recursive) FindDependentAddins (list, iaddin.Id, true); } } } } public bool ResolveDependencies (IProgressStatus statusMonitor, AddinRepositoryEntry[] addins, out PackageCollection resolved, out PackageCollection toUninstall, out DependencyCollection unresolved) { resolved = new PackageCollection (); for (int n=0; n // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Text; namespace Mono.Addins.Setup { enum WrappingType { None, Char, Word, WordChar } class TextFormatter { string indentString = ""; string formattedIndentString; int indentColumnWidth; string paragFormattedIndentString; int paragIndentColumnWidth; int leftMargin; int paragraphStartMargin; WrappingType wrap; int tabWidth; bool tabsAsSpaces; public int MaxColumns { get; set; } StringBuilder builder = new StringBuilder (); StringBuilder currentWord = new StringBuilder (); int curCol; bool lineStart = true; bool lastWasSeparator; bool paragraphStart = true; int wordLevel; public TextFormatter () { MaxColumns = 80; TabWidth = 4; } public int TabWidth { get { return tabWidth; } set { tabWidth = value; formattedIndentString = null; } } public string IndentString { get { return indentString; } set { if (value == null) throw new ArgumentNullException ("value"); indentString = value; formattedIndentString = null; } } public int LeftMargin { get { return leftMargin; } set { leftMargin = value; formattedIndentString = null; } } public int ParagraphStartMargin { get { return paragraphStartMargin; } set { paragraphStartMargin = value; formattedIndentString = null; } } public WrappingType Wrap { get { return wrap; } set { if (wrap != value) { AppendCurrentWord ('x'); wrap = value; } } } public bool TabsAsSpaces { get { return tabsAsSpaces; } set { tabsAsSpaces = value; formattedIndentString = null; } } string FormattedIndentString { get { if (formattedIndentString == null) CreateIndentString (); return formattedIndentString; } } int IndentColumnWidth { get { if (formattedIndentString == null) CreateIndentString (); return indentColumnWidth; } } string ParagFormattedIndentString { get { if (formattedIndentString == null) CreateIndentString (); return paragFormattedIndentString; } } int ParagIndentColumnWidth { get { if (formattedIndentString == null) CreateIndentString (); return paragIndentColumnWidth; } } public void Clear () { builder = new StringBuilder (); currentWord = new StringBuilder (); curCol = 0; lineStart = true; paragraphStart = true; lastWasSeparator = false; } public void AppendWord (string text) { BeginWord (); Append (text); EndWord (); } public void Append (string text) { if (string.IsNullOrEmpty (text)) return; if (builder.Length == 0) { curCol = IndentColumnWidth; lineStart = true; paragraphStart = true; } if (Wrap == WrappingType.None || Wrap == WrappingType.Char) { AppendChars (text, Wrap == WrappingType.Char); return; } int n = 0; while (n < text.Length) { int sn = n; bool foundSpace = false; while (n < text.Length && !foundSpace) { if ((char.IsWhiteSpace (text [n]) && wordLevel == 0) || text [n] == '\n') foundSpace = true; else n++; } if (n != sn) currentWord.Append (text.Substring (sn, n - sn)); if (foundSpace) { AppendCurrentWord (text[n]); n++; } } } public void AppendLine () { AppendCurrentWord ('x'); AppendChar ('\n', false); } public void BeginWord () { wordLevel++; } public void EndWord () { if (wordLevel == 0) throw new InvalidOperationException ("Missing BeginWord call"); wordLevel--; char lastChar = 'x'; if (currentWord.Length > 0) { lastChar = currentWord [currentWord.Length - 1]; if (char.IsWhiteSpace (lastChar)) currentWord.Remove (currentWord.Length - 1, 1); } AppendCurrentWord (lastChar); } public void FlushWord () { AppendCurrentWord ('x'); if (curCol > MaxColumns) AppendSoftBreak (); } public override string ToString () { if (currentWord.Length > 0) AppendCurrentWord ('x'); return builder.ToString (); } void AppendChars (string s, bool wrapChars) { foreach (char c in s) AppendChar (c, wrapChars); } void AppendSoftBreak () { AppendChar ('\n', true); paragraphStart = false; curCol = IndentColumnWidth; } void AppendChar (char c, bool wrapChars) { if (c == '\n') { lineStart = true; paragraphStart = true; builder.Append (c); curCol = ParagIndentColumnWidth; lastWasSeparator = false; return; } else if (lineStart) { if (paragraphStart) builder.Append (ParagFormattedIndentString); else builder.Append (FormattedIndentString); lineStart = false; paragraphStart = false; lastWasSeparator = false; } if (wrapChars && curCol >= MaxColumns) { AppendSoftBreak (); if (!char.IsWhiteSpace (c)) AppendChar (c, false); return; } if (c == '\t') { int tw = GetTabWidth (curCol); if (TabsAsSpaces) builder.Append (' ', tw); else builder.Append (c); curCol += tw; } else { builder.Append (c); curCol++; } } void AppendCurrentWord (char separatorChar) { if (currentWord.Length == 0) return; if (Wrap == WrappingType.Word || Wrap == WrappingType.WordChar) { if (curCol + currentWord.Length > MaxColumns) { // If the last char was a word separator, remove it if (lastWasSeparator) builder.Remove (builder.Length - 1, 1); if (!lineStart) AppendSoftBreak (); } } AppendChars (currentWord.ToString (), Wrap == WrappingType.WordChar); if (char.IsWhiteSpace (separatorChar) || (separatorChar == '\n' && !lineStart)) { lastWasSeparator = true; AppendChar (separatorChar, true); } else lastWasSeparator = false; currentWord = new StringBuilder (); } int GetTabWidth (int startCol) { int res = startCol % TabWidth; if (res == 0) return TabWidth; else return TabWidth - res; } void CreateIndentString () { StringBuilder sb = new StringBuilder (); indentColumnWidth = AddIndentString (sb, indentString); paragFormattedIndentString = sb.ToString () + new string (' ', paragraphStartMargin); paragIndentColumnWidth = indentColumnWidth + paragraphStartMargin; if (LeftMargin > 0) { sb.Append (' ', LeftMargin); indentColumnWidth += LeftMargin; } formattedIndentString = sb.ToString (); if (paragraphStart) curCol = paragIndentColumnWidth; else if (lineStart) curCol = indentColumnWidth; } int AddIndentString (StringBuilder sb, string txt) { if (string.IsNullOrEmpty (txt)) return 0; int count = 0; foreach (char c in txt) { if (c == '\t') { int tw = GetTabWidth (count); count += tw; if (TabsAsSpaces) sb.Append (' ', tw); else sb.Append (c); } else { sb.Append (c); count++; } } return count; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositoryEntry.cs0000664000175000017500000000270612136523632027764 0ustar00directhexdirecthex00000000000000// // RepositoryEntry.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Setup { internal class RepositoryEntry { string url; internal Repository owner; public string Url { get { return url; } set { url = value; } } internal Repository Repository { get { return owner; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositorySerializer.cs0000664000175000017500000000400312136523632030764 0ustar00directhexdirecthex00000000000000// // RepositorySerializer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Text; using System.Collections; using System.Globalization; namespace Mono.Addins.Setup { internal class RepositorySerializer : XmlSerializer { protected override void Serialize (object o, XmlSerializationWriter writer) { RepositoryWriter xsWriter = writer as RepositoryWriter; xsWriter.WriteRoot_Repository (o); } protected override object Deserialize (XmlSerializationReader reader) { RepositoryReader xsReader = reader as RepositoryReader; return xsReader.ReadRoot_Repository (); } protected override XmlSerializationWriter CreateWriter () { return new RepositoryWriter (); } protected override XmlSerializationReader CreateReader () { return new RepositoryReader (); } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinRepositoryEntry.cs0000664000175000017500000000774112136523632030730 0ustar00directhexdirecthex00000000000000// // PackageRepositoryEntry.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Net; using System.Collections.Generic; using System.IO; using System.Threading; namespace Mono.Addins.Setup { internal class PackageRepositoryEntry: RepositoryEntry, AddinRepositoryEntry, IComparable { AddinInfo addin; public AddinInfo Addin { get { return addin; } set { addin = value; } } AddinHeader AddinRepositoryEntry.Addin { get { return addin; } } public string RepositoryUrl { get { return Repository.Url; } } public string RepositoryName { get { return Repository.Name; } } public int CompareTo (object other) { PackageRepositoryEntry rep = (PackageRepositoryEntry) other; string n1 = Mono.Addins.Addin.GetIdName (Addin.Id); string n2 = Mono.Addins.Addin.GetIdName (rep.Addin.Id); if (n1 != n2) return n1.CompareTo (n2); else return Mono.Addins.Addin.CompareVersions (rep.Addin.Version, Addin.Version); } public IAsyncResult BeginDownloadSupportFile (string name, AsyncCallback cb, object state) { return Repository.BeginDownloadSupportFile (name, cb, state); } public Stream EndDownloadSupportFile (IAsyncResult ares) { return Repository.EndDownloadSupportFile (ares); } } /// /// A reference to an add-in available in an on-line repository /// public interface AddinRepositoryEntry { /// /// Add-in information /// AddinHeader Addin { get; } /// /// Url to the add-in package /// string Url { get; } /// /// The URL of the repository /// string RepositoryUrl { get; } /// /// Name of the repository /// string RepositoryName { get; } /// /// Begins downloading a support file /// /// /// Result of the asynchronous operation, to be used when calling EndDownloadSupportFile to /// get the download result. /// /// /// Name of the file. /// /// /// Callback to be called when the download operation ends. /// /// /// Custom state object provided by the caller. /// /// /// This method can be used to get the contents of a support file of an add-in. /// A support file is a file referenced in the custom properties of an add-in. /// IAsyncResult BeginDownloadSupportFile (string name, AsyncCallback cb, object state); /// /// Gets the result of the asynchronous download of a file /// /// /// The downloaded file. /// /// /// The async result object returned by BeginDownloadSupportFile. /// Stream EndDownloadSupportFile (IAsyncResult ares); } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/Package.cs0000664000175000017500000000713712136523632026121 0ustar00directhexdirecthex00000000000000// // Package.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using Mono.Addins.Description; namespace Mono.Addins.Setup { /// /// An add-in package /// public abstract class Package { internal Package () { } /// /// Name of the package /// public abstract string Name { get; } /// /// Returns true if the package will be installed in the shared directory, /// false if it will be installed in the user directory. /// public virtual bool SharedInstall { get { return false; } } /// /// Creates a package object for an add-in available in an on-line repository /// /// /// An add-in reference /// /// /// The package /// public static Package FromRepository (AddinRepositoryEntry repAddin) { return AddinPackage.PackageFromRepository (repAddin); } /// /// Creates a package object for a local package file /// /// /// Package file path /// /// /// The package /// public static Package FromFile (string file) { return AddinPackage.PackageFromFile (file); } internal abstract void Resolve (IProgressMonitor monitor, AddinStore service, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection required, DependencyCollection unresolved); internal abstract void PrepareInstall (IProgressMonitor monitor, AddinStore service); internal abstract void CommitInstall (IProgressMonitor monitor, AddinStore service); internal abstract void RollbackInstall (IProgressMonitor monitor, AddinStore service); internal abstract void PrepareUninstall (IProgressMonitor monitor, AddinStore service); internal abstract void CommitUninstall (IProgressMonitor monitor, AddinStore service); internal abstract void RollbackUninstall (IProgressMonitor monitor, AddinStore service); internal abstract bool IsUpgradeOf (Package p); internal virtual void EndInstall (IProgressMonitor monitor, AddinStore service) { } internal virtual void EndUninstall (IProgressMonitor monitor, AddinStore service) { } internal string CreateTempFolder () { string bname = Path.Combine (Path.GetTempPath (), "mdtmp"); string tempFolder = bname; int n = 0; while (Directory.Exists (tempFolder)) tempFolder = bname + (++n); return tempFolder; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositoryRecord.cs0000664000175000017500000000773312136523632030106 0ustar00directhexdirecthex00000000000000// // RepositoryRecord.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using System.Xml; using System.Xml.Serialization; namespace Mono.Addins.Setup { internal class RepositoryRecord: AddinRepository { string id; bool isReference; string file; string url; string name; bool enabled = true; DateTime lastModified = new DateTime (1900,1,1); [XmlAttribute ("id")] public string Id { get { return id; } set { id = value; } } public bool IsReference { get { return isReference; } set { isReference = value; } } public string File { get { return file; } set { file = value; } } public string CachedFilesDir { get { return Path.Combine (Path.GetDirectoryName (File), Path.GetFileNameWithoutExtension (File) + "_files"); } } public string Url { get { return url; } set { url = value; } } public string Name { get { return name; } set { name = value; } } public string Title { get { return Name != null && Name != "" ? Name : Url; } } public DateTime LastModified { get { return lastModified; } set { lastModified = value; } } [System.ComponentModel.DefaultValue (true)] public bool Enabled { get { return this.enabled; } set { enabled = value; } } public Repository GetCachedRepository () { Repository repo = (Repository) AddinStore.ReadObject (File, typeof(Repository)); if (repo != null) repo.CachedFilesDir = CachedFilesDir; return repo; } public void ClearCachedRepository () { if (System.IO.File.Exists (File)) System.IO.File.Delete (File); if (Directory.Exists (CachedFilesDir)) Directory.Delete (CachedFilesDir, true); } internal void UpdateCachedRepository (Repository newRep) { newRep.url = Url; if (newRep.Name == null) newRep.Name = new Uri (Url).Host; AddinStore.WriteObject (File, newRep); if (name == null) name = newRep.Name; newRep.CachedFilesDir = CachedFilesDir; } } /// /// An on-line add-in repository /// public interface AddinRepository { /// /// Path to the cached add-in repository file /// string File { get; } /// /// Url of the repository /// string Url { get; } /// /// Do not use. Use Title instead. /// string Name { get; set; } /// /// Title of the repository /// string Title { get; } /// /// Last change timestamp /// DateTime LastModified { get; } /// /// Gets a value indicating whether this is enabled. /// /// /// true if enabled; otherwise, false. /// bool Enabled { get; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/RepositoryEntryCollection.cs0000664000175000017500000000365012136523632031777 0ustar00directhexdirecthex00000000000000// // RepositoryEntryCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Setup { internal class RepositoryEntryCollection: CollectionBase { Repository owner; internal RepositoryEntryCollection (Repository owner) { this.owner = owner; } public RepositoryEntry this [int n] { get { return (RepositoryEntry) List [n]; } } public void Add (RepositoryEntry entry) { List.Add (entry); } public void Remove (RepositoryEntry entry) { List.Remove (entry); } protected override void OnInsert(int index, object value) { ((RepositoryEntry)value).owner = owner; } protected override void OnSet(int index, object oldValue, object newValue) { ((RepositoryEntry)newValue).owner = owner; } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/serializers.xml0000664000175000017500000000134712136523632027312 0ustar00directhexdirecthex00000000000000 AddinSystemConfigurationReader AddinSystemConfigurationWriter Mono.Addins.Setup AddinSystemConfigurationReaderWriter.cs true RepositoryReader RepositoryWriter Mono.Addins.Setup RepositoryReaderWriter.cs true mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinInfoCollection.cs0000664000175000017500000000271112136523632030426 0ustar00directhexdirecthex00000000000000// // AddinInfoCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Setup { internal class AddinInfoCollection: CollectionBase { public AddinInfo this [int n] { get { return (AddinInfo) List [n]; } } public void Add (AddinInfo p) { List.Add (p); } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/IProgressMonitor.cs0000664000175000017500000000322712136523632030047 0ustar00directhexdirecthex00000000000000// // IProgressMonitor.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Addins { internal interface IProgressMonitor: IDisposable { void BeginTask (string name, int totalWork); void BeginStepTask (string name, int totalWork, int stepSize); void EndTask (); void Step (int work); TextWriter Log { get; } int LogLevel { get; } void ReportWarning (string message); void ReportError (string message, Exception exception); bool IsCancelRequested { get; } void Cancel (); } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup/AddinSystemConfigurationReaderWriter.cs0000664000175000017500000002733612136523632034065 0ustar00directhexdirecthex00000000000000// It is automatically generated using System; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.Text; using System.Collections; using System.Globalization; namespace Mono.Addins.Setup { internal class AddinSystemConfigurationReader : XmlSerializationReader { static readonly System.Reflection.MethodInfo fromBinHexStringMethod = typeof (XmlConvert).GetMethod ("FromBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (string)}, null); static byte [] FromBinHexString (string input) { return input == null ? null : (byte []) fromBinHexStringMethod.Invoke (null, new object [] {input}); } public object ReadRoot_AddinSystemConfiguration () { Reader.MoveToContent(); if (Reader.LocalName != "AddinSystemConfiguration" || Reader.NamespaceURI != "") throw CreateUnknownNodeException(); return ReadObject_AddinSystemConfiguration (true, true); } public Mono.Addins.Setup.AddinSystemConfiguration ReadObject_AddinSystemConfiguration (bool isNullable, bool checkType) { Mono.Addins.Setup.AddinSystemConfiguration ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "AddinSystemConfiguration" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.AddinSystemConfiguration) Activator.CreateInstance(typeof(Mono.Addins.Setup.AddinSystemConfiguration), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b0=false, b1=false, b2=false, b3=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "AddinPaths" && Reader.NamespaceURI == "" && !b3) { if (((object)ob.@AddinPaths) == null) throw CreateReadOnlyCollectionException ("System.Collections.Specialized.StringCollection"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n4 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Addin" && Reader.NamespaceURI == "") { string s5 = Reader.ReadElementString (); if (((object)ob.@AddinPaths) == null) throw CreateReadOnlyCollectionException ("System.Collections.Specialized.StringCollection"); ob.@AddinPaths.Add (s5); n4++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b3 = true; } else if (Reader.LocalName == "RepositoryIdCount" && Reader.NamespaceURI == "" && !b1) { b1 = true; string s6 = Reader.ReadElementString (); ob.@RepositoryIdCount = Int32.Parse (s6, CultureInfo.InvariantCulture); } else if (Reader.LocalName == "DisabledAddins" && Reader.NamespaceURI == "" && !b2) { if (((object)ob.@DisabledAddins) == null) throw CreateReadOnlyCollectionException ("System.Collections.Specialized.StringCollection"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n7 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Addin" && Reader.NamespaceURI == "") { string s8 = Reader.ReadElementString (); if (((object)ob.@DisabledAddins) == null) throw CreateReadOnlyCollectionException ("System.Collections.Specialized.StringCollection"); ob.@DisabledAddins.Add (s8); n7++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b2 = true; } else if (Reader.LocalName == "Repositories" && Reader.NamespaceURI == "" && !b0) { if (((object)ob.@Repositories) == null) throw CreateReadOnlyCollectionException ("System.Collections.ArrayList"); if (Reader.IsEmptyElement) { Reader.Skip(); } else { int n9 = 0; Reader.ReadStartElement(); Reader.MoveToContent(); while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "Repository" && Reader.NamespaceURI == "") { if (((object)ob.@Repositories) == null) throw CreateReadOnlyCollectionException ("System.Collections.ArrayList"); ob.@Repositories.Add (ReadObject_RepositoryRecord (false, true)); n9++; } else UnknownNode (null); } else UnknownNode (null); Reader.MoveToContent(); } ReadEndElement(); } b0 = true; } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } public Mono.Addins.Setup.RepositoryRecord ReadObject_RepositoryRecord (bool isNullable, bool checkType) { Mono.Addins.Setup.RepositoryRecord ob = null; if (isNullable && ReadNull()) return null; if (checkType) { System.Xml.XmlQualifiedName t = GetXsiType(); if (t == null) { } else if (t.Name != "RepositoryRecord" || t.Namespace != "") throw CreateUnknownTypeException(t); } ob = (Mono.Addins.Setup.RepositoryRecord) Activator.CreateInstance(typeof(Mono.Addins.Setup.RepositoryRecord), true); Reader.MoveToElement(); while (Reader.MoveToNextAttribute()) { if (Reader.LocalName == "id" && Reader.NamespaceURI == "") { ob.@Id = Reader.Value; } else if (IsXmlnsAttribute (Reader.Name)) { } else { UnknownNode (ob); } } Reader.MoveToElement (); Reader.MoveToElement(); if (Reader.IsEmptyElement) { Reader.Skip (); return ob; } Reader.ReadStartElement(); Reader.MoveToContent(); bool b10=false, b11=false, b12=false, b13=false, b14=false, b15=false; while (Reader.NodeType != System.Xml.XmlNodeType.EndElement) { if (Reader.NodeType == System.Xml.XmlNodeType.Element) { if (Reader.LocalName == "File" && Reader.NamespaceURI == "" && !b11) { b11 = true; string s16 = Reader.ReadElementString (); ob.@File = s16; } else if (Reader.LocalName == "Enabled" && Reader.NamespaceURI == "" && !b15) { b15 = true; string s17 = Reader.ReadElementString (); ob.@Enabled = XmlConvert.ToBoolean (s17); } else if (Reader.LocalName == "IsReference" && Reader.NamespaceURI == "" && !b10) { b10 = true; string s18 = Reader.ReadElementString (); ob.@IsReference = XmlConvert.ToBoolean (s18); } else if (Reader.LocalName == "Name" && Reader.NamespaceURI == "" && !b13) { b13 = true; string s19 = Reader.ReadElementString (); ob.@Name = s19; } else if (Reader.LocalName == "Url" && Reader.NamespaceURI == "" && !b12) { b12 = true; string s20 = Reader.ReadElementString (); ob.@Url = s20; } else if (Reader.LocalName == "LastModified" && Reader.NamespaceURI == "" && !b14) { b14 = true; string s21 = Reader.ReadElementString (); ob.@LastModified = XmlConvert.ToDateTime (s21, XmlDateTimeSerializationMode.RoundtripKind); } else { UnknownNode (ob); } } else UnknownNode(ob); Reader.MoveToContent(); } ReadEndElement(); return ob; } protected override void InitCallbacks () { } protected override void InitIDs () { } } internal class AddinSystemConfigurationWriter : XmlSerializationWriter { const string xmlNamespace = "http://www.w3.org/2000/xmlns/"; static readonly System.Reflection.MethodInfo toBinHexStringMethod = typeof (XmlConvert).GetMethod ("ToBinHexString", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic, null, new Type [] {typeof (byte [])}, null); static string ToBinHexString (byte [] input) { return input == null ? null : (string) toBinHexStringMethod.Invoke (null, new object [] {input}); } public void WriteRoot_AddinSystemConfiguration (object o) { WriteStartDocument (); Mono.Addins.Setup.AddinSystemConfiguration ob = (Mono.Addins.Setup.AddinSystemConfiguration) o; TopLevelElement (); WriteObject_AddinSystemConfiguration (ob, "AddinSystemConfiguration", "", true, false, true); } void WriteObject_AddinSystemConfiguration (Mono.Addins.Setup.AddinSystemConfiguration ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.AddinSystemConfiguration)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("AddinSystemConfiguration", ""); if (ob.@Repositories != null) { WriteStartElement ("Repositories", "", ob.@Repositories); for (int n22 = 0; n22 < ob.@Repositories.Count; n22++) { WriteObject_RepositoryRecord (((Mono.Addins.Setup.RepositoryRecord) ob.@Repositories[n22]), "Repository", "", false, false, true); } WriteEndElement (ob.@Repositories); } WriteElementString ("RepositoryIdCount", "", ob.@RepositoryIdCount.ToString(CultureInfo.InvariantCulture)); if (ob.@DisabledAddins != null) { WriteStartElement ("DisabledAddins", "", ob.@DisabledAddins); for (int n23 = 0; n23 < ob.@DisabledAddins.Count; n23++) { WriteElementString ("Addin", "", ob.@DisabledAddins[n23]); } WriteEndElement (ob.@DisabledAddins); } if (ob.@AddinPaths != null) { WriteStartElement ("AddinPaths", "", ob.@AddinPaths); for (int n24 = 0; n24 < ob.@AddinPaths.Count; n24++) { WriteElementString ("Addin", "", ob.@AddinPaths[n24]); } WriteEndElement (ob.@AddinPaths); } if (writeWrappingElem) WriteEndElement (ob); } void WriteObject_RepositoryRecord (Mono.Addins.Setup.RepositoryRecord ob, string element, string namesp, bool isNullable, bool needType, bool writeWrappingElem) { if (((object)ob) == null) { if (isNullable) WriteNullTagLiteral(element, namesp); return; } System.Type type = ob.GetType (); if (type == typeof(Mono.Addins.Setup.RepositoryRecord)) { } else { throw CreateUnknownTypeException (ob); } if (writeWrappingElem) { WriteStartElement (element, namesp, ob); } if (needType) WriteXsiType("RepositoryRecord", ""); WriteAttribute ("id", "", ob.@Id); WriteElementString ("IsReference", "", (ob.@IsReference?"true":"false")); WriteElementString ("File", "", ob.@File); WriteElementString ("Url", "", ob.@Url); WriteElementString ("Name", "", ob.@Name); WriteElementString ("LastModified", "", XmlConvert.ToString (ob.@LastModified, XmlDateTimeSerializationMode.RoundtripKind)); if (ob.@Enabled != true) { WriteElementString ("Enabled", "", (ob.@Enabled?"true":"false")); } if (writeWrappingElem) WriteEndElement (ob); } protected override void InitCallbacks () { } } } mono-addins-1.0/Mono.Addins.Setup/Makefile.in0000664000175000017500000004227012136523720023067 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mono-addins-setup.pc.in \ $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include \ ChangeLog subdir = ./Mono.Addins.Setup 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mono-addins-setup.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/Mono.Addins.Setup.dll ASSEMBLY_NAME = Mono.Addins.Setup PC_FILES_IN = mono-addins-setup.pc.in pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) EXTRA_DIST = \ $(wildcard $(ALL_FILES)) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) \ $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) ALL_CSPROJ = $(wildcard *.csproj) MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_FALSE@PROFILE_NAME = DebugNotGui @ENABLE_GUI_TRUE@PROFILE_NAME = Debug XBUILD = xbuild XBUILD_VERBOSITY = quiet XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES := $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES := $(wildcard $(ALL_FILES)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Mono.Addins.Setup/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Mono.Addins.Setup/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mono-addins-setup.pc: $(top_builddir)/config.status $(srcdir)/mono-addins-setup.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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: distclean-am -rm -f Makefile 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-data-local install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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 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: uninstall-binSCRIPTS uninstall-local \ uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-data-local 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-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-local uninstall-pkgconfigDATA install-data-local: gac-install uninstall-local: gac-uninstall $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.csproj0000664000175000017500000001203412136524015025445 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 {A85C9721-C054-4BD8-A1F3-0227615F0A36} Library Mono.Addins.Setup 2.0 Mono.Addins.Setup True ..\mono-addins.snk v4.0 True full True ..\bin prompt 4 True False True 1574 none True ..\bin prompt 4 True False {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Mono.Addins False mono-addins-1.0/Mono.Addins.Setup/policy.0.5.config0000664000175000017500000000055412136524030024003 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Setup/policy.0.3.config0000664000175000017500000000055412136524030024001 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Setup/obj/0000775000175000017500000000000012136524043021566 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Setup/obj/Debug/0000775000175000017500000000000012136524044022615 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Setup/obj/Debug/Mono.Addins.Setup.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000034412136524037034205 0ustar00directhexdirecthex00000000000000/tmp/mono-addins/bin/Mono.Addins.Setup.dll.mdb /tmp/mono-addins/bin/Mono.Addins.Setup.dll /tmp/mono-addins/Mono.Addins.Setup/obj/Debug/Mono.Addins.Setup.dll /tmp/mono-addins/Mono.Addins.Setup/obj/Debug/Mono.Addins.Setup.dll.mdb mono-addins-1.0/Mono.Addins.Setup/ChangeLog0000664000175000017500000002206012136523632022571 0ustar00directhexdirecthex000000000000002010-10-14 Lluis Sanchez Gual * SetupService.cs: Build package now returns a list of the generated files. 2010-07-01 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Generate documentation. 2010-07-01 Lluis Sanchez Gual * Mono.Addins.Setup/Package.cs: * Mono.Addins.Setup/AddinInfo.cs: * Mono.Addins.Setup/SetupTool.cs: * Mono.Addins.Setup/SetupService.cs: * Mono.Addins.Setup/RepositoryRecord.cs: * Mono.Addins.Setup/InstallException.cs: * Mono.Addins.Setup/PackageCollection.cs: * Mono.Addins.Setup/RepositoryRegistry.cs: * Mono.Addins.Setup/AddinRepositoryEntry.cs: * Mono.Addins.Setup/ConsoleAddinInstaller.cs: Added some documentation. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Fix output directory for the Release configuration. 2010-04-08 Lluis Sanchez Gual * Mono.Addins.Setup/AddinStore.cs: Properly get the url path (old way didn't work on windows). 2010-04-08 Lluis Sanchez Gual * Mono.Addins.Setup/RepositoryRegistry.cs: GetAvailableUpdates (id,version) doesn't work. It makes no sense to ask for updates for a specific add-in version. Added GetAvaliableAddinUpdates methods which take only an id and no version. 2010-03-30 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Make sure the solution builds on MS.NET 2.0. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Flush. 2009-11-13 Lluis Sanchez Gual * Mono.Addins.Setup/SetupTool.cs: Allow specifying multiple levels of verbosity. 2009-09-01 Lluis Sanchez Gual * AssemblyInfo.cs: Bump Mono.Addins version. 2009-08-25 Lluis Sanchez Gual * Mono.Addins.Setup/PcFileCache.cs: Updated from MD. 2009-08-24 Lluis Sanchez Gual * Mono.Addins.Setup/PcFileCache.cs: * Mono.Addins.Setup/SetupService.cs: Make it buildable in .net 2.0. 2009-08-21 Lluis Sanchez Gual * Mono.Addins.Setup/SetupService.cs: Applications can now register a test command to be used for testing add-ins. Don't use the pkg-config command, use instead the PcFileCache. * Mono.Addins.Setup/PcFileCache.cs: Updated. 2009-08-20 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.Setup.csproj: * Mono.Addins.Setup/SetupTool.cs: * Mono.Addins.Setup/PcFileCache.cs: * Mono.Addins.Setup/SetupService.cs: Added a new project which Implements an msbuild task for resolving add-in references. 2009-08-19 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Update target framework to 2.0. 2009-06-17 Lluis Sanchez Gual * Mono.Addins.Setup/SetupService.cs: Added method for getting a registry from a package name. * Mono.Addins.Setup/SetupTool.cs: Added some more help for the info command. 2009-06-04 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.Setup.csproj: Remove unnecessary Mono.Posix reference. 2009-05-28 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Properly sign assemblies. 2009-02-06 Lluis Sanchez Gual * Mono.Addins.Setup/SetupTool.cs: Added command for getting the list of assemblies of an add-in. 2009/02/06 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Updated. 2008-11-10 Lluis Sanchez Gual * mono-addins-setup.pc.in: Respect custom libdir during ./configure. Fixes bug #443205. Patch by Diego Pettenò. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-08-22 Lluis Sanchez Gual * Mono.Addins.Setup.csproj, Mono.Addins.Setup.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-07-15 Lluis Sanchez Gual * Mono.Addins.Setup/SetupTool.cs: Add missing parameter documentation. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.Setup.mdp: Updated. * Mono.Addins.Setup/SetupTool.cs: Don't allow uninstalling add-ins with the CantUninstall flag. Same for hidden flag. 2008-02-06 Lluis Sanchez Gual * AssemblyInfo.cs: Added support for pluggable add-in assembly reflectors. Implemented an add-in assembly reflector based on Cecil. 2008-01-18 Lluis Sanchez Gual * Mono.Addins.Setup/RepositoryRegistry.cs: Don't break the api. 2008-01-17 Lluis Sanchez Gual * Mono.Addins.Setup/AddinPackage.cs: Delete subdirectories when uninstalling. * Mono.Addins.Setup/AddinStore.cs: Use a more informative uninstall message. * Mono.Addins.Setup/RepositoryRegistry.cs: Fix a nullref. Improved error reporting. 2007-12-15 Lluis Sanchez Gual * mono-addins-setup.pc.in: Update assembly paths. 2007-12-12 Lluis Sanchez Gual * Mono.Addins.Setup/SetupTool.cs: Typo fix. * Makefile.am: Generate and install policy files for old Mono.Addins versions. 2007-12-05 Lluis Sanchez Gual * Mono.Addins.Setup/AddinPackage.cs: When checking if an add-in is installed, don't provide the version number. This will return whatever version is installed. 2007-12-04 Lluis Sanchez Gual * mono-addins-setup.pc.in: Fix dependencies. 2007-12-03 Lluis Sanchez Gual * Mono.Addins.Setup.mdp: Updated. * Mono.Addins.Setup/SetupTool.cs: Added initial support for generating add-in documentation as XML. 2007-10-29 Lluis Sanchez Gual * Mono.Addins.Setup.mdp: Update paths. 2007-10-18 Lluis Sanchez Gual * AssemblyInfo.cs: Get ready for 0.3 release. 2007-09-10 Lluis Sanchez Gual * Mono.Addins.Setup/RepositoryRegistry.cs: Make sure RegisterRepository always returns a reference to the new repo. 2007-07-05 Lluis Sanchez Gual * Mono.Addins.Setup.mdp: Minor fix. 2007-07-03 Lluis Sanchez Gual * AssemblyInfo.cs, Mono.Addins.Setup.mdp, Makefile.am: Sign the assembly. * Mono.Addins.Setup/ConsoleAddinInstaller.cs: New IAddinInstaller implementation. 2007-07-02 Lluis Sanchez Gual * Mono.Addins.Setup.ProgressMonitoring/ConsoleProgressMonitor.cs, Mono.Addins.Setup.ProgressMonitoring/ProgressStatusMonitor.cs, Mono.Addins.Setup.ProgressMonitoring/NullProgressMonitor.cs, Mono.Addins.Setup/IProgressMonitor.cs: Track api changes. * Mono.Addins.Setup/SetupService.cs, Mono.Addins.Setup/AddinStore.cs: Added new overload for ResolveDependencies. * Mono.Addins.Setup/SetupTool.cs: Added new CheckInstall command. Fixed some issues with add-in id comparison. * Mono.Addins.Setup/AddinRepositoryEntry.cs, Mono.Addins.Setup/RepositoryRegistry.cs: When looking for installable add-ins, sort the result by version number. Some fix in the code that compares ids. 2007-05-07 Lluis Sanchez Gual * Mono.Addins.Setup/SetupService.cs: When creating a package, generating a valid file name when the add-in doesn't have an ID. Fixed the generated html page. Don't add the go-mono repository by default. * Mono.Addins.Setup/AddinInfo.cs: Generate a better default name when not provided. * Mono.Addins.Setup/RepositoryRegistry.cs: Added method for registering a repository without updating it. 2007-05-04 Lluis Sanchez Gual * Mono.Addins.mdp: Updated. * Mono.Addins/ExtensionContext.cs: Fixed GetExtensionObjects overload which was not using the correct reuseCachedInstance value. * Mono.Addins/ExtensionTree.cs: Improved error message. When looking for a type in an assembly, avoid throwing an exception too early, since it may be found in other assemblies. * Mono.Addins.Database/AddinDatabase.cs: In the addin info cache, also store information about unsuccessful lookups, to avoid looking for an add-in again if we found that it doesn't exist. In Update(), don't use verbose output by default. 2007-04-04 Lluis Sanchez Gual * Mono.Addins.Setup.ProgressMonitoring/NullProgressMonitor.cs: Fix warning. * Mono.Addins.Setup/SetupTool.cs, Makefile.am: Use ISO-1 compliant c# only. 2007-04-04 Lluis Sanchez Gual * Mono.Addins.Setup.csproj: Added msbuild project files. Patch by Matthijs ter Woord. * Mono.Addins.Setup/AddinPackage.cs, Mono.Addins.Setup/AddinStore.cs, Mono.Addins.Setup/SetupTool.cs, Mono.Addins.Setup/RepositoryRegistry.cs: Removed Mono.Posix dependency. Patch by Matthijs ter Woord. 2007-03-30 Lluis Sanchez Gual * Mono.Addins.Setup/SetupTool.cs: Cosmetic fixes. * Mono.Addins.Setup/RepositoryRegistry.cs: Fix NRE (repoList may change as a result of initializing the configuration). 2007-03-23 Lluis Sanchez Gual * Mono.Addins.Setup.mdp, Makefile.am: Removed unused file. mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/0000775000175000017500000000000012136524044030076 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/ProgressTracker.cs0000664000175000017500000000645712136523632033563 0ustar00directhexdirecthex00000000000000// // ProgressTracker.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Setup.ProgressMonitoring { internal class ProgressTracker { bool done; ArrayList tasks = new ArrayList (); class Task { public string Name; public int TotalWork; public int CurrentWork; public int StepSize = 1; public bool IsStep; public double GetWorkPercent (double part) { if (TotalWork <= 0) return 0; if (CurrentWork >= TotalWork) return 1.0; return ((double)CurrentWork + part) / (double)TotalWork; } } public void Reset () { done = false; tasks.Clear (); } public void BeginTask (string name, int totalWork) { Task t = new Task (); t.Name = name; t.TotalWork = totalWork; tasks.Add (t); } public void BeginStepTask (string name, int totalWork, int stepSize) { Task t = new Task (); t.StepSize = stepSize; t.IsStep = true; t.Name = name; t.TotalWork = totalWork; tasks.Add (t); } public void EndTask () { if (tasks.Count > 0) { Task t = LastTask; tasks.RemoveAt (tasks.Count - 1); if (t.IsStep) Step (t.StepSize); } } public void Step (int work) { if (tasks.Count == 0) return; Task t = LastTask; t.CurrentWork += work; if (t.CurrentWork > t.TotalWork) t.CurrentWork = t.TotalWork; } Task LastTask { get { return (Task)tasks [tasks.Count-1]; } } public string CurrentTask { get { if (tasks.Count == 0) return null; return LastTask.Name; } } public double CurrentTaskWork { get { if (tasks.Count == 0) return 0; return LastTask.GetWorkPercent (0); } } public bool UnknownWork { get { if (tasks.Count == 0) return false; return LastTask.TotalWork <= 1; } } public double GlobalWork { get { if (done) return 1.0; double work = 0; for (int n = tasks.Count - 1; n >= 0; n--) { Task t = (Task) tasks [n]; work = t.GetWorkPercent (work) * (double)t.StepSize; } return work; } } public bool InProgress { get { return !done; } } public void Done () { done = true; tasks.Clear (); } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/ProgressStatusMonitor.cs0000664000175000017500000000603512136523632035013 0ustar00directhexdirecthex00000000000000// // ProgressStatusMonitor.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Addins.Setup.ProgressMonitoring { internal class ProgressStatusMonitor: MarshalByRefObject, IProgressMonitor { IProgressStatus status; LogTextWriter logger; ProgressTracker tracker = new ProgressTracker (); public ProgressStatusMonitor (IProgressStatus status) { this.status = status; logger = new LogTextWriter (); logger.TextWritten += new LogTextEventHandler (WriteLog); } public static IProgressMonitor GetProgressMonitor (IProgressStatus status) { if (status == null) return new NullProgressMonitor (); else return new ProgressStatusMonitor (status); } public void BeginTask (string name, int totalWork) { tracker.BeginTask (name, totalWork); status.SetMessage (tracker.CurrentTask); status.SetProgress (tracker.GlobalWork); } public void BeginStepTask (string name, int totalWork, int stepSize) { tracker.BeginStepTask (name, totalWork, stepSize); status.SetMessage (tracker.CurrentTask); status.SetProgress (tracker.GlobalWork); } public void Step (int work) { tracker.Step (work); status.SetProgress (tracker.GlobalWork); } public void EndTask () { tracker.EndTask (); status.SetMessage (tracker.CurrentTask); status.SetProgress (tracker.GlobalWork); } void WriteLog (string text) { status.Log (text); } public TextWriter Log { get { return logger; } } public void ReportWarning (string message) { status.ReportWarning (message); } public void ReportError (string message, Exception ex) { status.ReportError (message, ex); } public bool IsCancelRequested { get { return status.IsCanceled; } } public void Cancel () { status.Cancel (); } public int LogLevel { get { return status.LogLevel; } } public void Dispose () { } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/ConsoleProgressMonitor.cs0000664000175000017500000001064412136523632035133 0ustar00directhexdirecthex00000000000000// // ConsoleProgressMonitor.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Addins.Setup.ProgressMonitoring { internal class ConsoleProgressMonitor: NullProgressMonitor { int columns = 80; bool indent = true; bool wrap = true; int ilevel = 0; int isize = 3; int col = -1; int logLevel; LogTextWriter logger; public ConsoleProgressMonitor (): this (1) { } public ConsoleProgressMonitor (int logLevel) { this.logLevel = logLevel; logger = new LogTextWriter (); logger.TextWritten += new LogTextEventHandler (WriteLog); } public bool WrapText { get { return wrap; } set { wrap = value; } } public int WrapColumns { get { return columns; } set { columns = value; } } public bool IndentTasks { get { return indent; } set { indent = value; } } public override int LogLevel { get { return logLevel; } } public override void BeginTask (string name, int totalWork) { WriteText (name); Indent (); } public override void BeginStepTask (string name, int totalWork, int stepSize) { BeginTask (name, totalWork); } public override void EndTask () { Unindent (); } void WriteLog (string text) { WriteText (text); } public override TextWriter Log { get { return logger; } } public override void ReportSuccess (string message) { WriteText (message); } public override void ReportWarning (string message) { if (logLevel != 0) WriteText ("WARNING: " + message + "\n"); } public override void ReportError (string message, Exception ex) { if (logLevel == 0) return; if (message != null && ex != null) { WriteText ("ERROR: " + message + "\n"); if (logLevel > 1) WriteText (ex + "\n"); } if (message != null) WriteText ("ERROR: " + message + "\n"); else if (ex != null) { if (logLevel > 1) WriteText ("ERROR: " + ex + "\n"); else WriteText ("ERROR: " + ex.Message + "\n"); } } void WriteText (string text) { if (indent) WriteText (text, ilevel); else WriteText (text, 0); } void WriteText (string text, int leftMargin) { if (text == null || text.Length == 0) return; int n = 0; int maxCols = wrap ? columns : int.MaxValue; while (n < text.Length) { if (col == -1) { Console.Write (new String (' ', leftMargin)); col = leftMargin; } int lastWhite = -1; int sn = n; bool eol = false; while (col < maxCols && n < text.Length) { char c = text [n]; if (c == '\r') { n++; continue; } if (c == '\n') { eol = true; break; } if (char.IsWhiteSpace (c)) lastWhite = n; col++; n++; } if (lastWhite == -1 || col < maxCols) lastWhite = n; else if (col >= maxCols) n = lastWhite + 1; Console.Write (text.Substring (sn, lastWhite - sn)); if (eol || col >= maxCols) { col = -1; Console.WriteLine (); if (eol) n++; } } } void Indent () { ilevel += isize; if (col != -1) { Console.WriteLine (); col = -1; } } void Unindent () { ilevel -= isize; if (ilevel < 0) ilevel = 0; if (col != -1) { Console.WriteLine (); col = -1; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/NullProgressMonitor.cs0000664000175000017500000000721012136523632034436 0ustar00directhexdirecthex00000000000000// // NullProgressMonitor.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Threading; using System.IO; namespace Mono.Addins.Setup.ProgressMonitoring { internal class NullProgressMonitor: MarshalByRefObject, IProgressMonitor { bool done, canceled; ArrayList errors; ArrayList warnings; ArrayList messages; public string[] Messages { get { if (messages != null) return (string[]) messages.ToArray (typeof(string)); else return new string [0]; } } public string[] Warnings { get { if (warnings != null) return (string[]) warnings.ToArray (typeof(string)); else return new string [0]; } } public ProgressError[] Errors { get { if (errors != null) return (ProgressError[]) errors.ToArray (typeof(ProgressError)); else return new ProgressError [0]; } } public virtual void BeginTask (string name, int totalWork) { } public virtual void EndTask () { } public virtual void BeginStepTask (string name, int totalWork, int stepSize) { } public virtual void Step (int work) { } public virtual TextWriter Log { get { return TextWriter.Null; } } public virtual void ReportSuccess (string message) { if (messages == null) messages = new ArrayList (); messages.Add (message); } public virtual void ReportWarning (string message) { if (warnings == null) warnings = new ArrayList (); messages.Add (message); } public virtual void ReportError (string message, Exception ex) { if (errors == null) errors = new ArrayList (); if (message == null && ex != null) message = ex.Message; else if (message != null && ex != null) { if (!message.EndsWith (".")) message += "."; message += " " + ex.Message; } errors.Add (new ProgressError (message, ex)); } public bool IsCancelRequested { get { return canceled; } } public void Cancel () { canceled = true; } public virtual int LogLevel { get { return 1; } } public virtual void Dispose () { lock (this) { if (done) return; done = true; } OnCompleted (); } protected virtual void OnCompleted () { } } internal class ProgressError { Exception ex; string message; public ProgressError (string message, Exception ex) { this.ex = ex; this.message = message; } public string Message { get { return message; } } public Exception Exception { get { return ex; } } } } mono-addins-1.0/Mono.Addins.Setup/Mono.Addins.Setup.ProgressMonitoring/LogTextWriter.cs0000664000175000017500000000472312136523632033220 0ustar00directhexdirecthex00000000000000// // LogTextWriter.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Text; using System.Collections; namespace Mono.Addins.Setup.ProgressMonitoring { internal delegate void LogTextEventHandler (string writtenText); internal class LogTextWriter: TextWriter { ArrayList chainedWriters; public void ChainWriter (TextWriter writer) { if (chainedWriters == null) chainedWriters = new ArrayList (); chainedWriters.Add (writer); } public void UnchainWriter (TextWriter writer) { if (chainedWriters != null) { chainedWriters.Remove (writer); if (chainedWriters.Count == 0) chainedWriters = null; } } public override Encoding Encoding { get { return Encoding.Default; } } public override void Close () { if (Closed != null) Closed (this, null); } public override void Write (char value) { if (TextWritten != null) TextWritten (value.ToString ()); if (chainedWriters != null) foreach (TextWriter cw in chainedWriters) cw.Write (value); } public override void Write (string value) { if (TextWritten != null) TextWritten (value); if (chainedWriters != null) foreach (TextWriter cw in chainedWriters) cw.Write (value); } public event LogTextEventHandler TextWritten; public event EventHandler Closed; } } mono-addins-1.0/Mono.Addins.Setup/policy.0.6.config0000664000175000017500000000055412136524031024005 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Setup/policy.0.4.config0000664000175000017500000000055412136524030024002 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Setup/policy.0.2.config0000664000175000017500000000055412136524030024000 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins/0000775000175000017500000000000012136524043017715 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/AssemblyInfo.cs0000664000175000017500000000200312136523632022635 0ustar00directhexdirecthex00000000000000using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("Mono.Addins")] [assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.0.0")] [assembly: InternalsVisibleTo ("Mono.Addins.Setup, PublicKey=00240000048000009400000006020000002400005253413100" + "0400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c" + "3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4" + "f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] mono-addins-1.0/Mono.Addins/Makefile.am0000664000175000017500000000044112136523632021753 0ustar00directhexdirecthex00000000000000 ASSEMBLY = ../bin/Mono.Addins.dll ASSEMBLY_NAME=Mono.Addins PC_FILES_IN = mono-addins.pc.in install-data-local: gac-install uninstall-local: gac-uninstall include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include CLEANFILES += $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) mono-addins-1.0/Mono.Addins/Mono.Addins.csproj0000664000175000017500000002221212136524015023246 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Library Mono.Addins 2.0 Mono.Addins True ..\mono-addins.snk v4.0 True full True ..\bin prompt 4 True False True 1574 none True ..\bin prompt 4 True False mono-addins-1.0/Mono.Addins/Mono.Addins/0000775000175000017500000000000012136524043022026 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/Mono.Addins/NodeAttributeAttribute.cs0000664000175000017500000001735512136523632027030 0ustar00directhexdirecthex00000000000000// // NodeAttributeAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Indicates that a field or property is bound to a node attribute /// [AttributeUsage (AttributeTargets.Class | AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple=true)] public class NodeAttributeAttribute: Attribute { string name; bool required; bool localizable; Type type; string typeName; string description; /// /// Initializes a new instance /// public NodeAttributeAttribute () { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// public NodeAttributeAttribute (string name) :this (name, false, null) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Description of the attribute. /// public NodeAttributeAttribute (string name, string description) :this (name, false, description) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Indicates whether the attribute is required or not. /// public NodeAttributeAttribute (string name, bool required) : this (name, required, null) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Indicates whether the attribute is required or not. /// /// /// Description of the attribute. /// public NodeAttributeAttribute (string name, bool required, string description) { this.name = name; this.required = required; this.description = description; } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Type of the extension node attribute. /// /// /// The type of the attribute is only required when applying this attribute at class level. /// It is not required when it is applied to a field, since the attribute type will be the type of the field. /// public NodeAttributeAttribute (string name, Type type) : this (name, type, false, null) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Type of the extension node attribute. /// /// /// Description of the attribute. /// /// /// The type of the attribute is only required when applying this attribute at class level. /// It is not required when it is applied to a field, since the attribute type will be the type of the field. /// public NodeAttributeAttribute (string name, Type type, string description) : this (name, type, false, description) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Type of the extension node attribute. /// /// /// Indicates whether the attribute is required or not. /// /// /// The type of the attribute is only required when applying this attribute at class level. /// It is not required when it is applied to a field, since the attribute type will be the type of the field. /// public NodeAttributeAttribute (string name, Type type, bool required) : this (name, type, false, null) { } /// /// Initializes a new instance /// /// /// XML name of the attribute. /// /// /// Type of the extension node attribute. /// /// /// Indicates whether the attribute is required or not. /// /// /// Description of the attribute. /// /// /// The type of the attribute is only required when applying this attribute at class level. /// It is not required when it is applied to a field, since the attribute type will be the type of the field. /// public NodeAttributeAttribute (string name, Type type, bool required, string description) { this.name = name; this.type = type; this.required = required; this.description = description; } /// /// XML name of the attribute. /// /// /// If the name is not specified, the field name to which the [NodeAttribute] /// is applied will be used as name. Providing a name is mandatory when applying /// [NodeAttribute] at class level. /// public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } /// /// Indicates whether the attribute is required or not. /// public bool Required { get { return required; } set { required = value; } } /// /// Type of the extension node attribute. /// /// /// To be used only when applying [NodeAttribute] at class level. It is not required when it /// is applied to a field, since the attribute type will be the type of the field. /// public Type Type { get { return type; } set { type = value; typeName = type.FullName; } } internal string TypeName { get { return typeName; } set { typeName = value; type = null; } } /// /// Description of the attribute. /// /// /// To be used in the extension point documentation. /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } /// /// When set to True, the value of the field or property is expected to be a string id which /// will be localized by the add-in engine /// public bool Localizable { get { return localizable; } set { localizable = value; } } /// /// Gets or sets the type of the content. /// /// /// Allows specifying the type of the content of a string attribute. /// This value is for documentation purposes only. /// public ContentType ContentType { get; set; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinDescriptionAttribute.cs0000664000175000017500000000467212136523632027500 0ustar00directhexdirecthex00000000000000// // AddinDescriptionAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Describes the purpose of an add-in or add-in root /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] public class AddinDescriptionAttribute: Attribute { /// /// Initializes a new instance of the class. /// /// /// Description of the add-in /// public AddinDescriptionAttribute (string description) { Description = description; } /// /// Initializes a new instance of the class. /// /// /// Description of the add-in /// /// /// Locale of the description (for example, 'en-US', or 'en') /// public AddinDescriptionAttribute (string description, string locale) { Description = description; Locale = locale; } /// /// Description of the add-in /// public string Description { get; set; } /// /// Locale of the description (for example, 'en-US', or 'en') /// public string Locale { get; set; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/MissingDependencyException.cs0000664000175000017500000000321512136523632027650 0ustar00directhexdirecthex00000000000000// // MissingDependencyException.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Runtime.Serialization; namespace Mono.Addins { /// /// Exception thrown when the add-in engine can't find a required add-in dependency /// [Serializable] internal class MissingDependencyException: Exception { public MissingDependencyException (SerializationInfo inf, StreamingContext ctx) : base (inf, ctx) { } public MissingDependencyException (string message): base (message) { } } } mono-addins-1.0/Mono.Addins/Mono.Addins/NodeElement.cs0000664000175000017500000000547012136523632024565 0ustar00directhexdirecthex00000000000000// // NodeElement.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins { /// /// An extension node element. /// /// /// A raw representation of an extension node. Contains the basic information /// needed to create ExtensionNode instances. /// public interface NodeElement { /// /// Name of the node element. /// string NodeName { get; } /// /// Gets element attributes. /// /// /// Name of the attribute /// /// /// The value of the attribute /// string GetAttribute (string key); /// /// Gets all attributes defined in the element. /// NodeAttribute[] Attributes { get; } /// /// Gets child nodes of this node /// NodeElementCollection ChildNodes { get; } } /// /// Attribute of a NodeElement. /// public class NodeAttribute { internal string name; internal string value; internal NodeAttribute () { } /// /// Name of the attribute. /// public string Name { get { return name; } } /// /// Value of the attribute. /// public string Value { get { return value; } } } /// /// A collection of NodeElement objects /// public interface NodeElementCollection: IList, ICollection, IEnumerable { /// /// Gets the at the specified index /// /// /// Index /// new NodeElement this [int n] { get; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinDependencyAttribute.cs0000664000175000017500000000401412136523632027261 0ustar00directhexdirecthex00000000000000// // AddinDependencyAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Declares a dependency on an add-in or add-in host /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)] public class AddinDependencyAttribute: Attribute { string id; string version; /// /// Initializes the attribute /// /// /// Identifier of the add-in /// /// /// Version of the add-in /// public AddinDependencyAttribute (string id, string version) { this.id = id; this.version = version; } /// /// Identifier of the add-in /// public string Id { get { return id; } } /// /// Version of the add-in /// public string Version { get { return version; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinManager.cs0000664000175000017500000006664412136523632024712 0ustar00directhexdirecthex00000000000000// // AddinManager.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Reflection; using System.Collections; using System.Collections.Generic; using Mono.Addins.Localization; namespace Mono.Addins { /// /// Provides access to add-in and extension model management operations. /// public class AddinManager { static AddinEngine sessionService; private AddinManager () { } /// /// Initializes the add-in engine. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// When initialized with this method, it will look for add-ins in the global add-in registry. /// public static void Initialize () { // Code not shared with the other Initialize since I need to get the calling assembly Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); AddinEngine.Initialize (asm, null, null, null); } /// /// Initializes the add-in engine. /// /// /// Location of the add-in registry. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// Configuration information about the add-in registry will be stored in the /// provided location. The add-in engine will look for add-ins in an 'addins' /// subdirectory of the provided directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public static void Initialize (string configDir) { Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); AddinEngine.Initialize (asm, configDir, null, null); } /// /// Initializes the add-in engine. /// /// /// Location of the add-in registry. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// Configuration information about the add-in registry will be stored in the /// provided location. The add-in engine will look for add-ins in the provided /// 'addinsDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public static void Initialize (string configDir, string addinsDir) { Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); AddinEngine.Initialize (asm, configDir, addinsDir, null); } /// /// Initializes the add-in engine. /// /// /// Location of the add-in registry. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// Location of the add-in database. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// Configuration information about the add-in registry will be stored in the /// provided location. The add-in engine will look for add-ins in the provided /// 'addinsDir' directory. Cached information about add-ins will be stored in /// the 'databaseDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public static void Initialize (string configDir, string addinsDir, string databaseDir) { Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); AddinEngine.Initialize (asm, configDir, addinsDir, databaseDir); } /// /// Finalizes an add-in engine. /// public static void Shutdown () { AddinEngine.Shutdown (); } /// /// Sets the default localizer to be used for this add-in engine /// /// /// The add-in localizer /// public static void InitializeDefaultLocalizer (IAddinLocalizer localizer) { AddinEngine.InitializeDefaultLocalizer (localizer); } internal static string StartupDirectory { get { return AddinEngine.StartupDirectory; } } /// /// Gets whether the add-in engine has been initialized. /// public static bool IsInitialized { get { return AddinEngine.IsInitialized; } } /// /// Gets the default add-in installer /// /// /// The default installer is used by the CheckInstalled method to request /// the installation of missing add-ins. /// public static IAddinInstaller DefaultInstaller { get { return AddinEngine.DefaultInstaller; } set { AddinEngine.DefaultInstaller = value; } } /// /// Gets the default localizer for this add-in engine /// public static AddinLocalizer DefaultLocalizer { get { return AddinEngine.DefaultLocalizer; } } /// /// Gets the localizer for the add-in that is invoking this property /// public static AddinLocalizer CurrentLocalizer { get { AddinEngine.CheckInitialized (); RuntimeAddin addin = AddinEngine.GetAddinForAssembly (Assembly.GetCallingAssembly ()); if (addin != null) return addin.Localizer; else return AddinEngine.DefaultLocalizer; } } /// /// Gets a reference to the RuntimeAddin object for the add-in that is invoking this property /// public static RuntimeAddin CurrentAddin { get { AddinEngine.CheckInitialized (); return AddinEngine.GetAddinForAssembly (Assembly.GetCallingAssembly ()); } } /// /// Gets the default add-in engine /// public static AddinEngine AddinEngine { get { if (sessionService == null) sessionService = new AddinEngine(); return sessionService; } } /// /// Gets the add-in registry bound to the default add-in engine /// public static AddinRegistry Registry { get { return AddinEngine.Registry; } } /// /// Checks if the provided add-ins are installed, and requests the installation of those /// which aren't. /// /// /// Message to show to the user when new add-ins have to be installed. /// /// /// List of IDs of the add-ins to be checked. /// /// /// This method checks if the specified add-ins are installed. /// If some of the add-ins are not installed, it will use /// the installer assigned to the DefaultAddinInstaller property /// to install them. If the installation fails, or if DefaultAddinInstaller /// is not set, an exception will be thrown. /// public static void CheckInstalled (string message, params string[] addinIds) { AddinEngine.CheckInstalled (message, addinIds); } /// /// Checks if an add-in has been loaded. /// /// /// Full identifier of the add-in. /// /// /// True if the add-in is loaded. /// public static bool IsAddinLoaded (string id) { return AddinEngine.IsAddinLoaded (id); } /// /// Forces the loading of an add-in. /// /// /// Status monitor to keep track of the loading process. /// /// /// Full identifier of the add-in to load. /// /// /// This method loads all assemblies that belong to an add-in in memory. /// All add-ins on which the specified add-in depends will also be loaded. /// Notice that in general add-ins don't need to be explicitely loaded using /// this method, since the add-in engine will load them on demand. /// public static void LoadAddin (IProgressStatus statusMonitor, string id) { AddinEngine.LoadAddin (statusMonitor, id); } /// /// Creates a new extension context. /// /// /// The new extension context. /// /// /// Extension contexts can be used to query the extension model using particular condition values. /// public static ExtensionContext CreateExtensionContext () { return AddinEngine.CreateExtensionContext (); } /// /// Returns the extension node in a path /// /// /// Location of the node. /// /// /// The node, or null if not found. /// public static ExtensionNode GetExtensionNode (string path) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNode (path); } /// /// Returns the extension node in a path /// /// /// Location of the node. /// /// /// The node, or null if not found. /// public static T GetExtensionNode (string path) where T:ExtensionNode { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNode (path); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path.> /// /// /// All nodes registered in the provided path. /// public static ExtensionNodeList GetExtensionNodes (string path) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (path); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path. /// /// /// Expected node type. /// /// /// A list of nodes /// /// /// This method returns all nodes registered under the provided path. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided type. /// public static ExtensionNodeList GetExtensionNodes (string path, Type expectedNodeType) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (path, expectedNodeType); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path. /// /// /// A list of nodes /// /// /// This method returns all nodes registered under the provided path. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided type. /// public static ExtensionNodeList GetExtensionNodes (string path) where T:ExtensionNode { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (path); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// A list of nodes /// /// /// This method returns all extension nodes bound to the provided type. /// public static ExtensionNodeList GetExtensionNodes (Type instanceType) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (instanceType); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// Expected extension node type /// /// /// A list of nodes /// /// /// This method returns all nodes registered for the provided type. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided node type. /// public static ExtensionNodeList GetExtensionNodes (Type instanceType, Type expectedNodeType) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (instanceType, expectedNodeType); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// A list of nodes /// /// /// This method returns all nodes registered for the provided type. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the specified node type argument. /// public static ExtensionNodeList GetExtensionNodes (Type instanceType) where T: ExtensionNode { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionNodes (instanceType); } /// /// Gets extension objects registered for a type extension point. /// /// /// Type defining the extension point /// /// /// A list of objects /// public static object[] GetExtensionObjects (Type instanceType) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (instanceType); } /// /// Gets extension objects registered for a type extension point. /// /// /// A list of objects /// /// /// The type argument of this generic method is the type that defines /// the extension point. /// public static T[] GetExtensionObjects () { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (); } /// /// Gets extension objects registered for a type extension point. /// /// /// Type defining the extension point /// /// /// When set to True, it will return instances created in previous calls. /// /// /// A list of extension objects. /// public static object[] GetExtensionObjects (Type instanceType, bool reuseCachedInstance) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (instanceType, reuseCachedInstance); } /// /// Gets extension objects registered for a type extension point. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// A list of extension objects. /// /// /// The type argument of this generic method is the type that defines /// the extension point. /// public static T[] GetExtensionObjects (bool reuseCachedInstance) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (reuseCachedInstance); } /// /// Gets extension objects registered in a path /// /// /// An extension path. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// public static object[] GetExtensionObjects (string path) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true) /// public static object[] GetExtensionObjects (string path, bool reuseCachedInstance) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path, reuseCachedInstance); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// Type of the return array elements. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public static object[] GetExtensionObjects (string path, Type arrayElementType) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path, arrayElementType); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public static T[] GetExtensionObjects (string path) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// Type of the return array elements. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true). /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public static object[] GetExtensionObjects (string path, Type arrayElementType, bool reuseCachedInstance) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path, arrayElementType, reuseCachedInstance); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true). /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public static T[] GetExtensionObjects (string path, bool reuseCachedInstance) { AddinEngine.CheckInitialized (); return AddinEngine.GetExtensionObjects (path, reuseCachedInstance); } /// /// Extension change event. /// /// /// This event is fired when any extension point in the add-in system changes. /// The event args object provides the path of the changed extension, although /// it does not provide information about what changed. Hosts subscribing to /// this event should get the new list of nodes using a query method such as /// AddinManager.GetExtensionNodes() and then update whatever needs to be updated. /// public static event ExtensionEventHandler ExtensionChanged { add { AddinEngine.CheckInitialized(); AddinEngine.ExtensionChanged += value; } remove { AddinEngine.CheckInitialized(); AddinEngine.ExtensionChanged -= value; } } /// /// Register a listener of extension node changes. /// /// /// Path of the node. /// /// /// A handler method. /// /// /// Hosts can call this method to be subscribed to an extension change /// event for a specific path. The event will be fired once for every /// individual node change. The event arguments include the change type /// (Add or Remove) and the extension node added or removed. /// /// NOTE: The handler will be called for all nodes existing in the path at the moment of registration. /// public static void AddExtensionNodeHandler (string path, ExtensionNodeEventHandler handler) { AddinEngine.CheckInitialized (); AddinEngine.AddExtensionNodeHandler (path, handler); } /// /// Unregister a listener of extension node changes. /// /// /// Path of the node. /// /// /// A handler method. /// /// /// This method unregisters a delegate from the node change event of a path. /// public static void RemoveExtensionNodeHandler (string path, ExtensionNodeEventHandler handler) { AddinEngine.CheckInitialized (); AddinEngine.RemoveExtensionNodeHandler (path, handler); } /// /// Register a listener of extension node changes. /// /// /// Type defining the extension point /// /// /// A handler method. /// /// /// Hosts can call this method to be subscribed to an extension change /// event for a specific type extension point. The event will be fired once for every /// individual node change. The event arguments include the change type /// (Add or Remove) and the extension node added or removed. /// /// NOTE: The handler will be called for all nodes existing in the path at the moment of registration. /// public static void AddExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) { AddinEngine.CheckInitialized (); AddinEngine.AddExtensionNodeHandler (instanceType, handler); } /// /// Unregister a listener of extension node changes. /// /// /// Type defining the extension point /// /// /// A handler method. /// public static void RemoveExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) { AddinEngine.CheckInitialized (); AddinEngine.RemoveExtensionNodeHandler (instanceType, handler); } /// /// Add-in loading error event. /// /// /// This event is fired when there is an error when loading the extension /// of an add-in, or any other kind of error that may happen when querying extension points. /// public static event AddinErrorEventHandler AddinLoadError { add { AddinEngine.AddinLoadError += value; } remove { AddinEngine.AddinLoadError -= value; } } /// /// Add-in loaded event. /// /// /// Fired after loading an add-in in memory. /// public static event AddinEventHandler AddinLoaded { add { AddinEngine.AddinLoaded += value; } remove { AddinEngine.AddinLoaded -= value; } } /// /// Add-in unload event. /// /// /// Fired when an add-in is unloaded from memory. It may happen an add-in is disabled or uninstalled. /// public static event AddinEventHandler AddinUnloaded { add { AddinEngine.AddinUnloaded += value; } remove { AddinEngine.AddinUnloaded -= value; } } internal static bool CheckAssembliesLoaded (HashSet files) { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) { if (asm is System.Reflection.Emit.AssemblyBuilder) continue; try { Uri u; if (!Uri.TryCreate (asm.CodeBase, UriKind.Absolute, out u)) continue; string asmFile = u.LocalPath; if (files.Contains (Path.GetFullPath (asmFile))) return true; } catch { // Ignore } } return false; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/TypeExtensionPointAttribute.cs0000664000175000017500000000724312136523632030102 0ustar00directhexdirecthex00000000000000// // TypeExtensionPointAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Declares an extension point bound to a type /// [AttributeUsage (AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple=true)] public class TypeExtensionPointAttribute: Attribute { string path; string nodeName; Type nodeType; string nodeTypeName; string desc; string name; Type customAttributeType; string customAttributeTypeName; /// /// Initializes a new instance /// public TypeExtensionPointAttribute () { } /// /// Initializes a new instance /// /// /// Path that identifies the extension point /// public TypeExtensionPointAttribute (string path) { this.path = path; } /// /// Path that identifies the extension point /// public string Path { get { return path != null ? path : string.Empty; } set { path = value; } } /// /// Description of the extension point. /// public string Description { get { return desc != null ? desc : string.Empty; } set { desc = value; } } /// /// Element name to be used when defining an extension in an XML manifest. The default name is "Type". /// public string NodeName { get { return nodeName != null && nodeName.Length > 0 ? nodeName : "Type"; } set { nodeName = value; } } /// /// Display name of the extension point. /// public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } /// /// Type of the extension node to be created for extensions /// public Type NodeType { get { return nodeType != null ? nodeType : typeof(TypeExtensionNode); } set { nodeType = value; nodeTypeName = value.FullName; } } internal string NodeTypeName { get { return nodeTypeName != null ? nodeTypeName : typeof(TypeExtensionNode).FullName; } set { nodeTypeName = value; nodeType = null; } } /// /// Type of the custom attribute to be used to specify metadata for the extension point /// public Type ExtensionAttributeType { get { return this.customAttributeType; } set { this.customAttributeType = value; customAttributeTypeName = value.FullName; } } internal string ExtensionAttributeTypeName { get { return this.customAttributeTypeName; } set { this.customAttributeTypeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinRootAttribute.cs0000664000175000017500000000414412136523632026132 0ustar00directhexdirecthex00000000000000// // AddinRootAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Marks an assembly as being an add-in root. /// /// /// An add-in root is an assemly which can be extended by add-ins. /// [AttributeUsage (AttributeTargets.Assembly)] public class AddinRootAttribute: AddinAttribute { /// /// Initializes a new instance /// public AddinRootAttribute () { } /// /// Initializes a new instance /// /// /// Identifier of the add-in root /// public AddinRootAttribute (string id): base (id) { } /// /// Initializes a new instance /// /// /// Identifier of the add-in root /// /// /// Version of the add-in root /// public AddinRootAttribute (string id, string version): base (id, version) { } } } mono-addins-1.0/Mono.Addins/Mono.Addins/RuntimeAddin.cs0000664000175000017500000004613112136524015024744 0ustar00directhexdirecthex00000000000000// // RuntimeAddin.cs // // Author: // Lluis Sanchez Gual, // Georg Wächter // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Xml; using System.Resources; using System.Globalization; using Mono.Addins.Description; using Mono.Addins.Localization; namespace Mono.Addins { /// /// Run-time representation of an add-in. /// public class RuntimeAddin { string id; string baseDirectory; string privatePath; Addin ainfo; RuntimeAddin parentAddin; Assembly[] assemblies; RuntimeAddin[] depAddins; ResourceManager[] resourceManagers; AddinLocalizer localizer; ModuleDescription module; AddinEngine addinEngine; internal RuntimeAddin (AddinEngine addinEngine) { this.addinEngine = addinEngine; } internal RuntimeAddin (AddinEngine addinEngine, RuntimeAddin parentAddin, ModuleDescription module) { this.addinEngine = addinEngine; this.parentAddin = parentAddin; this.module = module; id = parentAddin.id; baseDirectory = parentAddin.baseDirectory; privatePath = parentAddin.privatePath; ainfo = parentAddin.ainfo; localizer = parentAddin.localizer; module.RuntimeAddin = this; } internal ModuleDescription Module { get { return module; } } internal Assembly[] Assemblies { get { EnsureAssembliesLoaded (); return assemblies; } } /// /// Identifier of the add-in. /// public string Id { get { return Addin.GetIdName (id); } } /// /// Version of the add-in. /// public string Version { get { return Addin.GetIdVersion (id); } } internal Addin Addin { get { return ainfo; } } /// /// Returns a string that represents the current RuntimeAddin. /// /// /// A string that represents the current RuntimeAddin. /// public override string ToString () { return ainfo.ToString (); } ResourceManager[] GetResourceManagers () { if (resourceManagers != null) return resourceManagers; EnsureAssembliesLoaded (); ArrayList managersList = new ArrayList (); // Search for embedded resource files foreach (Assembly asm in assemblies) { foreach (string res in asm.GetManifestResourceNames ()) { if (res.EndsWith (".resources")) managersList.Add (new ResourceManager (res.Substring (0, res.Length - ".resources".Length), asm)); } } return resourceManagers = (ResourceManager[]) managersList.ToArray (typeof(ResourceManager)); } /// /// Gets a resource string /// /// /// Name of the resource /// /// /// The value of the resource string, or null if the resource can't be found. /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public string GetResourceString (string name) { return (string) GetResourceObject (name, true, null); } /// /// Gets a resource string /// /// /// Name of the resource /// /// /// When set to true, an exception will be thrown if the resource is not found. /// /// /// The value of the resource string /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public string GetResourceString (string name, bool throwIfNotFound) { return (string) GetResourceObject (name, throwIfNotFound, null); } /// /// Gets a resource string /// /// /// Name of the resource /// /// /// When set to true, an exception will be thrown if the resource is not found. /// /// /// Culture of the resource /// /// /// The value of the resource string /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public string GetResourceString (string name, bool throwIfNotFound, CultureInfo culture) { return (string) GetResourceObject (name, throwIfNotFound, culture); } /// /// Gets a resource object /// /// /// Name of the resource /// /// /// Value of the resource /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public object GetResourceObject (string name) { return GetResourceObject (name, true, null); } /// /// Gets a resource object /// /// /// Name of the resource /// /// /// When set to true, an exception will be thrown if the resource is not found. /// /// /// Value of the resource /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public object GetResourceObject (string name, bool throwIfNotFound) { return GetResourceObject (name, throwIfNotFound, null); } /// /// Gets a resource object /// /// /// Name of the resource /// /// /// When set to true, an exception will be thrown if the resource is not found. /// /// /// Culture of the resource /// /// /// Value of the resource /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public object GetResourceObject (string name, bool throwIfNotFound, CultureInfo culture) { // Look in resources of this add-in foreach (ResourceManager manager in GetAllResourceManagers ()) { object t = manager.GetObject (name, culture); if (t != null) return t; } // Look in resources of dependent add-ins foreach (RuntimeAddin addin in GetAllDependencies ()) { object t = addin.GetResourceObject (name, false, culture); if (t != null) return t; } if (throwIfNotFound) throw new InvalidOperationException ("Resource object '" + name + "' not found in add-in '" + id + "'"); return null; } /// /// Gets a type defined in the add-in /// /// /// Full name of the type /// /// /// A type. /// /// /// The type will be looked up in the assemblies that implement the add-in, /// and recursivelly in all add-ins on which it depends. /// /// This method throws an InvalidOperationException if the type can't be found. /// public Type GetType (string typeName) { return GetType (typeName, true); } /// /// Gets a type defined in the add-in /// /// /// Full name of the type /// /// /// Indicates whether the method should throw an exception if the type can't be found. /// /// /// A /// /// /// The type will be looked up in the assemblies that implement the add-in, /// and recursivelly in all add-ins on which it depends. /// /// If the type can't be found, this method throw a InvalidOperationException if /// 'throwIfNotFound' is 'true', or 'null' otherwise. /// public Type GetType (string typeName, bool throwIfNotFound) { EnsureAssembliesLoaded (); // Look in the addin assemblies Type at = Type.GetType (typeName, false); if (at != null) return at; foreach (Assembly asm in GetAllAssemblies ()) { Type t = asm.GetType (typeName, false); if (t != null) return t; } // Look in the dependent add-ins foreach (RuntimeAddin addin in GetAllDependencies ()) { Type t = addin.GetType (typeName, false); if (t != null) return t; } if (throwIfNotFound) throw new InvalidOperationException ("Type '" + typeName + "' not found in add-in '" + id + "'"); return null; } IEnumerable GetAllResourceManagers () { foreach (ResourceManager rm in GetResourceManagers ()) yield return rm; if (parentAddin != null) { foreach (ResourceManager rm in parentAddin.GetResourceManagers ()) yield return rm; } } IEnumerable GetAllAssemblies () { foreach (Assembly asm in Assemblies) yield return asm; // Look in the parent addin assemblies if (parentAddin != null) { foreach (Assembly asm in parentAddin.Assemblies) yield return asm; } } IEnumerable GetAllDependencies () { // Look in the dependent add-ins foreach (RuntimeAddin addin in GetDepAddins ()) yield return addin; if (parentAddin != null) { // Look in the parent dependent add-ins foreach (RuntimeAddin addin in parentAddin.GetDepAddins ()) yield return addin; } } /// /// Creates an instance of a type defined in the add-in /// /// /// Name of the type. /// /// /// A new instance of the type /// /// /// The type will be looked up in the assemblies that implement the add-in, /// and recursivelly in all add-ins on which it depends. /// /// This method throws an InvalidOperationException if the type can't be found. /// /// The specified type must have a default constructor. /// public object CreateInstance (string typeName) { return CreateInstance (typeName, true); } /// /// Creates an instance of a type defined in the add-in /// /// /// Name of the type. /// /// /// Indicates whether the method should throw an exception if the type can't be found. /// /// /// A new instance of the type /// /// /// The type will be looked up in the assemblies that implement the add-in, /// and recursivelly in all add-ins on which it depends. /// /// If the type can't be found, this method throw a InvalidOperationException if /// 'throwIfNotFound' is 'true', or 'null' otherwise. /// /// The specified type must have a default constructor. /// public object CreateInstance (string typeName, bool throwIfNotFound) { Type type = GetType (typeName, throwIfNotFound); if (type == null) return null; else return Activator.CreateInstance (type, true); } /// /// Gets the path of an add-in file /// /// /// Relative path of the file /// /// /// Full path of the file /// /// /// This method can be used to get the full path of a data file deployed together with the add-in. /// public string GetFilePath (string fileName) { return Path.Combine (baseDirectory, fileName); } /// /// Gets the path of an add-in file /// /// /// Components of the file path /// /// /// Full path of the file /// /// /// This method can be used to get the full path of a data file deployed together with the add-in. /// public string GetFilePath (params string[] filePath) { return Path.Combine (baseDirectory, string.Join ("" + Path.DirectorySeparatorChar, filePath)); } /// /// Path to a directory where add-ins can store private configuration or status data /// public string PrivateDataPath { get { if (privatePath == null) { privatePath = ainfo.PrivateDataPath; if (!Directory.Exists (privatePath)) Directory.CreateDirectory (privatePath); } return privatePath; } } /// /// Gets the content of a resource /// /// /// Name of the resource /// /// /// Content of the resource, or null if not found /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public Stream GetResource (string resourceName) { return GetResource (resourceName, false); } /// /// Gets the content of a resource /// /// /// Name of the resource /// /// /// When set to true, an exception will be thrown if the resource is not found. /// /// /// Content of the resource. /// /// /// The add-in engine will look for resources in the main add-in assembly and in all included add-in assemblies. /// public Stream GetResource (string resourceName, bool throwIfNotFound) { EnsureAssembliesLoaded (); // Look in the addin assemblies foreach (Assembly asm in GetAllAssemblies ()) { Stream res = asm.GetManifestResourceStream (resourceName); if (res != null) return res; } // Look in the dependent add-ins foreach (RuntimeAddin addin in GetAllDependencies ()) { Stream res = addin.GetResource (resourceName); if (res != null) return res; } if (throwIfNotFound) throw new InvalidOperationException ("Resource '" + resourceName + "' not found in add-in '" + id + "'"); return null; } /// /// Localizer which can be used to localize strings defined in this add-in /// public AddinLocalizer Localizer { get { if (localizer != null) return localizer; else return addinEngine.DefaultLocalizer; } } internal RuntimeAddin GetModule (ModuleDescription module) { // If requesting the root module, return this if (module == module.ParentAddinDescription.MainModule) return this; if (module.RuntimeAddin != null) return module.RuntimeAddin; RuntimeAddin addin = new RuntimeAddin (addinEngine, this, module); return addin; } internal AddinDescription Load (Addin iad) { ainfo = iad; AddinDescription description = iad.Description; id = description.AddinId; baseDirectory = description.BasePath; module = description.MainModule; module.RuntimeAddin = this; if (description.Localizer != null) { string cls = description.Localizer.GetAttribute ("type"); // First try getting one of the stock localizers. If none of found try getting the type. object fob = null; Type t = Type.GetType ("Mono.Addins.Localization." + cls + "Localizer, " + GetType().Assembly.FullName, false); if (t != null) fob = Activator.CreateInstance (t); if (fob == null) fob = CreateInstance (cls, true); IAddinLocalizerFactory factory = fob as IAddinLocalizerFactory; if (factory == null) throw new InvalidOperationException ("Localizer factory type '" + cls + "' must implement IAddinLocalizerFactory"); localizer = new AddinLocalizer (factory.CreateLocalizer (this, description.Localizer)); } return description; } RuntimeAddin[] GetDepAddins () { if (depAddins != null) return depAddins; ArrayList plugList = new ArrayList (); string ns = ainfo.Description.Namespace; // Collect dependent ids foreach (Dependency dep in module.Dependencies) { AddinDependency pdep = dep as AddinDependency; if (pdep != null) { RuntimeAddin adn = addinEngine.GetAddin (Addin.GetFullId (ns, pdep.AddinId, pdep.Version)); if (adn != null) plugList.Add (adn); else addinEngine.ReportError ("Add-in dependency not loaded: " + pdep.FullAddinId, module.ParentAddinDescription.AddinId, null, false); } } return depAddins = (RuntimeAddin[]) plugList.ToArray (typeof(RuntimeAddin)); } void LoadModule (ModuleDescription module, ArrayList asmList) { // Load the assemblies foreach (string s in module.Assemblies) { Assembly asm = null; // don't load the assembly if it's already loaded string asmPath = Path.Combine (baseDirectory, s); foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) { // Sorry, you can't load addins from // dynamic assemblies as get_Location // throws a NotSupportedException if (a is System.Reflection.Emit.AssemblyBuilder || a.IsDynamic) { continue; } try { if (a.Location == asmPath) { asm = a; break; } } catch (NotSupportedException) { // Some assemblies don't have a location } } if (asm == null) { asm = Assembly.LoadFrom (asmPath); } asmList.Add (asm); } } internal void UnloadExtensions () { addinEngine.UnregisterAddinNodeSets (id); } bool CheckAddinDependencies (ModuleDescription module, bool forceLoadAssemblies) { foreach (Dependency dep in module.Dependencies) { AddinDependency pdep = dep as AddinDependency; if (pdep == null) continue; if (!addinEngine.IsAddinLoaded (pdep.FullAddinId)) return false; if (forceLoadAssemblies) addinEngine.GetAddin (pdep.FullAddinId).EnsureAssembliesLoaded (); } return true; } internal bool AssembliesLoaded { get { return assemblies != null; } } void EnsureAssembliesLoaded () { if (assemblies != null) return; ArrayList asmList = new ArrayList (); // Load the assemblies of the module CheckAddinDependencies (module, true); LoadModule (module, asmList); assemblies = (Assembly[]) asmList.ToArray (typeof(Assembly)); addinEngine.RegisterAssemblies (this); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/Addin.cs0000664000175000017500000002452712136523632023411 0ustar00directhexdirecthex00000000000000// // Addin.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2005 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Collections.Specialized; using Mono.Addins.Description; using Mono.Addins.Database; using System.Linq; namespace Mono.Addins { /// /// An add-in. /// public class Addin { AddinInfo addin; string configFile; string sourceFile; WeakReference desc; AddinDatabase database; bool? isLatestVersion; bool? isUserAddin; string id; internal Addin (AddinDatabase database, string file) { this.database = database; configFile = file; } /// /// Full identifier of the add-in, including namespace and version. /// public string Id { get { if (configFile != null) { if (id == null) id = Path.GetFileNameWithoutExtension (configFile); return id; } return this.AddinInfo.Id; } } /// /// Namespace of the add-in. /// public string Namespace { get { return this.AddinInfo.Namespace; } } /// /// Identifier of the add-in (without namespace) /// public string LocalId { get { return this.AddinInfo.LocalId; } } /// /// Version of the add-in /// public string Version { get { return this.AddinInfo.Version; } } /// /// Display name of the add-in /// public string Name { get { return this.AddinInfo.Name; } } /// /// Custom properties specified in the add-in header /// public AddinPropertyCollection Properties { get { return this.AddinInfo.Properties; } } internal string PrivateDataPath { get { return Path.Combine (database.AddinPrivateDataPath, Path.GetFileNameWithoutExtension (Description.FileName)); } } /// /// Checks version compatibility. /// /// /// An add-in version. /// /// /// True if the provided version is compatible with this add-in. /// /// /// This method checks the CompatVersion property to know if the provided version is compatible with the version of this add-in. /// public bool SupportsVersion (string version) { return AddinInfo.SupportsVersion (version); } /// /// Returns a that represents the current . /// /// /// A that represents the current . /// public override string ToString () { return Id; } internal AddinInfo AddinInfo { get { if (addin == null) { try { addin = AddinInfo.ReadFromDescription (Description); } catch (Exception ex) { throw new InvalidOperationException ("Could not read add-in file: " + configFile, ex); } } return addin; } } /// /// Gets or sets the enabled status of the add-in. /// /// /// This property can be used to enable or disable an add-in. /// The enabled status of an add-in is stored in the add-in registry, /// so when an add-in is disabled, it will be disabled for all applications /// sharing the same registry. /// When an add-in is enabled or disabled, the extension points currently loaded /// in memory will be properly updated to include or exclude extensions from the add-in. /// public bool Enabled { get { if (!IsLatestVersion) return false; return AddinInfo.IsRoot ? true : database.IsAddinEnabled (Description.Domain, AddinInfo.Id, true); } set { if (value) database.EnableAddin (Description.Domain, AddinInfo.Id, true); else database.DisableAddin (Description.Domain, AddinInfo.Id); } } internal bool IsLatestVersion { get { if (isLatestVersion == null) { string id, version; Addin.GetIdParts (AddinInfo.Id, out id, out version); var addins = database.GetInstalledAddins (null, AddinSearchFlagsInternal.IncludeAll | AddinSearchFlagsInternal.LatestVersionsOnly); isLatestVersion = addins.Where (a => Addin.GetIdName (a.Id) == id && a.Version == version).Any (); } return isLatestVersion.Value; } set { isLatestVersion = value; } } /// /// Returns 'true' if the add-in is installed in the user's personal folder /// public bool IsUserAddin { get { if (isUserAddin == null) SetIsUserAddin (Description); return isUserAddin.Value; } } void SetIsUserAddin (AddinDescription adesc) { string installPath = database.Registry.DefaultAddinsFolder; if (installPath [installPath.Length - 1] != Path.DirectorySeparatorChar) installPath += Path.DirectorySeparatorChar; isUserAddin = adesc != null && Path.GetFullPath (adesc.AddinFile).StartsWith (installPath); } /// /// Path to the add-in file (it can be an assembly or a standalone XML manifest) /// public string AddinFile { get { if (sourceFile == null && addin == null) LoadAddinInfo (); return sourceFile; } } void LoadAddinInfo () { if (addin == null) { try { AddinDescription m = Description; sourceFile = m.AddinFile; addin = AddinInfo.ReadFromDescription (m); } catch (Exception ex) { throw new InvalidOperationException ("Could not read add-in file: " + configFile, ex); } } } /// /// Description of the add-in /// public AddinDescription Description { get { if (desc != null) { AddinDescription d = desc.Target as AddinDescription; if (d != null) return d; } AddinDescription m; database.ReadAddinDescription (new ConsoleProgressStatus (true), configFile, out m); if (m == null) { try { if (File.Exists (configFile)) { // The file is corrupted. Remove it. File.Delete (configFile); } } catch { // Ignore } throw new InvalidOperationException ("Could not read add-in description"); } if (addin == null) { addin = AddinInfo.ReadFromDescription (m); sourceFile = m.AddinFile; } SetIsUserAddin (m); if (!isUserAddin.Value) m.Flags |= AddinFlags.CantUninstall; desc = new WeakReference (m); return m; } } internal void ResetCachedData () { desc = null; addin = null; } /// /// Compares two add-in versions /// /// /// -1 if v1 is greater than v2, 0 if v1 == v2, 1 if v1 less than v2 /// /// /// A version /// /// /// A version /// public static int CompareVersions (string v1, string v2) { string[] a1 = v1.Split ('.'); string[] a2 = v2.Split ('.'); for (int n=0; n= a2.Length) return -1; if (a1[n].Length == 0) { if (a2[n].Length != 0) return 1; continue; } try { int n1 = int.Parse (a1[n]); int n2 = int.Parse (a2[n]); if (n1 < n2) return 1; else if (n1 > n2) return -1; } catch { return 1; } } if (a2.Length > a1.Length) return 1; return 0; } /// /// Returns the identifier of an add-in /// /// /// The full identifier. /// /// /// Namespace of the add-in /// /// /// Name of the add-in /// /// /// Version of the add-in /// public static string GetFullId (string ns, string id, string version) { string res; if (id.StartsWith ("::")) res = id.Substring (2); else if (ns != null && ns.Length > 0) res = ns + "." + id; else res = id; if (version != null && version.Length > 0) return res + "," + version; else return res; } /// /// Given a full add-in identifier, returns the namespace and name of the add-in (it removes the version number) /// /// /// Add-in identifier. /// public static string GetIdName (string addinId) { int i = addinId.IndexOf (','); if (i != -1) return addinId.Substring (0, i); else return addinId; } /// /// Given a full add-in identifier, returns the version the add-in /// /// /// The version. /// public static string GetIdVersion (string addinId) { int i = addinId.IndexOf (','); if (i != -1) return addinId.Substring (i + 1).Trim (); else return string.Empty; } /// /// Splits a full add-in identifier in name and version /// /// /// Add-in identifier. /// /// /// The resulting name /// /// /// The resulting version /// public static void GetIdParts (string addinId, out string name, out string version) { int i = addinId.IndexOf (','); if (i != -1) { name = addinId.Substring (0, i); version = addinId.Substring (i+1).Trim (); } else { name = addinId; version = string.Empty; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/TreeNodeCollection.cs0000664000175000017500000000423212136523632026102 0ustar00directhexdirecthex00000000000000// // TreeNodeCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins { class TreeNodeCollection: IEnumerable { ArrayList list; internal static TreeNodeCollection Empty = new TreeNodeCollection (null); public TreeNodeCollection (ArrayList list) { this.list = list; } public IEnumerator GetEnumerator () { if (list != null) return list.GetEnumerator (); else return Type.EmptyTypes.GetEnumerator (); } public TreeNode this [int n] { get { if (list != null) return (TreeNode) list [n]; else throw new System.IndexOutOfRangeException (); } } public int IndexOfNode (string id) { for (int n=0; n /// An add-in registry. /// /// /// An add-in registry is a data structure used by the add-in engine to locate add-ins to load. /// /// A registry can be configured to look for add-ins in several directories. However, add-ins /// copied to those directories won't be detected until an explicit add-in scan is requested. /// The registry can be updated by an application by calling Registry.Update(), or by a user by /// running the 'mautil' add-in setup tool. /// /// The registry has information about the location of every add-in and a timestamp of the last /// check, so the Update method will only scan new or modified add-ins. An application can /// add a call to Registry.Update() in the Main method to detect all new add-ins every time the /// app is started. /// /// Every add-in added to the registry is parsed and validated, and if there is any error it /// will be rejected. The registry is also in charge of scanning the add-in assemblies and look /// for extensions and other information declared using custom attributes. That information is /// merged with the manifest information (if there is one) to create a complete add-in /// description ready to be used at run-time. /// /// Mono.Addins allows sharing an add-in registry among several applications. In this context, /// all applications sharing the registry share the same extension point model, and it is /// possible to implement add-ins which extend several hosts. /// public class AddinRegistry: IDisposable { AddinDatabase database; StringCollection addinDirs; string basePath; string currentDomain; string startupDirectory; string addinsDir; string databaseDir; /// /// Initializes a new instance. /// /// /// Location of the add-in registry. /// /// /// Creates a new add-in registry located in the provided path. /// The add-in registry will look for add-ins in an 'addins' /// subdirectory of the provided registryPath. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public AddinRegistry (string registryPath): this (null, registryPath, null, null, null) { } /// /// Initializes a new instance. /// /// /// Location of the add-in registry. /// /// /// Location of the application. /// /// /// Creates a new add-in registry located in the provided path. /// The add-in registry will look for add-ins in an 'addins' /// subdirectory of the provided registryPath. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public AddinRegistry (string registryPath, string startupDirectory): this (null, registryPath, startupDirectory, null, null) { } /// /// Initializes a new instance of the class. /// /// /// Location of the add-in registry. /// /// /// Location of the application. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// Creates a new add-in registry located in the provided path. /// Configuration information about the add-in registry will be stored in /// 'registryPath'. The add-in registry will look for add-ins in the provided /// 'addinsDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public AddinRegistry (string registryPath, string startupDirectory, string addinsDir): this (null, registryPath, startupDirectory, addinsDir, null) { } /// /// Initializes a new instance of the class. /// /// /// Location of the add-in registry. /// /// /// Location of the application. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// Location of the add-in database. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// Creates a new add-in registry located in the provided path. /// Configuration information about the add-in registry will be stored in /// 'registryPath'. The add-in registry will look for add-ins in the provided /// 'addinsDir' directory. Cached information about add-ins will be stored in /// the 'databaseDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public AddinRegistry (string registryPath, string startupDirectory, string addinsDir, string databaseDir): this (null, registryPath, startupDirectory, addinsDir, databaseDir) { } internal AddinRegistry (AddinEngine engine, string registryPath, string startupDirectory, string addinsDir, string databaseDir) { basePath = Path.GetFullPath (Util.NormalizePath (registryPath)); if (addinsDir != null) { addinsDir = Util.NormalizePath (addinsDir); if (Path.IsPathRooted (addinsDir)) this.addinsDir = Path.GetFullPath (addinsDir); else this.addinsDir = Path.GetFullPath (Path.Combine (basePath, addinsDir)); } else this.addinsDir = Path.Combine (basePath, "addins"); if (databaseDir != null) { databaseDir = Util.NormalizePath (databaseDir); if (Path.IsPathRooted (databaseDir)) this.databaseDir = Path.GetFullPath (databaseDir); else this.databaseDir = Path.GetFullPath (Path.Combine (basePath, databaseDir)); } else this.databaseDir = Path.GetFullPath (basePath); // Look for add-ins in the hosts directory and in the default // addins directory addinDirs = new StringCollection (); addinDirs.Add (DefaultAddinsFolder); // Initialize the database after all paths have been set database = new AddinDatabase (engine, this); // Get the domain corresponding to the startup folder if (startupDirectory != null && startupDirectory.Length > 0) { this.startupDirectory = Util.NormalizePath (startupDirectory); currentDomain = database.GetFolderDomain (null, this.startupDirectory); } else currentDomain = AddinDatabase.GlobalDomain; } /// /// Gets the global registry. /// /// /// The global registry /// /// /// The global add-in registry is created in "~/.config/mono.addins", /// and it is the default registry used when none is specified. /// public static AddinRegistry GetGlobalRegistry () { return GetGlobalRegistry (null, null); } internal static AddinRegistry GetGlobalRegistry (AddinEngine engine, string startupDirectory) { AddinRegistry reg = new AddinRegistry (engine, GlobalRegistryPath, startupDirectory, null, null); string baseDir; if (Util.IsWindows) baseDir = Environment.GetFolderPath (Environment.SpecialFolder.CommonProgramFiles); else baseDir = "/etc"; reg.GlobalAddinDirectories.Add (Path.Combine (baseDir, "mono.addins")); return reg; } internal bool UnknownDomain { get { return currentDomain == AddinDatabase.UnknownDomain; } } internal static string GlobalRegistryPath { get { string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_GLOBAL_REGISTRY"); if (customDir != null && customDir.Length > 0) return Path.GetFullPath (Util.NormalizePath (customDir)); string path = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); path = Path.Combine (path, "mono.addins"); return Path.GetFullPath (path); } } internal string CurrentDomain { get { return currentDomain; } } /// /// Location of the add-in registry. /// public string RegistryPath { get { return basePath; } } /// /// Disposes the add-in engine. /// public void Dispose () { database.Shutdown (); } /// /// Returns an add-in from the registry. /// /// /// Identifier of the add-in. /// /// /// The add-in, or 'null' if not found. /// /// /// The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2" /// public Addin GetAddin (string id) { if (currentDomain == AddinDatabase.UnknownDomain) return null; Addin ad = database.GetInstalledAddin (currentDomain, id); if (ad != null && IsRegisteredForUninstall (ad.Id)) return null; return ad; } /// /// Returns an add-in from the registry. /// /// /// Identifier of the add-in. /// /// /// 'true' if the exact add-in version must be found. /// /// /// The add-in, or 'null' if not found. /// /// /// The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2". /// In this case, if the exact version is not found and exactVersionMatch is 'false', it will /// return one than is compatible with the required version. /// public Addin GetAddin (string id, bool exactVersionMatch) { if (currentDomain == AddinDatabase.UnknownDomain) return null; Addin ad = database.GetInstalledAddin (currentDomain, id, exactVersionMatch); if (ad != null && IsRegisteredForUninstall (ad.Id)) return null; return ad; } /// /// Gets all add-ins or add-in roots registered in the registry. /// /// /// The addins. /// /// /// Flags. /// public Addin[] GetModules (AddinSearchFlags flags) { if (currentDomain == AddinDatabase.UnknownDomain) return new Addin [0]; AddinSearchFlagsInternal f = (AddinSearchFlagsInternal)(int)flags; return database.GetInstalledAddins (currentDomain, f | AddinSearchFlagsInternal.ExcludePendingUninstall).ToArray (); } /// /// Gets all add-ins registered in the registry. /// /// /// Add-ins registered in the registry. /// public Addin[] GetAddins () { return GetModules (AddinSearchFlags.IncludeAddins); } /// /// Gets all add-in roots registered in the registry. /// /// /// Descriptions of all add-in roots. /// public Addin[] GetAddinRoots () { return GetModules (AddinSearchFlags.IncludeRoots); } /// /// Loads an add-in description /// /// /// Progress tracker. /// /// /// Name of the file to load /// /// /// An add-in description /// /// /// This method loads an add-in description from a file. The file can be an XML manifest or an /// assembly that implements an add-in. /// public AddinDescription GetAddinDescription (IProgressStatus progressStatus, string file) { if (currentDomain == AddinDatabase.UnknownDomain) return null; string outFile = Path.GetTempFileName (); try { database.ParseAddin (progressStatus, currentDomain, file, outFile, false); } catch { File.Delete (outFile); throw; } try { AddinDescription desc = AddinDescription.Read (outFile); if (desc != null) { desc.AddinFile = file; desc.OwnerDatabase = database; } return desc; } catch { // Errors are already reported using the progress status object return null; } finally { File.Delete (outFile); } } /// /// Reads an XML add-in manifest /// /// /// Path to the XML file /// /// /// An add-in description /// public AddinDescription ReadAddinManifestFile (string file) { AddinDescription desc = AddinDescription.Read (file); if (currentDomain != AddinDatabase.UnknownDomain) { desc.OwnerDatabase = database; desc.Domain = currentDomain; } return desc; } /// /// Reads an XML add-in manifest /// /// /// Reader that contains the XML /// /// /// Base path to use to discover add-in files /// /// /// An add-in description /// public AddinDescription ReadAddinManifestFile (TextReader reader, string baseFile) { if (currentDomain == AddinDatabase.UnknownDomain) return null; AddinDescription desc = AddinDescription.Read (reader, baseFile); desc.OwnerDatabase = database; desc.Domain = currentDomain; return desc; } /// /// Checks whether an add-in is enabled. /// /// /// Identifier of the add-in. /// /// /// 'true' if the add-in is enabled. /// public bool IsAddinEnabled (string id) { if (currentDomain == AddinDatabase.UnknownDomain) return false; return database.IsAddinEnabled (currentDomain, id); } /// /// Enables an add-in. /// /// /// Identifier of the add-in /// /// /// If the enabled add-in depends on other add-ins which are disabled, /// those will automatically be enabled too. /// public void EnableAddin (string id) { if (currentDomain == AddinDatabase.UnknownDomain) return; database.EnableAddin (currentDomain, id, true); } /// /// Disables an add-in. /// /// /// Identifier of the add-in. /// /// /// When an add-in is disabled, all extension points it defines will be ignored /// by the add-in engine. Other add-ins which depend on the disabled add-in will /// also automatically be disabled. /// public void DisableAddin (string id) { if (currentDomain == AddinDatabase.UnknownDomain) return; database.DisableAddin (currentDomain, id); } /// /// Registers a set of add-ins for uninstallation. /// /// /// Identifier of the add-in /// /// /// Files to be uninstalled /// /// /// This method can be used to instruct the add-in manager to uninstall /// an add-in the next time the registry is updated. This is useful /// when an add-in manager can't delete an add-in because if it is /// loaded. /// public void RegisterForUninstall (string id, IEnumerable files) { database.RegisterForUninstall (currentDomain, id, files); } /// /// Determines whether an add-in is registered for uninstallation /// /// /// true if the add-in is registered for uninstallation /// /// /// Identifier of the add-in /// public bool IsRegisteredForUninstall (string addinId) { return database.IsRegisteredForUninstall (currentDomain, addinId); } /// /// Gets a value indicating whether there are pending add-ins to be uninstalled installed /// public bool HasPendingUninstalls { get { return database.HasPendingUninstalls (currentDomain); } } /// /// Internal use only /// public void DumpFile (string file) { Mono.Addins.Serialization.BinaryXmlReader.DumpFile (file); } /// /// Resets the configuration files of the registry /// public void ResetConfiguration () { database.ResetConfiguration (); } internal void NotifyDatabaseUpdated () { if (startupDirectory != null) currentDomain = database.GetFolderDomain (null, startupDirectory); } /// /// Updates the add-in registry. /// /// /// This method must be called after modifying, installing or uninstalling add-ins. /// /// When calling Update, every add-in added to the registry is parsed and validated, /// and if there is any error it will be rejected. It will also cache add-in information /// needed at run-time. /// /// If during the update operation the registry finds new add-ins or detects that some /// add-ins have been deleted, the loaded extension points will be updated to include /// or exclude extension nodes from those add-ins. /// public void Update () { Update (new ConsoleProgressStatus (false)); } /// /// Updates the add-in registry. /// /// /// Progress monitor to keep track of the update operation. /// /// /// This method must be called after modifying, installing or uninstalling add-ins. /// /// When calling Update, every add-in added to the registry is parsed and validated, /// and if there is any error it will be rejected. It will also cache add-in information /// needed at run-time. /// /// If during the update operation the registry finds new add-ins or detects that some /// add-ins have been deleted, the loaded extension points will be updated to include /// or exclude extension nodes from those add-ins. /// public void Update (IProgressStatus monitor) { database.Update (monitor, currentDomain); } /// /// Regenerates the cached data of the add-in registry. /// /// /// Progress monitor to keep track of the rebuild operation. /// public void Rebuild (IProgressStatus monitor) { database.Repair (monitor, currentDomain); } /// /// Registers an extension. Only AddinFileSystemExtension extensions are supported right now. /// /// /// The extension to register /// public void RegisterExtension (object extension) { database.RegisterExtension (extension); } /// /// Unregisters an extension. /// /// /// The extension to unregister /// public void UnregisterExtension (object extension) { database.UnregisterExtension (extension); } internal void CopyExtensionsFrom (AddinRegistry other) { database.CopyExtensions (other.database); } internal Addin GetAddinForHostAssembly (string filePath) { if (currentDomain == AddinDatabase.UnknownDomain) return null; return database.GetAddinForHostAssembly (currentDomain, filePath); } internal bool AddinDependsOn (string id1, string id2) { return database.AddinDependsOn (currentDomain, id1, id2); } internal void ScanFolders (IProgressStatus monitor, string folderToScan, StringCollection filesToIgnore) { database.ScanFolders (monitor, currentDomain, folderToScan, filesToIgnore); } internal void ParseAddin (IProgressStatus progressStatus, string file, string outFile) { database.ParseAddin (progressStatus, currentDomain, file, outFile, true); } /// /// Gets the default add-ins folder of the registry. /// /// /// For every add-in registry there is an add-in folder where the registry will look for add-ins by default. /// This folder is an "addins" subdirectory of the directory where the repository is located. In most cases, /// this folder will only contain .addins files referencing other more convenient locations for add-ins. /// public string DefaultAddinsFolder { get { return addinsDir; } } internal string AddinCachePath { get { return databaseDir; } } internal StringCollection GlobalAddinDirectories { get { return addinDirs; } } internal string StartupDirectory { get { return startupDirectory; } } internal bool CreateHostAddinsFile (string hostFile) { hostFile = Path.GetFullPath (hostFile); string baseName = Path.GetFileNameWithoutExtension (hostFile); if (!Directory.Exists (database.HostsPath)) Directory.CreateDirectory (database.HostsPath); foreach (string s in Directory.GetFiles (database.HostsPath, baseName + "*.addins")) { try { using (StreamReader sr = new StreamReader (s)) { XmlTextReader tr = new XmlTextReader (sr); tr.MoveToContent (); string host = tr.GetAttribute ("host-reference"); if (host == hostFile) return false; } } catch { // Ignore this file } } string file = Path.Combine (database.HostsPath, baseName) + ".addins"; int n=1; while (File.Exists (file)) { file = Path.Combine (database.HostsPath, baseName) + "_" + n + ".addins"; n++; } using (StreamWriter sw = new StreamWriter (file)) { XmlTextWriter tw = new XmlTextWriter (sw); tw.Formatting = Formatting.Indented; tw.WriteStartElement ("Addins"); tw.WriteAttributeString ("host-reference", hostFile); tw.WriteStartElement ("Directory"); tw.WriteAttributeString ("shared", "false"); tw.WriteString (Path.GetDirectoryName (hostFile)); tw.WriteEndElement (); tw.Close (); } return true; } #pragma warning disable 1591 [Obsolete] public static string[] GetRegisteredStartupFolders (string registryPath) { string dbDir = Path.Combine (registryPath, "addin-db-" + AddinDatabase.VersionTag); dbDir = Path.Combine (dbDir, "hosts"); if (!Directory.Exists (dbDir)) return new string [0]; ArrayList dirs = new ArrayList (); foreach (string s in Directory.GetFiles (dbDir, "*.addins")) { try { using (StreamReader sr = new StreamReader (s)) { XmlTextReader tr = new XmlTextReader (sr); tr.MoveToContent (); string host = tr.GetAttribute ("host-reference"); host = Path.GetDirectoryName (host); if (!dirs.Contains (host)) dirs.Add (host); } } catch { // Ignore this file } } return (string[]) dirs.ToArray (typeof(string)); } #pragma warning restore 1591 } /// /// Addin search flags. /// [Flags] public enum AddinSearchFlags { /// /// Add-ins are included in the search /// IncludeAddins = 1, /// /// Add-in roots are included in the search /// IncludeRoots = 1 << 1, /// /// Both add-in and add-in roots are included in the search /// IncludeAll = IncludeAddins | IncludeRoots, /// /// Only the latest version of every add-in or add-in root is included in the search /// LatestVersionsOnly = 1 << 3 } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionPointAttribute.cs0000664000175000017500000001170412136523632027235 0ustar00directhexdirecthex00000000000000// // ExtensionPointAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Declares an extension point. /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)] public class ExtensionPointAttribute: Attribute { string path; Type nodeType; string nodeName; string desc; string name; Type objectType; string nodeTypeName; string objectTypeName; Type customAttributeType; string customAttributeTypeName; /// /// Initializes a new instance /// public ExtensionPointAttribute () { } /// /// Initializes a new instance /// /// /// Extension path that identifies the extension point /// public ExtensionPointAttribute (string path) { this.path = path; } /// /// Initializes a new instance /// /// /// Extension path that identifies the extension point /// /// /// Type of the extension node to be created for extensions /// public ExtensionPointAttribute (string path, Type nodeType) { this.path = path; this.nodeType = nodeType; } /// /// Initializes a new instance /// /// /// Extension path that identifies the extension point /// /// /// Element name to be used when defining an extension in an XML manifest. /// /// /// Type of the extension node to be created for extensions /// public ExtensionPointAttribute (string path, string nodeName, Type nodeType) { this.path = path; this.nodeType = nodeType; this.nodeName = nodeName; } /// /// Extension path that identifies the extension point /// public string Path { get { return path != null ? path : string.Empty; } set { path = value; } } /// /// Long description of the extension point. /// public string Description { get { return desc != null ? desc : string.Empty; } set { desc = value; } } /// /// Type of the extension node to be created for extensions /// public Type NodeType { get { return nodeType != null ? nodeType : typeof(TypeExtensionNode); } set { nodeType = value; nodeTypeName = value.FullName; } } /// /// Expected extension object type (when nodes are of type TypeExtensionNode) /// public Type ObjectType { get { return objectType; } set { objectType = value; objectTypeName = value.FullName; } } internal string NodeTypeName { get { return nodeTypeName != null ? nodeTypeName : typeof(TypeExtensionNode).FullName; } set { nodeTypeName = value; } } internal string ObjectTypeName { get { return objectTypeName; } set { objectTypeName = value; } } /// /// Element name to be used when defining an extension in an XML manifest. The default name is "Type". /// public string NodeName { get { return nodeName != null && nodeName.Length > 0 ? nodeName : string.Empty; } set { nodeName = value; } } /// /// Display name of the extension point. /// public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } /// /// Type of the custom attribute to be used to specify metadata for the extension point /// public Type ExtensionAttributeType { get { return this.customAttributeType; } set { this.customAttributeType = value; customAttributeTypeName = value.FullName; } } internal string ExtensionAttributeTypeName { get { return this.customAttributeTypeName; } set { this.customAttributeTypeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/TreeNode.cs0000664000175000017500000002145612136523632024075 0ustar00directhexdirecthex00000000000000// // TreeNode.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using System.Collections; using Mono.Addins.Description; namespace Mono.Addins { class TreeNode { ArrayList childrenList; TreeNodeCollection children; ExtensionNode extensionNode; bool childrenLoaded; string id; TreeNode parent; ExtensionNodeSet nodeTypes; ExtensionPoint extensionPoint; BaseCondition condition; protected AddinEngine addinEngine; public TreeNode (AddinEngine addinEngine, string id) { this.id = id; this.addinEngine = addinEngine; // Root node if (id.Length == 0) childrenLoaded = true; } public AddinEngine AddinEngine { get { return addinEngine; } } internal void AttachExtensionNode (ExtensionNode enode) { this.extensionNode = enode; if (extensionNode != null) extensionNode.SetTreeNode (this); } public string Id { get { return id; } } public ExtensionNode ExtensionNode { get { if (extensionNode == null && extensionPoint != null) { extensionNode = new ExtensionNode (); extensionNode.SetData (addinEngine, extensionPoint.RootAddin, null, null); AttachExtensionNode (extensionNode); } return extensionNode; } } public ExtensionPoint ExtensionPoint { get { return extensionPoint; } set { extensionPoint = value; } } public ExtensionNodeSet ExtensionNodeSet { get { return nodeTypes; } set { nodeTypes = value; } } public TreeNode Parent { get { return parent; } } public BaseCondition Condition { get { return condition; } set { condition = value; } } public virtual ExtensionContext Context { get { if (parent != null) return parent.Context; else return null; } } public bool IsEnabled { get { if (condition == null) return true; ExtensionContext ctx = Context; if (ctx == null) return true; else return condition.Evaluate (ctx); } } public bool ChildrenLoaded { get { return childrenLoaded; } } public void AddChildNode (TreeNode node) { node.parent = this; if (childrenList == null) childrenList = new ArrayList (); childrenList.Add (node); } public void InsertChildNode (int n, TreeNode node) { node.parent = this; if (childrenList == null) childrenList = new ArrayList (); childrenList.Insert (n, node); // Dont call NotifyChildrenChanged here. It is called by ExtensionTree, // after inserting all children of the node. } internal int ChildCount { get { return childrenList == null ? 0 : childrenList.Count; } } public ExtensionNode GetExtensionNode (string path, string childId) { TreeNode node = GetNode (path, childId); return node != null ? node.ExtensionNode : null; } public ExtensionNode GetExtensionNode (string path) { TreeNode node = GetNode (path); return node != null ? node.ExtensionNode : null; } public TreeNode GetNode (string path, string childId) { if (childId == null || childId.Length == 0) return GetNode (path); else return GetNode (path + "/" + childId); } public TreeNode GetNode (string path) { return GetNode (path, false); } public TreeNode GetNode (string path, bool buildPath) { if (path.StartsWith ("/")) path = path.Substring (1); string[] parts = path.Split ('/'); TreeNode curNode = this; foreach (string part in parts) { int i = curNode.Children.IndexOfNode (part); if (i != -1) { curNode = curNode.Children [i]; continue; } if (buildPath) { TreeNode newNode = new TreeNode (addinEngine, part); curNode.AddChildNode (newNode); curNode = newNode; } else return null; } return curNode; } public TreeNodeCollection Children { get { if (!childrenLoaded) { childrenLoaded = true; if (extensionPoint != null) Context.LoadExtensions (GetPath ()); // We have to keep the relation info, since add-ins may be loaded/unloaded } if (childrenList == null) return TreeNodeCollection.Empty; if (children == null) children = new TreeNodeCollection (childrenList); return children; } } public string GetPath () { int num=0; TreeNode node = this; while (node != null) { num++; node = node.parent; } string[] ids = new string [num]; node = this; while (node != null) { ids [--num] = node.id; node = node.parent; } return string.Join ("/", ids); } public void NotifyAddinLoaded (RuntimeAddin ad, bool recursive) { if (extensionNode != null && extensionNode.AddinId == ad.Addin.Id) extensionNode.OnAddinLoaded (); if (recursive && childrenLoaded) { foreach (TreeNode node in Children.Clone ()) node.NotifyAddinLoaded (ad, true); } } public ExtensionPoint FindLoadedExtensionPoint (string path) { if (path.StartsWith ("/")) path = path.Substring (1); string[] parts = path.Split ('/'); TreeNode curNode = this; foreach (string part in parts) { int i = curNode.Children.IndexOfNode (part); if (i != -1) { curNode = curNode.Children [i]; if (!curNode.ChildrenLoaded) return null; if (curNode.ExtensionPoint != null) return curNode.ExtensionPoint; continue; } return null; } return null; } public void FindAddinNodes (string id, ArrayList nodes) { if (id != null && extensionPoint != null && extensionPoint.RootAddin == id) { // It is an extension point created by the add-in. All nodes below this // extension point will be added to the list, even if they come from other add-ins. id = null; } if (childrenLoaded) { // Deep-first search, to make sure children are removed before the parent. foreach (TreeNode node in Children) node.FindAddinNodes (id, nodes); } if (id == null || (ExtensionNode != null && ExtensionNode.AddinId == id)) nodes.Add (this); } public bool FindExtensionPathByType (IProgressStatus monitor, Type type, string nodeName, out string path, out string pathNodeName) { if (extensionPoint != null) { foreach (ExtensionNodeType nt in extensionPoint.NodeSet.NodeTypes) { if (nt.ObjectTypeName.Length > 0 && (nodeName.Length == 0 || nodeName == nt.Id)) { RuntimeAddin addin = addinEngine.GetAddin (extensionPoint.RootAddin); Type ot = addin.GetType (nt.ObjectTypeName); if (ot != null) { if (ot.IsAssignableFrom (type)) { path = extensionPoint.Path; pathNodeName = nt.Id; return true; } } else monitor.ReportError ("Type '" + nt.ObjectTypeName + "' not found in add-in '" + Id + "'", null); } } } else { foreach (TreeNode node in Children) { if (node.FindExtensionPathByType (monitor, type, nodeName, out path, out pathNodeName)) return true; } } path = null; pathNodeName = null; return false; } public void Remove () { if (parent != null) { if (Condition != null) Context.UnregisterNodeCondition (this, Condition); parent.childrenList.Remove (this); parent.NotifyChildrenChanged (); } } public bool NotifyChildrenChanged () { if (extensionNode != null) return extensionNode.NotifyChildChanged (); else return false; } public void ResetCachedData () { if (extensionPoint != null) { string aid = Addin.GetIdName (extensionPoint.ParentAddinDescription.AddinId); RuntimeAddin ad = addinEngine.GetAddin (aid); if (ad != null) extensionPoint = ad.Addin.Description.ExtensionPoints [GetPath ()]; } if (childrenList != null) { foreach (TreeNode cn in childrenList) cn.ResetCachedData (); } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/IProgressStatus.cs0000664000175000017500000000636712136523632025515 0ustar00directhexdirecthex00000000000000// // IProgressStatus.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Progress status listener. /// public interface IProgressStatus { /// /// Sets the description of the current operation. /// /// /// A message /// /// /// This method is called by the add-in engine to show a description of the operation being monitorized. /// void SetMessage (string msg); /// /// Sets the progress of the operation. /// /// /// A number between 0 and 1. 0 means no progress, 1 means operation completed. /// /// /// This method is called by the add-in engine to show the progress of the operation being monitorized. /// void SetProgress (double progress); /// /// Writes text to the log. /// /// /// Message to write /// void Log (string msg); /// /// Log level requested by the user: 0: no log, 1: normal log, >1 verbose log /// int LogLevel { get; } /// /// Reports a warning. /// /// /// Warning message /// /// /// This method is called by the add-in engine to report a warning in the operation being monitorized. /// void ReportWarning (string message); /// /// Reports an error. /// /// /// Error message /// /// /// Exception that caused the error. It can be null. /// /// /// This method is called by the add-in engine to report an error occurred while executing the operation being monitorized. /// void ReportError (string message, Exception exception); /// /// Returns True when the user requested to cancel this operation /// bool IsCanceled { get; } /// /// Cancels the operation being montorized. /// void Cancel (); } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinLocalizer.cs0000664000175000017500000001246712136523632025256 0ustar00directhexdirecthex00000000000000// // AddinLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Addins.Localization; namespace Mono.Addins { /// /// Converts message identifiers to localized messages. /// public class AddinLocalizer { IAddinLocalizer localizer; IPluralAddinLocalizer pluralLocalizer; internal AddinLocalizer (IAddinLocalizer localizer) { this.localizer = localizer; pluralLocalizer = localizer as IPluralAddinLocalizer; } /// /// Gets a localized message /// /// /// Message identifier /// /// /// The localized message /// public string GetString (string msgid) { return localizer.GetString (msgid); } /// /// Gets a formatted and localized message /// /// /// Message identifier (can contain string format placeholders) /// /// /// Arguments for the string format operation /// /// /// The formatted and localized string /// public string GetString (string msgid, params string[] args) { return string.Format (localizer.GetString (msgid), args); } /// /// Gets a formatted and localized message /// /// /// Message identifier (can contain string format placeholders) /// /// /// Arguments for the string format operation /// /// /// The formatted and localized string /// public string GetString (string msgid, params object[] args) { return string.Format (localizer.GetString (msgid), args); } /// /// Gets a localized plural form for a message identifier /// /// /// Message identifier for the singular form /// /// /// Default result message for the plural form /// /// /// Value count. Determines wether to use singular or plural form. /// /// /// The localized message /// public string GetPluralString (string msgid, string defaultPlural, int n) { // If the localizer does not support plural forms, just use GetString to // get a translation. It is not correct to check 'n' in this case because // there is no guarantee that 'defaultPlural' will be translated. if (pluralLocalizer != null) return pluralLocalizer.GetPluralString (msgid, defaultPlural, n); else return GetString (msgid); } /// /// Gets a localized and formatted plural form for a message identifier /// /// /// Message identifier for the singular form (can contain string format placeholders) /// /// /// Default result message for the plural form (can contain string format placeholders) /// /// /// Value count. Determines whether to use singular or plural form. /// /// /// Arguments for the string format operation /// /// /// The localized message /// public string GetPluralString (string singular, string defaultPlural, int n, params string[] args) { return string.Format (GetPluralString (singular, defaultPlural, n), args); } /// /// Gets a localized and formatted plural form for a message identifier /// /// /// Message identifier for the singular form (can contain string format placeholders) /// /// /// Default result message for the plural form (can contain string format placeholders) /// /// /// Value count. Determines whether to use singular or plural form. /// /// /// Arguments for the string format operation /// /// /// The localized message /// public string GetPluralString (string singular, string defaultPlural, int n, params object[] args) { return string.Format (GetPluralString (singular, defaultPlural, n), args); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ContentType.cs0000664000175000017500000000314312136523632024635 0ustar00directhexdirecthex00000000000000// // ContentType.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Type of the content of a string extension node attribute /// public enum ContentType { /// /// Plain text /// Text, /// /// A class name /// Class, /// /// A resource name /// Resource, /// /// A file name /// File } } mono-addins-1.0/Mono.Addins/Mono.Addins/TypeExtensionNode.cs0000664000175000017500000001115212136523632026004 0ustar00directhexdirecthex00000000000000// // TypeExtensionNode.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; namespace Mono.Addins { /// /// An extension node which specifies a type. /// /// /// This class is a kind of Mono.Addins.ExtensionNode which can be used to register /// types in an extension point. This is a very common case: a host application /// defines an interface, and add-ins create classes that implement that interface. /// The host will define an extension point which will use TypeExtensionNode as node /// type. Add-ins will register the classes they implement in that extension point. /// /// When the nodes of an extension point are of type TypeExtensionNode it is then /// possible to use query methods such as AddinManager.GetExtensionObjects(string), /// which will get all nodes in the provided extension path and will create an object /// for each node. /// /// When declaring extension nodes in an add-in manifest, the class names can be /// specified using the 'class' or 'type' attribute. If none of those attributes is /// provided, the class name will be taken from the 'id' attribute. /// /// TypeExtensionNode is the default extension type used when no type is provided /// in the definition of an extension point. /// [ExtensionNode ("Type", Description="Specifies a class that will be used to create an extension object.")] [NodeAttribute ("class", typeof(Type), false, ContentType = ContentType.Class, Description="Name of the class. If a value is not provided, the class name will be taken from the 'id' attribute")] public class TypeExtensionNode: InstanceExtensionNode { string typeName; Type type; /// /// Reads the extension node data /// /// /// The element containing the extension data /// /// /// This method can be overriden to provide a custom method for reading extension node data from an element. /// The default implementation reads the attributes if the element and assigns the values to the fields /// and properties of the extension node that have the corresponding [NodeAttribute] decoration. /// internal protected override void Read (NodeElement elem) { base.Read (elem); typeName = elem.GetAttribute ("type"); if (typeName.Length == 0) typeName = elem.GetAttribute ("class"); if (typeName.Length == 0) typeName = elem.GetAttribute ("id"); } /// /// Creates a new extension object /// /// /// The extension object /// public override object CreateInstance () { return Activator.CreateInstance (Type); } /// /// Type of the object that this node creates /// public Type Type { get { if (type == null) { if (typeName.Length == 0) throw new InvalidOperationException ("Type name not specified."); type = Addin.GetType (typeName, true); } return type; } } } /// /// An extension node which specifies a type with custom extension metadata /// /// /// This is the default type for type extension nodes bound to a custom extension attribute. /// public class TypeExtensionNode: TypeExtensionNode where T:CustomExtensionAttribute { T data; /// /// The custom attribute containing the extension metadata /// [NodeAttribute] public T Data { get { return data; } internal set { data = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionNodeAttribute.cs0000664000175000017500000000635712136523632027041 0ustar00directhexdirecthex00000000000000// // ExtensionNodeAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// This attribute can be applied to an ExtensionNode subclass to specify the default name and description. /// /// /// This information will be used when an extension point does not define a name or description for a node type. /// [AttributeUsage (AttributeTargets.Class)] public class ExtensionNodeAttribute: Attribute { string nodeName; string description; string customAttributeTypeName; Type customAttributeType; /// /// Initializes the attribute /// public ExtensionNodeAttribute () { } /// /// Initializes the attribute /// /// /// Name of the node /// public ExtensionNodeAttribute (string nodeName) { this.nodeName = nodeName; } /// /// Initializes the attribute /// /// /// Name of the node /// /// /// Description of the node /// public ExtensionNodeAttribute (string nodeName, string description) { this.nodeName = nodeName; this.description = description; } /// /// Default name of the extension node /// public string NodeName { get { return nodeName != null ? nodeName : string.Empty; } set { nodeName = value; } } /// /// Default description of the extension node type /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } /// /// Type of a custom attribute which can be used to specify metadata for this extension node type /// public Type ExtensionAttributeType { get { return customAttributeType; } set { customAttributeType = value; customAttributeTypeName = value.FullName; } } internal string ExtensionAttributeTypeName { get { return customAttributeTypeName ?? string.Empty; } set { customAttributeTypeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ConditionType.cs0000664000175000017500000001347112136523632025156 0ustar00directhexdirecthex00000000000000// // ConditionType.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using Mono.Addins.Description; using System.Collections; namespace Mono.Addins { /// /// A condition evaluator. /// /// /// Add-ins may use conditions to register nodes in an extension point which /// are only visible under some contexts. For example, an add-in registering /// a custom menu option to the main menu of a sample text editor might want /// to make that option visible only for some kind of files. To allow add-ins /// to do this kind of check, the host application needs to define a new condition. /// public abstract class ConditionType { internal event EventHandler Changed; string id; /// /// Evaluates the condition. /// /// /// Condition node information. /// /// /// 'true' if the condition is satisfied. /// public abstract bool Evaluate (NodeElement conditionNode); /// /// Notifies that the condition has changed, and that it has to be re-evaluated. /// /// This method must be called when there is a change in the state that determines /// the result of the evaluation. When this method is called, all node conditions /// depending on it are reevaluated and the corresponding events for adding or /// removing extension nodes are fired. /// /// public void NotifyChanged () { if (Changed != null) Changed (this, EventArgs.Empty); } internal string Id { get { return id; } set { id = value; } } } internal class BaseCondition { BaseCondition parent; internal BaseCondition (BaseCondition parent) { this.parent = parent; } public virtual bool Evaluate (ExtensionContext ctx) { return parent == null || parent.Evaluate (ctx); } internal virtual void GetConditionTypes (ArrayList listToFill) { } } internal class NullCondition: BaseCondition { public NullCondition (): base (null) { } public override bool Evaluate (ExtensionContext ctx) { return false; } } class OrCondition: BaseCondition { BaseCondition[] conditions; public OrCondition (BaseCondition[] conditions, BaseCondition parent): base (parent) { this.conditions = conditions; } public override bool Evaluate (ExtensionContext ctx) { if (!base.Evaluate (ctx)) return false; foreach (BaseCondition cond in conditions) if (cond.Evaluate (ctx)) return true; return false; } internal override void GetConditionTypes (ArrayList listToFill) { foreach (BaseCondition cond in conditions) cond.GetConditionTypes (listToFill); } } class AndCondition: BaseCondition { BaseCondition[] conditions; public AndCondition (BaseCondition[] conditions, BaseCondition parent): base (parent) { this.conditions = conditions; } public override bool Evaluate (ExtensionContext ctx) { if (!base.Evaluate (ctx)) return false; foreach (BaseCondition cond in conditions) if (!cond.Evaluate (ctx)) return false; return true; } internal override void GetConditionTypes (ArrayList listToFill) { foreach (BaseCondition cond in conditions) cond.GetConditionTypes (listToFill); } } class NotCondition: BaseCondition { BaseCondition baseCond; public NotCondition (BaseCondition baseCond, BaseCondition parent): base (parent) { this.baseCond = baseCond; } public override bool Evaluate (ExtensionContext ctx) { return !base.Evaluate (ctx); } internal override void GetConditionTypes (System.Collections.ArrayList listToFill) { baseCond.GetConditionTypes (listToFill); } } internal sealed class Condition: BaseCondition { ExtensionNodeDescription node; string typeId; AddinEngine addinEngine; internal Condition (AddinEngine addinEngine, ExtensionNodeDescription element, BaseCondition parent): base (parent) { this.addinEngine = addinEngine; typeId = element.GetAttribute ("id"); node = element; } public override bool Evaluate (ExtensionContext ctx) { if (!base.Evaluate (ctx)) return false; ConditionType type = ctx.GetCondition (typeId); if (type == null) { addinEngine.ReportError ("Condition '" + typeId + "' not found in current extension context.", null, null, false); return false; } try { return type.Evaluate (node); } catch (Exception ex) { addinEngine.ReportError ("Error while evaluating condition '" + typeId + "'", null, ex, false); return false; } } internal override void GetConditionTypes (ArrayList listToFill) { listToFill.Add (typeId); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinInfo.cs0000664000175000017500000001250112136523632024212 0ustar00directhexdirecthex00000000000000// // AddinInfo.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Collections; using System.Xml; using System.Xml.Serialization; using Mono.Addins.Description; namespace Mono.Addins { internal class AddinInfo { string id = ""; string namspace = ""; string name = ""; string version = ""; string baseVersion = ""; string author = ""; string copyright = ""; string url = ""; string description = ""; string category = ""; bool defaultEnabled = true; bool isroot; DependencyCollection dependencies; DependencyCollection optionalDependencies; AddinPropertyCollection properties; private AddinInfo () { dependencies = new DependencyCollection (); optionalDependencies = new DependencyCollection (); } public string Id { get { return Addin.GetFullId (namspace, id, version); } } public string LocalId { get { return id; } set { id = value; } } public string Namespace { get { return namspace; } set { namspace = value; } } public bool IsRoot { get { return isroot; } set { isroot = value; } } public string Name { get { string s = Properties.GetPropertyValue ("Name"); if (s.Length > 0) return s; if (name != null && name.Length > 0) return name; string sid = id; if (sid.StartsWith ("__")) sid = sid.Substring (2); return Addin.GetFullId (namspace, sid, null); } set { name = value; } } public string Version { get { return version; } set { version = value; } } public string BaseVersion { get { return baseVersion; } set { baseVersion = value; } } public string Author { get { string s = Properties.GetPropertyValue ("Author"); if (s.Length > 0) return s; return author; } set { author = value; } } public string Copyright { get { string s = Properties.GetPropertyValue ("Copyright"); if (s.Length > 0) return s; return copyright; } set { copyright = value; } } public string Url { get { string s = Properties.GetPropertyValue ("Url"); if (s.Length > 0) return s; return url; } set { url = value; } } public string Description { get { string s = Properties.GetPropertyValue ("Description"); if (s.Length > 0) return s; return description; } set { description = value; } } public string Category { get { string s = Properties.GetPropertyValue ("Category"); if (s.Length > 0) return s; return category; } set { category = value; } } public bool EnabledByDefault { get { return defaultEnabled; } set { defaultEnabled = value; } } public DependencyCollection Dependencies { get { return dependencies; } } public DependencyCollection OptionalDependencies { get { return optionalDependencies; } } public AddinPropertyCollection Properties { get { return properties; } } internal static AddinInfo ReadFromDescription (AddinDescription description) { AddinInfo info = new AddinInfo (); info.id = description.LocalId; info.namspace = description.Namespace; info.name = description.Name; info.version = description.Version; info.author = description.Author; info.copyright = description.Copyright; info.url = description.Url; info.description = description.Description; info.category = description.Category; info.baseVersion = description.CompatVersion; info.isroot = description.IsRoot; info.defaultEnabled = description.EnabledByDefault; foreach (Dependency dep in description.MainModule.Dependencies) info.Dependencies.Add (dep); foreach (ModuleDescription mod in description.OptionalModules) { foreach (Dependency dep in mod.Dependencies) info.OptionalDependencies.Add (dep); } info.properties = description.Properties; return info; } public bool SupportsVersion (string version) { if (Addin.CompareVersions (Version, version) > 0) return false; if (baseVersion == "") return true; return Addin.CompareVersions (BaseVersion, version) >= 0; } public int CompareVersionTo (AddinInfo other) { return Addin.CompareVersions (this.version, other.Version); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinAttribute.cs0000664000175000017500000000736712136523632025300 0ustar00directhexdirecthex00000000000000// // AddinAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Addins.Description; namespace Mono.Addins { /// /// Marks an assembly as being an add-in. /// [AttributeUsage (AttributeTargets.Assembly)] public class AddinAttribute: Attribute { string id; string version; string ns; string category; bool enabledByDefault = true; AddinFlags flags; string compatVersion; string url; /// /// Initializes an add-in marker attribute /// public AddinAttribute () { } /// /// Initializes an add-in marker attribute /// /// /// Identifier of the add-in /// public AddinAttribute (string id) { this.id = id; } /// /// Initializes an add-in marker attribute /// /// /// Identifier of the add-in /// /// /// Version of the add-in /// public AddinAttribute (string id, string version) { this.id = id; this.version = version; } /// /// Identifier of the add-in. /// public string Id { get { return id != null ? id : string.Empty; } set { id = value; } } /// /// Version of the add-in. /// public string Version { get { return version != null ? version : string.Empty; } set { version = value; } } /// /// Version of the add-in with which this add-in is backwards compatible. /// public string CompatVersion { get { return compatVersion != null ? compatVersion : string.Empty; } set { compatVersion = value; } } /// /// Namespace of the add-in /// public string Namespace { get { return ns != null ? ns : string.Empty; } set { ns = value; } } /// /// Category of the add-in /// public string Category { get { return category != null ? category : string.Empty; } set { category = value; } } /// /// Url to a web page with more information about the add-in /// public string Url { get { return url != null ? url : string.Empty; } set { url = value; } } /// /// When set to True, the add-in will be automatically enabled after installing. /// It's True by default. /// public bool EnabledByDefault { get { return this.enabledByDefault; } set { this.enabledByDefault = value; } } /// /// Add-in flags /// public AddinFlags Flags { get { return this.flags; } set { this.flags = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinEventArgs.cs0000664000175000017500000000367112136523632025225 0ustar00directhexdirecthex00000000000000// // AddinEventArgs.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Delegate to be used in add-in engine events /// public delegate void AddinEventHandler (object sender, AddinEventArgs args); /// /// Provides information about an add-in engine event. /// public class AddinEventArgs: EventArgs { string addinId; /// /// Initializes a new instance of the class. /// /// /// Add-in identifier. /// public AddinEventArgs (string addinId) { this.addinId = addinId; } /// /// Identifier of the add-in that generated the event. /// public string AddinId { get { return addinId; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionTree.cs0000664000175000017500000002655012136523632025164 0ustar00directhexdirecthex00000000000000// // ExtensionTree.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Reflection; using System.Xml; using Mono.Addins.Description; using System.Collections.Generic; namespace Mono.Addins { internal class ExtensionTree: TreeNode { int internalId; internal const string AutoIdPrefix = "__nid_"; ExtensionContext context; public ExtensionTree (AddinEngine addinEngine, ExtensionContext context): base (addinEngine, "") { this.context = context; } public override ExtensionContext Context { get { return context; } } public void LoadExtension (string addin, Extension extension, ArrayList addedNodes) { TreeNode tnode = GetNode (extension.Path); if (tnode == null) { addinEngine.ReportError ("Can't load extensions for path '" + extension.Path + "'. Extension point not defined.", addin, null, false); return; } int curPos = tnode.ChildCount; LoadExtensionElement (tnode, addin, extension.ExtensionNodes, (ModuleDescription) extension.Parent, ref curPos, tnode.Condition, false, addedNodes); } void LoadExtensionElement (TreeNode tnode, string addin, ExtensionNodeDescriptionCollection extension, ModuleDescription module, ref int curPos, BaseCondition parentCondition, bool inComplextCondition, ArrayList addedNodes) { foreach (ExtensionNodeDescription elem in extension) { if (inComplextCondition) { parentCondition = ReadComplexCondition (elem, parentCondition); inComplextCondition = false; continue; } if (elem.NodeName == "ComplexCondition") { LoadExtensionElement (tnode, addin, elem.ChildNodes, module, ref curPos, parentCondition, true, addedNodes); continue; } if (elem.NodeName == "Condition") { Condition cond = new Condition (AddinEngine, elem, parentCondition); LoadExtensionElement (tnode, addin, elem.ChildNodes, module, ref curPos, cond, false, addedNodes); continue; } string after = elem.GetAttribute ("insertafter"); if (after.Length > 0) { int i = tnode.Children.IndexOfNode (after); if (i != -1) curPos = i+1; } string before = elem.GetAttribute ("insertbefore"); if (before.Length > 0) { int i = tnode.Children.IndexOfNode (before); if (i != -1) curPos = i; } // Find the type of the node in this extension ExtensionNodeType ntype = addinEngine.FindType (tnode.ExtensionNodeSet, elem.NodeName, addin); if (ntype == null) { addinEngine.ReportError ("Node '" + elem.NodeName + "' not allowed in extension: " + tnode.GetPath (), addin, null, false); continue; } string id = elem.GetAttribute ("id"); if (id.Length == 0) id = AutoIdPrefix + (++internalId); TreeNode cnode = new TreeNode (addinEngine, id); ExtensionNode enode = ReadNode (cnode, addin, ntype, elem, module); if (enode == null) continue; cnode.Condition = parentCondition; cnode.ExtensionNodeSet = ntype; tnode.InsertChildNode (curPos, cnode); addedNodes.Add (cnode); if (cnode.Condition != null) Context.RegisterNodeCondition (cnode, cnode.Condition); // Load children if (elem.ChildNodes.Count > 0) { int cp = 0; LoadExtensionElement (cnode, addin, elem.ChildNodes, module, ref cp, parentCondition, false, addedNodes); } curPos++; } if (Context.FireEvents) tnode.NotifyChildrenChanged (); } BaseCondition ReadComplexCondition (ExtensionNodeDescription elem, BaseCondition parentCondition) { if (elem.NodeName == "Or" || elem.NodeName == "And" || elem.NodeName == "Not") { ArrayList conds = new ArrayList (); foreach (ExtensionNodeDescription celem in elem.ChildNodes) { conds.Add (ReadComplexCondition (celem, null)); } if (elem.NodeName == "Or") return new OrCondition ((BaseCondition[]) conds.ToArray (typeof(BaseCondition)), parentCondition); else if (elem.NodeName == "And") return new AndCondition ((BaseCondition[]) conds.ToArray (typeof(BaseCondition)), parentCondition); else { if (conds.Count != 1) { addinEngine.ReportError ("Invalid complex condition element '" + elem.NodeName + "'. 'Not' condition can only have one parameter.", null, null, false); return new NullCondition (); } return new NotCondition ((BaseCondition) conds [0], parentCondition); } } if (elem.NodeName == "Condition") { return new Condition (AddinEngine, elem, parentCondition); } addinEngine.ReportError ("Invalid complex condition element '" + elem.NodeName + "'.", null, null, false); return new NullCondition (); } public ExtensionNode ReadNode (TreeNode tnode, string addin, ExtensionNodeType ntype, ExtensionNodeDescription elem, ModuleDescription module) { try { if (ntype.Type == null) { if (!InitializeNodeType (ntype)) return null; } ExtensionNode node; node = Activator.CreateInstance (ntype.Type) as ExtensionNode; if (node == null) { addinEngine.ReportError ("Extension node type '" + ntype.Type + "' must be a subclass of ExtensionNode", addin, null, false); return null; } tnode.AttachExtensionNode (node); node.SetData (addinEngine, addin, ntype, module); node.Read (elem); return node; } catch (Exception ex) { addinEngine.ReportError ("Could not read extension node of type '" + ntype.Type + "' from extension path '" + tnode.GetPath() + "'", addin, ex, false); return null; } } bool InitializeNodeType (ExtensionNodeType ntype) { RuntimeAddin p = addinEngine.GetAddin (ntype.AddinId); if (p == null) { if (!addinEngine.IsAddinLoaded (ntype.AddinId)) { if (!addinEngine.LoadAddin (null, ntype.AddinId, false)) return false; p = addinEngine.GetAddin (ntype.AddinId); if (p == null) { addinEngine.ReportError ("Add-in not found", ntype.AddinId, null, false); return false; } } } // If no type name is provided, use TypeExtensionNode by default if (ntype.TypeName == null || ntype.TypeName.Length == 0 || ntype.TypeName == typeof(TypeExtensionNode).FullName) { // If it has a custom attribute, use the generic version of TypeExtensionNode if (ntype.ExtensionAttributeTypeName.Length > 0) { Type attType = p.GetType (ntype.ExtensionAttributeTypeName, false); if (attType == null) { addinEngine.ReportError ("Custom attribute type '" + ntype.ExtensionAttributeTypeName + "' not found.", ntype.AddinId, null, false); return false; } if (ntype.ObjectTypeName.Length > 0) ntype.Type = typeof(TypeExtensionNode<>).MakeGenericType (attType); else ntype.Type = typeof(ExtensionNode<>).MakeGenericType (attType); } else { ntype.Type = typeof(TypeExtensionNode); return true; } } else { ntype.Type = p.GetType (ntype.TypeName, false); if (ntype.Type == null) { addinEngine.ReportError ("Extension node type '" + ntype.TypeName + "' not found.", ntype.AddinId, null, false); return false; } } // Check if the type has NodeAttribute attributes applied to fields. ExtensionNodeType.FieldData boundAttributeType = null; Dictionary fields = GetMembersMap (ntype.Type, out boundAttributeType); ntype.CustomAttributeMember = boundAttributeType; if (fields.Count > 0) ntype.Fields = fields; // If the node type is bound to a custom attribute and there is a member bound to that attribute, // get the member map for the attribute. if (boundAttributeType != null) { if (ntype.ExtensionAttributeTypeName.Length == 0) throw new InvalidOperationException ("Extension node not bound to a custom attribute."); if (ntype.ExtensionAttributeTypeName != boundAttributeType.MemberType.FullName) throw new InvalidOperationException ("Incorrect custom attribute type declaration in " + ntype.Type + ". Expected '" + ntype.ExtensionAttributeTypeName + "' found '" + boundAttributeType.MemberType.FullName + "'"); fields = GetMembersMap (boundAttributeType.MemberType, out boundAttributeType); if (fields.Count > 0) ntype.CustomAttributeFields = fields; } return true; } Dictionary GetMembersMap (Type type, out ExtensionNodeType.FieldData boundAttributeType) { string fname; Dictionary fields = new Dictionary (); boundAttributeType = null; while (type != typeof(object) && type != null) { foreach (FieldInfo field in type.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { NodeAttributeAttribute at = (NodeAttributeAttribute) Attribute.GetCustomAttribute (field, typeof(NodeAttributeAttribute), true); if (at != null) { ExtensionNodeType.FieldData fd = CreateFieldData (field, at, out fname, ref boundAttributeType); if (fd != null) fields [fname] = fd; } } foreach (PropertyInfo prop in type.GetProperties (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { NodeAttributeAttribute at = (NodeAttributeAttribute) Attribute.GetCustomAttribute (prop, typeof(NodeAttributeAttribute), true); if (at != null) { ExtensionNodeType.FieldData fd = CreateFieldData (prop, at, out fname, ref boundAttributeType); if (fd != null) fields [fname] = fd; } } type = type.BaseType; } return fields; } ExtensionNodeType.FieldData CreateFieldData (MemberInfo member, NodeAttributeAttribute at, out string name, ref ExtensionNodeType.FieldData boundAttributeType) { ExtensionNodeType.FieldData fdata = new ExtensionNodeType.FieldData (); fdata.Member = member; fdata.Required = at.Required; fdata.Localizable = at.Localizable; if (at.Name != null && at.Name.Length > 0) name = at.Name; else name = member.Name; if (typeof(CustomExtensionAttribute).IsAssignableFrom (fdata.MemberType)) { if (boundAttributeType != null) throw new InvalidOperationException ("Type '" + member.DeclaringType + "' has two members bound to a custom attribute. There can be only one."); boundAttributeType = fdata; return null; } return fdata; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionNodeChildAttribute.cs0000664000175000017500000000625512136523632030002 0ustar00directhexdirecthex00000000000000// // ExtensionNodeChildAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Declares allowed children of an extension node type. /// /// /// This attribute allows declaring the type of children that an extension node can have. /// [AttributeUsage (AttributeTargets.Class, AllowMultiple=true)] public class ExtensionNodeChildAttribute: Attribute { string nodeName; Type extensionNodeType; string extensionNodeTypeName; /// /// Initializes a new instance /// /// /// Name of the allowed child extension node. /// public ExtensionNodeChildAttribute (string nodeName) : this (typeof(TypeExtensionNode), nodeName) { } /// /// Initializes a new instance /// /// /// Type of the allowed child extension node. /// public ExtensionNodeChildAttribute (Type extensionNodeType) : this (extensionNodeType, null) { } /// /// Initializes a new instance /// /// /// Type of the allowed child extension node. /// /// /// Name of the allowed child extension node. /// public ExtensionNodeChildAttribute (Type extensionNodeType, string nodeName) { ExtensionNodeType = extensionNodeType; this.nodeName = nodeName; } /// /// Name of the allowed child extension node. /// public string NodeName { get { return nodeName != null ? nodeName : string.Empty; } set { nodeName = value; } } /// /// Type of the allowed child extension node. /// public Type ExtensionNodeType { get { return extensionNodeType; } set { extensionNodeType = value; extensionNodeTypeName = value.FullName; } } internal string ExtensionNodeTypeName { get { return extensionNodeTypeName; } set { extensionNodeTypeName = value; extensionNodeType = null; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinAuthorAttribute.cs0000664000175000017500000000344012136523632026447 0ustar00directhexdirecthex00000000000000// // AddinAuthorAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Declares an author of the add-in /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)] public class AddinAuthorAttribute: Attribute { string name; /// /// Initializes the attribute /// /// /// Name of the author /// public AddinAuthorAttribute (string name) { this.name = name; } /// /// Author name /// public string Name { get { return this.name; } set { this.name = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionAttributeAttribute.cs0000664000175000017500000000754612136523632030120 0ustar00directhexdirecthex00000000000000// // ExtensionAttributeAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Assigns an attribute value to an extension /// /// /// This attribute can be used together with the [Extenion] attribute to specify /// a value for an attribute of the extension. /// public class ExtensionAttributeAttribute: Attribute { Type targetType; string targetTypeName; string name; string val; string path; /// /// Initializes a new instance of the class. /// /// /// Name of the attribute /// /// /// Value of the attribute /// public ExtensionAttributeAttribute (string name, string value) { Name = name; Value = value; } /// /// Initializes a new instance of the class. /// /// /// Type of the extension for which the attribute value is being set /// /// /// Name of the attribute /// /// /// Value of the attribute /// public ExtensionAttributeAttribute (Type type, string name, string value) { Name = name; Value = value; Type = type; } /// /// Initializes a new instance of the class. /// /// /// Path of the extension for which the attribute value is being set /// /// /// Name of the attribute /// /// /// Value of the attribute /// public ExtensionAttributeAttribute (string path, string name, string value) { Name = name; Value = value; Path = path; } /// /// Name of the attribute /// public string Name { get { return this.name; } set { this.name = value; } } /// /// Value of the attribute /// public string Value { get { return this.val; } set { this.val = value; } } /// /// Path of the extension for which the attribute value is being set /// public string Path { get { return this.path; } set { this.path = value; } } /// /// Type of the extension for which the attribute value is being set /// public Type Type { get { return targetType; } set { targetType = value; targetTypeName = targetType.FullName; } } internal string TypeName { get { return targetTypeName ?? string.Empty; } set { targetTypeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinNameAttribute.cs0000664000175000017500000000443712136523632026074 0ustar00directhexdirecthex00000000000000// // AddinNameAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Sets the display name of an add-in /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] public class AddinNameAttribute: Attribute { /// /// Initializes a new instance of the class. /// /// /// Name of the add-in /// public AddinNameAttribute (string name) { Name = name; } /// /// Initializes a new instance of the class. /// /// /// Name of the add-in /// /// /// Locale of the name (for example, 'en-US', or 'en') /// public AddinNameAttribute (string name, string locale) { Name = name; Locale = locale; } /// /// Name of the add-in /// public string Name { get; set; } /// /// Locale of the name (for example, 'en-US', or 'en') /// public string Locale { get; set; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionAttribute.cs0000664000175000017500000001260512136523632026224 0ustar00directhexdirecthex00000000000000// // ExtensionAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Declares a type extension. /// /// /// When applied to a class, specifies that the class is an extension /// class to be registered in a matching extension point. /// [AttributeUsage (AttributeTargets.Class, AllowMultiple=true)] public class ExtensionAttribute: Attribute { string path; string nodeName; string id; string insertBefore; string insertAfter; string typeName; Type type; /// /// Initializes a new instance of the ExtensionAttribute class. /// public ExtensionAttribute () { } /// /// Initializes a new instance /// /// /// Path of the extension point. /// /// The path is only required if there are several extension points defined for the same type. public ExtensionAttribute (string path) { this.path = path; } /// /// Initializes a new instance /// /// /// Type defining the extension point being extended /// /// /// This constructor can be used to explicitly specify the type that defines the extension point /// to be extended. By default, Mono.Addins will try to find any extension point defined in any /// of the base classes or interfaces. The type parameter can be used when there is more than one /// base type providing an extension point. /// public ExtensionAttribute (Type type) { Type = type; } /// /// Path of the extension point being extended /// /// /// The path is only required if there are several extension points defined for the same type. /// public string Path { get { return path ?? string.Empty; } set { path = value; } } /// /// Name of the extension node /// /// /// Extension points may require extensions to use a specific node name. /// This is needed when an extension point may contain several different types of nodes. /// public string NodeName { get { return !string.IsNullOrEmpty (nodeName) ? nodeName : "Type"; } set { nodeName = value; } } /// /// Identifier of the extension node. /// /// /// The ExtensionAttribute.InsertAfter and ExtensionAttribute.InsertBefore /// properties can be used to specify the relative location of a node. The nodes /// referenced in those properties must be defined either in the add-in host /// being extended, or in any add-in on which this add-in depends. /// public string Id { get { return id ?? string.Empty; } set { id = value; } } /// /// Identifier of the extension node before which this node has to be added in the extension point. /// /// /// The ExtensionAttribute.InsertAfter and ExtensionAttribute.InsertBefore /// properties can be used to specify the relative location of a node. The nodes /// referenced in those properties must be defined either in the add-in host /// being extended, or in any add-in on which this add-in depends. /// public string InsertBefore { get { return insertBefore ?? string.Empty; } set { insertBefore = value; } } /// /// Identifier of the extension node after which this node has to be added in the extension point. /// public string InsertAfter { get { return insertAfter ?? string.Empty; } set { insertAfter = value; } } /// /// Type defining the extension point being extended /// /// /// This property can be used to explicitly specify the type that defines the extension point /// to be extended. By default, Mono.Addins will try to find any extension point defined in any /// of the base classes or interfaces. This property can be used when there is more than one /// base type providing an extension point. /// public Type Type { get { return type; } set { type = value; typeName = type.FullName; } } internal string TypeName { get { return typeName ?? string.Empty; } set { typeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionContext.cs0000664000175000017500000012213212136523632025702 0ustar00directhexdirecthex00000000000000// // ExtensionContext.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using Mono.Addins.Description; namespace Mono.Addins { /// /// An extension context. /// /// /// Extension contexts can be used to query the extension tree /// using particular condition values. Extension points which /// declare the availability of a condition type can only be /// queryed using an extension context which provides an /// evaluator for that condition. /// public class ExtensionContext { Hashtable conditionTypes = new Hashtable (); Hashtable conditionsToNodes = new Hashtable (); List childContexts; ExtensionContext parentContext; ExtensionTree tree; bool fireEvents = false; ArrayList runTimeEnabledAddins; ArrayList runTimeDisabledAddins; /// /// Extension change event. /// /// /// This event is fired when any extension point in the add-in system changes. /// The event args object provides the path of the changed extension, although /// it does not provide information about what changed. Hosts subscribing to /// this event should get the new list of nodes using a query method such as /// AddinManager.GetExtensionNodes() and then update whatever needs to be updated. /// public event ExtensionEventHandler ExtensionChanged; internal void Initialize (AddinEngine addinEngine) { fireEvents = false; tree = new ExtensionTree (addinEngine, this); } #pragma warning disable 1591 [ObsoleteAttribute] protected void Clear () { } #pragma warning restore 1591 internal void ClearContext () { conditionTypes.Clear (); conditionsToNodes.Clear (); childContexts = null; parentContext = null; tree = null; runTimeEnabledAddins = null; runTimeDisabledAddins = null; } internal AddinEngine AddinEngine { get { return tree.AddinEngine; } } void CleanDisposedChildContexts () { if (childContexts != null) childContexts.RemoveAll (w => w.Target == null); } internal virtual void ResetCachedData () { tree.ResetCachedData (); if (childContexts != null) { foreach (WeakReference wref in childContexts) { ExtensionContext ctx = wref.Target as ExtensionContext; if (ctx != null) ctx.ResetCachedData (); } } } internal ExtensionContext CreateChildContext () { lock (conditionTypes) { if (childContexts == null) childContexts = new List (); else CleanDisposedChildContexts (); ExtensionContext ctx = new ExtensionContext (); ctx.Initialize (AddinEngine); ctx.parentContext = this; WeakReference wref = new WeakReference (ctx); childContexts.Add (wref); return ctx; } } /// /// Registers a new condition in the extension context. /// /// /// Identifier of the condition. /// /// /// Condition evaluator. /// /// /// The registered condition will be particular to this extension context. /// Any event that might be fired as a result of changes in the condition will /// only be fired in this context. /// public void RegisterCondition (string id, ConditionType type) { type.Id = id; ConditionInfo info = CreateConditionInfo (id); ConditionType ot = info.CondType as ConditionType; if (ot != null) ot.Changed -= new EventHandler (OnConditionChanged); info.CondType = type; type.Changed += new EventHandler (OnConditionChanged); } /// /// Registers a new condition in the extension context. /// /// /// Identifier of the condition. /// /// /// Type of the condition evaluator. Must be a subclass of Mono.Addins.ConditionType. /// /// /// The registered condition will be particular to this extension context. Any event /// that might be fired as a result of changes in the condition will only be fired in this context. /// public void RegisterCondition (string id, Type type) { // Allows delayed creation of condition types ConditionInfo info = CreateConditionInfo (id); ConditionType ot = info.CondType as ConditionType; if (ot != null) ot.Changed -= new EventHandler (OnConditionChanged); info.CondType = type; } ConditionInfo CreateConditionInfo (string id) { ConditionInfo info = conditionTypes [id] as ConditionInfo; if (info == null) { info = new ConditionInfo (); conditionTypes [id] = info; } return info; } internal bool FireEvents { get { return fireEvents; } } internal ConditionType GetCondition (string id) { ConditionType ct; ConditionInfo info = (ConditionInfo) conditionTypes [id]; if (info != null) { if (info.CondType is Type) { // The condition was registered as a type, create an instance now ct = (ConditionType) Activator.CreateInstance ((Type)info.CondType); ct.Id = id; ct.Changed += new EventHandler (OnConditionChanged); info.CondType = ct; } else ct = info.CondType as ConditionType; if (ct != null) return ct; } if (parentContext != null) return parentContext.GetCondition (id); else return null; } internal void RegisterNodeCondition (TreeNode node, BaseCondition cond) { ArrayList list = (ArrayList) conditionsToNodes [cond]; if (list == null) { list = new ArrayList (); conditionsToNodes [cond] = list; ArrayList conditionTypeIds = new ArrayList (); cond.GetConditionTypes (conditionTypeIds); foreach (string cid in conditionTypeIds) { // Make sure the condition is properly created GetCondition (cid); ConditionInfo info = CreateConditionInfo (cid); if (info.BoundConditions == null) info.BoundConditions = new ArrayList (); info.BoundConditions.Add (cond); } } list.Add (node); } internal void UnregisterNodeCondition (TreeNode node, BaseCondition cond) { ArrayList list = (ArrayList) conditionsToNodes [cond]; if (list == null) return; list.Remove (node); if (list.Count == 0) { conditionsToNodes.Remove (cond); ArrayList conditionTypeIds = new ArrayList (); cond.GetConditionTypes (conditionTypeIds); foreach (string cid in conditionTypes.Keys) { ConditionInfo info = conditionTypes [cid] as ConditionInfo; if (info != null && info.BoundConditions != null) info.BoundConditions.Remove (cond); } } } /// /// Returns the extension node in a path /// /// /// Location of the node. /// /// /// The node, or null if not found. /// public ExtensionNode GetExtensionNode (string path) { TreeNode node = GetNode (path); if (node == null) return null; if (node.Condition == null || node.Condition.Evaluate (this)) return node.ExtensionNode; else return null; } /// /// Returns the extension node in a path /// /// /// Location of the node. /// /// /// The node, or null if not found. /// public T GetExtensionNode (string path) where T: ExtensionNode { return (T) GetExtensionNode (path); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path.> /// /// /// All nodes registered in the provided path. /// public ExtensionNodeList GetExtensionNodes (string path) { return GetExtensionNodes (path, null); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path. /// /// /// A list of nodes /// /// /// This method returns all nodes registered under the provided path. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided type. /// public ExtensionNodeList GetExtensionNodes (string path) where T: ExtensionNode { ExtensionNodeList nodes = GetExtensionNodes (path, typeof(T)); return new ExtensionNodeList (nodes.list); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// A list of nodes /// /// /// This method returns all extension nodes bound to the provided type. /// public ExtensionNodeList GetExtensionNodes (Type instanceType) { return GetExtensionNodes (instanceType, typeof(ExtensionNode)); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// Expected extension node type /// /// /// A list of nodes /// /// /// This method returns all nodes registered for the provided type. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided node type. /// public ExtensionNodeList GetExtensionNodes (Type instanceType, Type expectedNodeType) { string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); if (path == null) return new ExtensionNodeList (null); return GetExtensionNodes (path, expectedNodeType); } /// /// Gets extension nodes for a type extension point /// /// /// Type defining the extension point /// /// /// A list of nodes /// /// /// This method returns all nodes registered for the provided type. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the specified node type argument. /// public ExtensionNodeList GetExtensionNodes (Type instanceType) where T: ExtensionNode { string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); if (path == null) return new ExtensionNodeList (null); return new ExtensionNodeList (GetExtensionNodes (path, typeof (T)).list); } /// /// Gets extension nodes registered in a path. /// /// /// An extension path. /// /// /// Expected node type. /// /// /// A list of nodes /// /// /// This method returns all nodes registered under the provided path. /// It will throw a InvalidOperationException if the type of one of /// the registered nodes is not assignable to the provided type. /// public ExtensionNodeList GetExtensionNodes (string path, Type expectedNodeType) { TreeNode node = GetNode (path); if (node == null || node.ExtensionNode == null) return ExtensionNodeList.Empty; ExtensionNodeList list = node.ExtensionNode.ChildNodes; if (expectedNodeType != null) { bool foundError = false; foreach (ExtensionNode cnode in list) { if (!expectedNodeType.IsInstanceOfType (cnode)) { foundError = true; AddinEngine.ReportError ("Error while getting nodes for path '" + path + "'. Expected subclass of node type '" + expectedNodeType + "'. Found '" + cnode.GetType (), null, null, false); } } if (foundError) { // Create a new list excluding the elements that failed the test List newList = new List (); foreach (ExtensionNode cnode in list) { if (expectedNodeType.IsInstanceOfType (cnode)) newList.Add (cnode); } return new ExtensionNodeList (newList); } } return list; } /// /// Gets extension objects registered for a type extension point. /// /// /// Type defining the extension point /// /// /// A list of objects /// public object[] GetExtensionObjects (Type instanceType) { return GetExtensionObjects (instanceType, true); } /// /// Gets extension objects registered for a type extension point. /// /// /// A list of objects /// /// /// The type argument of this generic method is the type that defines /// the extension point. /// public T[] GetExtensionObjects () { return GetExtensionObjects (true); } /// /// Gets extension objects registered for a type extension point. /// /// /// Type defining the extension point /// /// /// When set to True, it will return instances created in previous calls. /// /// /// A list of extension objects. /// public object[] GetExtensionObjects (Type instanceType, bool reuseCachedInstance) { string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); if (path == null) return (object[]) Array.CreateInstance (instanceType, 0); return GetExtensionObjects (path, instanceType, reuseCachedInstance); } /// /// Gets extension objects registered for a type extension point. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// A list of extension objects. /// /// /// The type argument of this generic method is the type that defines /// the extension point. /// public T[] GetExtensionObjects (bool reuseCachedInstance) { string path = AddinEngine.GetAutoTypeExtensionPoint (typeof(T)); if (path == null) return new T[0]; return GetExtensionObjects (path, reuseCachedInstance); } /// /// Gets extension objects registered in a path /// /// /// An extension path. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// public object[] GetExtensionObjects (string path) { return GetExtensionObjects (path, typeof(object), true); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true) /// public object[] GetExtensionObjects (string path, bool reuseCachedInstance) { return GetExtensionObjects (path, typeof(object), reuseCachedInstance); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// Type of the return array elements. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public object[] GetExtensionObjects (string path, Type arrayElementType) { return GetExtensionObjects (path, arrayElementType, true); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node. /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public T[] GetExtensionObjects (string path) { return GetExtensionObjects (path, true); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true). /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public T[] GetExtensionObjects (string path, bool reuseCachedInstance) { ExtensionNode node = GetExtensionNode (path); if (node == null) throw new InvalidOperationException ("Extension node not found in path: " + path); return node.GetChildObjects (reuseCachedInstance); } /// /// Gets extension objects registered in a path. /// /// /// An extension path. /// /// /// Type of the return array elements. /// /// /// When set to True, it will return instances created in previous calls. /// /// /// An array of objects registered in the path. /// /// /// This method can only be used if all nodes in the provided extension path /// are of type Mono.Addins.TypeExtensionNode. The returned array is composed /// by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if /// reuseCachedInstance is set to true). /// /// An InvalidOperationException exception is thrown if one of the found /// objects is not a subclass of the provided type. /// public object[] GetExtensionObjects (string path, Type arrayElementType, bool reuseCachedInstance) { ExtensionNode node = GetExtensionNode (path); if (node == null) throw new InvalidOperationException ("Extension node not found in path: " + path); return node.GetChildObjects (arrayElementType, reuseCachedInstance); } /// /// Register a listener of extension node changes. /// /// /// Path of the node. /// /// /// A handler method. /// /// /// Hosts can call this method to be subscribed to an extension change /// event for a specific path. The event will be fired once for every /// individual node change. The event arguments include the change type /// (Add or Remove) and the extension node added or removed. /// /// NOTE: The handler will be called for all nodes existing in the path at the moment of registration. /// public void AddExtensionNodeHandler (string path, ExtensionNodeEventHandler handler) { ExtensionNode node = GetExtensionNode (path); if (node == null) throw new InvalidOperationException ("Extension node not found in path: " + path); node.ExtensionNodeChanged += handler; } /// /// Unregister a listener of extension node changes. /// /// /// Path of the node. /// /// /// A handler method. /// /// /// This method unregisters a delegate from the node change event of a path. /// public void RemoveExtensionNodeHandler (string path, ExtensionNodeEventHandler handler) { ExtensionNode node = GetExtensionNode (path); if (node == null) throw new InvalidOperationException ("Extension node not found in path: " + path); node.ExtensionNodeChanged -= handler; } /// /// Register a listener of extension node changes. /// /// /// Type defining the extension point /// /// /// A handler method. /// /// /// Hosts can call this method to be subscribed to an extension change /// event for a specific type extension point. The event will be fired once for every /// individual node change. The event arguments include the change type /// (Add or Remove) and the extension node added or removed. /// /// NOTE: The handler will be called for all nodes existing in the path at the moment of registration. /// public void AddExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) { string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); if (path == null) throw new InvalidOperationException ("Type '" + instanceType + "' not bound to an extension point."); AddExtensionNodeHandler (path, handler); } /// /// Unregister a listener of extension node changes. /// /// /// Type defining the extension point /// /// /// A handler method. /// public void RemoveExtensionNodeHandler (Type instanceType, ExtensionNodeEventHandler handler) { string path = AddinEngine.GetAutoTypeExtensionPoint (instanceType); if (path == null) throw new InvalidOperationException ("Type '" + instanceType + "' not bound to an extension point."); RemoveExtensionNodeHandler (path, handler); } void OnConditionChanged (object s, EventArgs a) { ConditionType cond = (ConditionType) s; NotifyConditionChanged (cond); } internal void NotifyConditionChanged (ConditionType cond) { try { fireEvents = true; ConditionInfo info = (ConditionInfo) conditionTypes [cond.Id]; if (info != null && info.BoundConditions != null) { Hashtable parentsToNotify = new Hashtable (); foreach (BaseCondition c in info.BoundConditions) { ArrayList nodeList = (ArrayList) conditionsToNodes [c]; if (nodeList != null) { foreach (TreeNode node in nodeList) parentsToNotify [node.Parent] = null; } } foreach (TreeNode node in parentsToNotify.Keys) { if (node.NotifyChildrenChanged ()) NotifyExtensionsChanged (new ExtensionEventArgs (node.GetPath ())); } } } finally { fireEvents = false; } // Notify child contexts lock (conditionTypes) { if (childContexts != null) { CleanDisposedChildContexts (); foreach (WeakReference wref in childContexts) { ExtensionContext ctx = wref.Target as ExtensionContext; if (ctx != null) ctx.NotifyConditionChanged (cond); } } } } internal void NotifyExtensionsChanged (ExtensionEventArgs args) { if (!fireEvents) return; if (ExtensionChanged != null) ExtensionChanged (this, args); } internal void NotifyAddinLoaded (RuntimeAddin ad) { tree.NotifyAddinLoaded (ad, true); lock (conditionTypes) { if (childContexts != null) { CleanDisposedChildContexts (); foreach (WeakReference wref in childContexts) { ExtensionContext ctx = wref.Target as ExtensionContext; if (ctx != null) ctx.NotifyAddinLoaded (ad); } } } } internal void CreateExtensionPoint (ExtensionPoint ep) { TreeNode node = tree.GetNode (ep.Path, true); if (node.ExtensionPoint == null) { node.ExtensionPoint = ep; node.ExtensionNodeSet = ep.NodeSet; } } internal void ActivateAddinExtensions (string id) { // Looks for loaded extension points which are extended by the provided // add-in, and adds the new nodes try { fireEvents = true; Addin addin = AddinEngine.Registry.GetAddin (id); if (addin == null) { AddinEngine.ReportError ("Required add-in not found", id, null, false); return; } // Take note that this add-in has been enabled at run-time // Needed because loaded add-in descriptions may not include this add-in. RegisterRuntimeEnabledAddin (id); // Look for loaded extension points Hashtable eps = new Hashtable (); ArrayList newExtensions = new ArrayList (); foreach (ModuleDescription mod in addin.Description.AllModules) { foreach (Extension ext in mod.Extensions) { if (!newExtensions.Contains (ext.Path)) newExtensions.Add (ext.Path); ExtensionPoint ep = tree.FindLoadedExtensionPoint (ext.Path); if (ep != null && !eps.Contains (ep)) eps.Add (ep, ep); } } // Add the new nodes ArrayList loadedNodes = new ArrayList (); foreach (ExtensionPoint ep in eps.Keys) { ExtensionLoadData data = GetAddinExtensions (id, ep); if (data != null) { foreach (Extension ext in data.Extensions) { TreeNode node = GetNode (ext.Path); if (node != null && node.ExtensionNodeSet != null) { if (node.ChildrenLoaded) LoadModuleExtensionNodes (ext, data.AddinId, node.ExtensionNodeSet, loadedNodes); } else AddinEngine.ReportError ("Extension node not found or not extensible: " + ext.Path, id, null, false); } } } // Call the OnAddinLoaded method on nodes, if the add-in is already loaded foreach (TreeNode nod in loadedNodes) nod.ExtensionNode.OnAddinLoaded (); // Global extension change event. Other events are fired by LoadModuleExtensionNodes. // The event is called for all extensions, even for those not loaded. This is for coherence, // although that something that it doesn't make much sense to do (subcribing the ExtensionChanged // event without first getting the list of nodes that may change). foreach (string newExt in newExtensions) NotifyExtensionsChanged (new ExtensionEventArgs (newExt)); } finally { fireEvents = false; } // Do the same in child contexts lock (conditionTypes) { if (childContexts != null) { CleanDisposedChildContexts (); foreach (WeakReference wref in childContexts) { ExtensionContext ctx = wref.Target as ExtensionContext; if (ctx != null) ctx.ActivateAddinExtensions (id); } } } } internal void RemoveAddinExtensions (string id) { try { // Registers this add-in as disabled, so from now on extension from this // add-in will be ignored RegisterRuntimeDisabledAddin (id); fireEvents = true; // This method removes all extension nodes added by the add-in // Get all nodes created by the addin ArrayList list = new ArrayList (); tree.FindAddinNodes (id, list); // Remove each node and notify the change foreach (TreeNode node in list) { if (node.ExtensionNode == null) { // It's an extension point. Just remove it, no notifications are needed node.Remove (); } else { node.ExtensionNode.OnAddinUnloaded (); node.Remove (); } } // Notify global extension point changes. // The event is called for all extensions, even for those not loaded. This is for coherence, // although that something that it doesn't make much sense to do (subcribing the ExtensionChanged // event without first getting the list of nodes that may change). // We get the runtime add-in because the add-in may already have been deleted from the registry RuntimeAddin addin = AddinEngine.GetAddin (id); if (addin != null) { ArrayList paths = new ArrayList (); // Using addin.Module.ParentAddinDescription here because addin.Addin.Description may not // have a valid reference (the description is lazy loaded and may already have been removed from the registry) foreach (ModuleDescription mod in addin.Module.ParentAddinDescription.AllModules) { foreach (Extension ext in mod.Extensions) { if (!paths.Contains (ext.Path)) paths.Add (ext.Path); } } foreach (string path in paths) NotifyExtensionsChanged (new ExtensionEventArgs (path)); } } finally { fireEvents = false; } } void RegisterRuntimeDisabledAddin (string addinId) { if (runTimeDisabledAddins == null) runTimeDisabledAddins = new ArrayList (); if (!runTimeDisabledAddins.Contains (addinId)) runTimeDisabledAddins.Add (addinId); if (runTimeEnabledAddins != null) runTimeEnabledAddins.Remove (addinId); } void RegisterRuntimeEnabledAddin (string addinId) { if (runTimeEnabledAddins == null) runTimeEnabledAddins = new ArrayList (); if (!runTimeEnabledAddins.Contains (addinId)) runTimeEnabledAddins.Add (addinId); if (runTimeDisabledAddins != null) runTimeDisabledAddins.Remove (addinId); } internal ICollection GetAddinsForPath (string path, List col) { ArrayList newlist = null; // Always consider add-ins which have been enabled at runtime since // they may contain extensioin for this path. // Ignore addins disabled at run-time. if (runTimeEnabledAddins != null && runTimeEnabledAddins.Count > 0) { newlist = new ArrayList (); newlist.AddRange (col); foreach (string s in runTimeEnabledAddins) if (!newlist.Contains (s)) newlist.Add (s); } if (runTimeDisabledAddins != null && runTimeDisabledAddins.Count > 0) { if (newlist == null) { newlist = new ArrayList (); newlist.AddRange (col); } foreach (string s in runTimeDisabledAddins) newlist.Remove (s); } return newlist != null ? (ICollection)newlist : (ICollection)col; } // Load the extension nodes at the specified path. If the path // contains extension nodes implemented in an add-in which is // not loaded, the add-in will be automatically loaded internal void LoadExtensions (string requestedExtensionPath) { TreeNode node = GetNode (requestedExtensionPath); if (node == null) throw new InvalidOperationException ("Extension point not defined: " + requestedExtensionPath); ExtensionPoint ep = node.ExtensionPoint; if (ep != null) { // Collect extensions to be loaded from add-ins. Before loading the extensions, // they must be sorted, that's why loading is split in two steps (collecting + loading). ArrayList loadData = new ArrayList (); foreach (string addin in GetAddinsForPath (ep.Path, ep.Addins)) { ExtensionLoadData ed = GetAddinExtensions (addin, ep); if (ed != null) { // Insert the addin data taking into account dependencies. // An add-in must be processed after all its dependencies. bool added = false; for (int n=0; n /// Delegate to be used in extension point subscriptions /// public delegate void ExtensionEventHandler (object sender, ExtensionEventArgs args); /// /// Delegate to be used in extension point subscriptions /// public delegate void ExtensionNodeEventHandler (object sender, ExtensionNodeEventArgs args); /// /// Arguments for extension events. /// public class ExtensionEventArgs: EventArgs { string path; internal ExtensionEventArgs () { } /// /// Creates a new instance. /// /// /// Path of the extension node that has changed. /// public ExtensionEventArgs (string path) { this.path = path; } /// /// Path of the extension node that has changed. /// public virtual string Path { get { return path; } } /// /// Checks if a path has changed. /// /// /// An extension path. /// /// /// 'true' if the path is affected by the extension change event. /// /// /// Checks if the specified path or any of its children paths is affected by the extension change event. /// public bool PathChanged (string pathToCheck) { if (pathToCheck.EndsWith ("/")) return path.StartsWith (pathToCheck); else return path.StartsWith (pathToCheck) && (pathToCheck.Length == path.Length || path [pathToCheck.Length] == '/'); } } /// /// Arguments for extension node events. /// public class ExtensionNodeEventArgs: ExtensionEventArgs { ExtensionNode node; ExtensionChange change; /// /// Creates a new instance /// /// /// Type of change. /// /// /// Node that has been added or removed. /// public ExtensionNodeEventArgs (ExtensionChange change, ExtensionNode node) { this.node = node; this.change = change; } /// /// Path of the extension that changed. /// public override string Path { get { return node.Path; } } /// /// Type of change. /// public ExtensionChange Change { get { return change; } } /// /// Node that has been added or removed. /// public ExtensionNode ExtensionNode { get { return node; } } /// /// Extension object that has been added or removed. /// public object ExtensionObject { get { InstanceExtensionNode tnode = node as InstanceExtensionNode; if (tnode == null) throw new InvalidOperationException ("Node is not an InstanceExtensionNode"); return tnode.GetInstance (); } } } /// /// Type of change in an extension change event. /// public enum ExtensionChange { /// /// An extension node has been added. /// Add, /// /// An extension node has been removed. /// Remove } internal class ExtensionLoadData { public string AddinId; public ArrayList Extensions; } } mono-addins-1.0/Mono.Addins/Mono.Addins/CustomExtensionAttribute.cs0000664000175000017500000000534612136523632027423 0ustar00directhexdirecthex00000000000000// // CustomExtensionAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Base class for custon extension attributes. /// /// /// Custom extension attributes can be used to declare extensions with custom metadata. /// All custom extension attributes must subclass CustomExtensionAttribute. /// public class CustomExtensionAttribute: Attribute { string id; string insertBefore; string insertAfter; string path; internal const string PathFieldKey = "__path"; /// /// Identifier of the node /// [NodeAttributeAttribute ("id")] public string Id { get { return id; } set { id = value; } } /// /// Identifier of the node before which this node has to be placed /// [NodeAttributeAttribute ("insertbefore")] public string InsertBefore { get { return insertBefore; } set { insertBefore = value; } } /// /// Identifier of the node after which this node has to be placed /// [NodeAttributeAttribute ("insertafter")] public string InsertAfter { get { return insertAfter; } set { insertAfter = value; } } /// /// Path of the extension point being extended. /// /// /// This property is optional and useful only when there are several extension points which allow /// using this custom attribute to define extensions. /// [NodeAttributeAttribute ("__path")] public string Path { get { return path; } set { path = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinModuleAttribute.cs0000664000175000017500000000362712136523632026441 0ustar00directhexdirecthex00000000000000// // AddinModuleAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Declares an optional add-in module /// public class AddinModuleAttribute: Attribute { string assemblyFile; /// /// Initializes the instance. /// /// /// Relative path to the assembly that implements the optional module /// public AddinModuleAttribute (string assemblyFile) { this.assemblyFile = assemblyFile; } /// /// Relative path to the assembly that implements the optional module /// public string AssemblyFile { get { return this.assemblyFile ?? string.Empty; } set { this.assemblyFile = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinEngine.cs0000775000175000017500000005463012136524015024534 0ustar00directhexdirecthex00000000000000// // AddinService.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Linq; using System.Xml; using System.Collections; using System.Reflection; using Mono.Addins.Description; using Mono.Addins.Database; using Mono.Addins.Localization; using System.Collections.Generic; namespace Mono.Addins { /// /// An add-in engine. /// /// /// This class allows hosting several independent add-in engines in a single application domain. /// In general, applications use the AddinManager class to query and manage extensions. This class is static, /// so the API is easily accessible. However, some kind applications may need to use several isolated /// add-in engines, and in this case the AddinManager class can't be used, because it is bound to a single /// add-in engine. Those applications can instead create several instances of the AddinEngine class. Each /// add-in engine can be independently initialized with different add-in registries and extension models. /// public class AddinEngine: ExtensionContext { bool initialized; string startupDirectory; AddinRegistry registry; IAddinInstaller installer; bool checkAssemblyLoadConflicts; Hashtable loadedAddins = new Hashtable (); Dictionary nodeSets = new Dictionary (); Hashtable autoExtensionTypes = new Hashtable (); Hashtable loadedAssemblies = new Hashtable (); AddinLocalizer defaultLocalizer; IProgressStatus defaultProgressStatus = new ConsoleProgressStatus (false); /// /// Raised when there is an error while loading an add-in /// public static event AddinErrorEventHandler AddinLoadError; /// /// Raised when an add-in is loaded /// public static event AddinEventHandler AddinLoaded; /// /// Raised when an add-in is unloaded /// public static event AddinEventHandler AddinUnloaded; /// /// Initializes a new instance of the class. /// public AddinEngine () { } /// /// Initializes the add-in engine /// /// /// Location of the add-in registry. /// /// The add-in engine needs to be initialized before doing any add-in operation. /// When initialized with this method, it will look for add-in in the add-in registry /// located in the specified path. /// public void Initialize (string configDir) { if (initialized) return; Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); Initialize (asm, configDir, null, null); } /// /// Initializes the add-in engine. /// /// /// Location of the add-in registry. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// Configuration information about the add-in registry will be stored in the /// provided location. The add-in engine will look for add-ins in the provided /// 'addinsDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public void Initialize (string configDir, string addinsDir) { if (initialized) return; Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); Initialize (asm, configDir, addinsDir, null); } /// /// Initializes the add-in engine. /// /// /// Location of the add-in registry. /// /// /// Add-ins directory. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// Location of the add-in database. If the path is relative, it is considered to be relative /// to the configDir directory. /// /// /// The add-in engine needs to be initialized before doing any add-in operation. /// Configuration information about the add-in registry will be stored in the /// provided location. The add-in engine will look for add-ins in the provided /// 'addinsDir' directory. Cached information about add-ins will be stored in /// the 'databaseDir' directory. /// /// When specifying a path, it is possible to use a special folder name as root. /// For example: [Personal]/.config/MyApp. In this case, [Personal] will be replaced /// by the location of the Environment.SpecialFolder.Personal folder. Any value /// of the Environment.SpecialFolder enumeration can be used (always between square /// brackets) /// public void Initialize (string configDir, string addinsDir, string databaseDir) { if (initialized) return; Assembly asm = Assembly.GetEntryAssembly (); if (asm == null) asm = Assembly.GetCallingAssembly (); Initialize (asm, configDir, addinsDir, databaseDir); } internal void Initialize (Assembly startupAsm, string configDir, string addinsDir, string databaseDir) { if (initialized) return; Initialize (this); string asmFile = new Uri (startupAsm.CodeBase).LocalPath; startupDirectory = System.IO.Path.GetDirectoryName (asmFile); string customDir = Environment.GetEnvironmentVariable ("MONO_ADDINS_REGISTRY"); if (customDir != null && customDir.Length > 0) configDir = customDir; if (configDir == null || configDir.Length == 0) registry = AddinRegistry.GetGlobalRegistry (this, startupDirectory); else registry = new AddinRegistry (this, configDir, startupDirectory, addinsDir, databaseDir); if (registry.CreateHostAddinsFile (asmFile) || registry.UnknownDomain) registry.Update (new ConsoleProgressStatus (false)); initialized = true; ActivateRoots (); OnAssemblyLoaded (null, null); AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler (OnAssemblyLoaded); } /// /// Finalizes the add-in engine. /// public void Shutdown () { initialized = false; AppDomain.CurrentDomain.AssemblyLoad -= new AssemblyLoadEventHandler (OnAssemblyLoaded); loadedAddins.Clear (); loadedAssemblies.Clear (); registry.Dispose (); registry = null; startupDirectory = null; ClearContext (); } /// /// Sets the default localizer to be used for this add-in engine /// /// /// The add-in localizer /// public void InitializeDefaultLocalizer (IAddinLocalizer localizer) { CheckInitialized (); if (localizer != null) defaultLocalizer = new AddinLocalizer (localizer); else defaultLocalizer = null; } internal string StartupDirectory { get { return startupDirectory; } } /// /// Gets whether the add-in engine has been initialized. /// public bool IsInitialized { get { return initialized; } } /// /// Gets the default add-in installer /// /// /// The default installer is used by the CheckInstalled method to request /// the installation of missing add-ins. /// public IAddinInstaller DefaultInstaller { get { return installer; } set { installer = value; } } /// /// Gets the default localizer for this add-in engine /// public AddinLocalizer DefaultLocalizer { get { CheckInitialized (); if (defaultLocalizer != null) return defaultLocalizer; else return NullLocalizer.Instance; } } internal ExtensionContext DefaultContext { get { return this; } } /// /// Gets the localizer for the add-in that is invoking this property /// public AddinLocalizer CurrentLocalizer { get { CheckInitialized (); Assembly asm = Assembly.GetCallingAssembly (); RuntimeAddin addin = GetAddinForAssembly (asm); if (addin != null) return addin.Localizer; else return DefaultLocalizer; } } /// /// Gets a reference to the RuntimeAddin object for the add-in that is invoking this property /// public RuntimeAddin CurrentAddin { get { CheckInitialized (); Assembly asm = Assembly.GetCallingAssembly (); return GetAddinForAssembly (asm); } } /// /// Gets the add-in registry bound to this add-in engine /// public AddinRegistry Registry { get { CheckInitialized (); return registry; } } internal RuntimeAddin GetAddinForAssembly (Assembly asm) { return (RuntimeAddin) loadedAssemblies [asm]; } /// /// Checks if the provided add-ins are installed, and requests the installation of those /// which aren't. /// /// /// Message to show to the user when new add-ins have to be installed. /// /// /// List of IDs of the add-ins to be checked. /// /// /// This method checks if the specified add-ins are installed. /// If some of the add-ins are not installed, it will use /// the installer assigned to the DefaultAddinInstaller property /// to install them. If the installation fails, or if DefaultAddinInstaller /// is not set, an exception will be thrown. /// public void CheckInstalled (string message, params string[] addinIds) { ArrayList notInstalled = new ArrayList (); foreach (string id in addinIds) { Addin addin = Registry.GetAddin (id, false); if (addin != null) { // The add-in is already installed // If the add-in is disabled, enable it now if (!addin.Enabled) addin.Enabled = true; } else { notInstalled.Add (id); } } if (notInstalled.Count == 0) return; if (installer == null) throw new InvalidOperationException ("Add-in installer not set"); // Install the add-ins installer.InstallAddins (Registry, message, (string[]) notInstalled.ToArray (typeof(string))); } // Enables or disables conflict checking while loading assemblies. // Disabling makes loading faster, but less safe. internal bool CheckAssemblyLoadConflicts { get { return checkAssemblyLoadConflicts; } set { checkAssemblyLoadConflicts = value; } } /// /// Checks if an add-in has been loaded. /// /// /// Full identifier of the add-in. /// /// /// True if the add-in is loaded. /// public bool IsAddinLoaded (string id) { CheckInitialized (); return loadedAddins.Contains (Addin.GetIdName (id)); } internal RuntimeAddin GetAddin (string id) { return (RuntimeAddin) loadedAddins [Addin.GetIdName (id)]; } internal void ActivateAddin (string id) { ActivateAddinExtensions (id); } internal void UnloadAddin (string id) { RemoveAddinExtensions (id); RuntimeAddin addin = GetAddin (id); if (addin != null) { addin.UnloadExtensions (); loadedAddins.Remove (Addin.GetIdName (id)); if (addin.AssembliesLoaded) { foreach (Assembly asm in addin.Assemblies) loadedAssemblies.Remove (asm); } ReportAddinUnload (id); } } /// /// Forces the loading of an add-in. /// /// /// Status monitor to keep track of the loading process. /// /// /// Full identifier of the add-in to load. /// /// /// This method loads all assemblies that belong to an add-in in memory. /// All add-ins on which the specified add-in depends will also be loaded. /// Notice that in general add-ins don't need to be explicitely loaded using /// this method, since the add-in engine will load them on demand. /// public void LoadAddin (IProgressStatus statusMonitor, string id) { CheckInitialized (); LoadAddin (statusMonitor, id, true); } internal bool LoadAddin (IProgressStatus statusMonitor, string id, bool throwExceptions) { try { if (IsAddinLoaded (id)) return true; if (!Registry.IsAddinEnabled (id)) { string msg = GettextCatalog.GetString ("Disabled add-ins can't be loaded."); ReportError (msg, id, null, false); if (throwExceptions) throw new InvalidOperationException (msg); return false; } ArrayList addins = new ArrayList (); Stack depCheck = new Stack (); ResolveLoadDependencies (addins, depCheck, id, false); addins.Reverse (); if (statusMonitor != null) statusMonitor.SetMessage ("Loading Addins"); for (int n=0; n 0) { Type ntype = addin.GetType (nt.ObjectTypeName, true); RegisterAutoTypeExtensionPoint (ntype, ep.Path); } } } bool ResolveLoadDependencies (ArrayList addins, Stack depCheck, string id, bool optional) { if (IsAddinLoaded (id)) return true; if (depCheck.Contains (id)) throw new InvalidOperationException ("A cyclic addin dependency has been detected."); depCheck.Push (id); Addin iad = Registry.GetAddin (id); if (iad == null || !iad.Enabled) { if (optional) return false; else if (iad != null && !iad.Enabled) throw new MissingDependencyException (GettextCatalog.GetString ("The required addin '{0}' is disabled.", id)); else throw new MissingDependencyException (GettextCatalog.GetString ("The required addin '{0}' is not installed.", id)); } // If this addin has already been requested, bring it to the head // of the list, so it is loaded earlier than before. addins.Remove (iad); addins.Add (iad); foreach (Dependency dep in iad.AddinInfo.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep != null) { try { string adepid = Addin.GetFullId (iad.AddinInfo.Namespace, adep.AddinId, adep.Version); ResolveLoadDependencies (addins, depCheck, adepid, false); } catch (MissingDependencyException) { if (optional) return false; else throw; } } } if (iad.AddinInfo.OptionalDependencies != null) { foreach (Dependency dep in iad.AddinInfo.OptionalDependencies) { AddinDependency adep = dep as AddinDependency; if (adep != null) { string adepid = Addin.GetFullId (iad.Namespace, adep.AddinId, adep.Version); if (!ResolveLoadDependencies (addins, depCheck, adepid, true)) return false; } } } depCheck.Pop (); return true; } internal void RegisterNodeSet (string addinId, ExtensionNodeSet nset) { nset.SourceAddinId = addinId; nodeSets [nset.Id] = nset; } internal void UnregisterAddinNodeSets (string addinId) { foreach (var nset in nodeSets.Values.Where (n => n.SourceAddinId == addinId).ToArray ()) nodeSets.Remove (nset.Id); } internal string GetNodeTypeAddin (ExtensionNodeSet nset, string type, string callingAddinId) { ExtensionNodeType nt = FindType (nset, type, callingAddinId); if (nt != null) return nt.AddinId; else return null; } internal ExtensionNodeType FindType (ExtensionNodeSet nset, string name, string callingAddinId) { if (nset == null) return null; foreach (ExtensionNodeType nt in nset.NodeTypes) { if (nt.Id == name) return nt; } foreach (string ns in nset.NodeSets) { ExtensionNodeSet regSet; if (!nodeSets.TryGetValue (ns, out regSet)) { ReportError ("Unknown node set: " + ns, callingAddinId, null, false); return null; } ExtensionNodeType nt = FindType (regSet, name, callingAddinId); if (nt != null) return nt; } return null; } internal void RegisterAutoTypeExtensionPoint (Type type, string path) { autoExtensionTypes [type] = path; } internal void UnregisterAutoTypeExtensionPoint (Type type, string path) { autoExtensionTypes.Remove (type); } internal string GetAutoTypeExtensionPoint (Type type) { return autoExtensionTypes [type] as string; } void OnAssemblyLoaded (object s, AssemblyLoadEventArgs a) { if (a != null) CheckHostAssembly (a.LoadedAssembly); } internal void ActivateRoots () { foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) CheckHostAssembly (asm); } void CheckHostAssembly (Assembly asm) { if (AddinDatabase.RunningSetupProcess || asm is System.Reflection.Emit.AssemblyBuilder || asm.IsDynamic) return; string codeBase; try { codeBase = asm.CodeBase; } catch { return; } Uri u; if (!Uri.TryCreate (codeBase, UriKind.Absolute, out u)) return; string asmFile = u.LocalPath; Addin ainfo = Registry.GetAddinForHostAssembly (asmFile); if (ainfo != null && !IsAddinLoaded (ainfo.Id)) { AddinDescription adesc = null; try { adesc = ainfo.Description; } catch (Exception ex) { defaultProgressStatus.ReportError ("Add-in description could not be loaded.", ex); } if (adesc == null || adesc.FilesChanged ()) { // If the add-in has changed, update the add-in database. // We do it here because once loaded, add-in roots can't be // reloaded like regular add-ins. Registry.Update (null); ainfo = Registry.GetAddinForHostAssembly (asmFile); if (ainfo == null) return; } LoadAddin (null, ainfo.Id, false); } } /// /// Creates a new extension context. /// /// /// The new extension context. /// /// /// Extension contexts can be used to query the extension model using particular condition values. /// public ExtensionContext CreateExtensionContext () { CheckInitialized (); return CreateChildContext (); } internal void CheckInitialized () { if (!initialized) throw new InvalidOperationException ("Add-in engine not initialized."); } internal void ReportError (string message, string addinId, Exception exception, bool fatal) { if (AddinLoadError != null) AddinLoadError (null, new AddinErrorEventArgs (message, addinId, exception)); else { Console.WriteLine (message); if (exception != null) Console.WriteLine (exception); } } internal void ReportAddinLoad (string id) { if (AddinLoaded != null) { try { AddinLoaded (null, new AddinEventArgs (id)); } catch { // Ignore subscriber exceptions } } } internal void ReportAddinUnload (string id) { if (AddinUnloaded != null) { try { AddinUnloaded (null, new AddinEventArgs (id)); } catch { // Ignore subscriber exceptions } } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinErrorEventArgs.cs0000664000175000017500000000451112136523632026231 0ustar00directhexdirecthex00000000000000// // AddinErrorEventArgs.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Delegate to be used in add-in error subscriptions /// public delegate void AddinErrorEventHandler (object sender, AddinErrorEventArgs args); /// /// Provides information about an add-in loading error. /// public class AddinErrorEventArgs: AddinEventArgs { Exception exception; string message; /// /// Initializes a new instance of the class. /// /// /// Error message /// /// /// Add-in identifier. /// /// /// Exception that caused the error. /// public AddinErrorEventArgs (string message, string addinId, Exception exception): base (addinId) { this.message = message; this.exception = exception; } /// /// Exception that caused the error. /// public Exception Exception { get { return exception; } } /// /// Error message /// public string Message { get { return message; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ImportAddinFileAttribute.cs0000664000175000017500000000462012136523632027260 0ustar00directhexdirecthex00000000000000// // ImportAddinFileAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Declares an add-in file import /// /// /// An add-in may be composed by several assemblies and data files. /// Data files must be declared in the main assembly using this attribute, or in the XML manifest. /// /// It is important to properly declare all files used by an add-in. /// This information is used by setup tools to know exactly what needs to be packaged when creating /// an add-in package, or to know what needs to be deleted when removing an add-in. /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] public class ImportAddinFileAttribute: Attribute { string filePath; /// /// Initializes a new instance /// /// /// Path to the file. Must be relative to the assembly declaring this attribute. /// public ImportAddinFileAttribute (string filePath) { this.filePath = filePath; } /// /// Path to the file. Must be relative to the assembly declaring this attribute. /// public string FilePath { get { return filePath; } set { filePath = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/IAddinInstaller.cs0000664000175000017500000000110012136523632025356 0ustar00directhexdirecthex00000000000000 using System; namespace Mono.Addins { /// /// An add-in installation handler /// public interface IAddinInstaller { /// /// Installs a set of add-ins /// /// /// Registry where to install /// /// /// Message to show to the user when new add-ins have to be installed. /// /// /// List of IDs of the add-ins to be installed. /// void InstallAddins (AddinRegistry reg, string message, string[] addinIds); } } mono-addins-1.0/Mono.Addins/Mono.Addins/ConsoleProgressStatus.cs0000664000175000017500000001117312136523632026716 0ustar00directhexdirecthex00000000000000// // ConsoleProgressStatus.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// An IProgressStatus class which writes output to the console. /// public class ConsoleProgressStatus: MarshalByRefObject, IProgressStatus { bool canceled; int logLevel; /// /// Initializes a new instance /// /// /// Set to true to enabled verbose log /// public ConsoleProgressStatus (bool verboseLog) { if (verboseLog) logLevel = 2; else logLevel = 1; } /// /// Initializes a new instance /// /// /// Verbosity level. 0: not verbose, 1: normal, >1 extra verbose /// public ConsoleProgressStatus (int logLevel) { this.logLevel = logLevel; } /// /// Sets the description of the current operation. /// /// /// A message /// /// /// This method is called by the add-in engine to show a description of the operation being monitorized. /// public void SetMessage (string msg) { } /// /// Sets the progress of the operation. /// /// /// A number between 0 and 1. 0 means no progress, 1 means operation completed. /// /// /// This method is called by the add-in engine to show the progress of the operation being monitorized. /// public void SetProgress (double progress) { } /// /// Writes text to the log. /// /// /// Message to write /// public void Log (string msg) { Console.WriteLine (msg); } /// /// Reports a warning. /// /// /// Warning message /// /// /// This method is called by the add-in engine to report a warning in the operation being monitorized. /// public void ReportWarning (string message) { if (logLevel > 0) Console.WriteLine ("WARNING: " + message); } /// /// Reports an error. /// /// /// Error message /// /// /// Exception that caused the error. It can be null. /// /// /// This method is called by the add-in engine to report an error occurred while executing the operation being monitorized. /// public void ReportError (string message, Exception exception) { if (logLevel == 0) return; Console.Write ("ERROR: "); if (logLevel > 1) { if (message != null) Console.WriteLine (message); if (exception != null) Console.WriteLine (exception); } else { if (message != null && exception != null) Console.WriteLine (message + " (" + exception.Message + ")"); else { if (message != null) Console.WriteLine (message); if (exception != null) Console.WriteLine (exception.Message); } } } /// /// Returns True when the user requested to cancel this operation /// public bool IsCanceled { get { return canceled; } } /// /// Log level requested by the user: 0: no log, 1: normal log, >1 verbose log /// public int LogLevel { get { return logLevel; } } /// /// Cancels the operation being montorized. /// public void Cancel () { canceled = true; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ImportAddinAssemblyAttribute.cs0000664000175000017500000000551312136523632030162 0ustar00directhexdirecthex00000000000000// // ImportAddinAssemblyAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Declares an add-in assembly import /// /// /// An add-in may be composed by several assemblies and data files. /// Assemblies must be declared in the main assembly using this attribute, or in the XML manifest. /// /// It is important to properly declare all files used by an add-in. /// For example, when a type from the add-in is required (e.g. an ICommand implementation), /// only properly declared assemblies will be checked. /// This information is also used by setup tools to know exactly what needs to be packaged when creating /// an add-in package, or to know what needs to be deleted when removing an add-in. /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple = true)] public class ImportAddinAssemblyAttribute: Attribute { string filePath; bool scan = true; /// /// Initializes a new instance /// /// /// Path to the assembly. Must be relative to the assembly declaring this attribute. /// public ImportAddinAssemblyAttribute (string filePath) { this.filePath = filePath; } /// /// Path to the assembly. Must be relative to the assembly declaring this attribute. /// public string FilePath { get { return filePath; } set { filePath = value; } } /// /// When set to true (the default), the included assembly will be scanned /// looking for extension point declarations. /// public bool Scan { get { return this.scan; } set { this.scan = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionNode.cs0000664000175000017500000004164012136523632025147 0ustar00directhexdirecthex00000000000000// // ExtensionNode.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.Xml; using System.Reflection; using Mono.Addins.Description; namespace Mono.Addins { /// /// A node of the extension model. /// /// /// An extension node is an element registered by an add-in in an extension point. /// A host can get nodes registered in an extension point using methods such as /// AddinManager.GetExtensionNodes(string), which returns a collection of ExtensionNode objects. /// /// ExtensionNode will normally be used as a base class of more complex extension point types. /// The most common subclass is Mono.Addins.TypeExtensionNode, which allows registering a class /// implemented in an add-in. /// public class ExtensionNode { bool childrenLoaded; TreeNode treeNode; ExtensionNodeList childNodes; RuntimeAddin addin; string addinId; ExtensionNodeType nodeType; ModuleDescription module; AddinEngine addinEngine; event ExtensionNodeEventHandler extensionNodeChanged; /// /// Identifier of the node. /// /// /// It is not mandatory to specify an 'id' for a node. When none is provided, /// the add-in manager will automatically generate an unique id for the node. /// The ExtensionNode.HasId property can be used to know if the 'id' has been /// specified by the developer or not. /// public string Id { get { return treeNode != null ? treeNode.Id : string.Empty; } } /// /// Location of this node in the extension tree. /// /// /// The node path is composed by the path of the extension point where it is defined, /// the identifiers of its parent nodes, and its own identifier. /// public string Path { get { return treeNode != null ? treeNode.GetPath () : string.Empty; } } /// /// Parent node of this node. /// public ExtensionNode Parent { get { if (treeNode != null && treeNode.Parent != null) return treeNode.Parent.ExtensionNode; else return null; } } /// /// Extension context to which this node belongs /// public ExtensionContext ExtensionContext { get { return treeNode.Context; } } /// /// Specifies whether the extension node has as an Id or not. /// /// /// It is not mandatory to specify an 'id' for a node. When none is provided, /// the add-in manager will automatically generate an unique id for the node. /// This property will return true if an 'id' was provided for the node, and /// false if the id was assigned by the add-in manager. /// public bool HasId { get { return !Id.StartsWith (ExtensionTree.AutoIdPrefix); } } internal void SetTreeNode (TreeNode node) { treeNode = node; } internal void SetData (AddinEngine addinEngine, string plugid, ExtensionNodeType nodeType, ModuleDescription module) { this.addinEngine = addinEngine; this.addinId = plugid; this.nodeType = nodeType; this.module = module; } internal string AddinId { get { return addinId; } } internal TreeNode TreeNode { get { return treeNode; } } /// /// The add-in that registered this extension node. /// /// /// This property provides access to the resources and types of the add-in that created this extension node. /// public RuntimeAddin Addin { get { if (addin == null && addinId != null) { if (!addinEngine.IsAddinLoaded (addinId)) addinEngine.LoadAddin (null, addinId, true); addin = addinEngine.GetAddin (addinId); if (addin != null) addin = addin.GetModule (module); } if (addin == null) throw new InvalidOperationException ("Add-in '" + addinId + "' could not be loaded."); return addin; } } /// /// Notifies that a child node of this node has been added or removed. /// /// /// The first time the event is subscribed, the handler will be called for each existing node. /// public event ExtensionNodeEventHandler ExtensionNodeChanged { add { extensionNodeChanged += value; foreach (ExtensionNode node in ChildNodes) { try { value (this, new ExtensionNodeEventArgs (ExtensionChange.Add, node)); } catch (Exception ex) { addinEngine.ReportError (null, node.Addin != null ? node.Addin.Id : null, ex, false); } } } remove { extensionNodeChanged -= value; } } /// /// Child nodes of this extension node. /// public ExtensionNodeList ChildNodes { get { if (childrenLoaded) return childNodes; try { if (treeNode.Children.Count == 0) { childNodes = ExtensionNodeList.Empty; return childNodes; } } catch (Exception ex) { addinEngine.ReportError (null, null, ex, false); childNodes = ExtensionNodeList.Empty; return childNodes; } finally { childrenLoaded = true; } List list = new List (); foreach (TreeNode cn in treeNode.Children) { // For each node check if it is visible for the current context. // If something fails while evaluating the condition, just ignore the node. try { if (cn.ExtensionNode != null && cn.IsEnabled) list.Add (cn.ExtensionNode); } catch (Exception ex) { addinEngine.ReportError (null, null, ex, false); } } if (list.Count > 0) childNodes = new ExtensionNodeList (list); else childNodes = ExtensionNodeList.Empty; return childNodes; } } /// /// Returns the child objects of a node. /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the /// TypeExtensionNode.GetInstance() method for each node. /// public object[] GetChildObjects () { return GetChildObjects (typeof(object), true); } /// /// Returns the child objects of a node. /// /// /// True if the method can reuse instances created in previous calls. /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if reuseCachedInstance is set to true). /// public object[] GetChildObjects (bool reuseCachedInstance) { return GetChildObjects (typeof(object), reuseCachedInstance); } /// /// Returns the child objects of a node (with type check). /// /// /// Type of the return array elements. /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the /// TypeExtensionNode.GetInstance(Type) method for each node. /// /// An InvalidOperationException exception is thrown if one of the found child objects is not a /// subclass of the provided type. /// public object[] GetChildObjects (Type arrayElementType) { return GetChildObjects (arrayElementType, true); } /// /// Returns the child objects of a node (casting to the specified type) /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the /// TypeExtensionNode.GetInstance() method for each node. /// public T[] GetChildObjects () { return (T[]) GetChildObjectsInternal (typeof(T), true); } /// /// Returns the child objects of a node (with type check). /// /// /// Type of the return array elements. /// /// /// True if the method can reuse instances created in previous calls. /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the TypeExtensionNode.CreateInstance(Type) /// method for each node (or TypeExtensionNode.GetInstance(Type) if reuseCachedInstance is set to true). /// /// An InvalidOperationException exception will be thrown if one of the found child objects is not a subclass /// of the provided type. /// public object[] GetChildObjects (Type arrayElementType, bool reuseCachedInstance) { return (object[]) GetChildObjectsInternal (arrayElementType, reuseCachedInstance); } /// /// Returns the child objects of a node (casting to the specified type). /// /// /// True if the method can reuse instances created in previous calls. /// /// /// An array of child objects. /// /// /// This method only works if all children of this node are of type Mono.Addins.TypeExtensionNode. /// The returned array is composed by all objects created by calling the TypeExtensionNode.CreateInstance() /// method for each node (or TypeExtensionNode.GetInstance() if reuseCachedInstance is set to true). /// public T[] GetChildObjects (bool reuseCachedInstance) { return (T[]) GetChildObjectsInternal (typeof(T), reuseCachedInstance); } Array GetChildObjectsInternal (Type arrayElementType, bool reuseCachedInstance) { ArrayList list = new ArrayList (ChildNodes.Count); for (int n=0; n /// Reads the extension node data /// /// /// The element containing the extension data /// /// /// This method can be overriden to provide a custom method for reading extension node data from an element. /// The default implementation reads the attributes if the element and assigns the values to the fields /// and properties of the extension node that have the corresponding [NodeAttribute] decoration. /// internal protected virtual void Read (NodeElement elem) { if (nodeType == null) return; NodeAttribute[] attributes = elem.Attributes; ReadObject (this, attributes, nodeType.Fields); if (nodeType.CustomAttributeMember != null) { object att = Activator.CreateInstance (nodeType.CustomAttributeMember.MemberType); ReadObject (att, attributes, nodeType.CustomAttributeFields); nodeType.CustomAttributeMember.SetValue (this, att); } } void ReadObject (object ob, NodeAttribute[] attributes, Dictionary fields) { if (fields == null) return; // Make a copy because we are going to remove fields that have been used fields = new Dictionary (fields); foreach (NodeAttribute at in attributes) { ExtensionNodeType.FieldData f; if (!fields.TryGetValue (at.name, out f)) continue; fields.Remove (at.name); object val; Type memberType = f.MemberType; if (memberType == typeof(string)) { if (f.Localizable) val = Addin.Localizer.GetString (at.value); else val = at.value; } else if (memberType == typeof(string[])) { string[] ss = at.value.Split (','); if (ss.Length == 0 && ss[0].Length == 0) val = new string [0]; else { for (int n=0; n 0) { // Check if one of the remaining fields is mandatory foreach (KeyValuePair e in fields) { ExtensionNodeType.FieldData f = e.Value; if (f.Required) throw new InvalidOperationException ("Required attribute '" + e.Key + "' not found."); } } } internal bool NotifyChildChanged () { if (!childrenLoaded) return false; ExtensionNodeList oldList = childNodes; childrenLoaded = false; bool changed = false; foreach (ExtensionNode nod in oldList) { if (ChildNodes [nod.Id] == null) { changed = true; OnChildNodeRemoved (nod); } } foreach (ExtensionNode nod in ChildNodes) { if (oldList [nod.Id] == null) { changed = true; OnChildNodeAdded (nod); } } if (changed) OnChildrenChanged (); return changed; } /// /// Called when the add-in that defined this extension node is actually loaded in memory. /// internal protected virtual void OnAddinLoaded () { } /// /// Called when the add-in that defined this extension node is being /// unloaded from memory. /// internal protected virtual void OnAddinUnloaded () { } /// /// Called when the children list of this node has changed. It may be due to add-ins /// being loaded/unloaded, or to conditions being changed. /// protected virtual void OnChildrenChanged () { } /// /// Called when a child node is added /// /// /// Added node. /// protected virtual void OnChildNodeAdded (ExtensionNode node) { if (extensionNodeChanged != null) extensionNodeChanged (this, new ExtensionNodeEventArgs (ExtensionChange.Add, node)); } /// /// Called when a child node is removed /// /// /// Removed node. /// protected virtual void OnChildNodeRemoved (ExtensionNode node) { if (extensionNodeChanged != null) extensionNodeChanged (this, new ExtensionNodeEventArgs (ExtensionChange.Remove, node)); } } /// /// An extension node with custom metadata /// /// /// This is the default type for extension nodes bound to a custom extension attribute. /// public class ExtensionNode: ExtensionNode where T:CustomExtensionAttribute { T data; /// /// The custom attribute containing the extension metadata /// [NodeAttribute] public T Data { get { return data; } internal set { data = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinLocalizerGettextAttribute.cs0000664000175000017500000000703712136523632030504 0ustar00directhexdirecthex00000000000000// // AddinLocalizerAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2010 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Declares a Gettext-based localizer for an add-in /// [AttributeUsage (AttributeTargets.Assembly)] public class AddinLocalizerGettextAttribute: Attribute { string catalog; string location; /// /// Initializes a new instance of the class. /// public AddinLocalizerGettextAttribute () { } /// /// Initializes a new instance of the class. /// /// /// Name of the catalog which contains the strings. /// public AddinLocalizerGettextAttribute (string catalog) { this.catalog = catalog; } /// /// Initializes a new instance of the class. /// /// /// Name of the catalog which contains the strings. /// /// /// Relative path to the location of the catalog. This path must be relative to the add-in location. /// /// /// The location path must contain a directory structure like this: /// /// {language-id}/LC_MESSAGES/{Catalog}.mo /// /// For example, the catalog for spanish strings would be located at: /// /// locale/es/LC_MESSAGES/some-addin.mo /// public AddinLocalizerGettextAttribute (string catalog, string location) { this.catalog = catalog; this.location = location; } /// /// Name of the catalog which contains the strings. /// public string Catalog { get { return this.catalog; } set { this.catalog = value; } } /// /// Relative path to the location of the catalog. This path must be relative to the add-in location. /// /// /// When not specified, the default value of this property is 'locale'. /// The location path must contain a directory structure like this: /// /// {language-id}/LC_MESSAGES/{Catalog}.mo /// /// For example, the catalog for spanish strings would be located at: /// /// locale/es/LC_MESSAGES/some-addin.mo /// public string Location { get { return this.location; } set { this.location = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins/GettextCatalog.cs0000664000175000017500000000302612136523632025300 0ustar00directhexdirecthex00000000000000// // GettextCatalog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { // TODO: Add real translation suport, which can work in Windows internal class GettextCatalog { public static string GetString (string str) { return str; } public static string GetString (string str, params object[] arguments) { return string.Format (GetString (str), arguments); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/ExtensionNodeList.cs0000664000175000017500000001162512136523632026003 0ustar00directhexdirecthex00000000000000// // ExtensionNodeList.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; namespace Mono.Addins { /// /// A list of extension nodes. /// public class ExtensionNodeList: IEnumerable { internal List list; internal static ExtensionNodeList Empty = new ExtensionNodeList (new List ()); internal ExtensionNodeList (List list) { this.list = list; } /// /// Returns the node in the specified index. /// /// /// The index. /// public ExtensionNode this [int n] { get { if (list == null) throw new System.IndexOutOfRangeException (); else return (ExtensionNode) list [n]; } } /// /// Returns the node with the specified ID. /// /// /// An id. /// public ExtensionNode this [string id] { get { if (list == null) return null; else { for (int n = list.Count - 1; n >= 0; n--) if (((ExtensionNode) list [n]).Id == id) return (ExtensionNode) list [n]; return null; } } } /// /// Gets an enumerator which enumerates all nodes in the list /// public IEnumerator GetEnumerator () { if (list == null) return ((IList)Type.EmptyTypes).GetEnumerator (); return list.GetEnumerator (); } /// /// Number of nodes of the collection. /// public int Count { get { return list == null ? 0 : list.Count; } } /// /// Copies all nodes to an array /// /// /// The target array /// /// /// Initial index where to copy to /// public void CopyTo (ExtensionNode[] array, int index) { if (list != null) list.CopyTo (array, index); } } /// /// A list of extension nodes. /// public class ExtensionNodeList: IEnumerable, IEnumerable where T: ExtensionNode { List list; internal static ExtensionNodeList Empty = new ExtensionNodeList (new List ()); internal ExtensionNodeList (List list) { this.list = list; } /// /// Returns the node in the specified index. /// /// /// The index. /// public T this [int n] { get { if (list == null) throw new System.IndexOutOfRangeException (); else return (T) list [n]; } } /// /// Returns the node with the specified ID. /// /// /// An id. /// public T this [string id] { get { if (list == null) return null; else { for (int n = list.Count - 1; n >= 0; n--) if (list [n].Id == id) return (T) list [n]; return null; } } } /// /// Gets an enumerator which enumerates all nodes in the list /// public IEnumerator GetEnumerator () { if (list == null) yield break; foreach (ExtensionNode n in list) yield return (T) n; } IEnumerator IEnumerable.GetEnumerator () { if (list == null) return ((IList)Type.EmptyTypes).GetEnumerator (); return list.GetEnumerator (); } /// /// Number of nodes of the collection. /// public int Count { get { return list == null ? 0 : list.Count; } } /// /// Copies all nodes to an array /// /// /// The target array /// /// /// Initial index where to copy to /// public void CopyTo (T[] array, int index) { if (list != null) list.CopyTo (array, index); } } } mono-addins-1.0/Mono.Addins/Mono.Addins/AddinPropertyAttribute.cs0000664000175000017500000000523512136523632027035 0ustar00directhexdirecthex00000000000000// // AddinPropertyAttribute.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins { /// /// Defines an add-in property /// [AttributeUsage (AttributeTargets.Assembly, AllowMultiple=true)] public class AddinPropertyAttribute: Attribute { /// /// Initializes a new instance of the class. /// /// /// Name of the property /// /// /// Value of the property /// public AddinPropertyAttribute (string name, string value): this (name, null, value) { } /// /// Initializes a new instance of the class. /// /// /// Name of the property /// /// /// Locale of the property. It can be null if the property is not bound to a locale. /// /// /// Value of the property /// public AddinPropertyAttribute (string name, string locale, string value) { Name = name; Locale = locale; Value = value; } /// /// Name of the property /// public string Name { get; set; } /// /// Locale of the property. It can be null if the property is not bound to a locale. /// public string Locale { get; set; } /// /// Value of the property /// public string Value { get; set; } } } mono-addins-1.0/Mono.Addins/Mono.Addins/InstanceExtensionNode.cs0000664000175000017500000000637712136523632026644 0ustar00directhexdirecthex00000000000000// // InstanceExtensionNode.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins { /// /// Base class for extension nodes which create extension objects /// public abstract class InstanceExtensionNode: ExtensionNode { object cachedInstance; /// /// Gets the extension object declared by this node /// /// /// Expected object type. An exception will be thrown if the object is not an instance of the specified type. /// /// /// The extension object /// /// /// The extension object is cached and the same instance will be returned at every call. /// public object GetInstance (Type expectedType) { object ob = GetInstance (); if (!expectedType.IsInstanceOfType (ob)) throw new InvalidOperationException (string.Format ("Expected subclass of type '{0}'. Found '{1}'.", expectedType, ob.GetType ())); return ob; } /// /// Gets the extension object declared by this node /// /// /// The extension object /// /// /// The extension object is cached and the same instance will be returned at every call. /// public object GetInstance () { if (cachedInstance == null) cachedInstance = CreateInstance (); return cachedInstance; } /// /// Creates a new extension object /// /// /// Expected object type. An exception will be thrown if the object is not an instance of the specified type. /// /// /// The extension object /// public object CreateInstance (Type expectedType) { object ob = CreateInstance (); if (!expectedType.IsInstanceOfType (ob)) throw new InvalidOperationException (string.Format ("Expected subclass of type '{0}'. Found '{1}'.", expectedType, ob.GetType ())); return ob; } /// /// Creates a new extension object /// /// /// The extension object /// public abstract object CreateInstance (); } } mono-addins-1.0/Mono.Addins/Makefile.in0000664000175000017500000004217112136523720021770 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mono-addins.pc.in $(top_srcdir)/Makefile.include \ $(top_srcdir)/xbuild.include ChangeLog subdir = ./Mono.Addins 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mono-addins.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/Mono.Addins.dll ASSEMBLY_NAME = Mono.Addins PC_FILES_IN = mono-addins.pc.in pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) EXTRA_DIST = \ $(wildcard $(ALL_FILES)) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) \ $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) ALL_CSPROJ = $(wildcard *.csproj) MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_FALSE@PROFILE_NAME = DebugNotGui @ENABLE_GUI_TRUE@PROFILE_NAME = Debug XBUILD = xbuild XBUILD_VERBOSITY = quiet XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES := $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES := $(wildcard $(ALL_FILES)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Mono.Addins/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Mono.Addins/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mono-addins.pc: $(top_builddir)/config.status $(srcdir)/mono-addins.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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: distclean-am -rm -f Makefile 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-data-local install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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 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: uninstall-binSCRIPTS uninstall-local \ uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-data-local 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-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-local uninstall-pkgconfigDATA install-data-local: gac-install uninstall-local: gac-uninstall $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/Mono.Addins/serializers.config0000664000175000017500000000136712136523632023452 0ustar00directhexdirecthex00000000000000 AddinSystemConfigurationReader AddinSystemConfigurationWriter true Origin.Core.Addins.Setup AddinSystemConfigurationReaderWriter.cs RepositoryReader RepositoryWriter true Origin.Core.Addins.Setup RepositoryReaderWriter.cs mono-addins-1.0/Mono.Addins/Mono.Addins.Serialization/0000775000175000017500000000000012136524043024642 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/Mono.Addins.Serialization/BinaryXmlWriter.cs0000664000175000017500000001420712136523632030302 0ustar00directhexdirecthex00000000000000// // BinaryXmlWriter.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Text; using System.IO; namespace Mono.Addins.Serialization { internal class BinaryXmlWriter { BinaryWriter writer; BinaryXmlTypeMap typeMap; Hashtable stringTable = new Hashtable (); public BinaryXmlWriter (Stream stream, BinaryXmlTypeMap typeMap) { this.typeMap = typeMap; writer = new BinaryWriter (stream); } public void WriteBeginElement (string name) { writer.Write (BinaryXmlReader.TagBeginElement); WriteString (name); } public void WriteEndElement () { writer.Write (BinaryXmlReader.TagEndElement); } void WriteValueHeader (string name, TypeCode type) { writer.Write (BinaryXmlReader.TagValue); WriteString (name); writer.Write ((byte) type); } public void WriteValue (string name, bool b) { WriteValueHeader (name, TypeCode.Boolean); writer.Write (b); } public void WriteValue (string name, string s) { WriteValueHeader (name, TypeCode.String); WriteString (s); } public void WriteValue (string name, char value) { WriteValueHeader (name, TypeCode.Char); writer.Write (value); } public void WriteValue (string name, byte value) { WriteValueHeader (name, TypeCode.Byte); writer.Write (value); } public void WriteValue (string name, short value) { WriteValueHeader (name, TypeCode.Int16); writer.Write (value); } public void WriteValue (string name, int value) { WriteValueHeader (name, TypeCode.Int32); writer.Write (value); } public void WriteValue (string name, long value) { WriteValueHeader (name, TypeCode.Int64); writer.Write (value); } public void WriteValue (string name, DateTime value) { WriteValueHeader (name, TypeCode.DateTime); writer.Write (value.Ticks); } public void WriteValue (string name, object ob) { TypeCode t = ob != null ? Type.GetTypeCode (ob.GetType ()) : TypeCode.Empty; WriteValueHeader (name, t); if (t != TypeCode.Empty) WriteValue (ob, t); } public void WriteValue (string name, IBinaryXmlElement ob) { if (ob == null) WriteValueHeader (name, TypeCode.Empty); else { WriteValueHeader (name, TypeCode.Object); WriteObject (ob); } } void WriteValue (object ob) { if (ob == null) writer.Write ((byte) TypeCode.Empty); else { TypeCode t = Type.GetTypeCode (ob.GetType ()); writer.Write ((byte) t); WriteValue (ob, t); } } void WriteValue (object ob, TypeCode t) { switch (t) { case TypeCode.Boolean: writer.Write ((bool)ob); break; case TypeCode.Char: writer.Write ((char)ob); break; case TypeCode.SByte: writer.Write ((sbyte)ob); break; case TypeCode.Byte: writer.Write ((byte)ob); break; case TypeCode.Int16: writer.Write ((short)ob); break; case TypeCode.UInt16: writer.Write ((ushort)ob); break; case TypeCode.Int32: writer.Write ((int)ob); break; case TypeCode.UInt32: writer.Write ((uint)ob); break; case TypeCode.Int64: writer.Write ((long)ob); break; case TypeCode.UInt64: writer.Write ((ulong)ob); break; case TypeCode.Single: writer.Write ((float)ob); break; case TypeCode.Double: writer.Write ((double)ob); break; case TypeCode.DateTime: writer.Write (((DateTime)ob).Ticks); break; case TypeCode.String: WriteString ((string)ob); break; case TypeCode.Object: WriteObject (ob); break; default: throw new InvalidOperationException ("Unexpected value type: " + t); } } void WriteObject (object ob) { if (ob == null) writer.Write (BinaryXmlReader.TagObjectNull); else { IBinaryXmlElement elem = ob as IBinaryXmlElement; if (elem != null) { writer.Write (BinaryXmlReader.TagObject); WriteString (typeMap.GetTypeName (elem)); elem.Write (this); WriteEndElement (); } else if (ob is IDictionary) { IDictionary dict = (IDictionary) ob; writer.Write (BinaryXmlReader.TagObjectDictionary); writer.Write (dict.Count); foreach (DictionaryEntry e in dict) { WriteValue (e.Key); WriteValue (e.Value); } } else if (ob is ICollection) { ICollection col = (ICollection) ob; writer.Write (BinaryXmlReader.TagObjectArray); if (ob is Array) writer.Write ((byte) Type.GetTypeCode (ob.GetType().GetElementType ())); else writer.Write ((byte) TypeCode.Object); writer.Write (col.Count); foreach (object e in col) { WriteValue (e); } } else throw new InvalidOperationException ("Invalid object type: " + ob.GetType ()); } } void WriteString (string s) { if (s == null) writer.Write (-1); else { object ind = stringTable [s]; if (ind == null) { stringTable.Add (s, stringTable.Count); byte[] bytes = Encoding.UTF8.GetBytes (s); writer.Write (bytes.Length); writer.Write (bytes); } else { // +2 because -1 is reserved for null, and 0 is considered positive writer.Write (-((int)ind + 2)); } } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Serialization/BinaryXmlTypeMap.cs0000664000175000017500000000417212136523632030405 0ustar00directhexdirecthex00000000000000// // BinaryXmlTypeMap.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Serialization { internal class BinaryXmlTypeMap { Hashtable types = new Hashtable (); Hashtable names = new Hashtable (); public BinaryXmlTypeMap () { } public BinaryXmlTypeMap (params Type[] types) { foreach (Type t in types) RegisterType (t); } public void RegisterType (Type type) { RegisterType (type, type.Name); } public void RegisterType (Type type, string name) { names [type] = name; types [name] = type; } public string GetTypeName (object ob) { string s = (string) names [ob.GetType ()]; if (s == null) throw new InvalidOperationException ("Type not registered: " + ob.GetType ()); return s; } public IBinaryXmlElement CreateObject (string typeName) { Type t = (Type) types [typeName]; if (t == null) return null; return (IBinaryXmlElement) Activator.CreateInstance (t,true); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Serialization/BinaryXmlReader.cs0000664000175000017500000003432212136523632030230 0ustar00directhexdirecthex00000000000000// // BinaryXmlReader.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Text; using System.IO; namespace Mono.Addins.Serialization { internal class BinaryXmlReader { BinaryReader reader; internal const byte TagEndOfFile = 0; internal const byte TagBeginElement = 1; internal const byte TagEndElement = 2; internal const byte TagValue = 4; internal const byte TagObject = 5; internal const byte TagObjectArray = 6; internal const byte TagObjectDictionary = 7; internal const byte TagObjectNull = 8; byte currentType; string currentName; ArrayList stringTable = new ArrayList (); BinaryXmlTypeMap typeMap; object contextData; bool ignoreDesc; public BinaryXmlReader (Stream stream, BinaryXmlTypeMap typeMap) { reader = new BinaryReader (stream); this.typeMap = typeMap; ReadNext (); } public BinaryXmlTypeMap TypeMap { get { return typeMap; } set { typeMap = value; } } public object ContextData { get { return contextData; } set { contextData = value; } } // Returns 'true' if description data must be ignored when reading the contents of a file public bool IgnoreDescriptionData { get { return ignoreDesc; } set { ignoreDesc = value; } } void ReadNext () { int b = reader.BaseStream.ReadByte (); if (b == -1) { currentType = TagEndOfFile; return; } currentType = (byte) b; if (currentType == TagBeginElement || currentType == TagValue) currentName = ReadString (); } string ReadString () { // The first integer means: // >=0: string of the specified length // -1: null string // <-1: a string from the string table int len = reader.ReadInt32 (); if (len == -1) return null; if (len < -1) return (string) stringTable [-(len + 2)]; byte[] bytes = new byte [len]; int n = 0; while (n < len) { int read = reader.Read (bytes, n, len - n); if (read == 0) throw new InvalidOperationException ("Length too high for string: " + len); n += read; } string s = Encoding.UTF8.GetString (bytes); stringTable.Add (s); return s; } public string LocalName { get { return currentName; } } public bool IsElement { get { return currentType == TagBeginElement; } } public bool IsValue { get { return currentType == TagValue; } } TypeCode ReadValueType (TypeCode type) { if (currentType != TagValue) throw new InvalidOperationException ("Reader not positioned on a value."); TypeCode t = (TypeCode) reader.ReadByte (); if (t != type && type != TypeCode.Empty) throw new InvalidOperationException ("Invalid value type. Expected " + type + ", found " + t); return t; } public string ReadStringValue (string name) { if (!SkipToValue (name)) return null; return ReadStringValue (); } public string ReadStringValue () { if (currentType != TagValue) throw new InvalidOperationException ("Reader not positioned on a value."); TypeCode t = (TypeCode) reader.ReadByte (); if (t == TypeCode.Empty) { ReadNext (); return null; } if (t != TypeCode.String) throw new InvalidOperationException ("Invalid value type. Expected String, found " + t); string s = ReadString (); ReadNext (); return s; } public bool ReadBooleanValue (string name) { if (!SkipToValue (name)) return false; return ReadBooleanValue (); } public bool ReadBooleanValue () { ReadValueType (TypeCode.Boolean); bool value = reader.ReadBoolean (); ReadNext (); return value; } public char ReadCharValue (string name) { if (!SkipToValue (name)) return (char)0; return ReadCharValue (); } public char ReadCharValue () { ReadValueType (TypeCode.Char); char value = reader.ReadChar (); ReadNext (); return value; } public byte ReadByteValue (string name) { if (!SkipToValue (name)) return (byte)0; return ReadByteValue (); } public byte ReadByteValue () { ReadValueType (TypeCode.Byte); byte value = reader.ReadByte (); ReadNext (); return value; } public short ReadInt16Value (string name) { if (!SkipToValue (name)) return (short)0; return ReadInt16Value (); } public short ReadInt16Value () { ReadValueType (TypeCode.Int16); short value = reader.ReadInt16 (); ReadNext (); return value; } public int ReadInt32Value (string name) { if (!SkipToValue (name)) return 0; return ReadInt32Value (); } public int ReadInt32Value () { ReadValueType (TypeCode.Int32); int value = reader.ReadInt32 (); ReadNext (); return value; } public long ReadInt64Value (string name) { if (!SkipToValue (name)) return (long)0; return ReadInt64Value (); } public long ReadInt64Value () { ReadValueType (TypeCode.Int64); long value = reader.ReadInt64 (); ReadNext (); return value; } public DateTime ReadDateTimeValue (string name) { if (!SkipToValue (name)) return DateTime.MinValue; return ReadDateTimeValue (); } public DateTime ReadDateTimeValue () { ReadValueType (TypeCode.DateTime); DateTime value = new DateTime (reader.ReadInt64 ()); ReadNext (); return value; } public object ReadValue (string name) { if (!SkipToValue (name)) return null; return ReadValue (); } public object ReadValue () { object res = ReadValueInternal (); ReadNext (); return res; } public object ReadValue (string name, object targetInstance) { if (!SkipToValue (name)) return null; return ReadValue (targetInstance); } public object ReadValue (object targetInstance) { TypeCode t = (TypeCode) reader.ReadByte (); if (t == TypeCode.Empty) { ReadNext (); return null; } if (t != TypeCode.Object) throw new InvalidOperationException ("Invalid value type. Expected Object, found " + t); object res = ReadObject (targetInstance); ReadNext (); return res; } object ReadValueInternal () { TypeCode t = (TypeCode) reader.ReadByte (); if (t == TypeCode.Empty) return null; return ReadValueInternal (t); } object ReadValueInternal (TypeCode t) { object res; switch (t) { case TypeCode.Boolean: res = reader.ReadBoolean (); break; case TypeCode.Char: res = reader.ReadChar (); break; case TypeCode.SByte: res = reader.ReadSByte (); break; case TypeCode.Byte: res = reader.ReadByte (); break; case TypeCode.Int16: res = reader.ReadInt16 (); break; case TypeCode.UInt16: res = reader.ReadUInt16 (); break; case TypeCode.Int32: res = reader.ReadInt32 (); break; case TypeCode.UInt32: res = reader.ReadUInt32 (); break; case TypeCode.Int64: res = reader.ReadInt64 (); break; case TypeCode.UInt64: res = reader.ReadUInt64 (); break; case TypeCode.Single: res = reader.ReadSingle (); break; case TypeCode.Double: res = reader.ReadDouble (); break; case TypeCode.DateTime: res = new DateTime (reader.ReadInt64 ()); break; case TypeCode.String: res = ReadString (); break; case TypeCode.Object: res = ReadObject (null); break; case TypeCode.Empty: res = null; break; default: throw new InvalidOperationException ("Unexpected value type: " + t); } return res; } bool SkipToValue (string name) { do { if ((currentType == TagBeginElement || currentType == TagValue) && currentName == name) return true; if (EndOfElement) return false; Skip (); } while (true); } public void ReadBeginElement () { if (currentType != TagBeginElement) throw new InvalidOperationException ("Reader not positioned on an element."); ReadNext (); } public void ReadEndElement () { if (currentType != TagEndElement) throw new InvalidOperationException ("Reader not positioned on an element."); ReadNext (); } public bool EndOfElement { get { return currentType == TagEndElement; } } public void Skip () { if (currentType == TagValue) ReadValue (); else if (currentType == TagEndElement) ReadNext (); else if (currentType == TagBeginElement) { ReadNext (); while (!EndOfElement) Skip (); ReadNext (); } } object ReadObject (object targetInstance) { byte ot = reader.ReadByte (); if (ot == TagObjectNull) { return null; } else if (ot == TagObject) { string tname = ReadString (); IBinaryXmlElement ob; if (targetInstance != null) { ob = targetInstance as IBinaryXmlElement; if (ob == null) throw new InvalidOperationException ("Target instance has an invalid type. Expected an IBinaryXmlElement implementation."); } else { ob = typeMap.CreateObject (tname); } ReadNext (); ob.Read (this); while (currentType != TagEndElement) Skip (); return ob; } else if (ot == TagObjectArray) { TypeCode tc = (TypeCode) reader.ReadByte (); int len = reader.ReadInt32 (); if (targetInstance != null) { IList list = targetInstance as IList; if (list == null) throw new InvalidOperationException ("Target instance has an invalid type. Expected an IList implementation."); for (int n=0; n"); DumpElement (ind + IndSize); Console.WriteLine (new string (' ', ind) + ""); } } public void DumpElement (int ind) { ReadNext (); while (currentType != TagEndElement) { Dump (ind + IndSize); ReadNext (); } } void DumpValue (int ind) { TypeCode t = (TypeCode) reader.ReadByte (); if (t != TypeCode.Object) { object ob = ReadValueInternal (t); if (ob == null) ob = "(null)"; Console.Write (ob); } else { byte ot = reader.ReadByte (); switch (ot) { case TagObjectNull: { Console.Write ("(null)"); break; } case TagObject: { string tname = ReadString (); Console.WriteLine ("(" + tname + ")"); DumpElement (ind + IndSize); break; } case TagObjectArray: { TypeCode tc = (TypeCode) reader.ReadByte (); int len = reader.ReadInt32 (); Console.WriteLine ("(" + tc + "[" + len + "])"); for (int n=0; n mono-addins-1.0/Mono.Addins/policy.0.3.config0000664000175000017500000000054612136524024022706 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins/obj/0000775000175000017500000000000012136524043020467 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/obj/Debug/0000775000175000017500000000000012136524043021515 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/obj/Debug/Mono.Addins.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000030012136524037031777 0ustar00directhexdirecthex00000000000000/tmp/mono-addins/bin/Mono.Addins.dll.mdb /tmp/mono-addins/bin/Mono.Addins.dll /tmp/mono-addins/Mono.Addins/obj/Debug/Mono.Addins.dll /tmp/mono-addins/Mono.Addins/obj/Debug/Mono.Addins.dll.mdb mono-addins-1.0/Mono.Addins/ChangeLog0000664000175000017500000012205712136523632021501 0ustar00directhexdirecthex000000000000002010-10-14 Lluis Sanchez Gual * AddinScanner.cs: Don't inherit CustomExtension attributes. The attribute must be explicitly applied to classes to be marked as extensions. 2010-07-01 Lluis Sanchez Gual * Mono.Addins.csproj: * Mono.Addins.Description/Extension.cs: * Mono.Addins.Description/Dependency.cs: * Mono.Addins.Description/AddinFlags.cs: * Mono.Addins.Description/ExtensionPoint.cs: * Mono.Addins.Description/AddinDependency.cs: * Mono.Addins.Description/AddinDescription.cs: * Mono.Addins.Description/ExtensionNodeSet.cs: * Mono.Addins.Description/NativeDependency.cs: * Mono.Addins.Localization/IAddinLocalizer.cs: * Mono.Addins.Description/ObjectDescription.cs: * Mono.Addins.Description/ModuleDescription.cs: * Mono.Addins.Description/ExtensionNodeType.cs: * Mono.Addins.Description/NodeTypeAttribute.cs: * Mono.Addins.Description/AssemblyDependency.cs: * Mono.Addins.Description/ExtensionCollection.cs: * Mono.Addins.Description/DependencyCollection.cs: * Mono.Addins.Localization/IPluralAddinLocalizer.cs: * Mono.Addins.Localization/IAddinLocalizerFactory.cs: * Mono.Addins.Description/ExtensionNodeDescription.cs: * Mono.Addins.Description/ExtensionPointCollection.cs: * Mono.Addins.Description/ConditionTypeDescription.cs: * Mono.Addins.Description/ExtensionNodeSetCollection.cs: * Mono.Addins.Description/ModuleDescriptionCollection.cs: * Mono.Addins.Description/NodeTypeAttributeCollection.cs: * Mono.Addins.Description/ExtensionNodeTypeCollection.cs: * Mono.Addins.Description/ObjectDescriptionCollection.cs: * Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs: * Mono.Addins.Description/ConditionTypeDescriptionCollection.cs: Added documentation. 2010-06-17 Lluis Sanchez Gual * Mono.Addins/NodeElement.cs: * Mono.Addins/RuntimeAddin.cs: * Mono.Addins/IProgressStatus.cs: * Mono.Addins/IAddinInstaller.cs: * Mono.Addins/TypeExtensionNode.cs: * Mono.Addins/ExtensionNodeList.cs: * Mono.Addins/InstanceExtensionNode.cs: * Mono.Addins/NodeAttributeAttribute.cs: * Mono.Addins/ExtensionNodeAttribute.cs: * Mono.Addins/ExtensionPointAttribute.cs: * Mono.Addins/ImportAddinFileAttribute.cs: * Mono.Addins/MissingDependencyException.cs: * Mono.Addins/TypeExtensionPointAttribute.cs: * Mono.Addins/ExtensionNodeChildAttribute.cs: * Mono.Addins/ImportAddinAssemblyAttribute.cs: Added some documentation. 2010-05-27 Lluis Sanchez Gual * Mono.Addins/AddinManager.cs: * Mono.Addins/ConditionType.cs: * Mono.Addins/ExtensionNode.cs: * Mono.Addins/ExtensionContext.cs: * Mono.Addins/ExtensionAttribute.cs: * Mono.Addins/AddinRootAttribute.cs: * Mono.Addins/ConsoleProgressStatus.cs: * Mono.Addins/CustomExtensionAttribute.cs: * Mono.Addins/ExtensionAttributeAttribute.cs: More documentation. 2010-05-27 Lluis Sanchez Gual * Mono.Addins/AddinEngine.cs: * Mono.Addins/AddinManager.cs: * Mono.Addins/AddinRegistry.cs: * Mono.Addins/AddinEventArgs.cs: * Mono.Addins/AddinLocalizer.cs: * Mono.Addins/AddinAttribute.cs: * Mono.Addins/AddinErrorEventArgs.cs: * Mono.Addins/AddinModuleAttribute.cs: * Mono.Addins/AddinAuthorAttribute.cs: * Mono.Addins/AddinDependencyAttribute.cs: * Mono.Addins/AddinLocalizerGettextAttribute.cs: Added some API documentation. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanResult.cs: Properly resolve Mono.Addins. 2010-05-25 Lluis Sanchez Gual * Mono.Addins/AddinManager.cs: * Mono.Addins/ExtensionContext.cs: Added methods for subscribing type-bound extension points. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.csproj: Add Debug and Release configurations. * Mono.Addins.Database/AddinScanner.cs: Fixed node type parsing issue with TypeExtensionPointAttribute. 2010-05-21 Lluis Sanchez Gual * Mono.Addins.Database/AddinUpdateData.cs: When resolving extension from an optional module, include dependencies defined in the main module. * Mono.Addins.Database/SetupDomain.cs: Flush. * Mono.Addins.Database/AddinScanner.cs: Look for assembly imports in the main assembly. 2010-05-21 Lluis Sanchez Gual * Mono.Addins/ExtensionNode.cs: * Mono.Addins/ExtensionTree.cs: Data extension points bound to an attribute now generate nodes of type ExtensionNode * Mono.Addins/Addin.cs: Added some docs. * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/ExtensionNodeAttribute.cs: * Mono.Addins.Database/AddinUpdateData.cs: * Mono.Addins.Description/ExtensionNodeType.cs: Changed name of property (for consistency) * Mono.Addins/ExtensionPointAttribute.cs: Don't set a default node name. The default name is assigned while scanning. * Mono.Addins.Database/DefaultAssemblyReflector.cs: This class should not be public. 2010-05-20 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.csproj: Updated. * Mono.Addins/TreeNode.cs: * Mono.Addins/AddinEngine.cs: * Mono.Addins/RuntimeAddin.cs: * Mono.Addins/AddinManager.cs: * Mono.Addins/ExtensionTree.cs: * Mono.Addins/ExtensionNode.cs: * Mono.Addins/ConditionType.cs: * Mono.Addins/AddinRegistry.cs: * Mono.Addins/ExtensionContext.cs: * Mono.Addins/AddinSessionService.cs: * Mono.Addins.Database/AddinDatabase.cs: * Mono.Addins.Description/Dependency.cs: * Mono.Addins.Description/AddinDependency.cs: * Mono.Addins.Description/NativeDependency.cs: * Mono.Addins.Description/AssemblyDependency.cs: New AddinEngine class, which can be used to support several engines in a single domain. * Mono.Addins/AddinAttribute.cs: * Mono.Addins/AddinModuleAttribute.cs: * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/ImportAddinFileAttribute.cs: * Mono.Addins/ImportAddinAssemblyAttribute.cs: Added support for new add-in declaration attributes. * Mono.Addins/AddinCategoryAttribute.cs: Removed. * Mono.Addins/ExtensionPointAttribute.cs: * Mono.Addins/TypeExtensionPointAttribute.cs: Use a better name for the custom attribute type property. * Mono.Addins.Database/IAssemblyReflector.cs: * Mono.Addins.Database/DefaultAssemblyReflector.cs: Added methods for getting resources from an assembly. 2010-03-30 Lluis Sanchez Gual * Mono.Addins.Serialization/BinaryXmlReader.cs: Properly detect EOF. * Mono.Addins/Addin.cs: If a file is corrupted and can't be read, delete it so that it can be properly regenerated. 2010-03-30 Lluis Sanchez Gual * Mono.Addins.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual * Mono.Addins.csproj: * Mono.Addins/TypeExtensionNode.cs: * Mono.Addins/AddinAuthorAttribute.cs: * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/CustomExtensionAttribute.cs: * Mono.Addins.Database/IAssemblyReflector.cs: * Mono.Addins/ExtensionAttributeAttribute.cs: Make sure the solution builds on MS.NET 2.0. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: Fix bug #541661 - Assemblies with capital .DLL cannot be loaded. 2010-03-26 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.csproj: * Mono.Addins/AddinAttribute.cs: * Mono.Addins/AddinAuthorAttribute.cs: * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/AddinCategoryAttribute.cs: * Mono.Addins/AddinLocalizerGettextAttribute.cs: Allow specifying some add-in properties using attribtues. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins.Description/AddinDescription.cs: Added support for multiple .addin.xml files in a single assembly. 2010-03-26 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.csproj: * Mono.Addins/AddinManager.cs: * Mono.Addins/ExtensionNode.cs: * Mono.Addins/ExtensionTree.cs: * Mono.Addins/ExtensionContext.cs: * Mono.Addins/TypeExtensionNode.cs: * Mono.Addins/ExtensionNodeList.cs: * Mono.Addins/ExtensionAttribute.cs: * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins/ExtensionNodeAttribute.cs: * Mono.Addins/NodeAttributeAttribute.cs: * Mono.Addins/ExtensionPointAttribute.cs: * Mono.Addins.Database/AddinUpdateData.cs: * Mono.Addins/CustomExtensionAttribute.cs: * Mono.Addins/ExtensionAttributeAttribute.cs: * Mono.Addins.Database/IAssemblyReflector.cs: * Mono.Addins/TypeExtensionPointAttribute.cs: * Mono.Addins.Description/ExtensionNodeType.cs: * Mono.Addins.Database/DefaultAssemblyReflector.cs: * Mono.Addins.Description/ExtensionNodeDescription.cs: Allow using custom attributes for specifying extension node metadata. * Mono.Addins.Database/AddinDatabase.cs: Consolidate extensions before saving the final add-in descriptions. That means merging extensions with the same path and making sure the extension nodes have a correct ordering. 2010-03-25 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: Removed special handling of type references inside add-in roots. Type references will now be resolved like in the add-ins, when mapping the extensions. 2010-03-01 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Let's use app domains for mono too. 2010-02-26 Lluis Sanchez Gual * Mono.Addins/ExtensionContext.cs: * Mono.Addins.Description/ExtensionPoint.cs: Use generics. * Mono.Addins.Description/ExtensionNodeDescription.cs: Fix bug in RemoteAttribute. 2010-02-22 Lluis Sanchez Gual * Mono.Addins.csproj: Update. * Mono.Addins/TreeNode.cs: * Mono.Addins/RuntimeAddin.cs: * Mono.Addins/ExtensionTree.cs: * Mono.Addins.Description/ModuleDescription.cs: Improved lazy loading of optional modules. * Mono.Addins/AddinManager.cs: * Mono.Addins/ExtensionContext.cs: * Mono.Addins/ExtensionNodeList.cs: Added some generic methods for querying extension points. * Mono.Addins/ExtensionNode.cs: Improved lazy loading of optional modules. Added some generic methods for querying extension points. * Mono.Addins.Description/ObjectDescriptionCollection.cs: Added Insert method. 2010-02-12 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: When loading the assemblies of an add-in, make sure the assemblies of the add-ins on which it depends are also loaded. 2010-02-11 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: Remove debug spew. 2010-02-09 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: * Mono.Addins/AddinSessionService.cs: Improve delayed loading of assemblies. 2010-01-11 Lluis Sanchez Gual * Mono.Addins/AddinManager.cs: * Mono.Addins/AddinRegistry.cs: Update the registry when the domain of a directory can't be retrieved for some reason (for example, if the registry has been cleaned) 2009-11-18 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Add missing null check. 2009-11-13 Lluis Sanchez Gual * Mono.Addins.Description/Extension.cs: Allow Not condition. * Mono.Addins.Database/AddinUpdateData.cs: Added some verbose logging. * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins.Database/AddinDatabase.cs: * Mono.Addins.Database/AddinScanResult.cs: Split the AddinsToUpdateRelation list in two. AddinsToUpdate contains addins that have been modified and whose extensions have to be registered again. AddinsToUpdateRelation now contains addins which have not been directly modified, but which are dependencies of modified add-ins. The extensions of those add-ins won't be processed, they will just include the new extensions from the updated add-ins. * Mono.Addins.Database/SetupDomain.cs: Remove debug messages. 2009-10-05 Lluis Sanchez Gual * Mono.Addins/AddinSessionService.cs: Pre-jit the assembly loader hook. 2009-09-01 Lluis Sanchez Gual * AssemblyInfo.cs: Bump Mono.Addins version. 2009-08-20 Lluis Sanchez Gual * Makefile.am: Added a new project which Implements an msbuild task for resolving add-in references. 2009-08-19 Lluis Sanchez Gual * Mono.Addins/ExtensionContext.cs: Fix potentiall nullref. 2009-08-19 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs: Allow reading add-in manifests even if the registry is not fully initialized. 2009-08-19 Lluis Sanchez Gual * Mono.Addins.csproj: Update target framework to 2.0. 2009-07-31 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: Properly read InserBefore and InsertAfter attribute properties. Patch by Levi Bard. 2009-05-28 Lluis Sanchez Gual * Mono.Addins.csproj: Properly sign assemblies. 2009-05-27 Lluis Sanchez Gual * Makefile.am: Remove startup class option. * Mono.Addins.Database/SetupProcess.cs: * Mono.Addins.Database/AddinDatabase.cs: Use a generated assembly instead of the dll to execute the scanner in a separate process. 2009-04-15 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: New overload for GetFilePath. * Mono.Addins/AddinSessionService.cs: Improve error reporting when the description of an add-in can't be loaded. * Mono.Addins.Database/Util.cs: * Mono.Addins/AddinRegistry.cs: Allow using special folder names in all paths. E.g. [ApplicationData]/MonoDevelop. It can be used when initializing the add-in engine or in .addins files. * Mono.Addins/Addin.cs: Write errors when loading a description. 2009-02-16 Lluis Sanchez Gual * Mono.Addins/ExtensionNodeChildAttribute.cs: Make sure the ExtensionNodeTypeName property is set when using the attribute constructor. 2009-02-06 Lluis Sanchez Gual * Makefile.am: * Mono.Addins.csproj: Updated. * Mono.Addins.Database/AddinScanner.cs: * Mono.Addins.Description/AddinDescription.cs: BasePath is now public. * Mono.Addins.Database/Util.cs: Added methods for checking if the app is running on mono. * Mono.Addins.Database/SetupDomain.cs: * Mono.Addins.Database/SetupProcess.cs: * Mono.Addins.Database/ISetupHandler.cs: * Mono.Addins.Database/AddinDatabase.cs: Added support for scanning the addins in a separate appdomain instead of a separate process. 2009-02-06 Lluis Sanchez Gual * Mono.Addins/ExtensionNode.cs: Improve error message. 2009-02-06 Lluis Sanchez Gual * Mono.Addins/ConditionType.cs: * Mono.Addins/ExtensionTree.cs: Add support for Not condition. 2008-11-10 Lluis Sanchez Gual * mono-addins.pc.in: Respect custom libdir during ./configure. Fixes bug #443205. Patch by Diego Pettenò. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-11-04 Lluis Sanchez Gual * Mono.Addins.csproj: Generate a library, not an exe. 2008-10-31 Lluis Sanchez Gual * Mono.Addins/ExtensionNode.cs: Improve error reporting. 2008-09-23 Lluis Sanchez Gual * Mono.Addins.Description/AddinDescription.cs, Mono.Addins/AddinRegistry.cs: Added methods which allow reading a manifest from a stream. 2008-09-03 Lluis Sanchez Gual * Mono.Addins/ExtensionNode.cs: Fix potential race. * Mono.Addins.Database/AddinScanResult.cs: Set the changesFound flag when all data needs to be regenerated. 2008-08-22 Lluis Sanchez Gual * Mono.Addins.csproj, Mono.Addins.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-08-18 Lluis Sanchez Gual * Mono.Addins/AddinSessionService.cs, Mono.Addins/TreeNode.cs, Mono.Addins/Addin.cs, Mono.Addins/ExtensionContext.cs: When the registry is updated in memory, reset cached data from all extension contexts. * Mono.Addins.Database/AddinDatabase.cs: Optimized Update method. The call to GetInstalledAddins loads all manifests when the provided AddinType is not All. Avoided using it. 2008-07-16 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: When a new domain needs to be assigned to a folder, try to reuse the startup domain, if it is set. 2008-07-16 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs, Mono.Addins.Database/AddinScanFolderInfo.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinScanner.cs: Properly assign the domain when scanning an application for the first time. 2008-07-15 Lluis Sanchez Gual * Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/ModuleDescription.cs, Mono.Addins.Database/AddinScanFolderInfo.cs, Mono.Addins.Database/AddinScanResult.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinScanner.cs: Add support for specifying paths to exclude in .addins files and in add-in manifests. * Mono.Addins.Database/Util.cs: Make sure window paths are converted to unix paths when running on unix, and vice-versa. 2008-07-15 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs, Mono.Addins.Database/AddinScanResult.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinScanner.cs: When updating the registry, only scan folders which belong to the current domain. * Mono.Addins/ExtensionContext.cs: Fix warning. 2008-07-09 Lluis Sanchez Gual * Mono.Addins/ExtensionContext.cs: Added missing null check. 2008-07-07 Lluis Sanchez Gual * Mono.Addins.Database/SetupProcess.cs: Make sure no console window is created when launching the scanner. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanFolderInfo.cs, Mono.Addins.Database/FileDatabase.cs: Fix problem in windows, where the path of folder info files could exceed the max allowed path length. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.mdp, Makefile.am, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/AddinFlags.cs: Added flags property to AddinDescription. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.Database/Util.cs: Make sure GetStringHashCode never throws an arithmentic overflow exception. Patch by Lauris BukÅ¡is-Haberkorns. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.mdp: Updated. * Mono.Addins/ExtensionContext.cs: For consistency, the ExtensionEvent event must be fired even for extension points which have not yet been loaded. 2008-04-07 Lluis Sanchez Gual * Mono.Addins.csproj: Added missing files. * Mono.Addins/ExtensionNode.cs: When subscribing the extension changed event, fire it for existing nodes, but only fire for the new handler. 2008-02-25 Lluis Sanchez Gual * Mono.Addins/TypeExtensionNode.cs: Added property for getting the type of an extension node. Based on a patch by Brad Taylor. 2008-02-18 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs: Allow getting the startup path of the registry. * Mono.Addins.Description/AddinDescription.cs: Improve error message. * Mono.Addins.Database/AddinDatabase.cs: Use the startup patch provided by the registry, not the global one. 2008-02-15 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs: Minor fixes. * Mono.Addins/AddinLocalizer.cs: Ouch, format arguments of GetString should have been objects, not strings. * Mono.Addins.Description/NodeTypeAttribute.cs, Mono.Addins.Description/ExtensionNodeType.cs, Mono.Addins.Description/ExtensionPoint.cs, Mono.Addins.Description/ConditionTypeDescription.cs, Mono.Addins.Description/ExtensionNodeSet.cs: Implemented CopyFrom. * Mono.Addins.Description/AddinDescription.cs: Set global domain to manifests read from xml files. * Mono.Addins.Description/ExtensionNodeDescription.cs: Remove insertbefore and insertafter attributes when set to an empty string. * Mono.Addins.Database/AddinScanner.cs: Set a domain for files parsed with ScanSingleFile. * Mono.Addins.Database/DefaultAssemblyReflector.cs: Fix bug in GetCustomAttribute. 2008-02-11 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Fix add-in scan issue. Avoid updating the same add-in twice. 2008-02-06 Lluis Sanchez Gual * AssemblyInfo.cs, Mono.Addins.mdp, Mono.Addins/NodeAttributeAttribute.cs, Mono.Addins/TypeExtensionPointAttribute.cs, Mono.Addins/ExtensionPointAttribute.cs, Mono.Addins/ExtensionNodeChildAttribute.cs, Makefile.am, Mono.Addins.Database/IAssemblyReflector.cs, Mono.Addins.Database/AddinScanResult.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinScanner.cs, Mono.Addins.Database/DefaultAssemblyReflector.cs: Added support for pluggable add-in assembly reflectors. Implemented an add-in assembly reflector based on Cecil. 2008-01-21 Lluis Sanchez Gual * Mono.Addins/ExtensionTree.cs: Since Mono r93079, GetFields don't return private fields from base classes. Fixed the code to work with the new behavior. 2008-01-07 Lluis Sanchez Gual * Mono.Addins.csproj: Updated VS solution files. Patch by Andrés G. Aragoneses. 2007-12-15 Lluis Sanchez Gual * mono-addins.pc.in: Update assembly paths. 2007-12-12 Lluis Sanchez Gual * Makefile.am: Generate and install policy files for old Mono.Addins versions. * Mono.Addins.Database/AddinScanner.cs: Improved reporting of reflection exceptions. 2007-12-11 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: The addinstoUpdate list may contain add-in with a version not installed (e.g. if it comes from an add-in reference). Make sure the correct add-in is found in this case. 2007-12-05 Lluis Sanchez Gual * Mono.Addins.Localization/GettextDomain.cs, Mono.Addins.Localization/IPluralAddinLocalizer.cs, Mono.Addins.Localization/GettextLocalizer.cs, Mono.Addins.mdp, Mono.Addins/AddinLocalizer.cs, Makefile.am: Add support for plural forms. 2007-12-04 Lluis Sanchez Gual * Mono.Addins.Localization/GettextDomain.cs: Fix bug in string unmarshalling. 2007-12-03 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs, Mono.Addins/Addin.cs: Added more informative implementation of ToString (). * Mono.Addins/AddinSessionService.cs, Mono.Addins/AddinManager.cs: Added CurrentAddin property, which returns the add-in on which the calling method is implemented. Same for CurrentLocalizer. * Mono.Addins/ExtensionNode.cs: Allow getting the extension context bound to an extension node. 2007-12-03 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanner.cs: ScanNodeSet may change the ExtensionNodeSets collection, so it is necessary to make a copy when iterating with it. 2007-12-03 Lluis Sanchez Gual * Mono.Addins/TypeExtensionNode.cs: Made the description of TypeExtensionNode shorter. * Mono.Addins/AddinRegistry.cs: Made the add-in registry constructor public. * Mono.Addins.Database/SetupProcess.cs: Fix problem when M.A. is located in a folder with spaces in the name. Fix by Georg Wächter. 2007-11-19 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Workaround for mcs bug. 2007-11-17 Lluis Sanchez Gual * Mono.Addins.Description/ExtensionNodeDescription.cs: Add missing ChildNodes property. 2007-11-17 Lluis Sanchez Gual * Mono.Addins.Localization, Mono.Addins.Localization/GettextDomain.cs, Mono.Addins.Localization/IAddinLocalizer.cs, Mono.Addins.Localization/NullLocalizer.cs, Mono.Addins.Localization/StringTableLocalizer.cs, Mono.Addins.Localization/StringResourceLocalizer.cs, Mono.Addins.Localization/IAddinLocalizerFactory.cs, Mono.Addins.Localization/GettextLocalizer.cs, Mono.Addins.mdp, Mono.Addins/RuntimeAddin.cs, Mono.Addins/ExtensionTree.cs, Mono.Addins/NodeAttributeAttribute.cs, Mono.Addins/AddinManager.cs, Mono.Addins/ExtensionNode.cs, Mono.Addins/AddinLocalizer.cs, Makefile.am, Mono.Addins.Description/NodeTypeAttribute.cs, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/ExtensionNodeType.cs: Implemented support for add-in localization. * Mono.Addins/NodeElement.cs, Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs: Added ChildNodes property to NodeElement. 2007-10-29 Lluis Sanchez Gual * Mono.Addins.mdp: Update paths. 2007-10-23 Ankit Jain * Mono.Addins.csproj: Add missing IAddinInstaller.cs 2007-10-18 Lluis Sanchez Gual * AssemblyInfo.cs: Get ready for 0.3 release. 2007-10-15 Lluis Sanchez Gual * Mono.Addins/ExtensionContext.cs: When an add-in is enabled at run-time, take it into account when loading any extension point, since the add-in list of the extension point may not have the latest info from the registry. The same when disabled. 2007-09-13 Lluis Sanchez Gual * Mono.Addins/Addin.cs: Fix issue in CompareVersions. 2007-09-10 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Fix bug in InternalGetInstalledAddins. It should return root addins when Type is set to Root. 2007-09-10 Lluis Sanchez Gual * Mono.Addins.Description/AddinDescription.cs: Improved error message. 2007-08-14 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Fixed file filter for getting all add-ins with a given name. 2007-08-09 Lluis Sanchez Gual * Mono.Addins/TreeNode.cs, Mono.Addins/ExtensionContext.cs: When activating an add-in (maybe as a result of a registry update), make sure only loaded extension points are updated. 2007-08-09 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs: Create host addin files in a directory inside the database. * Mono.Addins.Database/AddinDatabase.cs: Bump add-in database version. Removed debug code. 2007-08-08 Lluis Sanchez Gual * Mono.Addins/TreeNodeCollection.cs, Mono.Addins/TreeNode.cs: Clone the node children list when notifying the add-in load event since it may change. 2007-08-08 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs, Mono.Addins.Database/AddinDatabase.cs: Fix problem about the current registry domain not being properly set when the add-in database is regenerated due to an internal check. 2007-08-07 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinHostIndex.cs, Mono.Addins.Database/AddinScanFolderInfo.cs, Mono.Addins.Database/AddinScanner.cs, Mono.Addins.Database/AddinUpdateData.cs, Mono.Addins.Database/FileDatabase.cs, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/Extension.cs, Mono.Addins.Description/ExtensionNodeSet.cs, Mono.Addins.mdp, Mono.Addins/Addin.cs, Mono.Addins/AddinManager.cs, Mono.Addins/AddinRegistry.cs, Mono.Addins/AddinSessionService.cs: Implemented support for non-shared add-in folders. Add-ins located in such folders won't be visible from other non-shared folders. Folders containing add-in hosts are non-shared by default, wihch means that different installations of the same application won't interfere each other anymore. Add-in roots now can have depencencies on other add-in roots lacated in the same folder. The add-in database format has changed. 2007-08-07 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: Added missing null check. 2007-07-27 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/AddinScanner.cs: Better error reporting for missing assemblies. 2007-07-25 Lluis Sanchez Gual * Mono.Addins/AddinSessionService.cs, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Database/AddinScanner.cs: When loading an add-in root check if the add-in has changed. If it changed, update the add-in database to make sure the correct info is loaded. 2007-07-25 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: New GetResoruce overload. * Mono.Addins/ExtensionNode.cs: Added property for getting the parent of a node. Some more protection against exceptions. 2007-07-06 Lluis Sanchez Gual * Mono.Addins/ExtensionTree.cs: If a node has no children, there is no need to recursively call LoadExtensionElement. * Mono.Addins/TreeNode.cs, Mono.Addins/ExtensionContext.cs: When activating an add-in, don't add nodes in extensions that have not yet been loaded. * Mono.Addins/AddinManager.cs: GetEntryAssembly returns null when running in NUnit. 2007-07-03 Lluis Sanchez Gual * AssemblyInfo.cs, Mono.Addins.mdp, Makefile.am: Sign the assembly. 2007-07-03 Lluis Sanchez Gual * Mono.Addins/AddinInfo.cs, Mono.Addins/Addin.cs, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Database/DatabaseConfiguration.cs, Mono.Addins.Database/AddinDatabase.cs: Added support for add-ins which are disabled by default. * Mono.Addins.Database/AddinScanner.cs: Minor fix. 2007-07-02 Lluis Sanchez Gual * Mono.Addins/GettextCatalog.cs: Removed old copyright notice, since the file doesn't contain any code from the original class. 2007-07-02 Lluis Sanchez Gual * Mono.Addins.Database/AddinScanResult.cs, Mono.Addins.Database/AddinScanner.cs: Don't scan assemblies which are included by .addin files, since they will be already scanned when processing the .addin file. 2007-07-02 Lluis Sanchez Gual * Mono.Addins/AddinRegistry.cs, Mono.Addins.Database/SetupProcess.cs, Mono.Addins.Database/AddinScanResult.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/ProcessProgressStatus.cs, Mono.Addins.Database/AddinScanner.cs: Before scanning a file, log the file name. If for some reason the scanner process crashes, the main process will know the name of the file that made it crash and will restart the scan adding it to the ignore file list. 2007-07-02 Lluis Sanchez Gual * Mono.Addins.mdp, Makefile.am: Added new file. * Mono.Addins/RuntimeAddin.cs, Mono.Addins/Addin.cs, Mono.Addins/IProgressStatus.cs, Mono.Addins/ConsoleProgressStatus.cs, Mono.Addins.Database/SetupProcess.cs, Mono.Addins.Database/AddinDatabase.cs, Mono.Addins.Database/FileDatabase.cs, Mono.Addins.Database/ProcessProgressStatus.cs, Mono.Addins.Database/AddinScanner.cs: Added support for add-in private data: a directory where every add-in can store its own private data. IProgressStatus now has a LogLevel property instead of VerboseLog. * Mono.Addins/IAddinInstaller.cs, Mono.Addins/AddinManager.cs: Implemented CheckInstalled. This method checks if the specified add-ins are installed. If some of the add-ins are not installed, it will use the installer assigned to the DefaultAddinInstaller property to install them. 2007-06-28 Lluis Sanchez Gual * Mono.Addins.Database/Util.cs: Added helper method for getting the path of an assembly in the gac. * Mono.Addins.Database/AddinScanner.cs: Added support for GacAssembly in .addins files (scans assemblies installed in the gac). Also, when registering assemblies included in an add-in, make sure to use the a path relative to the add-in location (the assembly may have been loaded from a different location). 2007-06-26 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: Assembly loading fix by Brad Taylor. Fixes endless loop in Initialize. * Mono.Addins.Description/AddinDescription.cs: Set the hasUserId flag when loading from xml. * Mono.Addins.Database/AddinUpdateData.cs, Mono.Addins.Database/AddinDatabase.cs: Moved add-in update counters to the AddinUpdateData class, since they need to be updated there. 2007-05-30 Lluis Sanchez Gual * Mono.Addins/ExtensionTree.cs: Fix problem with insertbefore, which was basically broken. Inherit NodeAttribute attributes. * Mono.Addins.Database/AddinScanResult.cs: Removed debug code. * Mono.Addins.Database/AddinDatabase.cs: When rebuilding the database, don't try to delete folders when don't exist. 2007-05-25 Lluis Sanchez Gual * Mono.Addins.Database/AddinDatabase.cs: Fixed several issues when Enabling/Disabling add-ins. 2007-05-18 Lluis Sanchez Gual * Mono.Addins.Database/SetupProcess.cs, Mono.Addins.Database/AddinDatabase.cs: If the scanner process crashes for some reason, show a better error message and retry the scan again. 2007-05-17 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: Added support for getting resource string and resource objects. Patch by Georg Wächter. 2007-05-16 Lluis Sanchez Gual * Mono.Addins.Database/AddinHostIndex.cs: Windows may sometimes change the case of assemblies. 2007-05-14 Lluis Sanchez Gual * Mono.Addins/RuntimeAddin.cs: Use the full add-in id when checking for optional add-in dependencies. * Mono.Addins.Description/Extension.cs: Added method for getting a list of node types allowed in an extension. 2007-05-09 Lluis Sanchez Gual * Mono.Addins/ExtensionNode.cs: Added some null checks. * Mono.Addins.Database/AddinScanner.cs: Add-in id is not mandatory. 2007-05-08 Lluis Sanchez Gual * Mono.Addins.csproj: Added missing file. 2007-05-07 Lluis Sanchez Gual * Mono.Addins.Serialization/BinaryXmlReader.cs, Mono.Addins.Description/NodeTypeAttribute.cs, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/ExtensionNodeType.cs, Mono.Addins.Description/ExtensionPoint.cs, Mono.Addins.Description/ConditionTypeDescription.cs, Mono.Addins.Database/FileDatabase.cs: Added boolean property to be set to avoid loading documentation information from add-in descriptions (not needed at run-time). * Mono.Addins.mdp, Mono.Addins/TypeExtensionNode.cs, Mono.Addins/InstanceExtensionNode.cs, Mono.Addins/ExtensionContext.cs, Mono.Addins/ExtensionNode.cs, Makefile.am: Implemented new InstanceExtensionNode class. It is almost like TypeExtensionNode, but it does not implement the actual object creation, since CreateInstance is abstract. TypeExtensionNode is now a subclass of InstanceExtensionNode which creates an instance of the class specified in the 'class' attribute. * Mono.Addins/NodeAttributeAttribute.cs: Allow specifying the description in the constructor. * Mono.Addins.Description/ObjectDescriptionCollection.cs: New AddRange method. * Mono.Addins.Description/ExtensionNodeDescription.cs: Added method for getting the path to a node. Added some helper properties. * Mono.Addins.Database/AddinScanner.cs: Properly scan node types declared in node sets or declared as children of other nodes. 2007-05-04 Lluis Sanchez Gual * Mono.Addins.mdp: Updated. * Mono.Addins/ExtensionContext.cs: Fixed GetExtensionObjects overload which was not using the correct reuseCachedInstance value. * Mono.Addins/ExtensionTree.cs: Improved error message. When looking for a type in an assembly, avoid throwing an exception too early, since it may be found in other assemblies. * Mono.Addins.Database/AddinDatabase.cs: In the addin info cache, also store information about unsuccessful lookups, to avoid looking for an add-in again if we found that it doesn't exist. In Update(), don't use verbose output by default. 2007-04-10 Lluis Sanchez Gual * Mono.Addins.mdp, Makefile.am, Mono.Addins.csproj: Updated. * Mono.Addins/Addin.cs: Properly resolve absolute add-in ids (starting with ::). * Mono.Addins/AddinRegistry.cs: Added method for reading a manifest. * Mono.Addins.Description/Extension.cs: Added GetExtendedObject() method. Initialize the owner of all collections. * Mono.Addins.Description/AddinDependency.cs: Added method for getting the full ID of the referenced assembly. * Mono.Addins.Description/AddinDescription.cs: Added OwnerDatabase property. Initialize the owner of all collections. Properly check for referenced assemblies in Validate(). * Mono.Addins.Description/ExtensionNodeType.cs: Properly read the objectType attribute from XML. Initialize the owner of all collections. * Mono.Addins.Description/ObjectDescriptionCollection.cs: Added constructor which takes the collection owner as parameter. When an element is added, set the parent of the element. * Mono.Addins.Description/ExtensionPoint.cs, Mono.Addins.Description/ModuleDescription.cs: Initialize the owner of all collections. * Mono.Addins.Description/ExtensionNodeDescription.cs: Added GetNodeType() method and some helper properties. Initialize the owner of all collections. * Mono.Addins.Description/NodeTypeAttributeCollection.cs, Mono.Addins.Description/ExtensionCollection.cs, Mono.Addins.Description/DependencyCollection.cs, Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs, Mono.Addins.Description/ExtensionPointCollection.cs, Mono.Addins.Description/ModuleDescriptionCollection.cs, Mono.Addins.Description/ConditionTypeDescriptionCollection.cs, Mono.Addins.Description/ExtensionNodeSetCollection.cs: Added constructor which takes the collection owner as parameter. * Mono.Addins.Description/ExtensionNodeSet.cs: Added GetAllowedNodeTypes() method, which returns all allowed nodes, recursivelly looking at referenced node sets. Initialize the owner of all collections. * Mono.Addins.Description/ExtensionNodeTypeCollection.cs: New collection. * Mono.Addins.Description/ObjectDescription.cs: Added properties for getting the parent of an object, and the add-in description where the object is declared. * Mono.Addins.Database/AddinDatabase.cs: Properly reuse generated add-in ids when the add-in file is the same. Added method for finding a node set defined in the registry. Initialize the OwnerDatabase property of every loaded AddinDescription. * Mono.Addins.Database/AddinScanner.cs: When looking for add-in types, look in the references too. Set HasUserId to false for add-ins with auto-generated ID. 2007-04-04 Lluis Sanchez Gual * Mono.Addins/ExtensionContext.cs, Mono.Addins/AddinSessionService.cs, Makefile.am, Mono.Addins.Description/AddinDescription.cs, Mono.Addins.Description/ExtensionPoint.cs, Mono.Addins.Database/AddinUpdateData.cs, Mono.Addins.Database/AddinDatabase.cs: Use ISO-1 compliant c# only. * Mono.Addins.Description/Condition.cs, Mono.Addins.Description/ConditionCollection.cs: Removed unused files. 2007-04-04 Lluis Sanchez Gual * Mono.Addins.csproj: Added msbuild project files. Patch by Matthijs ter Woord. 2007-03-30 Lluis Sanchez Gual * Mono.Addins/Addin.cs: Added support for global add-in names. * Mono.Addins/ExtensionContext.cs: Make sure extensions of recently installed add-ins are properly loaded. Don't call OnAddinLoaded on nodes until all nodes of the extension point have been loaded, since OnAddinLoaded implementations may try to access to children which have not yet been loaded. * Mono.Addins/ExtensionNode.cs: Added some null checks. * Mono.Addins/ExtensionTree.cs: Fixed order when the insertafer attribute is specified. * Mono.Addins/TreeNode.cs: Added method for getting an extension point from a path. * Mono.Addins/AddinRegistry.cs: Added new env var for specifying the global add-in registry. * Mono.Addins.Database/AddinScanFolderInfo.cs: Only include add-in files in the list of missing files. * Mono.Addins.Database/AddinDatabase.cs: Properly remove add-in manifests from add-in folders that have been deleted. * Mono.Addins.Database/AddinScanner.cs: Moved code that removes manifests from deleted add-ins to a new method, which is called from AddinDatabase as well. 2007-03-28 Lluis Sanchez Gual * Mono.Addins.mdp: Generate a winexe, to avoid showing a console in windows. * Mono.Addins/Addin.cs: Null check. * Mono.Addins/AddinSessionService.cs, Mono.Addins/AddinManager.cs, Mono.Addins.Database/AddinScanner.cs: Use Assembly.CodeBase, since Assembly.Location will return the wrong value when the assembly is loaded using shadow copy. * Mono.Addins/AddinRegistry.cs, Mono.Addins.Database/SetupProcess.cs: Windows portability fixes. * Mono.Addins.Description/ExtensionNodeSet.cs: Workaround for mono bug. * Mono.Addins.Database/Util.cs, Mono.Addins.Database/FileDatabase.cs: Use a custom method for getting a string hash, to make sure we get consistent results. 2007-03-23 Lluis Sanchez Gual * Mono.Addins.mdp: Updated. * Mono.Addins/AddinRegistry.cs: Create the add-ins folder for host references when it doesn't exist. mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/0000775000175000017500000000000012136524043024455 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/IPluralAddinLocalizer.cs0000664000175000017500000000411012136523632031160 0ustar00directhexdirecthex00000000000000// IPluralAddinLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Localization { /// /// A localizer that supports localization of plural forms. /// /// /// This interface can be implemented by add-in localizers which want to provide /// support plural forms. /// public interface IPluralAddinLocalizer { /// /// Gets a localized message which may contain plural forms. /// /// /// The localized message. /// /// /// Message identifier to use when the specified count is 1. /// /// /// Default message identifier to use when the specified count is not 1. /// /// /// The count that determines which plural form to use. /// string GetPluralString (string singular, String defaultPlural, int n); } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/GettextLocalizer.cs0000664000175000017500000000375512136523632030312 0ustar00directhexdirecthex00000000000000// GettextLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using Mono.Addins; namespace Mono.Addins.Localization { class GettextLocalizer: IAddinLocalizerFactory, IAddinLocalizer, IPluralAddinLocalizer { GettextDomain domain; public IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element) { string pkg = element.GetAttribute ("catalog"); if (pkg.Length == 0) pkg = addin.Id; string dir = element.GetAttribute ("location"); if (dir.Length == 0) dir = "locale"; dir = addin.GetFilePath (dir); domain = new GettextDomain (); domain.Init (pkg, dir); return this; } public string GetString (string msgid) { return domain.GetString (msgid); } public string GetPluralString (string singular, string defaultPlural, int n) { return domain.GetPluralString (singular, defaultPlural, n); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/IAddinLocalizer.cs0000664000175000017500000000341512136523632030007 0ustar00directhexdirecthex00000000000000// // IAddinLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Localization { /// /// An add-in localizer. /// /// /// Add-in localizers which want to provide support for localization of plural forms /// can additionally implement . /// public interface IAddinLocalizer { /// /// Gets a localized message. /// /// /// The localized message. /// /// /// The message identifier. /// string GetString (string msgid); } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/StringTableLocalizer.cs0000664000175000017500000000621112136523632031072 0ustar00directhexdirecthex00000000000000// StringTableLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using System.Collections; using Mono.Addins; namespace Mono.Addins.Localization { class StringTableLocalizer: IAddinLocalizerFactory, IAddinLocalizer { Hashtable locales = new Hashtable (); static Hashtable nullLocale = new Hashtable (); public IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element) { foreach (NodeElement nloc in element.ChildNodes) { if (nloc.NodeName != "Locale") throw new InvalidOperationException ("Invalid element found: '" + nloc.NodeName + "'. Expected: 'Locale'"); string ln = nloc.GetAttribute ("id"); if (ln.Length == 0) throw new InvalidOperationException ("Locale id not specified"); ln = ln.Replace ('_','-'); Hashtable messages = new Hashtable (); foreach (NodeElement nmsg in nloc.ChildNodes) { if (nmsg.NodeName != "Msg") throw new InvalidOperationException ("Locale '" + ln + "': Invalid element found: '" + nmsg.NodeName + "'. Expected: 'Msg'"); string id = nmsg.GetAttribute ("id"); if (id.Length == 0) throw new InvalidOperationException ("Locale '" + ln + "': Message id not specified"); messages [id] = nmsg.GetAttribute ("str"); } locales [ln] = messages; } return this; } public string GetString (string id) { string cname = System.Threading.Thread.CurrentThread.CurrentCulture.Name; Hashtable loc = (Hashtable) locales [cname]; if (loc == null) { string sn = cname.Substring (0, 2); loc = (Hashtable) locales [sn]; if (loc != null) locales [cname] = loc; else { locales [cname] = nullLocale; return id; } } string msg = (string) loc [id]; if (msg == null) { if (cname.Length > 2) { // Try again without the country cname = cname.Substring (0, 2); loc = (Hashtable) locales [cname]; if (loc != null) { msg = (string) loc [id]; if (msg != null) return msg; } } return id; } else return msg; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/GettextDomain.cs0000664000175000017500000001055112136523632027565 0ustar00directhexdirecthex00000000000000// // GettextDomain.cs: Wrappers for the libintl library. // // Authors: // Edd Dumbill (edd@usefulinc.com) // Jonathan Pryor (jonpryor@vt.edu) // Lluis Sanchez Gual (lluis@novell.com) // // (C) 2004 Edd Dumbill // (C) 2005-2006 Jonathan Pryor // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Runtime.InteropServices; using System.IO; using System.Text; namespace Mono.Addins.Localization { class GettextDomain { [DllImport("intl")] static extern IntPtr bindtextdomain (IntPtr domainname, IntPtr dirname); [DllImport("intl")] static extern IntPtr bind_textdomain_codeset (IntPtr domainname, IntPtr codeset); [DllImport("intl")] static extern IntPtr dgettext (IntPtr domainname, IntPtr instring); [DllImport("intl")] static extern IntPtr dngettext (IntPtr domainname, IntPtr instring, IntPtr plural, int n); IntPtr ipackage; public void Init (String package, string localedir) { if (localedir == null) { localedir = System.Reflection.Assembly.GetEntryAssembly ().CodeBase; FileInfo f = new FileInfo (localedir); string prefix = f.Directory.Parent.Parent.Parent.ToString (); prefix = Path.Combine (Path.Combine (prefix, "share"), "locale"); } ipackage = StringToPtr (package); IntPtr ilocaledir = StringToPtr (localedir); IntPtr iutf8 = StringToPtr ("UTF-8"); try { if (bindtextdomain (ipackage, ilocaledir) == IntPtr.Zero) throw new InvalidOperationException ("Gettext localizer: bindtextdomain failed"); if (bind_textdomain_codeset (ipackage, iutf8) == IntPtr.Zero) throw new InvalidOperationException ("Gettext localizer: bind_textdomain_codeset failed"); } finally { Marshal.FreeHGlobal (ilocaledir); Marshal.FreeHGlobal (iutf8); } } ~GettextDomain () { Marshal.FreeHGlobal (ipackage); } public String GetString (String s) { IntPtr ints = StringToPtr (s); try { // gettext(3) returns the input pointer if no translation is found IntPtr r = dgettext (ipackage, ints); if (r != ints) return PtrToString (r); return s; } finally { Marshal.FreeHGlobal (ints); } } public String GetPluralString (String singular, String defaultPlural, int n) { IntPtr ints = StringToPtr (singular); IntPtr intp = StringToPtr (defaultPlural); try { // gettext(3) returns the input pointer if no translation is found IntPtr r = dngettext (ipackage, ints, intp, n); if (r == ints) return singular; if (r == intp) return defaultPlural; return PtrToString (r); } finally { Marshal.FreeHGlobal (ints); Marshal.FreeHGlobal (intp); } } static IntPtr StringToPtr (string s) { if (s == null) return IntPtr.Zero; byte[] marshal = Encoding.UTF8.GetBytes (s); IntPtr mem = Marshal.AllocHGlobal (marshal.Length + 1); Marshal.Copy (marshal, 0, mem, marshal.Length); Marshal.WriteByte (mem, marshal.Length, 0); return mem; } static string PtrToString (IntPtr ptr) { if (ptr == IntPtr.Zero) return null; int sz = 0; while (Marshal.ReadByte (ptr, sz) != 0) sz++; byte[] bytes = new byte [sz]; Marshal.Copy (ptr, bytes, 0, sz); return Encoding.UTF8.GetString (bytes); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/StringResourceLocalizer.cs0000664000175000017500000000330512136523632031633 0ustar00directhexdirecthex00000000000000// StringResourceLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using Mono.Addins; namespace Mono.Addins.Localization { class StringResourceLocalizer: IAddinLocalizerFactory, IAddinLocalizer { RuntimeAddin addin; public IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element) { this.addin = addin; return this; } public string GetString (string msgid) { string s = addin.GetResourceString (msgid, false, System.Threading.Thread.CurrentThread.CurrentCulture); if (s == null) return msgid; else return s; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/IAddinLocalizerFactory.cs0000664000175000017500000000332012136523632031332 0ustar00directhexdirecthex00000000000000// // IAddinLocalizerFactory.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Localization { /// /// A localizer factory. /// public interface IAddinLocalizerFactory { /// /// Creates a localizer for an add-in. /// /// /// The localizer. /// /// /// The add-in for which to create the localizer. /// /// /// Localizer parameters. /// IAddinLocalizer CreateLocalizer (RuntimeAddin addin, NodeElement element); } } mono-addins-1.0/Mono.Addins/Mono.Addins.Localization/NullLocalizer.cs0000664000175000017500000000265512136523632027576 0ustar00directhexdirecthex00000000000000// NullLocalizer.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Localization { class NullLocalizer: IAddinLocalizer { public static AddinLocalizer Instance = new AddinLocalizer (new NullLocalizer ()); public string GetString (string msgid) { return msgid; } } } mono-addins-1.0/Mono.Addins/policy.0.6.config0000664000175000017500000000054612136524024022711 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins/mono-addins.pc.in0000664000175000017500000000037212136523632023063 0ustar00directhexdirecthex00000000000000prefix=${pcfiledir}/../.. exec_prefix=${prefix} pkglibdir=${prefix}/lib/mono/@PACKAGE@ Libraries=${pkglibdir}/@MONO_ADDINS_DEFAULT_LIB@ Name: Mono.Addins Description: Version: @VERSION@ Requires: Libs: -r:${pkglibdir}/@MONO_ADDINS_DEFAULT_LIB@ mono-addins-1.0/Mono.Addins/policy.0.4.config0000664000175000017500000000054612136524024022707 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins/Mono.Addins.Database/0000775000175000017500000000000012136524043023531 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs0000664000175000017500000002504612136523632027046 0ustar00directhexdirecthex00000000000000// // AddinUpdateData.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using Mono.Addins.Description; using System.Collections.Generic; namespace Mono.Addins.Database { class AddinUpdateData { // This table collects information about extensions. Each path (key) // has a RootExtensionPoint object with information about the addin that // defines the extension point and the addins which extend it Dictionary> pathHash = new Dictionary> (); // Collects globally defined node sets. Key is node set name. Value is // a RootExtensionPoint Dictionary> nodeSetHash = new Dictionary> (); Dictionary> objectTypeExtensions = new Dictionary> (); Dictionary> customAttributeTypeExtensions = new Dictionary> (); internal int RelExtensionPoints; internal int RelExtensions; internal int RelNodeSetTypes; internal int RelExtensionNodes; class RootExtensionPoint { public AddinDescription Description; public ExtensionPoint ExtensionPoint; } IProgressStatus monitor; public AddinUpdateData (AddinDatabase database, IProgressStatus monitor) { this.monitor = monitor; } public void RegisterNodeSet (AddinDescription description, ExtensionNodeSet nset) { List extensions; if (nodeSetHash.TryGetValue (nset.Id, out extensions)) { // Extension point already registered List compatExtensions = GetCompatibleExtensionPoints (nset.Id, description, description.MainModule, extensions); if (compatExtensions.Count > 0) { foreach (ExtensionPoint einfo in compatExtensions) einfo.NodeSet.MergeWith (null, nset); return; } } // Create a new extension set RootExtensionPoint rep = new RootExtensionPoint (); rep.ExtensionPoint = new ExtensionPoint (); rep.ExtensionPoint.SetNodeSet (nset); rep.ExtensionPoint.RootAddin = description.AddinId; rep.ExtensionPoint.Path = nset.Id; rep.Description = description; if (extensions == null) { extensions = new List (); nodeSetHash [nset.Id] = extensions; } extensions.Add (rep); } public void RegisterExtensionPoint (AddinDescription description, ExtensionPoint ep) { List extensions; if (pathHash.TryGetValue (ep.Path, out extensions)) { // Extension point already registered List compatExtensions = GetCompatibleExtensionPoints (ep.Path, description, description.MainModule, extensions); if (compatExtensions.Count > 0) { foreach (ExtensionPoint einfo in compatExtensions) einfo.MergeWith (null, ep); RegisterObjectTypes (ep); return; } } // Create a new extension RootExtensionPoint rep = new RootExtensionPoint (); rep.ExtensionPoint = ep; rep.ExtensionPoint.RootAddin = description.AddinId; rep.Description = description; if (extensions == null) { extensions = new List (); pathHash [ep.Path] = extensions; } extensions.Add (rep); RegisterObjectTypes (ep); } void RegisterObjectTypes (ExtensionPoint ep) { // Register extension points bound to a node type foreach (ExtensionNodeType nt in ep.NodeSet.NodeTypes) { if (nt.ObjectTypeName.Length > 0) { List list; if (!objectTypeExtensions.TryGetValue (nt.ObjectTypeName, out list)) { list = new List (); objectTypeExtensions [nt.ObjectTypeName] = list; } list.Add (ep); } if (nt.ExtensionAttributeTypeName.Length > 0) { List list; if (!customAttributeTypeExtensions.TryGetValue (nt.ExtensionAttributeTypeName, out list)) { list = new List (); customAttributeTypeExtensions [nt.ExtensionAttributeTypeName] = list; } list.Add (nt); } } } public void RegisterExtension (AddinDescription description, ModuleDescription module, Extension extension) { if (extension.Path.StartsWith ("$")) { string[] objectTypes = extension.Path.Substring (1).Split (','); bool found = false; foreach (string s in objectTypes) { List list; if (objectTypeExtensions.TryGetValue (s, out list)) { found = true; foreach (ExtensionPoint ep in list) { if (IsAddinCompatible (ep.ParentAddinDescription, description, module)) { extension.Path = ep.Path; RegisterExtension (description, module, ep.Path); } } } } if (!found) monitor.ReportWarning ("The add-in '" + description.AddinId + "' is trying to register the class '" + extension.Path.Substring (1) + "', but there isn't any add-in defining a suitable extension point"); } else if (extension.Path.StartsWith ("%")) { string[] objectTypes = extension.Path.Substring (1).Split (','); bool found = false; foreach (string s in objectTypes) { List list; if (customAttributeTypeExtensions.TryGetValue (s, out list)) { found = true; foreach (ExtensionNodeType nt in list) { ExtensionPoint ep = (ExtensionPoint) ((ExtensionNodeSet)nt.Parent).Parent; if (IsAddinCompatible (ep.ParentAddinDescription, description, module)) { extension.Path = ep.Path; foreach (ExtensionNodeDescription node in extension.ExtensionNodes) node.NodeName = nt.NodeName; RegisterExtension (description, module, ep.Path); } } } } if (!found) monitor.ReportWarning ("The add-in '" + description.AddinId + "' is trying to register the class '" + extension.Path.Substring (1) + "', but there isn't any add-in defining a suitable extension point"); } } public void RegisterExtension (AddinDescription description, ModuleDescription module, string path) { List extensions; if (!pathHash.TryGetValue (path, out extensions)) { // Root add-in extension points are registered before any other kind of extension, // so we should find it now. extensions = GetParentExtensionInfo (path); } if (extensions == null) { monitor.ReportWarning ("The add-in '" + description.AddinId + "' is trying to extend '" + path + "', but there isn't any add-in defining this extension point"); return; } bool found = false; foreach (RootExtensionPoint einfo in extensions) { if (IsAddinCompatible (einfo.Description, description, module)) { if (!einfo.ExtensionPoint.Addins.Contains (description.AddinId)) einfo.ExtensionPoint.Addins.Add (description.AddinId); found = true; if (monitor.LogLevel > 2) { monitor.Log (" * " + einfo.Description.AddinId + "(" + einfo.Description.Domain + ") <- " + path); } } } if (!found) monitor.ReportWarning ("The add-in '" + description.AddinId + "' is trying to extend '" + path + "', but there isn't any compatible add-in defining this extension point"); } List GetCompatibleExtensionPoints (string path, AddinDescription description, ModuleDescription module, List rootExtensionPoints) { List list = new List (); foreach (RootExtensionPoint rep in rootExtensionPoints) { // Find an extension point defined in a root add-in which is compatible with the version of the extender dependency if (IsAddinCompatible (rep.Description, description, module)) list.Add (rep.ExtensionPoint); } return list; } List GetParentExtensionInfo (string path) { int i = path.LastIndexOf ('/'); if (i == -1) return null; string np = path.Substring (0, i); List ep; if (pathHash.TryGetValue (np, out ep)) return ep; else return GetParentExtensionInfo (np); } bool IsAddinCompatible (AddinDescription installedDescription, AddinDescription description, ModuleDescription module) { if (installedDescription == description) return true; if (installedDescription.Domain != AddinDatabase.GlobalDomain) { if (description.Domain != AddinDatabase.GlobalDomain && description.Domain != installedDescription.Domain) return false; } else if (description.Domain != AddinDatabase.GlobalDomain) return false; string addinId = Addin.GetFullId (installedDescription.Namespace, installedDescription.LocalId, null); string requiredVersion = null; IEnumerable deps; if (module == description.MainModule) deps = module.Dependencies; else { ArrayList list = new ArrayList (); list.AddRange (module.Dependencies); list.AddRange (description.MainModule.Dependencies); deps = list; } foreach (object dep in deps) { AddinDependency adep = dep as AddinDependency; if (adep != null && Addin.GetFullId (description.Namespace, adep.AddinId, null) == addinId) { requiredVersion = adep.Version; break; } } if (requiredVersion == null) return false; // Check if the required version is between rep.Description.CompatVersion and rep.Description.Version if (Addin.CompareVersions (installedDescription.Version, requiredVersion) > 0) return false; if (installedDescription.CompatVersion.Length > 0 && Addin.CompareVersions (installedDescription.CompatVersion, requiredVersion) < 0) return false; return true; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinDatabase.cs0000664000175000017500000016512712136523632026543 0ustar00directhexdirecthex00000000000000// // AddinDatabase.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Threading; using System.Collections; using System.Collections.Specialized; using System.IO; using System.Xml; using System.Reflection; using Mono.Addins.Description; using System.Collections.Generic; using System.Linq; namespace Mono.Addins.Database { class AddinDatabase { public const string GlobalDomain = "global"; public const string UnknownDomain = "unknown"; public const string VersionTag = "001"; List allSetupInfos; List addinSetupInfos; List rootSetupInfos; internal static bool RunningSetupProcess; bool fatalDatabseError; Hashtable cachedAddinSetupInfos = new Hashtable (); AddinScanResult currentScanResult; AddinHostIndex hostIndex; FileDatabase fileDatabase; string addinDbDir; DatabaseConfiguration config = null; AddinRegistry registry; int lastDomainId; AddinEngine addinEngine; AddinFileSystemExtension fs = new AddinFileSystemExtension (); List extensions = new List (); public AddinDatabase (AddinEngine addinEngine, AddinRegistry registry) { this.addinEngine = addinEngine; this.registry = registry; addinDbDir = Path.Combine (registry.AddinCachePath, "addin-db-" + VersionTag); fileDatabase = new FileDatabase (AddinDbDir); } string AddinDbDir { get { return addinDbDir; } } public AddinFileSystemExtension FileSystem { get { return fs; } } public string AddinCachePath { get { return Path.Combine (AddinDbDir, "addin-data"); } } public string AddinFolderCachePath { get { return Path.Combine (AddinDbDir, "addin-dir-data"); } } public string AddinPrivateDataPath { get { return Path.Combine (AddinDbDir, "addin-priv-data"); } } public string HostsPath { get { return Path.Combine (AddinDbDir, "hosts"); } } string HostIndexFile { get { return Path.Combine (AddinDbDir, "host-index"); } } string ConfigFile { get { return Path.Combine (AddinDbDir, "config.xml"); } } internal bool IsGlobalRegistry { get { return registry.RegistryPath == AddinRegistry.GlobalRegistryPath; } } public AddinRegistry Registry { get { return this.registry; } } public void Clear () { if (Directory.Exists (AddinCachePath)) Directory.Delete (AddinCachePath, true); if (Directory.Exists (AddinFolderCachePath)) Directory.Delete (AddinFolderCachePath, true); } public void CopyExtensions (AddinDatabase other) { foreach (object o in other.extensions) RegisterExtension (o); } public void RegisterExtension (object extension) { extensions.Add (extension); if (extension is AddinFileSystemExtension) fs = (AddinFileSystemExtension) extension; else throw new NotSupportedException (); } public void UnregisterExtension (object extension) { extensions.Remove (extension); if ((extension as AddinFileSystemExtension) == fs) fs = new AddinFileSystemExtension (); else throw new InvalidOperationException (); } public ExtensionNodeSet FindNodeSet (string domain, string addinId, string id) { return FindNodeSet (domain, addinId, id, new Hashtable ()); } ExtensionNodeSet FindNodeSet (string domain, string addinId, string id, Hashtable visited) { if (visited.Contains (addinId)) return null; visited.Add (addinId, addinId); Addin addin = GetInstalledAddin (domain, addinId, true, false); if (addin == null) return null; AddinDescription desc = addin.Description; if (desc == null) return null; foreach (ExtensionNodeSet nset in desc.ExtensionNodeSets) if (nset.Id == id) return nset; // Not found in the add-in. Look on add-ins on which it depends foreach (Dependency dep in desc.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; string aid = Addin.GetFullId (desc.Namespace, adep.AddinId, adep.Version); ExtensionNodeSet nset = FindNodeSet (domain, aid, id, visited); if (nset != null) return nset; } return null; } public IEnumerable GetInstalledAddins (string domain, AddinSearchFlagsInternal flags) { if (domain == null) domain = registry.CurrentDomain; // Get the cached list if the add-in list has already been loaded. // The domain doesn't have to be checked again, since it is always the same IEnumerable result = null; if ((flags & AddinSearchFlagsInternal.IncludeAll) == AddinSearchFlagsInternal.IncludeAll) { if (allSetupInfos != null) result = allSetupInfos; } else if ((flags & AddinSearchFlagsInternal.IncludeAddins) == AddinSearchFlagsInternal.IncludeAddins) { if (addinSetupInfos != null) result = addinSetupInfos; } else { if (rootSetupInfos != null) result = rootSetupInfos; } if (result == null) { InternalCheck (domain); using (fileDatabase.LockRead ()) { result = InternalGetInstalledAddins (domain, null, flags & ~AddinSearchFlagsInternal.LatestVersionsOnly); } } if ((flags & AddinSearchFlagsInternal.LatestVersionsOnly) == AddinSearchFlagsInternal.LatestVersionsOnly) result = result.Where (a => a.IsLatestVersion); if ((flags & AddinSearchFlagsInternal.ExcludePendingUninstall) == AddinSearchFlagsInternal.ExcludePendingUninstall) result = result.Where (a => !IsRegisteredForUninstall (a.Description.Domain, a.Id)); return result; } IEnumerable InternalGetInstalledAddins (string domain, AddinSearchFlagsInternal type) { return InternalGetInstalledAddins (domain, null, type); } IEnumerable InternalGetInstalledAddins (string domain, string idFilter, AddinSearchFlagsInternal type) { if ((type & AddinSearchFlagsInternal.LatestVersionsOnly) != 0) throw new InvalidOperationException ("LatestVersionsOnly flag not supported here"); if (allSetupInfos == null) { Dictionary adict = new Dictionary (); // Global add-ins are valid for any private domain if (domain != AddinDatabase.GlobalDomain) FindInstalledAddins (adict, AddinDatabase.GlobalDomain, idFilter); FindInstalledAddins (adict, domain, idFilter); List alist = new List (adict.Values); UpdateLastVersionFlags (alist); if (idFilter != null) return alist; allSetupInfos = alist; } if ((type & AddinSearchFlagsInternal.IncludeAll) == AddinSearchFlagsInternal.IncludeAll) return FilterById (allSetupInfos, idFilter); if ((type & AddinSearchFlagsInternal.IncludeAddins) == AddinSearchFlagsInternal.IncludeAddins) { if (addinSetupInfos == null) { addinSetupInfos = new List (); foreach (Addin adn in allSetupInfos) if (!adn.Description.IsRoot) addinSetupInfos.Add (adn); } return FilterById (addinSetupInfos, idFilter); } else { if (rootSetupInfos == null) { rootSetupInfos = new List (); foreach (Addin adn in allSetupInfos) if (adn.Description.IsRoot) rootSetupInfos.Add (adn); } return FilterById (rootSetupInfos, idFilter); } } IEnumerable FilterById (List addins, string id) { if (id == null) return addins; return addins.Where (a => Addin.GetIdName (a.Id) == id); } void FindInstalledAddins (Dictionary result, string domain, string idFilter) { if (idFilter == null) idFilter = "*"; string dir = Path.Combine (AddinCachePath, domain); if (Directory.Exists (dir)) { foreach (string file in fileDatabase.GetDirectoryFiles (dir, idFilter + ",*.maddin")) { string id = Path.GetFileNameWithoutExtension (file); if (!result.ContainsKey (id)) { var adesc = GetInstalledDomainAddin (domain, id, true, false, false); if (adesc != null) result.Add (id, adesc); } } } } void UpdateLastVersionFlags (List addins) { Dictionary versions = new Dictionary (); foreach (Addin a in addins) { string last; string id, version; Addin.GetIdParts (a.Id, out id, out version); if (!versions.TryGetValue (id, out last) || Addin.CompareVersions (last, version) > 0) versions [id] = version; } foreach (Addin a in addins) { string id, version; Addin.GetIdParts (a.Id, out id, out version); a.IsLatestVersion = versions [id] == version; } } public Addin GetInstalledAddin (string domain, string id) { return GetInstalledAddin (domain, id, false, false); } public Addin GetInstalledAddin (string domain, string id, bool exactVersionMatch) { return GetInstalledAddin (domain, id, exactVersionMatch, false); } public Addin GetInstalledAddin (string domain, string id, bool exactVersionMatch, bool enabledOnly) { // Try the given domain, and if not found, try the shared domain Addin ad = GetInstalledDomainAddin (domain, id, exactVersionMatch, enabledOnly, true); if (ad != null) return ad; if (domain != AddinDatabase.GlobalDomain) return GetInstalledDomainAddin (AddinDatabase.GlobalDomain, id, exactVersionMatch, enabledOnly, true); else return null; } Addin GetInstalledDomainAddin (string domain, string id, bool exactVersionMatch, bool enabledOnly, bool dbLockCheck) { Addin sinfo = null; string idd = id + " " + domain; object ob = cachedAddinSetupInfos [idd]; if (ob != null) { sinfo = ob as Addin; if (sinfo != null) { if (!enabledOnly || sinfo.Enabled) return sinfo; if (exactVersionMatch) return null; } else if (enabledOnly) // Ignore the 'not installed' flag when disabled add-ins are allowed return null; } if (dbLockCheck) InternalCheck (domain); using ((dbLockCheck ? fileDatabase.LockRead () : null)) { string path = GetDescriptionPath (domain, id); if (sinfo == null && fileDatabase.Exists (path)) { sinfo = new Addin (this, path); cachedAddinSetupInfos [idd] = sinfo; if (!enabledOnly || sinfo.Enabled) return sinfo; if (exactVersionMatch) { // Cache lookups with negative result cachedAddinSetupInfos [idd] = this; return null; } } // Exact version not found. Look for a compatible version if (!exactVersionMatch) { sinfo = null; string version, name, bestVersion = null; Addin.GetIdParts (id, out name, out version); foreach (Addin ia in InternalGetInstalledAddins (domain, name, AddinSearchFlagsInternal.IncludeAll)) { if ((!enabledOnly || ia.Enabled) && (version.Length == 0 || ia.SupportsVersion (version)) && (bestVersion == null || Addin.CompareVersions (bestVersion, ia.Version) > 0)) { bestVersion = ia.Version; sinfo = ia; } } if (sinfo != null) { cachedAddinSetupInfos [idd] = sinfo; return sinfo; } } // Cache lookups with negative result // Ignore the 'not installed' flag when disabled add-ins are allowed if (enabledOnly) cachedAddinSetupInfos [idd] = this; return null; } } public void Shutdown () { ResetCachedData (); } public Addin GetAddinForHostAssembly (string domain, string assemblyLocation) { InternalCheck (domain); Addin ainfo = null; object ob = cachedAddinSetupInfos [assemblyLocation]; if (ob != null) return ob as Addin; // Don't use a cast here is ob may not be an Addin. AddinHostIndex index = GetAddinHostIndex (); string addin, addinFile, rdomain; if (index.GetAddinForAssembly (assemblyLocation, out addin, out addinFile, out rdomain)) { string sid = addin + " " + rdomain; ainfo = cachedAddinSetupInfos [sid] as Addin; if (ainfo == null) ainfo = new Addin (this, GetDescriptionPath (rdomain, addin)); cachedAddinSetupInfos [assemblyLocation] = ainfo; cachedAddinSetupInfos [addin + " " + rdomain] = ainfo; } return ainfo; } public bool IsAddinEnabled (string domain, string id) { Addin ainfo = GetInstalledAddin (domain, id); if (ainfo != null) return ainfo.Enabled; else return false; } internal bool IsAddinEnabled (string domain, string id, bool exactVersionMatch) { if (!exactVersionMatch) return IsAddinEnabled (domain, id); Addin ainfo = GetInstalledAddin (domain, id, exactVersionMatch, false); if (ainfo == null) return false; return Configuration.IsEnabled (id, ainfo.AddinInfo.EnabledByDefault); } public void EnableAddin (string domain, string id) { EnableAddin (domain, id, true); } internal void EnableAddin (string domain, string id, bool exactVersionMatch) { Addin ainfo = GetInstalledAddin (domain, id, exactVersionMatch, false); if (ainfo == null) // It may be an add-in root return; if (IsAddinEnabled (domain, id)) return; // Enable required add-ins foreach (Dependency dep in ainfo.AddinInfo.Dependencies) { if (dep is AddinDependency) { AddinDependency adep = dep as AddinDependency; string adepid = Addin.GetFullId (ainfo.AddinInfo.Namespace, adep.AddinId, adep.Version); EnableAddin (domain, adepid, false); } } Configuration.SetStatus (id, true, ainfo.AddinInfo.EnabledByDefault); SaveConfiguration (); if (addinEngine != null && addinEngine.IsInitialized) addinEngine.ActivateAddin (id); } public void DisableAddin (string domain, string id) { Addin ai = GetInstalledAddin (domain, id, true); if (ai == null) throw new InvalidOperationException ("Add-in '" + id + "' not installed."); if (!IsAddinEnabled (domain, id)) return; Configuration.SetStatus (id, false, ai.AddinInfo.EnabledByDefault); SaveConfiguration (); // Disable all add-ins which depend on it try { string idName = Addin.GetIdName (id); foreach (Addin ainfo in GetInstalledAddins (domain, AddinSearchFlagsInternal.IncludeAddins)) { foreach (Dependency dep in ainfo.AddinInfo.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; string adepid = Addin.GetFullId (ainfo.AddinInfo.Namespace, adep.AddinId, null); if (adepid != idName) continue; // The add-in that has been disabled, might be a requeriment of this one, or maybe not // if there is an older version available. Check it now. adepid = Addin.GetFullId (ainfo.AddinInfo.Namespace, adep.AddinId, adep.Version); Addin adepinfo = GetInstalledAddin (domain, adepid, false, true); if (adepinfo == null) { DisableAddin (domain, ainfo.Id); break; } } } } catch { // If something goes wrong, enable the add-in again Configuration.SetStatus (id, true, ai.AddinInfo.EnabledByDefault); SaveConfiguration (); throw; } if (addinEngine != null && addinEngine.IsInitialized) addinEngine.UnloadAddin (id); } public void RegisterForUninstall (string domain, string id, IEnumerable files) { DisableAddin (domain, id); Configuration.RegisterForUninstall (id, files); SaveConfiguration (); } public bool IsRegisteredForUninstall (string domain, string addinId) { return Configuration.IsRegisteredForUninstall (addinId); } internal bool HasPendingUninstalls (string domain) { return Configuration.HasPendingUninstalls; } internal string GetDescriptionPath (string domain, string id) { return Path.Combine (Path.Combine (AddinCachePath, domain), id + ".maddin"); } void InternalCheck (string domain) { // If the database is broken, don't try to regenerate it at every check. if (fatalDatabseError) return; bool update = false; using (fileDatabase.LockRead ()) { if (!Directory.Exists (AddinCachePath)) { update = true; } } if (update) Update (null, domain); } void GenerateAddinExtensionMapsInternal (IProgressStatus monitor, List addinsToUpdate, List addinsToUpdateRelations, List removedAddins) { AddinUpdateData updateData = new AddinUpdateData (this, monitor); // Clear cached data cachedAddinSetupInfos.Clear (); // Collect all information AddinIndex addinHash = new AddinIndex (); if (monitor.LogLevel > 1) monitor.Log ("Generating add-in extension maps"); Hashtable changedAddins = null; ArrayList descriptionsToSave = new ArrayList (); ArrayList files = new ArrayList (); bool partialGeneration = addinsToUpdate != null; string[] domains = GetDomains (); // Get the files to be updated if (partialGeneration) { changedAddins = new Hashtable (); if (monitor.LogLevel > 2) monitor.Log ("Doing a partial registry update.\nAdd-ins to be updated:"); // Get the files and ids of all add-ins that have to be updated // Include removed add-ins: if there are several instances of the same add-in, removing one of // them will make other instances to show up. If there is a single instance, its files are // already removed. foreach (string sa in addinsToUpdate.Union (removedAddins)) { changedAddins [sa] = sa; if (monitor.LogLevel > 2) monitor.Log (" - " + sa); foreach (string file in GetAddinFiles (sa, domains)) { if (!files.Contains (file)) { files.Add (file); string an = Path.GetFileNameWithoutExtension (file); changedAddins [an] = an; if (monitor.LogLevel > 2 && an != sa) monitor.Log (" - " + an); } } } if (monitor.LogLevel > 2) monitor.Log ("Add-ins whose relations have to be updated:"); // Get the files and ids of all add-ins whose relations have to be updated foreach (string sa in addinsToUpdateRelations) { foreach (string file in GetAddinFiles (sa, domains)) { if (!files.Contains (file)) { if (monitor.LogLevel > 2) { string an = Path.GetFileNameWithoutExtension (file); monitor.Log (" - " + an); } files.Add (file); } } } } else { foreach (string dom in domains) files.AddRange (fileDatabase.GetDirectoryFiles (Path.Combine (AddinCachePath, dom), "*.maddin")); } // Load the descriptions. foreach (string file in files) { AddinDescription conf; if (!ReadAddinDescription (monitor, file, out conf)) { SafeDelete (monitor, file); continue; } // If the original file does not exist, the description can be deleted if (!fs.FileExists (conf.AddinFile)) { SafeDelete (monitor, file); continue; } // Remove old data from the description. Remove the data of the add-ins that // have changed. This data will be re-added later. conf.UnmergeExternalData (changedAddins); descriptionsToSave.Add (conf); addinHash.Add (conf); } // Sort the add-ins, to make sure add-ins are processed before // all their dependencies var sorted = addinHash.GetSortedAddins (); // Register extension points and node sets foreach (AddinDescription conf in sorted) CollectExtensionPointData (conf, updateData); if (monitor.LogLevel > 2) monitor.Log ("Registering new extensions:"); // Register extensions foreach (AddinDescription conf in sorted) { if (changedAddins == null || changedAddins.ContainsKey (conf.AddinId)) { if (monitor.LogLevel > 2) monitor.Log ("- " + conf.AddinId + " (" + conf.Domain + ")"); CollectExtensionData (monitor, addinHash, conf, updateData); } } // Save the maps foreach (AddinDescription conf in descriptionsToSave) { ConsolidateExtensions (conf); conf.SaveBinary (fileDatabase); } if (monitor.LogLevel > 1) { monitor.Log ("Addin relation map generated."); monitor.Log (" Addins Updated: " + descriptionsToSave.Count); monitor.Log (" Extension points: " + updateData.RelExtensionPoints); monitor.Log (" Extensions: " + updateData.RelExtensions); monitor.Log (" Extension nodes: " + updateData.RelExtensionNodes); monitor.Log (" Node sets: " + updateData.RelNodeSetTypes); } } void ConsolidateExtensions (AddinDescription conf) { // Merges extensions with the same path foreach (ModuleDescription module in conf.AllModules) { Dictionary extensions = new Dictionary (); foreach (Extension ext in module.Extensions) { Extension mainExt; if (extensions.TryGetValue (ext.Path, out mainExt)) { ArrayList list = new ArrayList (); EnsureInsertionsSorted (ext.ExtensionNodes); list.AddRange (ext.ExtensionNodes); int pos = -1; foreach (ExtensionNodeDescription node in list) { ext.ExtensionNodes.Remove (node); AddNodeSorted (mainExt.ExtensionNodes, node, ref pos); } } else { extensions [ext.Path] = ext; EnsureInsertionsSorted (ext.ExtensionNodes); } } // Sort the nodes } } void EnsureInsertionsSorted (ExtensionNodeDescriptionCollection list) { // Makes sure that the nodes in the collections are properly sorted wrt insertafter and insertbefore attributes Dictionary added = new Dictionary (); List halfSorted = new List (); bool orderChanged = false; for (int n = list.Count - 1; n >= 0; n--) { ExtensionNodeDescription node = list [n]; if (node.Id.Length > 0) added [node.Id] = node; if (node.InsertAfter.Length > 0) { ExtensionNodeDescription relNode; if (added.TryGetValue (node.InsertAfter, out relNode)) { // Out of order. Move it before the referenced node int i = halfSorted.IndexOf (relNode); halfSorted.Insert (i, node); orderChanged = true; } else { halfSorted.Add (node); } } else halfSorted.Add (node); } halfSorted.Reverse (); List fullSorted = new List (); added.Clear (); foreach (ExtensionNodeDescription node in halfSorted) { if (node.Id.Length > 0) added [node.Id] = node; if (node.InsertBefore.Length > 0) { ExtensionNodeDescription relNode; if (added.TryGetValue (node.InsertBefore, out relNode)) { // Out of order. Move it before the referenced node int i = fullSorted.IndexOf (relNode); fullSorted.Insert (i, node); orderChanged = true; } else { fullSorted.Add (node); } } else fullSorted.Add (node); } if (orderChanged) { list.Clear (); foreach (ExtensionNodeDescription node in fullSorted) list.Add (node); } } void AddNodeSorted (ExtensionNodeDescriptionCollection list, ExtensionNodeDescription node, ref int curPos) { // Adds the node at the correct position, taking into account insertbefore and insertafter if (node.InsertAfter.Length > 0) { string afterId = node.InsertAfter; for (int n=0; n 0) { string beforeId = node.InsertBefore; for (int n=0; n missingDeps = addinHash.GetMissingDependencies (conf, conf.MainModule); if (missingDeps.Any ()) { string w = "The add-in '" + conf.AddinId + "' could not be updated because some of its dependencies are missing or not compatible:"; w += BuildMissingAddinsList (addinHash, conf, missingDeps); monitor.ReportWarning (w); return; } CollectModuleExtensionData (conf, conf.MainModule, updateData); foreach (ModuleDescription module in conf.OptionalModules) { missingDeps = addinHash.GetMissingDependencies (conf, module); if (missingDeps.Any ()) { if (monitor.LogLevel > 1) { string w = "An optional module of the add-in '" + conf.AddinId + "' could not be updated because some of its dependencies are missing or not compatible:"; w += BuildMissingAddinsList (addinHash, conf, missingDeps); } } else CollectModuleExtensionData (conf, module, updateData); } } string BuildMissingAddinsList (AddinIndex addinHash, AddinDescription conf, IEnumerable missingDeps) { string w = ""; foreach (string dep in missingDeps) { var found = addinHash.GetSimilarExistingAddin (conf, dep); if (found == null) w += "\n missing: " + dep; else w += "\n required: " + dep + ", found: " + found.AddinId; } return w; } void CollectModuleExtensionData (AddinDescription conf, ModuleDescription module, AddinUpdateData updateData) { foreach (Extension ext in module.Extensions) { updateData.RelExtensions++; updateData.RegisterExtension (conf, module, ext); AddChildExtensions (conf, module, updateData, ext.Path, ext.ExtensionNodes, false); } } void AddChildExtensions (AddinDescription conf, ModuleDescription module, AddinUpdateData updateData, string path, ExtensionNodeDescriptionCollection nodes, bool conditionChildren) { // Don't register conditions as extension nodes. if (!conditionChildren) updateData.RegisterExtension (conf, module, path); foreach (ExtensionNodeDescription node in nodes) { if (node.NodeName == "ComplexCondition") continue; updateData.RelExtensionNodes++; string id = node.GetAttribute ("id"); if (id.Length != 0) AddChildExtensions (conf, module, updateData, path + "/" + id, node.ChildNodes, node.NodeName == "Condition"); } } string[] GetDomains () { string[] dirs = fileDatabase.GetDirectories (AddinCachePath); string[] ids = new string [dirs.Length]; for (int n=0; n= lastDomainId) lastDomainId = n + 1; } catch { } } return lastDomainId.ToString (); } internal void ResetBasicCachedData () { allSetupInfos = null; addinSetupInfos = null; rootSetupInfos = null; } internal void ResetCachedData () { ResetBasicCachedData (); hostIndex = null; cachedAddinSetupInfos.Clear (); if (addinEngine != null) addinEngine.ResetCachedData (); } public bool AddinDependsOn (string domain, string id1, string id2) { Hashtable visited = new Hashtable (); return AddinDependsOn (visited, domain, id1, id2); } bool AddinDependsOn (Hashtable visited, string domain, string id1, string id2) { if (visited.Contains (id1)) return false; visited.Add (id1, id1); Addin addin1 = GetInstalledAddin (domain, id1, false); // We can assumbe that if the add-in is not returned here, it may be a root addin. if (addin1 == null) return false; id2 = Addin.GetIdName (id2); foreach (Dependency dep in addin1.AddinInfo.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; string depid = Addin.GetFullId (addin1.AddinInfo.Namespace, adep.AddinId, null); if (depid == id2) return true; else if (AddinDependsOn (visited, domain, depid, id2)) return true; } return false; } public void Repair (IProgressStatus monitor, string domain) { using (fileDatabase.LockWrite ()) { try { if (Directory.Exists (AddinCachePath)) Directory.Delete (AddinCachePath, true); if (Directory.Exists (AddinFolderCachePath)) Directory.Delete (AddinFolderCachePath, true); if (File.Exists (HostIndexFile)) File.Delete (HostIndexFile); } catch (Exception ex) { monitor.ReportError ("The add-in registry could not be rebuilt. It may be due to lack of write permissions to the directory: " + AddinDbDir, ex); } } ResetBasicCachedData (); Update (monitor, domain); } public void Update (IProgressStatus monitor, string domain) { if (monitor == null) monitor = new ConsoleProgressStatus (false); if (RunningSetupProcess) return; fatalDatabseError = false; DateTime tim = DateTime.Now; RunPendingUninstalls (monitor); Hashtable installed = new Hashtable (); bool changesFound = CheckFolders (monitor, domain); if (monitor.IsCanceled) return; if (monitor.LogLevel > 1) monitor.Log ("Folders checked (" + (int) (DateTime.Now - tim).TotalMilliseconds + " ms)"); if (changesFound) { // Something has changed, the add-ins need to be re-scanned, but it has // to be done in an external process if (domain != null) { using (fileDatabase.LockRead ()) { foreach (Addin ainfo in InternalGetInstalledAddins (domain, AddinSearchFlagsInternal.IncludeAddins)) { installed [ainfo.Id] = ainfo.Id; } } } RunScannerProcess (monitor); ResetCachedData (); registry.NotifyDatabaseUpdated (); } if (fatalDatabseError) monitor.ReportError ("The add-in database could not be updated. It may be due to file corruption. Try running the setup repair utility", null); // Update the currently loaded add-ins if (changesFound && domain != null && addinEngine != null && addinEngine.IsInitialized) { Hashtable newInstalled = new Hashtable (); foreach (Addin ainfo in GetInstalledAddins (domain, AddinSearchFlagsInternal.IncludeAddins)) { newInstalled [ainfo.Id] = ainfo.Id; } foreach (string aid in installed.Keys) { // Always try to unload, event if the add-in was not currently loaded. // Required since the add-ins has to be marked as 'disabled', to avoid // extensions from this add-in to be loaded if (!newInstalled.Contains (aid)) addinEngine.UnloadAddin (aid); } foreach (string aid in newInstalled.Keys) { if (!installed.Contains (aid)) { Addin addin = addinEngine.Registry.GetAddin (aid); if (addin != null) addinEngine.ActivateAddin (aid); } } } } void RunPendingUninstalls (IProgressStatus monitor) { bool changesDone = false; foreach (var adn in Configuration.GetPendingUninstalls ()) { HashSet files = new HashSet (adn.Files); if (AddinManager.CheckAssembliesLoaded (files)) continue; if (monitor.LogLevel > 1) monitor.Log ("Uninstalling " + adn.AddinId); // Make sure all files can be deleted before doing so bool canUninstall = true; foreach (string f in adn.Files) { if (!File.Exists (f)) continue; try { File.OpenWrite (f).Close (); } catch { canUninstall = false; break; } } if (!canUninstall) continue; foreach (string f in adn.Files) { try { if (File.Exists (f)) File.Delete (f); } catch { canUninstall = false; } } if (canUninstall) { Configuration.UnregisterForUninstall (adn.AddinId); changesDone = true; } } if (changesDone) SaveConfiguration (); } void RunScannerProcess (IProgressStatus monitor) { ISetupHandler setup = GetSetupHandler (); IProgressStatus scanMonitor = monitor; ArrayList pparams = new ArrayList (); bool retry = false; do { try { if (monitor.LogLevel > 1) monitor.Log ("Looking for addins"); setup.Scan (scanMonitor, registry, null, (string[]) pparams.ToArray (typeof(string))); retry = false; } catch (Exception ex) { ProcessFailedException pex = ex as ProcessFailedException; if (pex != null) { // Get the last logged operation. if (pex.LastLog.StartsWith ("scan:")) { // It crashed while scanning a file. Add the file to the ignore list and try again. string file = pex.LastLog.Substring (5); pparams.Add (file); monitor.ReportWarning ("Could not scan file: " + file); retry = true; continue; } } fatalDatabseError = true; // If the process has crashed, try to do a new scan, this time using verbose log, // to give the user more information about the origin of the crash. if (pex != null && !retry) { monitor.ReportError ("Add-in scan operation failed. The Mono runtime may have encountered an error while trying to load an assembly.", null); if (monitor.LogLevel <= 1) { // Re-scan again using verbose log, to make it easy to find the origin of the error. retry = true; scanMonitor = new ConsoleProgressStatus (true); } } else retry = false; if (!retry) { monitor.ReportError ("Add-in scan operation failed", (ex is ProcessFailedException ? null : ex)); monitor.Cancel (); return; } } } while (retry); } bool DatabaseInfrastructureCheck (IProgressStatus monitor) { // Do some sanity check, to make sure the basic database infrastructure can be created bool hasChanges = false; try { if (!Directory.Exists (AddinCachePath)) { Directory.CreateDirectory (AddinCachePath); hasChanges = true; } if (!Directory.Exists (AddinFolderCachePath)) { Directory.CreateDirectory (AddinFolderCachePath); hasChanges = true; } // Make sure we can write in those folders Util.CheckWrittableFloder (AddinCachePath); Util.CheckWrittableFloder (AddinFolderCachePath); fatalDatabseError = false; } catch (Exception ex) { monitor.ReportError ("Add-in cache directory could not be created", ex); fatalDatabseError = true; monitor.Cancel (); } return hasChanges; } internal bool CheckFolders (IProgressStatus monitor, string domain) { using (fileDatabase.LockRead ()) { AddinScanResult scanResult = new AddinScanResult (); scanResult.CheckOnly = true; scanResult.Domain = domain; InternalScanFolders (monitor, scanResult); return scanResult.ChangesFound; } } internal void ScanFolders (IProgressStatus monitor, string currentDomain, string folderToScan, StringCollection filesToIgnore) { AddinScanResult res = new AddinScanResult (); res.Domain = currentDomain; res.AddPathsToIgnore (filesToIgnore); ScanFolders (monitor, res); } void ScanFolders (IProgressStatus monitor, AddinScanResult scanResult) { IDisposable checkLock = null; if (scanResult.CheckOnly) checkLock = fileDatabase.LockRead (); else { // All changes are done in a transaction, which won't be committed until // all files have been updated. if (!fileDatabase.BeginTransaction ()) { // The database is already being updated. Can't do anything for now. return; } } EventInfo einfo = typeof(AppDomain).GetEvent ("ReflectionOnlyAssemblyResolve"); ResolveEventHandler resolver = new ResolveEventHandler (OnResolveAddinAssembly); try { // Perform the add-in scan if (!scanResult.CheckOnly) { AppDomain.CurrentDomain.AssemblyResolve += resolver; if (einfo != null) einfo.AddEventHandler (AppDomain.CurrentDomain, resolver); } InternalScanFolders (monitor, scanResult); if (!scanResult.CheckOnly) fileDatabase.CommitTransaction (); } catch { if (!scanResult.CheckOnly) fileDatabase.RollbackTransaction (); throw; } finally { currentScanResult = null; if (scanResult.CheckOnly) checkLock.Dispose (); else { AppDomain.CurrentDomain.AssemblyResolve -= resolver; if (einfo != null) einfo.RemoveEventHandler (AppDomain.CurrentDomain, resolver); } } } void InternalScanFolders (IProgressStatus monitor, AddinScanResult scanResult) { try { fs.ScanStarted (); InternalScanFolders2 (monitor, scanResult); } finally { fs.ScanFinished (); } } void InternalScanFolders2 (IProgressStatus monitor, AddinScanResult scanResult) { DateTime tim = DateTime.Now; DatabaseInfrastructureCheck (monitor); if (monitor.IsCanceled) return; try { scanResult.HostIndex = GetAddinHostIndex (); } catch (Exception ex) { if (scanResult.CheckOnly) { scanResult.ChangesFound = true; return; } monitor.ReportError ("Add-in root index is corrupt. The add-in database will be regenerated.", ex); scanResult.RegenerateAllData = true; } AddinScanner scanner = new AddinScanner (this, scanResult, monitor); // Check if any of the previously scanned folders has been deleted foreach (string file in Directory.GetFiles (AddinFolderCachePath, "*.data")) { AddinScanFolderInfo folderInfo; bool res = ReadFolderInfo (monitor, file, out folderInfo); bool validForDomain = scanResult.Domain == null || folderInfo.Domain == GlobalDomain || folderInfo.Domain == scanResult.Domain; if (!res || (validForDomain && !fs.DirectoryExists (folderInfo.Folder))) { if (res) { // Folder has been deleted. Remove the add-ins it had. scanner.UpdateDeletedAddins (monitor, folderInfo, scanResult); } else { // Folder info file corrupt. Regenerate all. scanResult.ChangesFound = true; scanResult.RegenerateRelationData = true; } if (!scanResult.CheckOnly) SafeDelete (monitor, file); else if (scanResult.ChangesFound) return; } } // Look for changes in the add-in folders if (registry.StartupDirectory != null) scanner.ScanFolder (monitor, registry.StartupDirectory, null, scanResult); if (scanResult.CheckOnly && (scanResult.ChangesFound || monitor.IsCanceled)) return; if (scanResult.Domain == null) scanner.ScanFolder (monitor, HostsPath, GlobalDomain, scanResult); if (scanResult.CheckOnly && (scanResult.ChangesFound || monitor.IsCanceled)) return; foreach (string dir in registry.GlobalAddinDirectories) { if (scanResult.CheckOnly && (scanResult.ChangesFound || monitor.IsCanceled)) return; scanner.ScanFolderRec (monitor, dir, GlobalDomain, scanResult); } if (scanResult.CheckOnly || !scanResult.ChangesFound) return; // Scan the files which have been modified currentScanResult = scanResult; foreach (FileToScan file in scanResult.FilesToScan) scanner.ScanFile (monitor, file.File, file.AddinScanFolderInfo, scanResult); // Save folder info foreach (AddinScanFolderInfo finfo in scanResult.ModifiedFolderInfos) SaveFolderInfo (monitor, finfo); if (monitor.LogLevel > 1) monitor.Log ("Folders scan completed (" + (int) (DateTime.Now - tim).TotalMilliseconds + " ms)"); SaveAddinHostIndex (); ResetCachedData (); if (!scanResult.ChangesFound) { if (monitor.LogLevel > 1) monitor.Log ("No changes found"); return; } tim = DateTime.Now; try { if (scanResult.RegenerateRelationData) { if (monitor.LogLevel > 1) monitor.Log ("Regenerating all add-in relations."); scanResult.AddinsToUpdate = null; scanResult.AddinsToUpdateRelations = null; } GenerateAddinExtensionMapsInternal (monitor, scanResult.AddinsToUpdate, scanResult.AddinsToUpdateRelations, scanResult.RemovedAddins); } catch (Exception ex) { fatalDatabseError = true; monitor.ReportError ("The add-in database could not be updated. It may be due to file corruption. Try running the setup repair utility", ex); } if (monitor.LogLevel > 1) monitor.Log ("Add-in relations analyzed (" + (int) (DateTime.Now - tim).TotalMilliseconds + " ms)"); SaveAddinHostIndex (); } public void ParseAddin (IProgressStatus progressStatus, string domain, string file, string outFile, bool inProcess) { if (!inProcess) { ISetupHandler setup = GetSetupHandler (); setup.GetAddinDescription (progressStatus, registry, Path.GetFullPath (file), outFile); return; } using (fileDatabase.LockRead ()) { // First of all, check if the file belongs to a registered add-in AddinScanFolderInfo finfo; if (GetFolderInfoForPath (progressStatus, Path.GetDirectoryName (file), out finfo) && finfo != null) { AddinFileInfo afi = finfo.GetAddinFileInfo (file); if (afi != null && afi.IsAddin) { AddinDescription adesc; GetAddinDescription (progressStatus, afi.Domain, afi.AddinId, file, out adesc); if (adesc != null) adesc.Save (outFile); return; } } AddinScanResult sr = new AddinScanResult (); sr.Domain = domain; AddinScanner scanner = new AddinScanner (this, sr, progressStatus); SingleFileAssemblyResolver res = new SingleFileAssemblyResolver (progressStatus, registry, scanner); ResolveEventHandler resolver = new ResolveEventHandler (res.Resolve); EventInfo einfo = typeof(AppDomain).GetEvent ("ReflectionOnlyAssemblyResolve"); try { AppDomain.CurrentDomain.AssemblyResolve += resolver; if (einfo != null) einfo.AddEventHandler (AppDomain.CurrentDomain, resolver); AddinDescription desc = scanner.ScanSingleFile (progressStatus, file, sr); if (desc != null) desc.Save (outFile); } finally { AppDomain.CurrentDomain.AssemblyResolve -= resolver; if (einfo != null) einfo.RemoveEventHandler (AppDomain.CurrentDomain, resolver); } } } public string GetFolderDomain (IProgressStatus progressStatus, string path) { AddinScanFolderInfo folderInfo; if (GetFolderInfoForPath (progressStatus, path, out folderInfo) && folderInfo != null && !folderInfo.SharedFolder) return folderInfo.Domain; else return UnknownDomain; } Assembly OnResolveAddinAssembly (object s, ResolveEventArgs args) { string file = currentScanResult != null ? currentScanResult.GetAssemblyLocation (args.Name) : null; if (file != null) return Util.LoadAssemblyForReflection (file); else { if (!args.Name.StartsWith ("Mono.Addins.CecilReflector")) Console.WriteLine ("Assembly not found: " + args.Name); return null; } } public string GetFolderConfigFile (string path) { path = Path.GetFullPath (path); string s = path.Replace ("_", "__"); s = s.Replace (Path.DirectorySeparatorChar, '_'); s = s.Replace (Path.AltDirectorySeparatorChar, '_'); s = s.Replace (Path.VolumeSeparatorChar, '_'); return Path.Combine (AddinFolderCachePath, s + ".data"); } internal void UninstallAddin (IProgressStatus monitor, string domain, string addinId, string addinFile, AddinScanResult scanResult) { AddinDescription desc; if (!GetAddinDescription (monitor, domain, addinId, addinFile, out desc)) { // If we can't get information about the old assembly, just regenerate all relation data scanResult.RegenerateRelationData = true; return; } scanResult.AddRemovedAddin (addinId); // If the add-in didn't exist, there is nothing left to do if (desc == null) return; // If the add-in already existed, the dependencies of the old add-in need to be re-analized Util.AddDependencies (desc, scanResult); if (desc.IsRoot) scanResult.HostIndex.RemoveHostData (desc.AddinId, desc.AddinFile); RemoveAddinDescriptionFile (monitor, desc.FileName); } public bool GetAddinDescription (IProgressStatus monitor, string domain, string addinId, string addinFile, out AddinDescription description) { // If the same add-in is installed in different folders (in the same domain) there will be several .maddin files for it, // using the suffix "_X" where X is a number > 1 (for example: someAddin,1.0.maddin, someAddin,1.0.maddin_2, someAddin,1.0.maddin_3, ...) // We need to return the .maddin whose AddinFile matches the one being requested addinFile = Path.GetFullPath (addinFile); int altNum = 1; string baseFile = GetDescriptionPath (domain, addinId); string file = baseFile; bool failed = false; do { if (!ReadAddinDescription (monitor, file, out description)) { // Remove the AddinDescription here since it is corrupted. // Avoids creating alternate versions of corrupted files when later calling SaveDescription. RemoveAddinDescriptionFile (monitor, file); failed = true; continue; } if (description == null) break; if (Path.GetFullPath (description.AddinFile) == addinFile) return true; file = baseFile + "_" + (++altNum); } while (fileDatabase.Exists (file)); // File not found. Return false only if there has been any read error. description = null; return failed; } bool RemoveAddinDescriptionFile (IProgressStatus monitor, string file) { // Removes an add-in description and shifts up alternate instances of the description file // (so xxx,1.0.maddin_2 will become xxx,1.0.maddin, xxx,1.0.maddin_3 -> xxx,1.0.maddin_2, etc) if (!SafeDelete (monitor, file)) return false; int dversion; if (file.EndsWith (".maddin")) dversion = 2; else { int i = file.LastIndexOf ('_'); dversion = 1 + int.Parse (file.Substring (i + 1)); file = file.Substring (0, i); } while (fileDatabase.Exists (file + "_" + dversion)) { string newFile = dversion == 2 ? file : file + "_" + (dversion-1); try { fileDatabase.Rename (file + "_" + dversion, newFile); } catch (Exception ex) { if (monitor.LogLevel > 1) { monitor.Log ("Could not rename file '" + file + "_" + dversion + "' to '" + newFile + "'"); monitor.Log (ex.ToString ()); } } dversion++; } string dir = Path.GetDirectoryName (file); if (fileDatabase.DirectoryIsEmpty (dir)) SafeDeleteDir (monitor, dir); if (dversion == 2) { // All versions of the add-in removed. SafeDeleteDir (monitor, Path.Combine (AddinPrivateDataPath, Path.GetFileNameWithoutExtension (file))); } return true; } public bool ReadAddinDescription (IProgressStatus monitor, string file, out AddinDescription description) { try { description = AddinDescription.ReadBinary (fileDatabase, file); if (description != null) description.OwnerDatabase = this; return true; } catch (Exception ex) { if (monitor == null) throw; description = null; monitor.ReportError ("Could not read folder info file", ex); return false; } } public bool SaveDescription (IProgressStatus monitor, AddinDescription desc, string replaceFileName) { try { if (replaceFileName != null) desc.SaveBinary (fileDatabase, replaceFileName); else { string file = GetDescriptionPath (desc.Domain, desc.AddinId); string dir = Path.GetDirectoryName (file); if (!fileDatabase.DirExists (dir)) fileDatabase.CreateDir (dir); if (fileDatabase.Exists (file)) { // Another AddinDescription already exists with the same name. // Create an alternate AddinDescription file int altNum = 2; while (fileDatabase.Exists (file + "_" + altNum)) altNum++; file = file + "_" + altNum; } desc.SaveBinary (fileDatabase, file); } return true; } catch (Exception ex) { monitor.ReportError ("Add-in info file could not be saved", ex); return false; } } public bool AddinDescriptionExists (string domain, string addinId) { string file = GetDescriptionPath (domain, addinId); return fileDatabase.Exists (file); } public bool ReadFolderInfo (IProgressStatus monitor, string file, out AddinScanFolderInfo folderInfo) { try { folderInfo = AddinScanFolderInfo.Read (fileDatabase, file); return true; } catch (Exception ex) { folderInfo = null; monitor.ReportError ("Could not read folder info file", ex); return false; } } public bool GetFolderInfoForPath (IProgressStatus monitor, string path, out AddinScanFolderInfo folderInfo) { try { folderInfo = AddinScanFolderInfo.Read (fileDatabase, AddinFolderCachePath, path); return true; } catch (Exception ex) { folderInfo = null; if (monitor != null) monitor.ReportError ("Could not read folder info file", ex); return false; } } public bool SaveFolderInfo (IProgressStatus monitor, AddinScanFolderInfo folderInfo) { try { folderInfo.Write (fileDatabase, AddinFolderCachePath); return true; } catch (Exception ex) { monitor.ReportError ("Could not write folder info file", ex); return false; } } public bool DeleteFolderInfo (IProgressStatus monitor, AddinScanFolderInfo folderInfo) { return SafeDelete (monitor, folderInfo.FileName); } public bool SafeDelete (IProgressStatus monitor, string file) { try { fileDatabase.Delete (file); return true; } catch (Exception ex) { if (monitor.LogLevel > 1) { monitor.Log ("Could not delete file: " + file); monitor.Log (ex.ToString ()); } return false; } } public bool SafeDeleteDir (IProgressStatus monitor, string dir) { try { fileDatabase.DeleteDir (dir); return true; } catch (Exception ex) { if (monitor.LogLevel > 1) { monitor.Log ("Could not delete directory: " + dir); monitor.Log (ex.ToString ()); } return false; } } AddinHostIndex GetAddinHostIndex () { if (hostIndex != null) return hostIndex; using (fileDatabase.LockRead ()) { if (fileDatabase.Exists (HostIndexFile)) hostIndex = AddinHostIndex.Read (fileDatabase, HostIndexFile); else hostIndex = new AddinHostIndex (); } return hostIndex; } void SaveAddinHostIndex () { if (hostIndex != null) hostIndex.Write (fileDatabase, HostIndexFile); } internal string GetUniqueAddinId (string file, string oldId, string ns, string version) { string baseId = "__" + Path.GetFileNameWithoutExtension (file); if (Path.GetExtension (baseId) == ".addin") baseId = Path.GetFileNameWithoutExtension (baseId); string name = baseId; string id = Addin.GetFullId (ns, name, version); // If the old Id is already an automatically generated one, reuse it if (oldId != null && oldId.StartsWith (id)) return name; int n = 1; while (AddinIdExists (id)) { name = baseId + "_" + n; id = Addin.GetFullId (ns, name, version); n++; } return name; } bool AddinIdExists (string id) { foreach (string d in fileDatabase.GetDirectories (AddinCachePath)) { if (fileDatabase.Exists (Path.Combine (d, id + ".addin"))) return true; } return false; } ISetupHandler GetSetupHandler () { // if (Util.IsMono) // return new SetupProcess (); // else if (fs.RequiresIsolation) return new SetupDomain (); else return new SetupLocal (); } public void ResetConfiguration () { if (File.Exists (ConfigFile)) File.Delete (ConfigFile); config = null; ResetCachedData (); } DatabaseConfiguration Configuration { get { if (config == null) { using (fileDatabase.LockRead ()) { if (fileDatabase.Exists (ConfigFile)) config = DatabaseConfiguration.Read (ConfigFile); else config = new DatabaseConfiguration (); } } return config; } } void SaveConfiguration () { if (config != null) { using (fileDatabase.LockWrite ()) { config.Write (ConfigFile); } } } } class SingleFileAssemblyResolver { AddinScanResult scanResult; AddinScanner scanner; AddinRegistry registry; IProgressStatus progressStatus; public SingleFileAssemblyResolver (IProgressStatus progressStatus, AddinRegistry registry, AddinScanner scanner) { this.scanner = scanner; this.registry = registry; this.progressStatus = progressStatus; } public Assembly Resolve (object s, ResolveEventArgs args) { if (scanResult == null) { scanResult = new AddinScanResult (); scanResult.LocateAssembliesOnly = true; if (registry.StartupDirectory != null) scanner.ScanFolder (progressStatus, registry.StartupDirectory, null, scanResult); foreach (string dir in registry.GlobalAddinDirectories) scanner.ScanFolderRec (progressStatus, dir, AddinDatabase.GlobalDomain, scanResult); } string afile = scanResult.GetAssemblyLocation (args.Name); if (afile != null) return Util.LoadAssemblyForReflection (afile); else return null; } } class AddinIndex { Dictionary> addins = new Dictionary> (); public void Add (AddinDescription desc) { string id = Addin.GetFullId (desc.Namespace, desc.LocalId, null); List list; if (!addins.TryGetValue (id, out list)) addins [id] = list = new List (); list.Add (desc); } List FindDescriptions (string domain, string fullid) { // Returns all registered add-ins which are compatible with the provided // fullid. Compatible means that the id is the same and the version is within // the range of compatible versions of the add-in. var res = new List (); string id = Addin.GetIdName (fullid); List list; if (!addins.TryGetValue (id, out list)) return res; string version = Addin.GetIdVersion (fullid); foreach (AddinDescription desc in list) { if ((desc.Domain == domain || domain == AddinDatabase.GlobalDomain) && desc.SupportsVersion (version)) res.Add (desc); } return res; } public IEnumerable GetMissingDependencies (AddinDescription desc, ModuleDescription mod) { foreach (Dependency dep in mod.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; var descs = FindDescriptions (desc.Domain, adep.FullAddinId); if (descs.Count == 0) yield return adep.FullAddinId; } } public AddinDescription GetSimilarExistingAddin (AddinDescription conf, string addinId) { string domain = conf.Domain; List list; if (!addins.TryGetValue (Addin.GetIdName (addinId), out list)) return null; string version = Addin.GetIdVersion (addinId); foreach (AddinDescription desc in list) { if ((desc.Domain == domain || domain == AddinDatabase.GlobalDomain) && !desc.SupportsVersion (version)) return desc; } return null; } public List GetSortedAddins () { var inserted = new HashSet (); var lists = new Dictionary> (); foreach (List dlist in addins.Values) { foreach (AddinDescription desc in dlist) InsertSortedAddin (inserted, lists, desc); } // Merge all domain lists into a single list. // Make sure the global domain is inserted the last List global; lists.TryGetValue (AddinDatabase.GlobalDomain, out global); lists.Remove (AddinDatabase.GlobalDomain); List sortedAddins = new List (); foreach (var dl in lists.Values) { sortedAddins.AddRange (dl); } if (global != null) sortedAddins.AddRange (global); return sortedAddins; } void InsertSortedAddin (HashSet inserted, Dictionary> lists, AddinDescription desc) { string sid = desc.AddinId + " " + desc.Domain; if (!inserted.Add (sid)) return; foreach (ModuleDescription mod in desc.AllModules) { foreach (Dependency dep in mod.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; var descs = FindDescriptions (desc.Domain, adep.FullAddinId); if (descs.Count > 0) { foreach (AddinDescription sd in descs) InsertSortedAddin (inserted, lists, sd); } } } List list; if (!lists.TryGetValue (desc.Domain, out list)) lists [desc.Domain] = list = new List (); list.Add (desc); } } // Keep in sync with AddinSearchFlags enum AddinSearchFlagsInternal { IncludeAddins = 1, IncludeRoots = 1 << 1, IncludeAll = IncludeAddins | IncludeRoots, LatestVersionsOnly = 1 << 3, ExcludePendingUninstall = 1 << 4 } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinFileSystemExtension.cs0000664000175000017500000001304012136523632031002 0ustar00directhexdirecthex00000000000000// // AddinFileSystemExtension.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Reflection; namespace Mono.Addins.Database { /// /// An add-in file system extension. /// /// /// File system extensions can override the behavior of the add-in scanner and provide custom rules for /// locating and scanning assemblies. /// public class AddinFileSystemExtension { IAssemblyReflector reflector; /// /// Called when the add-in scan is about to start /// public virtual void ScanStarted () { } /// /// Called when the add-in scan has finished /// public virtual void ScanFinished () { } /// /// Checks if a directory exists /// /// /// 'true' if the directory exists /// /// /// Directory path /// public virtual bool DirectoryExists (string path) { return Directory.Exists (path); } /// /// Checks if a file exists /// /// /// 'true' if the file exists /// /// /// Path to the file /// public virtual bool FileExists (string path) { return File.Exists (path); } /// /// Gets the files in a directory /// /// /// The full path of the files in the directory /// /// /// Directory path /// public virtual System.Collections.Generic.IEnumerable GetFiles (string path) { return Directory.GetFiles (path); } /// /// Gets the subdirectories of a directory /// /// /// The subdirectories. /// /// /// The directory /// public virtual System.Collections.Generic.IEnumerable GetDirectories (string path) { return Directory.GetDirectories (path); } /// /// Gets the last write time of a file /// /// /// The last write time. /// /// /// File path. /// public virtual DateTime GetLastWriteTime (string filePath) { return File.GetLastWriteTime (filePath); } /// /// Opens a text file /// /// /// The text file stream /// /// /// File path. /// public virtual System.IO.StreamReader OpenTextFile (string path) { return new StreamReader (path); } /// /// Opens a file. /// /// /// The file stream. /// /// /// The file path. /// public virtual System.IO.Stream OpenFile (string path) { return File.OpenRead (path); } /// /// Gets an assembly reflector for a file. /// /// /// The reflector for the file. /// /// /// An assembly locator /// /// /// A file path /// public virtual IAssemblyReflector GetReflectorForFile (IAssemblyLocator locator, string path) { if (reflector != null) return reflector; // If there is a local copy of the cecil reflector, use it instead of the one in the gac Type t; string asmFile = Path.Combine (Path.GetDirectoryName (GetType().Assembly.Location), "Mono.Addins.CecilReflector.dll"); if (File.Exists (asmFile)) { Assembly asm = Assembly.LoadFrom (asmFile); t = asm.GetType ("Mono.Addins.CecilReflector.Reflector"); } else { string refName = GetType().Assembly.FullName; int i = refName.IndexOf (','); refName = "Mono.Addins.CecilReflector.Reflector, Mono.Addins.CecilReflector" + refName.Substring (i); t = Type.GetType (refName, false); } if (t != null) reflector = (IAssemblyReflector) Activator.CreateInstance (t); else reflector = new DefaultAssemblyReflector (); reflector.Initialize (locator); return reflector; } /// /// Gets a value indicating whether this needs to be isolated from the main execution process /// /// /// true if requires isolation; otherwise, false. /// public virtual bool RequiresIsolation { get { return true; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/ISetupHandler.cs0000664000175000017500000000277312136523632026603 0ustar00directhexdirecthex00000000000000// // ISetupHandler.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; namespace Mono.Addins.Database { internal interface ISetupHandler { void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore); void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile); } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinScanner.cs0000664000175000017500000012104512136523632026417 0ustar00directhexdirecthex00000000000000// // AddinScanner.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using System.Reflection; using System.Collections.Specialized; using System.Xml; using System.ComponentModel; using Mono.Addins.Description; namespace Mono.Addins.Database { class AddinScanner: MarshalByRefObject { AddinDatabase database; AddinFileSystemExtension fs; Dictionary coreAssemblies = new Dictionary (); public AddinScanner (AddinDatabase database, AddinScanResult scanResult, IProgressStatus monitor) { this.database = database; fs = database.FileSystem; } public void ScanFolder (IProgressStatus monitor, string path, string domain, AddinScanResult scanResult) { path = Path.GetFullPath (path); // Avoid folders including each other if (!scanResult.VisitFolder (path)) return; AddinScanFolderInfo folderInfo; if (!database.GetFolderInfoForPath (monitor, path, out folderInfo)) { // folderInfo file was corrupt. // Just in case, we are going to regenerate all relation data. if (!fs.DirectoryExists (path)) scanResult.RegenerateRelationData = true; } else { // Directory is included but it doesn't exist. Ignore it. if (folderInfo == null && !fs.DirectoryExists (path)) return; } // if domain is null it means that a new domain has to be created. bool sharedFolder = domain == AddinDatabase.GlobalDomain; bool isNewFolder = folderInfo == null; if (isNewFolder) { // No folder info. It is the first time this folder is scanned. // There is no need to store this object if the folder does not // contain add-ins. folderInfo = new AddinScanFolderInfo (path); } if (!sharedFolder && (folderInfo.SharedFolder || folderInfo.Domain != domain)) { // If the folder already has a domain, reuse it if (domain == null && folderInfo.RootsDomain != null && folderInfo.RootsDomain != AddinDatabase.GlobalDomain) domain = folderInfo.RootsDomain; else if (domain == null) { folderInfo.Domain = domain = database.GetUniqueDomainId (); scanResult.RegenerateRelationData = true; } else { folderInfo.Domain = domain; if (!isNewFolder) { // Domain has changed. Update the folder info and regenerate everything. scanResult.RegenerateRelationData = true; scanResult.RegisterModifiedFolderInfo (folderInfo); } } } else if (!folderInfo.SharedFolder && sharedFolder) { scanResult.RegenerateRelationData = true; } folderInfo.SharedFolder = sharedFolder; // If there is no domain assigned to the host, get one now if (scanResult.Domain == AddinDatabase.UnknownDomain) scanResult.Domain = domain; // Discard folders not belonging to the required domain if (scanResult.Domain != null && domain != scanResult.Domain && domain != AddinDatabase.GlobalDomain) { return; } if (monitor.LogLevel > 1 && !scanResult.LocateAssembliesOnly) monitor.Log ("Checking: " + path); if (fs.DirectoryExists (path)) { IEnumerable files = fs.GetFiles (path); // First of all, look for .addin files. Addin files must be processed before // assemblies, because they may add files to the ignore list (i.e., assemblies // included in .addin files won't be scanned twice). foreach (string file in files) { if (file.EndsWith (".addin.xml") || file.EndsWith (".addin")) { RegisterFileToScan (monitor, file, scanResult, folderInfo); } } // Now scan assemblies. They can also add files to the ignore list. foreach (string file in files) { string ext = Path.GetExtension (file).ToLower (); if (ext == ".dll" || ext == ".exe") { RegisterFileToScan (monitor, file, scanResult, folderInfo); scanResult.AddAssemblyLocation (file); } } // Finally scan .addins files foreach (string file in files) { if (Path.GetExtension (file).EndsWith (".addins")) { ScanAddinsFile (monitor, file, domain, scanResult); } } } else if (!scanResult.LocateAssembliesOnly) { // The folder has been deleted. All add-ins defined in that folder should also be deleted. scanResult.RegenerateRelationData = true; scanResult.ChangesFound = true; if (scanResult.CheckOnly) return; database.DeleteFolderInfo (monitor, folderInfo); } if (scanResult.LocateAssembliesOnly) return; // Look for deleted add-ins. UpdateDeletedAddins (monitor, folderInfo, scanResult); } public void UpdateDeletedAddins (IProgressStatus monitor, AddinScanFolderInfo folderInfo, AddinScanResult scanResult) { ArrayList missing = folderInfo.GetMissingAddins (fs); if (missing.Count > 0) { if (fs.DirectoryExists (folderInfo.Folder)) scanResult.RegisterModifiedFolderInfo (folderInfo); scanResult.ChangesFound = true; if (scanResult.CheckOnly) return; foreach (AddinFileInfo info in missing) { database.UninstallAddin (monitor, info.Domain, info.AddinId, info.File, scanResult); } } } void RegisterFileToScan (IProgressStatus monitor, string file, AddinScanResult scanResult, AddinScanFolderInfo folderInfo) { if (scanResult.LocateAssembliesOnly) return; AddinFileInfo finfo = folderInfo.GetAddinFileInfo (file); bool added = false; if (finfo != null && (!finfo.IsAddin || finfo.Domain == folderInfo.GetDomain (finfo.IsRoot)) && fs.GetLastWriteTime (file) == finfo.LastScan && !scanResult.RegenerateAllData) { if (finfo.ScanError) { // Always schedule the file for scan if there was an error in a previous scan. // However, don't set ChangesFound=true, in this way if there isn't any other // change in the registry, the file won't be scanned again. scanResult.AddFileToScan (file, folderInfo); added = true; } if (!finfo.IsAddin) return; if (database.AddinDescriptionExists (finfo.Domain, finfo.AddinId)) { // It is an add-in and it has not changed. Paths in the ignore list // are still valid, so they can be used. if (finfo.IgnorePaths != null) scanResult.AddPathsToIgnore (finfo.IgnorePaths); return; } } scanResult.ChangesFound = true; if (!scanResult.CheckOnly && !added) scanResult.AddFileToScan (file, folderInfo); } public void ScanFile (IProgressStatus monitor, string file, AddinScanFolderInfo folderInfo, AddinScanResult scanResult) { if (scanResult.IgnorePath (file)) { // The file must be ignored. Maybe it caused a crash in a previous scan, or it // might be included by a .addin file (in which case it will be scanned when processing // the .addin file). folderInfo.SetLastScanTime (file, null, false, fs.GetLastWriteTime (file), true); return; } if (monitor.LogLevel > 1) monitor.Log ("Scanning file: " + file); // Log the file to be scanned, so in case of a process crash the main process // will know what crashed monitor.Log ("plog:scan:" + file); string scannedAddinId = null; bool scannedIsRoot = false; bool scanSuccessful = false; AddinDescription config = null; try { string ext = Path.GetExtension (file).ToLower (); if (ext == ".dll" || ext == ".exe") scanSuccessful = ScanAssembly (monitor, file, scanResult, out config); else scanSuccessful = ScanConfigAssemblies (monitor, file, scanResult, out config); if (config != null) { AddinFileInfo fi = folderInfo.GetAddinFileInfo (file); // If version is not specified, make up one if (config.Version.Length == 0) { config.Version = "0.0.0.0"; } if (config.LocalId.Length == 0) { // Generate an internal id for this add-in config.LocalId = database.GetUniqueAddinId (file, (fi != null ? fi.AddinId : null), config.Namespace, config.Version); config.HasUserId = false; } // Check errors in the description StringCollection errors = config.Verify (fs); if (database.IsGlobalRegistry && config.AddinId.IndexOf ('.') == -1) { errors.Add ("Add-ins registered in the global registry must have a namespace."); } if (errors.Count > 0) { scanSuccessful = false; monitor.ReportError ("Errors found in add-in '" + file + ":", null); foreach (string err in errors) monitor.ReportError (err, null); } // Make sure all extensions sets are initialized with the correct add-in id config.SetExtensionsAddinId (config.AddinId); scanResult.ChangesFound = true; // If the add-in already existed, try to reuse the relation data it had. // Also, the dependencies of the old add-in need to be re-analized AddinDescription existingDescription = null; bool res = database.GetAddinDescription (monitor, folderInfo.Domain, config.AddinId, config.AddinFile, out existingDescription); // If we can't get information about the old assembly, just regenerate all relation data if (!res) scanResult.RegenerateRelationData = true; string replaceFileName = null; if (existingDescription != null) { // Reuse old relation data config.MergeExternalData (existingDescription); Util.AddDependencies (existingDescription, scanResult); replaceFileName = existingDescription.FileName; } // If the scanned file results in an add-in version different from the one obtained from // previous scans, the old add-in needs to be uninstalled. if (fi != null && fi.IsAddin && fi.AddinId != config.AddinId) { database.UninstallAddin (monitor, folderInfo.Domain, fi.AddinId, fi.File, scanResult); // If the add-in version has changed, regenerate everything again since old data can't be reused if (Addin.GetIdName (fi.AddinId) == Addin.GetIdName (config.AddinId)) scanResult.RegenerateRelationData = true; } // If a description could be generated, save it now (if the scan was successful) if (scanSuccessful) { // Assign the domain if (config.IsRoot) { if (folderInfo.RootsDomain == null) { if (scanResult.Domain != null && scanResult.Domain != AddinDatabase.UnknownDomain && scanResult.Domain != AddinDatabase.GlobalDomain) folderInfo.RootsDomain = scanResult.Domain; else folderInfo.RootsDomain = database.GetUniqueDomainId (); } config.Domain = folderInfo.RootsDomain; } else config.Domain = folderInfo.Domain; if (config.IsRoot && scanResult.HostIndex != null) { // If the add-in is a root, register its assemblies foreach (string f in config.MainModule.Assemblies) { string asmFile = Path.Combine (config.BasePath, f); scanResult.HostIndex.RegisterAssembly (asmFile, config.AddinId, config.AddinFile, config.Domain); } } // Finally save if (database.SaveDescription (monitor, config, replaceFileName)) { // The new dependencies also have to be updated Util.AddDependencies (config, scanResult); scanResult.AddAddinToUpdate (config.AddinId); scannedAddinId = config.AddinId; scannedIsRoot = config.IsRoot; return; } } } } catch (Exception ex) { monitor.ReportError ("Unexpected error while scanning file: " + file, ex); } finally { AddinFileInfo ainfo = folderInfo.SetLastScanTime (file, scannedAddinId, scannedIsRoot, fs.GetLastWriteTime (file), !scanSuccessful); if (scanSuccessful && config != null) { // Update the ignore list in the folder info object. To be used in the next scan foreach (string df in config.AllIgnorePaths) { string path = Path.Combine (config.BasePath, df); ainfo.AddPathToIgnore (Path.GetFullPath (path)); } } monitor.Log ("plog:endscan"); } } public AddinDescription ScanSingleFile (IProgressStatus monitor, string file, AddinScanResult scanResult) { AddinDescription config = null; if (monitor.LogLevel > 1) monitor.Log ("Scanning file: " + file); monitor.Log ("plog:scan:" + file); try { string ext = Path.GetExtension (file).ToLower (); bool scanSuccessful; if (ext == ".dll" || ext == ".exe") scanSuccessful = ScanAssembly (monitor, file, scanResult, out config); else scanSuccessful = ScanConfigAssemblies (monitor, file, scanResult, out config); if (scanSuccessful && config != null) { config.Domain = "global"; if (config.Version.Length == 0) config.Version = "0.0.0.0"; if (config.LocalId.Length == 0) { // Generate an internal id for this add-in config.LocalId = database.GetUniqueAddinId (file, "", config.Namespace, config.Version); } } } catch (Exception ex) { monitor.ReportError ("Unexpected error while scanning file: " + file, ex); } finally { monitor.Log ("plog:endscan"); } return config; } public void ScanAddinsFile (IProgressStatus monitor, string file, string domain, AddinScanResult scanResult) { XmlTextReader r = null; ArrayList directories = new ArrayList (); ArrayList directoriesWithSubdirs = new ArrayList (); string basePath = Path.GetDirectoryName (file); try { r = new XmlTextReader (fs.OpenTextFile (file)); r.MoveToContent (); if (r.IsEmptyElement) return; r.ReadStartElement (); r.MoveToContent (); while (r.NodeType != XmlNodeType.EndElement) { if (r.NodeType == XmlNodeType.Element && r.LocalName == "Directory") { string subs = r.GetAttribute ("include-subdirs"); string sdom; string share = r.GetAttribute ("shared"); if (share == "true") sdom = AddinDatabase.GlobalDomain; else if (share == "false") sdom = null; else sdom = domain; // Inherit the domain string path = r.ReadElementString ().Trim (); if (path.Length > 0) { path = Util.NormalizePath (path); if (subs == "true") directoriesWithSubdirs.Add (new string[] {path, sdom}); else directories.Add (new string[] {path, sdom}); } } else if (r.NodeType == XmlNodeType.Element && r.LocalName == "GacAssembly") { string aname = r.ReadElementString ().Trim (); if (aname.Length > 0) { aname = Util.NormalizePath (aname); aname = Util.GetGacPath (aname); if (aname != null) { // Gac assemblies always use the global domain directories.Add (new string[] {aname, AddinDatabase.GlobalDomain}); } } } else if (r.NodeType == XmlNodeType.Element && r.LocalName == "Exclude") { string path = r.ReadElementString ().Trim (); if (path.Length > 0) { path = Util.NormalizePath (path); if (!Path.IsPathRooted (path)) path = Path.Combine (basePath, path); scanResult.AddPathToIgnore (Path.GetFullPath (path)); } } else r.Skip (); r.MoveToContent (); } } catch (Exception ex) { monitor.ReportError ("Could not process addins file: " + file, ex); return; } finally { if (r != null) r.Close (); } foreach (string[] d in directories) { string dir = d[0]; if (!Path.IsPathRooted (dir)) dir = Path.Combine (basePath, dir); ScanFolder (monitor, dir, d[1], scanResult); } foreach (string[] d in directoriesWithSubdirs) { string dir = d[0]; if (!Path.IsPathRooted (dir)) dir = Path.Combine (basePath, dir); ScanFolderRec (monitor, dir, d[1], scanResult); } } public void ScanFolderRec (IProgressStatus monitor, string dir, string domain, AddinScanResult scanResult) { ScanFolder (monitor, dir, domain, scanResult); if (!fs.DirectoryExists (dir)) return; foreach (string sd in fs.GetDirectories (dir)) ScanFolderRec (monitor, sd, domain, scanResult); } bool ScanConfigAssemblies (IProgressStatus monitor, string filePath, AddinScanResult scanResult, out AddinDescription config) { config = null; try { IAssemblyReflector reflector = GetReflector (monitor, scanResult, filePath); string basePath = Path.GetDirectoryName (filePath); using (var s = fs.OpenFile (filePath)) { config = AddinDescription.Read (s, basePath); } config.FileName = filePath; config.SetBasePath (basePath); config.AddinFile = filePath; return ScanDescription (monitor, reflector, config, null, scanResult); } catch (Exception ex) { // Something went wrong while scanning the assembly. We'll ignore it for now. monitor.ReportError ("There was an error while scanning add-in: " + filePath, ex); return false; } } IAssemblyReflector GetReflector (IProgressStatus monitor, AddinScanResult scanResult, string filePath) { IAssemblyReflector reflector = fs.GetReflectorForFile (scanResult, filePath); object coreAssembly; if (!coreAssemblies.TryGetValue (reflector, out coreAssembly)) { if (monitor.LogLevel > 1) monitor.Log ("Using assembly reflector: " + reflector.GetType ()); coreAssemblies [reflector] = coreAssembly = reflector.LoadAssembly (GetType().Assembly.Location); } return reflector; } bool ScanAssembly (IProgressStatus monitor, string filePath, AddinScanResult scanResult, out AddinDescription config) { config = null; try { IAssemblyReflector reflector = GetReflector (monitor, scanResult, filePath); object asm = reflector.LoadAssembly (filePath); if (asm == null) throw new Exception ("Could not load assembly: " + filePath); // Get the config file from the resources, if there is one foreach (string res in reflector.GetResourceNames (asm)) { if (res.EndsWith (".addin") || res.EndsWith (".addin.xml")) { using (Stream s = reflector.GetResourceStream (asm, res)) { AddinDescription ad = AddinDescription.Read (s, Path.GetDirectoryName (filePath)); if (config != null) { if (!config.IsExtensionModel && !ad.IsExtensionModel) { // There is more than one add-in definition monitor.ReportError ("Duplicate add-in definition found in assembly: " + filePath, null); return false; } config = AddinDescription.Merge (config, ad); } else config = ad; } } } if (config == null) { // In this case, only scan the assembly if it has the Addin attribute. AddinAttribute att = (AddinAttribute) reflector.GetCustomAttribute (asm, typeof(AddinAttribute), false); if (att == null) return true; config = new AddinDescription (); } config.SetBasePath (Path.GetDirectoryName (filePath)); config.AddinFile = filePath; string rasmFile = Path.GetFileName (filePath); if (!config.MainModule.Assemblies.Contains (rasmFile)) config.MainModule.Assemblies.Add (rasmFile); return ScanDescription (monitor, reflector, config, asm, scanResult); } catch (Exception ex) { // Something went wrong while scanning the assembly. We'll ignore it for now. monitor.ReportError ("There was an error while scanning assembly: " + filePath, ex); return false; } } bool ScanDescription (IProgressStatus monitor, IAssemblyReflector reflector, AddinDescription config, object rootAssembly, AddinScanResult scanResult) { // First of all scan the main module ArrayList assemblies = new ArrayList (); try { string rootAsmFile = null; if (rootAssembly != null) { ScanAssemblyAddinHeaders (reflector, config, rootAssembly, scanResult); ScanAssemblyImports (reflector, config.MainModule, rootAssembly); assemblies.Add (rootAssembly); rootAsmFile = Path.GetFileName (config.AddinFile); } // The assembly list may be modified while scanning the headears, so // we use a for loop instead of a foreach for (int n=0; n 0) config.LocalId = att.Id; if (att.Version.Length > 0) config.Version = att.Version; if (att.Namespace.Length > 0) config.Namespace = att.Namespace; if (att.Category.Length > 0) config.Category = att.Category; if (att.CompatVersion.Length > 0) config.CompatVersion = att.CompatVersion; if (att.Url.Length > 0) config.Url = att.Url; config.IsRoot = att is AddinRootAttribute; config.EnabledByDefault = att.EnabledByDefault; config.Flags = att.Flags; } // Author attributes object[] atts = reflector.GetCustomAttributes (asm, typeof(AddinAuthorAttribute), false); foreach (AddinAuthorAttribute author in atts) { if (config.Author.Length == 0) config.Author = author.Name; else config.Author += ", " + author.Name; } // Name atts = reflector.GetCustomAttributes (asm, typeof(AddinNameAttribute), false); foreach (AddinNameAttribute at in atts) { if (string.IsNullOrEmpty (at.Locale)) config.Name = at.Name; else config.Properties.SetPropertyValue ("Name", at.Name, at.Locale); } // Description object catt = reflector.GetCustomAttribute (asm, typeof(AssemblyDescriptionAttribute), false); if (catt != null && config.Description.Length == 0) config.Description = ((AssemblyDescriptionAttribute)catt).Description; atts = reflector.GetCustomAttributes (asm, typeof(AddinDescriptionAttribute), false); foreach (AddinDescriptionAttribute at in atts) { if (string.IsNullOrEmpty (at.Locale)) config.Description = at.Description; else config.Properties.SetPropertyValue ("Description", at.Description, at.Locale); } // Copyright catt = reflector.GetCustomAttribute (asm, typeof(AssemblyCopyrightAttribute), false); if (catt != null && config.Copyright.Length == 0) config.Copyright = ((AssemblyCopyrightAttribute)catt).Copyright; // Localizer AddinLocalizerGettextAttribute locat = (AddinLocalizerGettextAttribute) reflector.GetCustomAttribute (asm, typeof(AddinLocalizerGettextAttribute), false); if (locat != null) { ExtensionNodeDescription node = new ExtensionNodeDescription (); if (!string.IsNullOrEmpty (locat.Catalog)) node.SetAttribute ("catalog", locat.Catalog); if (!string.IsNullOrEmpty (locat.Location)) node.SetAttribute ("location", locat.Catalog); config.Localizer = node; } // Optional modules atts = reflector.GetCustomAttributes (asm, typeof(AddinModuleAttribute), false); foreach (AddinModuleAttribute mod in atts) { if (mod.AssemblyFile.Length > 0) { ModuleDescription module = new ModuleDescription (); module.Assemblies.Add (mod.AssemblyFile); config.OptionalModules.Add (module); } } } void ScanAssemblyImports (IAssemblyReflector reflector, ModuleDescription module, object asm) { object[] atts = reflector.GetCustomAttributes (asm, typeof(ImportAddinAssemblyAttribute), false); foreach (ImportAddinAssemblyAttribute import in atts) { if (!string.IsNullOrEmpty (import.FilePath)) { module.Assemblies.Add (import.FilePath); if (!import.Scan) module.IgnorePaths.Add (import.FilePath); } } atts = reflector.GetCustomAttributes (asm, typeof(ImportAddinFileAttribute), false); foreach (ImportAddinFileAttribute import in atts) { if (!string.IsNullOrEmpty (import.FilePath)) module.DataFiles.Add (import.FilePath); } } void ScanAssemblyContents (IAssemblyReflector reflector, AddinDescription config, ModuleDescription module, object asm, AddinScanResult scanResult) { bool isMainModule = module == config.MainModule; // Get dependencies object[] deps = reflector.GetCustomAttributes (asm, typeof(AddinDependencyAttribute), false); foreach (AddinDependencyAttribute dep in deps) { AddinDependency adep = new AddinDependency (); adep.AddinId = dep.Id; adep.Version = dep.Version; module.Dependencies.Add (adep); } if (isMainModule) { // Get properties object[] props = reflector.GetCustomAttributes (asm, typeof(AddinPropertyAttribute), false); foreach (AddinPropertyAttribute prop in props) config.Properties.SetPropertyValue (prop.Name, prop.Value, prop.Locale); // Get extension points object[] extPoints = reflector.GetCustomAttributes (asm, typeof(ExtensionPointAttribute), false); foreach (ExtensionPointAttribute ext in extPoints) { ExtensionPoint ep = config.AddExtensionPoint (ext.Path); ep.Description = ext.Description; ep.Name = ext.Name; ExtensionNodeType nt = ep.AddExtensionNode (ext.NodeName, ext.NodeTypeName); nt.ExtensionAttributeTypeName = ext.ExtensionAttributeTypeName; } } // Look for extension nodes declared using assembly attributes foreach (CustomAttribute att in reflector.GetRawCustomAttributes (asm, typeof(CustomExtensionAttribute), true)) AddCustomAttributeExtension (module, att, "Type"); // Get extensions or extension points applied to types foreach (object t in reflector.GetAssemblyTypes (asm)) { string typeFullName = reflector.GetTypeFullName (t); // Look for extensions object[] extensionAtts = reflector.GetCustomAttributes (t, typeof(ExtensionAttribute), false); if (extensionAtts.Length > 0) { Dictionary nodes = new Dictionary (); ExtensionNodeDescription uniqueNode = null; foreach (ExtensionAttribute eatt in extensionAtts) { string path; string nodeName = eatt.NodeName; if (eatt.TypeName.Length > 0) { path = "$" + eatt.TypeName; } else if (eatt.Path.Length == 0) { path = GetBaseTypeNameList (reflector, t); if (path == "$") { // The type does not implement any interface and has no superclass. // Will be reported later as an error. path = "$" + typeFullName; } } else { path = eatt.Path; } ExtensionNodeDescription elem = module.AddExtensionNode (path, nodeName); nodes [path] = elem; uniqueNode = elem; if (eatt.Id.Length > 0) { elem.SetAttribute ("id", eatt.Id); elem.SetAttribute ("type", typeFullName); } else { elem.SetAttribute ("id", typeFullName); } if (eatt.InsertAfter.Length > 0) elem.SetAttribute ("insertafter", eatt.InsertAfter); if (eatt.InsertBefore.Length > 0) elem.SetAttribute ("insertbefore", eatt.InsertBefore); } // Get the node attributes foreach (ExtensionAttributeAttribute eat in reflector.GetCustomAttributes (t, typeof(ExtensionAttributeAttribute), false)) { ExtensionNodeDescription node; if (!string.IsNullOrEmpty (eat.Path)) nodes.TryGetValue (eat.Path, out node); else if (eat.TypeName.Length > 0) nodes.TryGetValue ("$" + eat.TypeName, out node); else { if (nodes.Count > 1) throw new Exception ("Missing type or extension path value in ExtensionAttribute for type '" + typeFullName + "'."); node = uniqueNode; } if (node == null) throw new Exception ("Invalid type or path value in ExtensionAttribute for type '" + typeFullName + "'."); node.SetAttribute (eat.Name ?? string.Empty, eat.Value ?? string.Empty); } } else { // Look for extension points extensionAtts = reflector.GetCustomAttributes (t, typeof(TypeExtensionPointAttribute), false); if (extensionAtts.Length > 0 && isMainModule) { foreach (TypeExtensionPointAttribute epa in extensionAtts) { ExtensionPoint ep; ExtensionNodeType nt = new ExtensionNodeType (); if (epa.Path.Length > 0) { ep = config.AddExtensionPoint (epa.Path); } else { ep = config.AddExtensionPoint (GetDefaultTypeExtensionPath (config, typeFullName)); nt.ObjectTypeName = typeFullName; } nt.Id = epa.NodeName; nt.TypeName = epa.NodeTypeName; nt.ExtensionAttributeTypeName = epa.ExtensionAttributeTypeName; ep.NodeSet.NodeTypes.Add (nt); ep.Description = epa.Description; ep.Name = epa.Name; ep.RootAddin = config.AddinId; ep.SetExtensionsAddinId (config.AddinId); } } else { // Look for custom extension attribtues foreach (CustomAttribute att in reflector.GetRawCustomAttributes (t, typeof(CustomExtensionAttribute), false)) { ExtensionNodeDescription elem = AddCustomAttributeExtension (module, att, "Type"); elem.SetAttribute ("type", typeFullName); if (string.IsNullOrEmpty (elem.GetAttribute ("id"))) elem.SetAttribute ("id", typeFullName); } } } } } ExtensionNodeDescription AddCustomAttributeExtension (ModuleDescription module, CustomAttribute att, string nameName) { string path; if (!att.TryGetValue (CustomExtensionAttribute.PathFieldKey, out path)) path = "%" + att.TypeName; ExtensionNodeDescription elem = module.AddExtensionNode (path, nameName); foreach (KeyValuePair prop in att) { if (prop.Key != CustomExtensionAttribute.PathFieldKey) elem.SetAttribute (prop.Key, prop.Value); } return elem; } void ScanNodeSet (IAssemblyReflector reflector, AddinDescription config, ExtensionNodeSet nset, ArrayList assemblies, Hashtable internalNodeSets) { foreach (ExtensionNodeType nt in nset.NodeTypes) ScanNodeType (reflector, config, nt, assemblies, internalNodeSets); } void ScanNodeType (IAssemblyReflector reflector, AddinDescription config, ExtensionNodeType nt, ArrayList assemblies, Hashtable internalNodeSets) { if (nt.TypeName.Length == 0) nt.TypeName = "Mono.Addins.TypeExtensionNode"; object ntype = FindAddinType (reflector, nt.TypeName, assemblies); if (ntype == null) return; // Add type information declared with attributes in the code ExtensionNodeAttribute nodeAtt = (ExtensionNodeAttribute) reflector.GetCustomAttribute (ntype, typeof(ExtensionNodeAttribute), true); if (nodeAtt != null) { if (nt.Id.Length == 0 && nodeAtt.NodeName.Length > 0) nt.Id = nodeAtt.NodeName; if (nt.Description.Length == 0 && nodeAtt.Description.Length > 0) nt.Description = nodeAtt.Description; if (nt.ExtensionAttributeTypeName.Length == 0 && nodeAtt.ExtensionAttributeTypeName.Length > 0) nt.ExtensionAttributeTypeName = nodeAtt.ExtensionAttributeTypeName; } else { // Use the node type name as default name if (nt.Id.Length == 0) nt.Id = reflector.GetTypeName (ntype); } // Add information about attributes object[] fieldAtts = reflector.GetCustomAttributes (ntype, typeof(NodeAttributeAttribute), true); foreach (NodeAttributeAttribute fatt in fieldAtts) { NodeTypeAttribute natt = new NodeTypeAttribute (); natt.Name = fatt.Name; natt.Required = fatt.Required; if (fatt.TypeName != null) natt.Type = fatt.TypeName; if (fatt.Description.Length > 0) natt.Description = fatt.Description; nt.Attributes.Add (natt); } // Check if the type has NodeAttribute attributes applied to fields. foreach (object field in reflector.GetFields (ntype)) { NodeAttributeAttribute fatt = (NodeAttributeAttribute) reflector.GetCustomAttribute (field, typeof(NodeAttributeAttribute), false); if (fatt != null) { NodeTypeAttribute natt = new NodeTypeAttribute (); if (fatt.Name.Length > 0) natt.Name = fatt.Name; else natt.Name = reflector.GetFieldName (field); if (fatt.Description.Length > 0) natt.Description = fatt.Description; natt.Type = reflector.GetFieldTypeFullName (field); natt.Required = fatt.Required; nt.Attributes.Add (natt); } } // Check if the extension type allows children by looking for [ExtensionNodeChild] attributes. // First of all, look in the internalNodeSets hashtable, which is being used as cache string childSet = (string) internalNodeSets [nt.TypeName]; if (childSet == null) { object[] ats = reflector.GetCustomAttributes (ntype, typeof(ExtensionNodeChildAttribute), true); if (ats.Length > 0) { // Create a new node set for this type. It is necessary to create a new node set // instead of just adding child ExtensionNodeType objects to the this node type // because child types references can be recursive. ExtensionNodeSet internalSet = new ExtensionNodeSet (); internalSet.Id = reflector.GetTypeName (ntype) + "_" + Guid.NewGuid().ToString (); foreach (ExtensionNodeChildAttribute at in ats) { ExtensionNodeType internalType = new ExtensionNodeType (); internalType.Id = at.NodeName; internalType.TypeName = at.ExtensionNodeTypeName; internalSet.NodeTypes.Add (internalType); } config.ExtensionNodeSets.Add (internalSet); nt.NodeSets.Add (internalSet.Id); // Register the new set in a hashtable, to allow recursive references to the // same internal set. internalNodeSets [nt.TypeName] = internalSet.Id; internalNodeSets [reflector.GetTypeAssemblyQualifiedName (ntype)] = internalSet.Id; ScanNodeSet (reflector, config, internalSet, assemblies, internalNodeSets); } } else { if (childSet.Length == 0) { // The extension type does not declare children. return; } // The extension type can have children. The allowed children are // defined in this extension set. nt.NodeSets.Add (childSet); return; } ScanNodeSet (reflector, config, nt, assemblies, internalNodeSets); } string GetBaseTypeNameList (IAssemblyReflector reflector, object type) { StringBuilder sb = new StringBuilder ("$"); foreach (string tn in reflector.GetBaseTypeFullNameList (type)) sb.Append (tn).Append (','); if (sb.Length > 0) sb.Remove (sb.Length - 1, 1); return sb.ToString (); } object FindAddinType (IAssemblyReflector reflector, string typeName, ArrayList assemblies) { // Look in the current assembly object etype = reflector.GetType (coreAssemblies [reflector], typeName); if (etype != null) return etype; // Look in referenced assemblies foreach (object asm in assemblies) { etype = reflector.GetType (asm, typeName); if (etype != null) return etype; } Hashtable visited = new Hashtable (); // Look in indirectly referenced assemblies foreach (object asm in assemblies) { foreach (object aref in reflector.GetAssemblyReferences (asm)) { if (visited.Contains (aref)) continue; visited.Add (aref, aref); object rasm = reflector.LoadAssemblyFromReference (aref); if (rasm != null) { etype = reflector.GetType (rasm, typeName); if (etype != null) return etype; } } } return null; } void RegisterTypeNode (AddinDescription config, ExtensionAttribute eatt, string path, string nodeName, string typeFullName) { ExtensionNodeDescription elem = config.MainModule.AddExtensionNode (path, nodeName); if (eatt.Id.Length > 0) { elem.SetAttribute ("id", eatt.Id); elem.SetAttribute ("type", typeFullName); } else { elem.SetAttribute ("id", typeFullName); } if (eatt.InsertAfter.Length > 0) elem.SetAttribute ("insertafter", eatt.InsertAfter); if (eatt.InsertBefore.Length > 0) elem.SetAttribute ("insertbefore", eatt.InsertBefore); } internal string GetDefaultTypeExtensionPath (AddinDescription desc, string typeFullName) { return "/" + Addin.GetIdName (desc.AddinId) + "/TypeExtensions/" + typeFullName; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinScanFolderInfo.cs0000664000175000017500000001615412136523632027666 0ustar00directhexdirecthex00000000000000// // AddinScanFolderInfo.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Collections; using System.Collections.Specialized; using Mono.Addins.Serialization; namespace Mono.Addins.Database { class AddinScanFolderInfo: IBinaryXmlElement { Hashtable files = new Hashtable (); string folder; string fileName; string domain; bool sharedFolder = true; static BinaryXmlTypeMap typeMap = new BinaryXmlTypeMap ( typeof(AddinScanFolderInfo), typeof(AddinFileInfo) ); internal AddinScanFolderInfo () { } public AddinScanFolderInfo (string folder) { this.folder = folder; } public string FileName { get { return fileName; } } public static AddinScanFolderInfo Read (FileDatabase filedb, string file) { AddinScanFolderInfo finfo = (AddinScanFolderInfo) filedb.ReadSharedObject (file, typeMap); if (finfo != null) finfo.fileName = file; return finfo; } public static AddinScanFolderInfo Read (FileDatabase filedb, string basePath, string folderPath) { string fileName; AddinScanFolderInfo finfo = (AddinScanFolderInfo) filedb.ReadSharedObject (basePath, GetDomain (folderPath), ".data", Path.GetFullPath (folderPath), typeMap, out fileName); if (finfo != null) finfo.fileName = fileName; return finfo; } static string GetDomain (string path) { path = Path.GetFullPath (path); string s = path.Replace (Path.DirectorySeparatorChar, '_'); s = s.Replace (Path.AltDirectorySeparatorChar, '_'); s = s.Replace (Path.VolumeSeparatorChar, '_'); s = s.Trim ('_'); return s; } public void Write (FileDatabase filedb, string basePath) { filedb.WriteSharedObject (basePath, GetDomain (folder), ".data", Path.GetFullPath (folder), fileName, typeMap, this); } public string GetExistingLocalDomain () { foreach (AddinFileInfo info in files.Values) { if (info.Domain != null && info.Domain != AddinDatabase.GlobalDomain) return info.Domain; } return AddinDatabase.GlobalDomain; } public string Folder { get { return folder; } } public string Domain { get { if (sharedFolder) return AddinDatabase.GlobalDomain; else return domain; } set { domain = value; sharedFolder = true; } } public string RootsDomain { get { return domain; } set { domain = value; } } public string GetDomain (bool isRoot) { if (isRoot) return RootsDomain; else return Domain; } public bool SharedFolder { get { return sharedFolder; } set { sharedFolder = value; } } public DateTime GetLastScanTime (string file) { AddinFileInfo info = (AddinFileInfo) files [file]; if (info == null) return DateTime.MinValue; else return info.LastScan; } public AddinFileInfo GetAddinFileInfo (string file) { return (AddinFileInfo) files [file]; } public AddinFileInfo SetLastScanTime (string file, string addinId, bool isRoot, DateTime time, bool scanError) { AddinFileInfo info = (AddinFileInfo) files [file]; if (info == null) { info = new AddinFileInfo (); info.File = file; files [file] = info; } info.LastScan = time; info.AddinId = addinId; info.IsRoot = isRoot; info.ScanError = scanError; if (addinId != null) info.Domain = GetDomain (isRoot); else info.Domain = null; return info; } public ArrayList GetMissingAddins (AddinFileSystemExtension fs) { ArrayList missing = new ArrayList (); if (!fs.DirectoryExists (folder)) { // All deleted foreach (AddinFileInfo info in files.Values) { if (info.IsAddin) missing.Add (info); } files.Clear (); return missing; } ArrayList toDelete = new ArrayList (); foreach (AddinFileInfo info in files.Values) { if (!fs.FileExists (info.File)) { if (info.IsAddin) missing.Add (info); toDelete.Add (info.File); } else if (info.IsAddin && info.Domain != GetDomain (info.IsRoot)) { missing.Add (info); } } foreach (string file in toDelete) files.Remove (file); return missing; } void IBinaryXmlElement.Write (BinaryXmlWriter writer) { if (files.Count == 0) { domain = null; sharedFolder = true; } writer.WriteValue ("folder", folder); writer.WriteValue ("files", files); writer.WriteValue ("domain", domain); writer.WriteValue ("sharedFolder", sharedFolder); } void IBinaryXmlElement.Read (BinaryXmlReader reader) { folder = reader.ReadStringValue ("folder"); reader.ReadValue ("files", files); domain = reader.ReadStringValue ("domain"); sharedFolder = reader.ReadBooleanValue ("sharedFolder"); } } class AddinFileInfo: IBinaryXmlElement { public string File; public DateTime LastScan; public string AddinId; public bool IsRoot; public bool ScanError; public string Domain; public StringCollection IgnorePaths; public bool IsAddin { get { return AddinId != null && AddinId.Length != 0; } } public void AddPathToIgnore (string path) { if (IgnorePaths == null) IgnorePaths = new StringCollection (); IgnorePaths.Add (path); } void IBinaryXmlElement.Write (BinaryXmlWriter writer) { writer.WriteValue ("File", File); writer.WriteValue ("LastScan", LastScan); writer.WriteValue ("AddinId", AddinId); writer.WriteValue ("IsRoot", IsRoot); writer.WriteValue ("ScanError", ScanError); writer.WriteValue ("Domain", Domain); if (IgnorePaths != null && IgnorePaths.Count > 0) writer.WriteValue ("IgnorePaths", IgnorePaths); } void IBinaryXmlElement.Read (BinaryXmlReader reader) { File = reader.ReadStringValue ("File"); LastScan = reader.ReadDateTimeValue ("LastScan"); AddinId = reader.ReadStringValue ("AddinId"); IsRoot = reader.ReadBooleanValue ("IsRoot"); ScanError = reader.ReadBooleanValue ("ScanError"); Domain = reader.ReadStringValue ("Domain"); IgnorePaths = (StringCollection) reader.ReadValue ("IgnorePaths", new StringCollection ()); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/Util.cs0000664000175000017500000001747612136524015025013 0ustar00directhexdirecthex00000000000000// // Util.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using System.Reflection; using Mono.Addins.Description; using Mono.Addins.Serialization; using System.Collections.Generic; namespace Mono.Addins.Database { internal class Util { static int isMono; static string monoVersion; public static bool IsWindows { get { return Path.DirectorySeparatorChar == '\\'; } } public static bool IsMono { get { if (isMono == 0) isMono = Type.GetType ("Mono.Runtime") != null ? 1 : -1; return isMono == 1; } } public static string MonoVersion { get { if (monoVersion == null) { if (!IsMono) throw new InvalidOperationException (); MethodInfo mi = Type.GetType ("Mono.Runtime").GetMethod ("GetDisplayName", BindingFlags.NonPublic|BindingFlags.Static); if (mi != null) monoVersion = (string) mi.Invoke (null, null); else monoVersion = string.Empty; } return monoVersion; } } public static void CheckWrittableFloder (string path) { string testFile = null; int n = 0; do { testFile = Path.Combine (path, new Random ().Next ().ToString ()); n++; } while (File.Exists (testFile) && n < 100); if (n == 100) throw new InvalidOperationException ("Could not create file in directory: " + path); StreamWriter w = new StreamWriter (testFile); w.Close (); File.Delete (testFile); } public static void AddDependencies (AddinDescription desc, AddinScanResult scanResult) { // Not implemented in AddinScanResult to avoid making AddinDescription remotable foreach (ModuleDescription mod in desc.AllModules) { foreach (Dependency dep in mod.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; string depid = Addin.GetFullId (desc.Namespace, adep.AddinId, adep.Version); scanResult.AddAddinToUpdateRelations (depid); } } } public static Assembly LoadAssemblyForReflection (string fileName) { /* if (!gotLoadMethod) { reflectionOnlyLoadFrom = typeof(Assembly).GetMethod ("ReflectionOnlyLoadFrom"); gotLoadMethod = true; LoadAssemblyForReflection (typeof(Util).Assembly.Location); } if (reflectionOnlyLoadFrom != null) return (Assembly) reflectionOnlyLoadFrom.Invoke (null, new string [] { fileName }); else */ return Assembly.LoadFile (fileName); } public static string NormalizePath (string path) { if (path.Length > 2 && path [0] == '[') { int i = path.IndexOf (']', 1); if (i != -1) { try { string fname = path.Substring (1, i - 1); Environment.SpecialFolder sf = (Environment.SpecialFolder) Enum.Parse (typeof(Environment.SpecialFolder), fname, true); path = Environment.GetFolderPath (sf) + path.Substring (i + 1); } catch { // Ignore } } } if (IsWindows) return path.Replace ('/','\\'); else return path.Replace ('\\','/'); } // A private hash calculation method is used to be able to get consistent // results across different .NET versions and implementations. public static int GetStringHashCode (string s) { int h = 0; int n = 0; for (; n < s.Length - 1; n+=2) { h = unchecked ((h << 5) - h + s[n]); h = unchecked ((h << 5) - h + s[n+1]); } if (n < s.Length) h = unchecked ((h << 5) - h + s[n]); return h; } public static string GetGacPath (string fullName) { string[] parts = fullName.Split (','); if (parts.Length != 4) return null; string name = parts[0].Trim (); int i = parts[1].IndexOf ('='); string version = i != -1 ? parts[1].Substring (i+1).Trim () : parts[1].Trim (); i = parts[2].IndexOf ('='); string culture = i != -1 ? parts[2].Substring (i+1).Trim () : parts[2].Trim (); if (culture == "neutral") culture = ""; i = parts[3].IndexOf ('='); string token = i != -1 ? parts[3].Substring (i+1).Trim () : parts[3].Trim (); string versionDirName = version + "_" + culture + "_" + token; if (Util.IsMono) { string gacDir = typeof(Uri).Assembly.Location; gacDir = Path.GetDirectoryName (gacDir); gacDir = Path.GetDirectoryName (gacDir); gacDir = Path.GetDirectoryName (gacDir); string dir = Path.Combine (gacDir, name); return Path.Combine (dir, versionDirName); } else { // .NET 4.0 introduces a new GAC directory structure and location. // Assembly version directory names are now prefixed with the CLR version // Since there can be different assembly versions for different target CLR runtimes, // we now look for the best match, that is, the assembly with the higher CLR version var currentVersion = new Version (Environment.Version.Major, Environment.Version.Minor); foreach (var gacDir in GetDotNetGacDirectories ()) { var asmDir = Path.Combine (gacDir, name); if (!Directory.Exists (asmDir)) continue; Version bestVersion = new Version (0, 0); string bestDir = null; foreach (var dir in Directory.GetDirectories (asmDir, "v*_" + versionDirName)) { var dirName = Path.GetFileName (dir); i = dirName.IndexOf ('_'); Version av; if (Version.TryParse (dirName.Substring (1, i - 1), out av)) { if (av == currentVersion) return dir; else if (av < currentVersion && av > bestVersion) { bestDir = dir; bestVersion = av; } } } if (bestDir != null) return bestDir; } // Look in the old GAC. There are no CLR prefixes here foreach (var gacDir in GetLegacyDotNetGacDirectories ()) { var asmDir = Path.Combine (gacDir, name); asmDir = Path.Combine (asmDir, versionDirName); if (Directory.Exists (asmDir)) return asmDir; } return null; } } static IEnumerable GetLegacyDotNetGacDirectories () { var winDir = Path.GetFullPath (Environment.SystemDirectory + "\\.."); string gacDir = winDir + "\\assembly\\GAC"; if (Directory.Exists (gacDir)) yield return gacDir; if (Directory.Exists (gacDir + "_32")) yield return gacDir + "_32"; if (Directory.Exists (gacDir + "_64")) yield return gacDir + "_64"; if (Directory.Exists (gacDir + "_MSIL")) yield return gacDir + "_MSIL"; } static IEnumerable GetDotNetGacDirectories () { var winDir = Path.GetFullPath (Environment.SystemDirectory + "\\.."); string gacDir = winDir + "\\Microsoft.NET\\assembly\\GAC"; if (Directory.Exists (gacDir)) yield return gacDir; if (Directory.Exists (gacDir + "_32")) yield return gacDir + "_32"; if (Directory.Exists (gacDir + "_64")) yield return gacDir + "_64"; if (Directory.Exists (gacDir + "_MSIL")) yield return gacDir + "_MSIL"; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/AddinScanResult.cs0000664000175000017500000001305412136523632027111 0ustar00directhexdirecthex00000000000000// // AddinScanResult.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; namespace Mono.Addins.Database { internal class AddinScanResult: MarshalByRefObject, IAssemblyLocator { internal ArrayList AddinsToScan = new ArrayList (); internal List AddinsToUpdateRelations = new List (); internal List AddinsToUpdate = new List (); internal ArrayList FilesToScan = new ArrayList (); internal ArrayList ModifiedFolderInfos = new ArrayList (); internal ArrayList FilesWithScanFailure = new ArrayList (); internal AddinHostIndex HostIndex; internal List RemovedAddins = new List (); Hashtable visitedFolders = new Hashtable (); Hashtable assemblyLocations = new Hashtable (); Hashtable assemblyLocationsByFullName = new Hashtable (); Hashtable filesToIgnore; bool regenerateRelationData; bool changesFound; public bool RegenerateAllData; public bool CheckOnly; public bool LocateAssembliesOnly; public string Domain; public bool ChangesFound { get { return changesFound; } set { changesFound = value; } } public bool RegenerateRelationData { get { return regenerateRelationData; } set { regenerateRelationData = value; if (value) ChangesFound = true; } } public bool VisitFolder (string folder) { if (visitedFolders.Contains (folder) || IgnorePath (folder)) return false; else { visitedFolders.Add (folder, folder); return true; } } public bool IgnorePath (string file) { if (filesToIgnore == null) return false; string root = Path.GetPathRoot (file); while (root != file) { if (filesToIgnore.Contains (file)) return true; file = Path.GetDirectoryName (file); } return false; } public void AddPathToIgnore (string path) { if (filesToIgnore == null) filesToIgnore = new Hashtable (); filesToIgnore [path] = path; } public void AddPathsToIgnore (IEnumerable paths) { foreach (string p in paths) AddPathToIgnore (p); } public void AddAddinToScan (string addinId) { if (!AddinsToScan.Contains (addinId)) AddinsToScan.Add (addinId); } public void AddRemovedAddin (string addinId) { if (!RemovedAddins.Contains (addinId)) RemovedAddins.Add (addinId); } public void AddFileToWithFailure (string file) { if (!FilesWithScanFailure.Contains (file)) FilesWithScanFailure.Add (file); } public void AddFileToScan (string file, AddinScanFolderInfo folderInfo) { FileToScan di = new FileToScan (); di.File = file; di.AddinScanFolderInfo = folderInfo; FilesToScan.Add (di); RegisterModifiedFolderInfo (folderInfo); } public void RegisterModifiedFolderInfo (AddinScanFolderInfo folderInfo) { if (!ModifiedFolderInfos.Contains (folderInfo)) ModifiedFolderInfos.Add (folderInfo); } public void AddAddinToUpdateRelations (string addinId) { if (!AddinsToUpdateRelations.Contains (addinId)) AddinsToUpdateRelations.Add (addinId); } public void AddAddinToUpdate (string addinId) { if (!AddinsToUpdate.Contains (addinId)) AddinsToUpdate.Add (addinId); } public void AddAssemblyLocation (string file) { string name = Path.GetFileNameWithoutExtension (file); ArrayList list = assemblyLocations [name] as ArrayList; if (list == null) { list = new ArrayList (); assemblyLocations [name] = list; } list.Add (file); } public string GetAssemblyLocation (string fullName) { string loc = assemblyLocationsByFullName [fullName] as String; if (loc != null) return loc; int i = fullName.IndexOf (','); string name = fullName.Substring (0,i); if (name == "Mono.Addins") return GetType ().Assembly.Location; ArrayList list = assemblyLocations [name] as ArrayList; if (list == null) return null; string lastAsm = null; foreach (string file in list.ToArray ()) { AssemblyName aname = AssemblyName.GetAssemblyName (file); list.Remove (file); lastAsm = file; assemblyLocationsByFullName [aname.FullName] = file; if (aname.FullName == fullName) return file; } if (lastAsm != null) { // If an exact version is not found, just take any of them return lastAsm; } return null; } } class FileToScan { public string File; public AddinScanFolderInfo AddinScanFolderInfo; } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/SetupDomain.cs0000664000175000017500000001232312136523632026314 0ustar00directhexdirecthex00000000000000// // SetupDomain.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Specialized; namespace Mono.Addins.Database { class SetupDomain: ISetupHandler { AppDomain domain; RemoteSetupDomain remoteSetupDomain; int useCount; public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor); try { RemoteSetupDomain rsd = GetDomain (); rsd.Scan (remMonitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, scanFolder, filesToIgnore); } catch (Exception ex) { throw new ProcessFailedException (remMonitor.ProgessLog, ex); } finally { System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor); ReleaseDomain (); } } public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { RemoteProgressStatus remMonitor = new RemoteProgressStatus (monitor); try { RemoteSetupDomain rsd = GetDomain (); rsd.GetAddinDescription (remMonitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, file, outFile); } catch (Exception ex) { throw new ProcessFailedException (remMonitor.ProgessLog, ex); } finally { System.Runtime.Remoting.RemotingServices.Disconnect (remMonitor); ReleaseDomain (); } } RemoteSetupDomain GetDomain () { lock (this) { if (useCount++ == 0) { domain = AppDomain.CreateDomain ("SetupDomain", null, AppDomain.CurrentDomain.SetupInformation); remoteSetupDomain = (RemoteSetupDomain) domain.CreateInstanceFromAndUnwrap (typeof(RemoteSetupDomain).Assembly.Location, typeof(RemoteSetupDomain).FullName); } return remoteSetupDomain; } } void ReleaseDomain () { lock (this) { if (--useCount == 0) { AppDomain.Unload (domain); domain = null; remoteSetupDomain = null; } } } } class RemoteSetupDomain: MarshalByRefObject { public override object InitializeLifetimeService () { return null; } public void Scan (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string scanFolder, string[] filesToIgnore) { AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); StringCollection files = new StringCollection (); for (int n=0; n // // Copyright (c) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using System.Collections; using System.Collections.Generic; using System.IO; namespace Mono.Addins.Database { /// /// An assembly reflector /// /// /// This interface can be implemented to provide a custom method for getting information about assemblies. /// public interface IAssemblyReflector { /// /// Called to initialize the assembly reflector /// /// /// IAssemblyLocator instance which can be used to locate referenced assemblies. /// void Initialize (IAssemblyLocator locator); /// /// Gets a list of custom attributes /// /// /// The custom attributes. /// /// /// An assembly, class or class member /// /// /// Type of the attribute to be returned. It will always be one of the attribute types /// defined in Mono.Addins. /// /// /// 'true' if inherited attributes must be returned /// object[] GetCustomAttributes (object obj, Type type, bool inherit); /// /// Gets a list of custom attributes /// /// /// The attributes. /// /// /// An assembly, class or class member /// /// /// Base type of the attribute to be returned /// /// /// 'true' if inherited attributes must be returned /// List GetRawCustomAttributes (object obj, Type type, bool inherit); /// /// Loads an assembly. /// /// /// The loaded assembly /// /// /// Path of the assembly. /// object LoadAssembly (string file); /// /// Loads the assembly specified in an assembly reference /// /// /// The assembly /// /// /// An assembly reference /// object LoadAssemblyFromReference (object asmReference); /// /// Gets the names of all resources embedded in an assembly /// /// /// The names of the resources /// /// /// An assembly /// string[] GetResourceNames (object asm); /// /// Gets the data stream of a resource /// /// /// The stream. /// /// /// An assembly /// /// /// The name of a resource /// Stream GetResourceStream (object asm, string resourceName); /// /// Gets all types defined in an assembly /// /// /// The types /// /// /// An assembly /// IEnumerable GetAssemblyTypes (object asm); /// /// Gets all assembly references of an assembly /// /// /// A list of assembly references /// /// /// An assembly /// IEnumerable GetAssemblyReferences (object asm); /// /// Looks for a type in an assembly /// /// /// The type. /// /// /// An assembly /// /// /// Name of the type /// object GetType (object asm, string typeName); /// /// Gets a custom attribute /// /// /// The custom attribute. /// /// /// An assembly, class or class member /// /// /// Base type of the attribute to be returned. It will always be one of the attribute types /// defined in Mono.Addins. /// /// /// 'true' if inherited attributes must be returned /// object GetCustomAttribute (object obj, Type type, bool inherit); /// /// Gets the name of a type (not including namespace) /// /// /// The type name. /// /// /// A type /// string GetTypeName (object type); /// /// Gets the full name of a type (including namespace) /// /// /// The full name of the type /// /// /// A type /// string GetTypeFullName (object type); /// /// Gets the assembly qualified name of a type /// /// /// The assembly qualified type name /// /// /// A type /// string GetTypeAssemblyQualifiedName (object type); /// /// Gets a list of all base types (including interfaces) of a type /// /// /// An enumeration of the full name of all base types of the type /// /// /// A type /// IEnumerable GetBaseTypeFullNameList (object type); /// /// Checks if a type is assignable to another type /// /// /// 'true' if the type is assignable /// /// /// Expected base type. /// /// /// A type. /// bool TypeIsAssignableFrom (object baseType, object type); /// /// Gets the fields of a type /// /// /// The fields. /// /// /// A type /// IEnumerable GetFields (object type); /// /// Gets the name of a field. /// /// /// The field name. /// /// /// A field. /// string GetFieldName (object field); /// /// Gets the full name of the type of a field /// /// /// The full type name /// /// /// A field. /// string GetFieldTypeFullName (object field); } /// /// Allows finding assemblies in the file system /// public interface IAssemblyLocator { /// /// Locates an assembly /// /// /// The full path to the assembly, or null if not found /// /// /// Full name of the assembly /// string GetAssemblyLocation (string fullName); } /// /// A custom attribute /// public class CustomAttribute: Dictionary { string typeName; /// /// Full name of the type of the custom attribute /// public string TypeName { get { return typeName; } set { typeName = value; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/FileDatabase.cs0000664000175000017500000003115312136523632026372 0ustar00directhexdirecthex00000000000000// // FileDatabase.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using Mono.Addins.Serialization; namespace Mono.Addins.Database { internal class FileDatabase { Stream updatingLock; bool inTransaction; string rootDirectory; Hashtable foldersToUpdate; Hashtable deletedFiles; Hashtable deletedDirs; IDisposable transactionLock; bool ignoreDesc; public FileDatabase (string rootDirectory) { this.rootDirectory = rootDirectory; } string DatabaseLockFile { get { return Path.Combine (rootDirectory, "fdb-lock"); } } string UpdateDatabaseLockFile { get { return Path.Combine (rootDirectory, "fdb-update-lock"); } } // Returns 'true' if description data must be ignored when reading the contents of a file public bool IgnoreDescriptionData { get { return ignoreDesc; } set { ignoreDesc = value; } } public bool BeginTransaction () { if (inTransaction) throw new InvalidOperationException ("Already in a transaction"); transactionLock = LockWrite (); try { updatingLock = new FileStream (UpdateDatabaseLockFile, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None); } catch (IOException) { // The database is already being updated. Can't do anything for now. return false; } finally { transactionLock.Dispose (); } // Delete .new files that could have been left by an aborted database update transactionLock = LockRead (); CleanDirectory (rootDirectory); inTransaction = true; foldersToUpdate = new Hashtable (); deletedFiles = new Hashtable (); deletedDirs = new Hashtable (); return true; } void CleanDirectory (string dir) { foreach (string file in Directory.GetFiles (dir, "*.new")) File.Delete (file); foreach (string sdir in Directory.GetDirectories (dir)) CleanDirectory (sdir); } public IDisposable LockRead () { return FileLock (FileAccess.Read, -1); } public IDisposable LockWrite () { return FileLock (FileAccess.Write, -1); } IDisposable FileLock (FileAccess access, int timeout) { DateTime tim = DateTime.Now; DateTime wt = tim; FileShare share = access == FileAccess.Read ? FileShare.Read : FileShare.None; string path = Path.GetDirectoryName (DatabaseLockFile); if (!Directory.Exists (path)) Directory.CreateDirectory (path); do { try { return new FileStream (DatabaseLockFile, FileMode.OpenOrCreate, access, share); } catch (IOException) { // Wait and try again if ((DateTime.Now - wt).TotalSeconds >= 4) { Console.WriteLine ("Waiting for " + access + " add-in database lock"); wt = DateTime.Now; } } System.Threading.Thread.Sleep (100); } while (timeout <= 0 || (DateTime.Now - tim).TotalMilliseconds < timeout); throw new Exception ("Lock timed out"); } public Stream Create (string fileName) { if (inTransaction) { deletedFiles.Remove (fileName); deletedDirs.Remove (Path.GetDirectoryName (fileName)); foldersToUpdate [Path.GetDirectoryName (fileName)] = null; return File.Create (fileName + ".new"); } else return File.Create (fileName); } public void Rename (string fileName, string newName) { if (inTransaction) { deletedFiles.Remove (newName); deletedDirs.Remove (Path.GetDirectoryName (newName)); foldersToUpdate [Path.GetDirectoryName (newName)] = null; string s = File.Exists (fileName + ".new") ? fileName + ".new" : fileName; File.Copy (s, newName + ".new"); Delete (fileName); } else File.Move (fileName, newName); } public Stream OpenRead (string fileName) { if (inTransaction) { if (deletedFiles.Contains (fileName)) throw new FileNotFoundException (); if (File.Exists (fileName + ".new")) return File.OpenRead (fileName + ".new"); } return File.OpenRead (fileName); } public void Delete (string fileName) { if (inTransaction) { if (deletedFiles.Contains (fileName)) return; if (File.Exists (fileName + ".new")) File.Delete (fileName + ".new"); if (File.Exists (fileName)) deletedFiles [fileName] = null; } else { File.Delete (fileName); } } public void DeleteDir (string dirName) { if (inTransaction) { if (deletedDirs.Contains (dirName)) return; if (Directory.Exists (dirName + ".new")) Directory.Delete (dirName + ".new", true); if (Directory.Exists (dirName)) deletedDirs [dirName] = null; } else { Directory.Delete (dirName, true); } } public bool Exists (string fileName) { if (inTransaction) { if (deletedFiles.Contains (fileName)) return false; if (File.Exists (fileName + ".new")) return true; } return File.Exists (fileName); } public bool DirExists (string dir) { return Directory.Exists (dir); } public void CreateDir (string dir) { Directory.CreateDirectory (dir); } public string[] GetDirectories (string dir) { return Directory.GetDirectories (dir); } public bool DirectoryIsEmpty (string dir) { foreach (string f in Directory.GetFiles (dir)) { if (!inTransaction || !deletedFiles.Contains (f)) return false; } return true; } public string[] GetDirectoryFiles (string dir, string pattern) { if (pattern == null || pattern.Length == 0 || pattern.EndsWith ("*")) throw new NotSupportedException (); if (inTransaction) { Hashtable files = new Hashtable (); foreach (string f in Directory.GetFiles (dir, pattern)) { if (!deletedFiles.Contains (f)) files [f] = f; } foreach (string f in Directory.GetFiles (dir, pattern + ".new")) { string ofile = f.Substring (0, f.Length - 4); files [ofile] = ofile; } string[] res = new string [files.Count]; int n = 0; foreach (string s in files.Keys) res [n++] = s; return res; } else return Directory.GetFiles (dir, pattern); } public void CommitTransaction () { if (!inTransaction) return; try { transactionLock.Dispose (); transactionLock = LockWrite (); foreach (string dir in foldersToUpdate.Keys) { foreach (string file in Directory.GetFiles (dir, "*.new")) { string dst = file.Substring (0, file.Length - 4); File.Delete (dst); File.Move (file, dst); } } foreach (string file in deletedFiles.Keys) File.Delete (file); foreach (string dir in deletedDirs.Keys) Directory.Delete (dir, true); } finally { transactionLock.Dispose (); EndTransaction (); } } public void RollbackTransaction () { if (!inTransaction) return; try { // There is no need for write lock since existing files won't be updated. foreach (string dir in foldersToUpdate.Keys) { foreach (string file in Directory.GetFiles (dir, "*.new")) File.Delete (file); } } finally { transactionLock.Dispose (); EndTransaction (); } } void EndTransaction () { inTransaction = false; deletedFiles = null; foldersToUpdate = null; updatingLock.Close (); updatingLock = null; transactionLock = null; } // The ReadSharedObject and WriteSharedObject methods can be used to read/write objects from/to files. // What's special about those methods is that they handle file name colisions. public string[] GetObjectSharedFiles (string directory, string sharedFileName, string extension) { return GetDirectoryFiles (directory, sharedFileName + "*" + extension); } public object ReadSharedObject (string fullFileName, BinaryXmlTypeMap typeMap) { object result; OpenFileForPath (fullFileName, null, typeMap, false, out result); return result; } public bool SharedObjectExists (string directory, string sharedFileName, string extension, string objectId) { return null != GetSharedObjectFile (directory, sharedFileName, extension, objectId); } public string GetSharedObjectFile (string directory, string sharedFileName, string extension, string objectId) { string fileName; ReadSharedObject (directory, sharedFileName, extension, objectId, null, true, out fileName); return fileName; } public object ReadSharedObject (string directory, string sharedFileName, string extension, string objectId, BinaryXmlTypeMap typeMap, out string fileName) { return ReadSharedObject (directory, sharedFileName, extension, objectId, typeMap, false, out fileName); } object ReadSharedObject (string directory, string sharedFileName, string extension, string objectId, BinaryXmlTypeMap typeMap, bool checkOnly, out string fileName) { string name = GetFileKey (directory, sharedFileName, objectId); string file = Path.Combine (directory, name + extension); object result; if (OpenFileForPath (file, objectId, typeMap, checkOnly, out result)) { fileName = file; return result; } // The file is not the one we expected. There has been a name colision foreach (string f in GetDirectoryFiles (directory, name + "*" + extension)) { if (f != file && OpenFileForPath (f, objectId, typeMap, checkOnly, out result)) { fileName = f; return result; } } // File not found fileName = null; return null; } bool OpenFileForPath (string f, string objectId, BinaryXmlTypeMap typeMap, bool checkOnly, out object result) { result = null; if (!Exists (f)) { return false; } using (Stream s = OpenRead (f)) { BinaryXmlReader reader = new BinaryXmlReader (s, typeMap); reader.ReadBeginElement (); string id = reader.ReadStringValue ("id"); if (objectId == null || objectId == id) { if (!checkOnly) result = reader.ReadValue ("data"); return true; } } return false; } public void WriteSharedObject (string objectId, string targetFile, BinaryXmlTypeMap typeMap, IBinaryXmlElement obj) { WriteSharedObject (null, null, null, objectId, targetFile, typeMap, obj); } public string WriteSharedObject (string directory, string sharedFileName, string extension, string objectId, string readFileName, BinaryXmlTypeMap typeMap, IBinaryXmlElement obj) { string file = readFileName; if (file == null) { int count = 1; string name = GetFileKey (directory, sharedFileName, objectId); file = Path.Combine (directory, name + extension); while (Exists (file)) { count++; file = Path.Combine (directory, name + "_" + count + extension); } } using (Stream s = Create (file)) { BinaryXmlWriter writer = new BinaryXmlWriter (s, typeMap); writer.WriteBeginElement ("File"); writer.WriteValue ("id", objectId); writer.WriteValue ("data", obj); writer.WriteEndElement (); } return file; } public object ReadObject (string file, BinaryXmlTypeMap typeMap) { using (Stream s = OpenRead (file)) { BinaryXmlReader reader = new BinaryXmlReader (s, typeMap); return reader.ReadValue ("data"); } } public void WriteObject (string file, object obj, BinaryXmlTypeMap typeMap) { using (Stream s = Create (file)) { BinaryXmlWriter writer = new BinaryXmlWriter (s, typeMap); writer.WriteValue ("data", obj); } } string GetFileKey (string directory, string sharedFileName, string objectId) { int avlen = System.Math.Max (240 - directory.Length, 10); string name = sharedFileName + "_" + Util.GetStringHashCode (objectId).ToString ("x"); if (name.Length > avlen) return name.Substring (name.Length - avlen); else return name; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/SetupProcess.cs0000664000175000017500000001546112136523632026531 0ustar00directhexdirecthex00000000000000// // SetupProcess.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Specialized; using System.IO; using System.Text; using System.Diagnostics; using System.Runtime.Serialization.Formatters.Binary; using System.Reflection; using System.Reflection.Emit; namespace Mono.Addins.Database { class SetupProcess: ISetupHandler { public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "scan", scanFolder, filesToIgnore); } public void GetAddinDescription (IProgressStatus monitor, AddinRegistry registry, string file, string outFile) { ExecuteCommand (monitor, registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath, "get-desc", file, outFile); } internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, params string[] args) { string verboseParam = monitor.LogLevel.ToString (); // Arguments string StringBuilder sb = new StringBuilder (); sb.Append (verboseParam).Append (' ').Append (name); sb.Append (" \"").Append (arg1).Append ("\""); foreach (string arg in args) sb.Append (" \"").Append (arg).Append ("\""); Process process = new Process (); string asm = null; try { asm = CreateHostExe (); if (!Util.IsMono) process.StartInfo = new ProcessStartInfo (asm, sb.ToString ()); else { asm = asm.Replace(" ", @"\ "); process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + sb.ToString ()); } process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardInput = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.EnableRaisingEvents = true; process.Start (); process.StandardInput.WriteLine (registryPath); process.StandardInput.WriteLine (startupDir); process.StandardInput.WriteLine (addinsDir); process.StandardInput.WriteLine (databaseDir); process.StandardInput.Flush (); // string rr = process.StandardOutput.ReadToEnd (); // Console.WriteLine (rr); StringCollection progessLog = new StringCollection (); ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput, progessLog); process.WaitForExit (); if (process.ExitCode != 0) throw new ProcessFailedException (progessLog); } catch (Exception ex) { Console.WriteLine (ex); throw; } finally { if (asm != null) { try { File.Delete (asm); } catch { } } } } public static int Main (string[] args) { ProcessProgressStatus monitor = new ProcessProgressStatus (int.Parse (args[0])); try { string registryPath = Console.In.ReadLine (); string startupDir = Console.In.ReadLine (); string addinsDir = Console.In.ReadLine (); string databaseDir = Console.In.ReadLine (); AddinDatabase.RunningSetupProcess = true; AddinRegistry reg = new AddinRegistry (registryPath, startupDir, addinsDir, databaseDir); switch (args [1]) { case "scan": string folder = args.Length > 2 ? args [2] : null; if (folder.Length == 0) folder = null; StringCollection filesToIgnore = new StringCollection (); for (int n=3; n 0 ? progessLog [progessLog.Count - 1] : ""; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/DatabaseConfiguration.cs0000664000175000017500000001214312136523632030320 0ustar00directhexdirecthex00000000000000// // DatabaseConfiguration.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Linq; using System.IO; using System.Collections; using System.Collections.Generic; using System.Xml; namespace Mono.Addins.Database { internal class DatabaseConfiguration { Dictionary addinStatus = new Dictionary (); internal class AddinStatus { public AddinStatus (string addinId) { this.AddinId = addinId; } public string AddinId; public bool Enabled; public bool Uninstalled; public List Files; } public bool IsEnabled (string addinId, bool defaultValue) { AddinStatus s; if (addinStatus.TryGetValue (addinId, out s)) return s.Enabled && !s.Uninstalled; else return defaultValue; } public void SetStatus (string addinId, bool enabled, bool defaultValue) { AddinStatus s; addinStatus.TryGetValue (addinId, out s); if (s != null && s.Uninstalled) return; if (enabled == defaultValue) { addinStatus.Remove (addinId); return; } if (s == null) s = addinStatus [addinId] = new AddinStatus (addinId); s.Enabled = enabled; } public void RegisterForUninstall (string addinId, IEnumerable files) { AddinStatus s; if (!addinStatus.TryGetValue (addinId, out s)) s = addinStatus [addinId] = new AddinStatus (addinId); s.Enabled = false; s.Uninstalled = true; s.Files = new List (files); } public void UnregisterForUninstall (string addinId) { addinStatus.Remove (addinId); } public bool IsRegisteredForUninstall (string addinId) { AddinStatus s; if (addinStatus.TryGetValue (addinId, out s)) return s.Uninstalled; else return false; } public bool HasPendingUninstalls { get { return addinStatus.Values.Where (s => s.Uninstalled).Any (); } } public AddinStatus[] GetPendingUninstalls () { return addinStatus.Values.Where (s => s.Uninstalled).ToArray (); } public static DatabaseConfiguration Read (string file) { DatabaseConfiguration config = new DatabaseConfiguration (); XmlDocument doc = new XmlDocument (); doc.Load (file); XmlElement disabledElem = (XmlElement) doc.DocumentElement.SelectSingleNode ("DisabledAddins"); if (disabledElem != null) { // For back compatibility foreach (XmlElement elem in disabledElem.SelectNodes ("Addin")) config.SetStatus (elem.InnerText, false, true); return config; } XmlElement statusElem = (XmlElement) doc.DocumentElement.SelectSingleNode ("AddinStatus"); if (statusElem != null) { foreach (XmlElement elem in statusElem.SelectNodes ("Addin")) { AddinStatus status = new AddinStatus (elem.GetAttribute ("id")); string senabled = elem.GetAttribute ("enabled"); status.Enabled = senabled.Length == 0 || senabled == "True"; status.Uninstalled = elem.GetAttribute ("uninstalled") == "True"; config.addinStatus [status.AddinId] = status; foreach (XmlElement fileElem in elem.SelectNodes ("File")) { if (status.Files == null) status.Files = new List (); status.Files.Add (fileElem.InnerText); } } } return config; } public void Write (string file) { StreamWriter s = new StreamWriter (file); using (s) { XmlTextWriter tw = new XmlTextWriter (s); tw.Formatting = Formatting.Indented; tw.WriteStartElement ("Configuration"); tw.WriteStartElement ("AddinStatus"); foreach (AddinStatus e in addinStatus.Values) { tw.WriteStartElement ("Addin"); tw.WriteAttributeString ("id", e.AddinId); tw.WriteAttributeString ("enabled", e.Enabled.ToString ()); if (e.Uninstalled) tw.WriteAttributeString ("uninstalled", "True"); if (e.Files != null && e.Files.Count > 0) { foreach (var f in e.Files) tw.WriteElementString ("File", f); } tw.WriteEndElement (); } tw.WriteEndElement (); // AddinStatus tw.WriteEndElement (); // Configuration } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/ProcessProgressStatus.cs0000664000175000017500000001064412136523632030437 0ustar00directhexdirecthex00000000000000// // ProcessProgressStatus.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Specialized; using System.IO; namespace Mono.Addins.Database { internal class ProcessProgressStatus: MarshalByRefObject, IProgressStatus { bool canceled; int logLevel; public ProcessProgressStatus (int logLevel) { this.logLevel = logLevel; } public void SetMessage (string msg) { Console.WriteLine ("process-ps-msg:" + Encode (msg)); } public void SetProgress (double progress) { Console.WriteLine ("process-ps-progress:" + progress.ToString ()); } public void Log (string msg) { if (msg.StartsWith ("plog:")) // This is an special type of log that will be provided to the // main process in case of a crash in the setup process Console.WriteLine ("process-ps-plog:" + Encode (msg.Substring (5))); else Console.WriteLine ("process-ps-log:" + Encode (msg)); } public void ReportWarning (string message) { Console.WriteLine ("process-ps-warning:" + Encode (message)); } public void ReportError (string message, Exception exception) { if (message == null) message = string.Empty; string et; if (logLevel > 1) et = exception != null ? exception.ToString () : string.Empty; else et = exception != null ? exception.Message : string.Empty; Console.WriteLine ("process-ps-exception:" + Encode (et)); Console.WriteLine ("process-ps-error:" + Encode (message)); } public bool IsCanceled { get { return canceled; } } public int LogLevel { get { return logLevel; } } public void Cancel () { canceled = true; Console.WriteLine ("process-ps-cancel:"); } static string Encode (string msg) { msg = msg.Replace ("&", "&a"); return msg.Replace ("\n", "&n"); } static string Decode (string msg) { msg = msg.Replace ("&n", "\n"); return msg.Replace ("&a", "&"); } public static void MonitorProcessStatus (IProgressStatus monitor, TextReader reader, StringCollection progessLog) { string line; string exceptionText = null; while ((line = reader.ReadLine ()) != null) { int i = line.IndexOf (':'); if (i != -1) { string tag = line.Substring (0, i); string txt = line.Substring (i+1); bool wasTag = true; switch (tag) { case "process-ps-msg": monitor.SetMessage (Decode (txt)); break; case "process-ps-progress": monitor.SetProgress (double.Parse (txt)); break; case "process-ps-log": monitor.Log (Decode (txt)); break; case "process-ps-warning": monitor.ReportWarning (Decode (txt)); break; case "process-ps-exception": exceptionText = Decode (txt); if (exceptionText == string.Empty) exceptionText = null; break; case "process-ps-error": string err = Decode (txt); if (err == string.Empty) err = null; monitor.ReportError (err, exceptionText != null ? new Exception (exceptionText) : null); break; case "process-ps-cancel": monitor.Cancel (); break; case "process-ps-plog": progessLog.Add (Decode (txt)); break; default: wasTag = false; break; } if (wasTag) continue; } Console.WriteLine (line); } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Database/SetupLocal.cs0000664000175000017500000000373512136523632026146 0ustar00directhexdirecthex00000000000000// // SetupLocal.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Specialized; namespace Mono.Addins.Database { class SetupLocal: ISetupHandler { public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore) { AddinRegistry reg = new AddinRegistry (registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath); reg.CopyExtensionsFrom (registry); StringCollection files = new StringCollection (); for (int n=0; n // // Copyright (c) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using System.Reflection; using System.Collections; using System.Collections.Generic; namespace Mono.Addins.Database { class DefaultAssemblyReflector: IAssemblyReflector { public void Initialize (IAssemblyLocator locator) { } public object LoadAssembly (string file) { return Util.LoadAssemblyForReflection (file); } public string[] GetResourceNames (object asm) { return ((Assembly)asm).GetManifestResourceNames (); } public System.IO.Stream GetResourceStream (object asm, string resourceName) { return ((Assembly)asm).GetManifestResourceStream (resourceName); } public object[] GetCustomAttributes (object obj, Type type, bool inherit) { ICustomAttributeProvider aprov = obj as ICustomAttributeProvider; if (aprov != null) return aprov.GetCustomAttributes (type, inherit); else return new object [0]; } public object GetCustomAttribute (object obj, Type type, bool inherit) { foreach (object att in GetCustomAttributes (obj, type, inherit)) if (type.IsInstanceOfType (att)) return att; return null; } public List GetRawCustomAttributes (object obj, Type type, bool inherit) { ICustomAttributeProvider aprov = obj as ICustomAttributeProvider; List atts = new List (); if (aprov == null) return atts; foreach (object at in aprov.GetCustomAttributes (type, inherit)) atts.Add (ConvertAttribute (at)); return atts; } CustomAttribute ConvertAttribute (object ob) { CustomAttribute at = new CustomAttribute (); Type type = ob.GetType (); at.TypeName = type.FullName; foreach (PropertyInfo prop in type.GetProperties (BindingFlags.Public | BindingFlags.Instance)) { object val = prop.GetValue (ob, null); if (val != null) { NodeAttributeAttribute bt = (NodeAttributeAttribute) Attribute.GetCustomAttribute (prop, typeof(NodeAttributeAttribute), true); if (bt != null) { string name = string.IsNullOrEmpty (bt.Name) ? prop.Name : bt.Name; at [name] = Convert.ToString (val, System.Globalization.CultureInfo.InvariantCulture); } } } foreach (FieldInfo field in type.GetFields (BindingFlags.Public | BindingFlags.Instance)) { object val = field.GetValue (ob); if (val != null) { NodeAttributeAttribute bt = (NodeAttributeAttribute) Attribute.GetCustomAttribute (field, typeof(NodeAttributeAttribute), true); if (bt != null) { string name = string.IsNullOrEmpty (bt.Name) ? field.Name : bt.Name; at [name] = Convert.ToString (val, System.Globalization.CultureInfo.InvariantCulture); } } } return at; } public string GetTypeName (object type) { return ((Type)type).Name; } public IEnumerable GetFields (object type) { return ((Type)type).GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance); } public string GetFieldName (object field) { return ((FieldInfo)field).Name; } public string GetFieldTypeFullName (object field) { return ((FieldInfo)field).FieldType.FullName; } public IEnumerable GetAssemblyTypes (object asm) { return ((Assembly)asm).GetTypes (); } public IEnumerable GetBaseTypeFullNameList (object type) { ArrayList list = new ArrayList (); Type btype = ((Type)type).BaseType; while (btype != typeof(object)) { list.Add (btype.FullName); btype = btype.BaseType; } foreach (Type iterf in ((Type)type).GetInterfaces ()) { list.Add (iterf.FullName); } return list; } public object LoadAssemblyFromReference (object asmReference) { return Assembly.Load ((AssemblyName)asmReference); } public IEnumerable GetAssemblyReferences (object asm) { return ((Assembly)asm).GetReferencedAssemblies (); } public object GetType (object asm, string typeName) { return ((Assembly)asm).GetType (typeName); } public string GetTypeFullName (object type) { return ((Type)type).FullName; } public bool TypeIsAssignableFrom (object baseType, object type) { return ((Type)baseType).IsAssignableFrom ((Type)type); } public string GetTypeAssemblyQualifiedName (object type) { return ((Type)type).AssemblyQualifiedName; } } } mono-addins-1.0/Mono.Addins/policy.0.2.config0000664000175000017500000000054612136524024022705 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins/Mono.Addins.Description/0000775000175000017500000000000012136524043024310 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ModuleDescription.cs0000664000175000017500000002512612136523632030301 0ustar00directhexdirecthex00000000000000// // ModuleDescription.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Collections.Specialized; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// A module definition. /// /// /// Optional modules can be used to declare extensions which will be registered only if some /// specified add-in dependencies can be satisfied. /// public class ModuleDescription: ObjectDescription { StringCollection assemblies; StringCollection dataFiles; StringCollection ignorePaths; DependencyCollection dependencies; ExtensionCollection extensions; // Used only at run time internal RuntimeAddin RuntimeAddin; internal ModuleDescription (XmlElement element) { Element = element; } /// /// Initializes a new instance of the class. /// public ModuleDescription () { } /// /// Checks if this module depends on the specified add-in. /// /// /// true if there is a dependency. /// /// /// Identifier of the add-in /// public bool DependsOnAddin (string addinId) { AddinDescription desc = Parent as AddinDescription; if (desc == null) throw new InvalidOperationException (); foreach (Dependency dep in Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; if (Addin.GetFullId (desc.Namespace, adep.AddinId, adep.Version) == addinId) return true; } return false; } /// /// Gets the list of paths to be ignored by the add-in scanner. /// public StringCollection IgnorePaths { get { if (ignorePaths == null) ignorePaths = new StringCollection (); return ignorePaths; } } /// /// Gets all external files /// /// /// All files. /// /// /// External files are data files and assemblies explicitly referenced in the Runtime section of the add-in manifest. /// public StringCollection AllFiles { get { StringCollection col = new StringCollection (); foreach (string s in Assemblies) col.Add (s); foreach (string d in DataFiles) col.Add (d); return col; } } /// /// Gets the list of external assemblies used by this module. /// public StringCollection Assemblies { get { if (assemblies == null) { if (Element != null) InitCollections (); else assemblies = new StringCollection (); } return assemblies; } } /// /// Gets the list of external data files used by this module /// public StringCollection DataFiles { get { if (dataFiles == null) { if (Element != null) InitCollections (); else dataFiles = new StringCollection (); } return dataFiles; } } /// /// Gets the dependencies of this module /// public DependencyCollection Dependencies { get { if (dependencies == null) { dependencies = new DependencyCollection (this); if (Element != null) { XmlNodeList elems = Element.SelectNodes ("Dependencies/*"); foreach (XmlNode node in elems) { XmlElement elem = node as XmlElement; if (elem == null) continue; if (elem.Name == "Addin") { AddinDependency dep = new AddinDependency (elem); dependencies.Add (dep); } else if (elem.Name == "Assembly") { AssemblyDependency dep = new AssemblyDependency (elem); dependencies.Add (dep); } } } } return dependencies; } } /// /// Gets the extensions of this module /// public ExtensionCollection Extensions { get { if (extensions == null) { extensions = new ExtensionCollection (this); if (Element != null) { foreach (XmlElement elem in Element.SelectNodes ("Extension")) extensions.Add (new Extension (elem)); } } return extensions; } } /// /// Adds an extension node to the module. /// /// /// The extension node. /// /// /// Path that identifies the extension point. /// /// /// Node name. /// /// /// This method creates a new Extension object for the provided path if none exist. /// public ExtensionNodeDescription AddExtensionNode (string path, string nodeName) { ExtensionNodeDescription node = new ExtensionNodeDescription (nodeName); GetExtension (path).ExtensionNodes.Add (node); return node; } /// /// Gets an extension instance. /// /// /// The extension instance. /// /// /// Path that identifies the extension point that the extension extends. /// /// /// This method creates a new Extension object for the provided path if none exist. /// public Extension GetExtension (string path) { foreach (Extension e in Extensions) { if (e.Path == path) return e; } Extension ex = new Extension (path); Extensions.Add (ex); return ex; } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "Module"); if (assemblies != null || dataFiles != null || ignorePaths != null) { XmlElement runtime = GetRuntimeElement (); while (runtime.FirstChild != null) runtime.RemoveChild (runtime.FirstChild); if (assemblies != null) { foreach (string s in assemblies) { XmlElement asm = Element.OwnerDocument.CreateElement ("Import"); asm.SetAttribute ("assembly", s); runtime.AppendChild (asm); } } if (dataFiles != null) { foreach (string s in dataFiles) { XmlElement asm = Element.OwnerDocument.CreateElement ("Import"); asm.SetAttribute ("file", s); runtime.AppendChild (asm); } } if (ignorePaths != null) { foreach (string s in ignorePaths) { XmlElement asm = Element.OwnerDocument.CreateElement ("ScanExclude"); asm.SetAttribute ("path", s); runtime.AppendChild (asm); } } runtime.AppendChild (Element.OwnerDocument.CreateTextNode ("\n")); } // Save dependency information if (dependencies != null) { XmlElement deps = GetDependenciesElement (); dependencies.SaveXml (deps); deps.AppendChild (Element.OwnerDocument.CreateTextNode ("\n")); if (extensions != null) extensions.SaveXml (Element); } } /// /// Adds an add-in reference (there is a typo in the method name) /// /// /// Identifier of the add-in. /// /// /// Version of the add-in. /// public void AddAssemblyReference (string id, string version) { XmlElement deps = GetDependenciesElement (); if (deps.SelectSingleNode ("Addin[@id='" + id + "']") != null) return; XmlElement dep = Element.OwnerDocument.CreateElement ("Addin"); dep.SetAttribute ("id", id); dep.SetAttribute ("version", version); deps.AppendChild (dep); } XmlElement GetDependenciesElement () { XmlElement de = Element ["Dependencies"]; if (de != null) return de; de = Element.OwnerDocument.CreateElement ("Dependencies"); Element.AppendChild (de); return de; } XmlElement GetRuntimeElement () { XmlElement de = Element ["Runtime"]; if (de != null) return de; de = Element.OwnerDocument.CreateElement ("Runtime"); Element.AppendChild (de); return de; } void InitCollections () { dataFiles = new StringCollection (); assemblies = new StringCollection (); XmlNodeList elems = Element.SelectNodes ("Runtime/*"); foreach (XmlElement elem in elems) { if (elem.LocalName == "Import") { string asm = elem.GetAttribute ("assembly"); if (asm.Length > 0) { assemblies.Add (asm); } else { string file = elem.GetAttribute ("file"); if (file.Length > 0) dataFiles.Add (file); } } else if (elem.LocalName == "ScanExclude") { string path = elem.GetAttribute ("path"); if (path.Length > 0) IgnorePaths.Add (path); } } } internal override void Verify (string location, StringCollection errors) { Dependencies.Verify (location + "Module/", errors); Extensions.Verify (location + "Module/", errors); } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("Assemblies", Assemblies); writer.WriteValue ("DataFiles", DataFiles); writer.WriteValue ("Dependencies", Dependencies); writer.WriteValue ("Extensions", Extensions); writer.WriteValue ("IgnorePaths", ignorePaths); } internal override void Read (BinaryXmlReader reader) { assemblies = (StringCollection) reader.ReadValue ("Assemblies", new StringCollection ()); dataFiles = (StringCollection) reader.ReadValue ("DataFiles", new StringCollection ()); dependencies = (DependencyCollection) reader.ReadValue ("Dependencies", new DependencyCollection (this)); extensions = (ExtensionCollection) reader.ReadValue ("Extensions", new ExtensionCollection (this)); ignorePaths = (StringCollection) reader.ReadValue ("IgnorePaths", new StringCollection ()); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/Extension.cs0000664000175000017500000002014112136523632026614 0ustar00directhexdirecthex00000000000000// // Extension.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Collections.Specialized; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// An extension definition. /// /// /// An Extension is a collection of nodes which have to be registered in an extension point. /// The target extension point is specified in the .Path property. /// public class Extension: ObjectDescription, IComparable { string path; ExtensionNodeDescriptionCollection nodes; /// /// Initializes a new instance of the class. /// public Extension () { } /// /// Initializes a new instance of the class. /// /// /// Path that identifies the extension point being extended /// public Extension (string path) { this.path = path; } /// /// Gets the object extended by this extension /// /// /// The extended object can be an or /// an . /// /// /// This method only works when the add-in description to which the extension belongs has been /// loaded from an add-in registry. /// public ObjectDescription GetExtendedObject () { AddinDescription desc = ParentAddinDescription; if (desc == null) return null; ExtensionPoint ep = FindExtensionPoint (desc, path); if (ep == null && desc.OwnerDatabase != null) { foreach (Dependency dep in desc.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; Addin ad = desc.OwnerDatabase.GetInstalledAddin (ParentAddinDescription.Domain, adep.FullAddinId); if (ad != null && ad.Description != null) { ep = FindExtensionPoint (ad.Description, path); if (ep != null) break; } } } if (ep != null) { string subp = path.Substring (ep.Path.Length).Trim ('/'); if (subp.Length == 0) return ep; // The extension is directly extending the extension point // The extension is extending a node of the extension point return desc.FindExtensionNode (path, true); } return null; } /// /// Gets the node types allowed in this extension. /// /// /// The allowed node types. /// /// /// This method only works when the add-in description to which the extension belongs has been /// loaded from an add-in registry. /// public ExtensionNodeTypeCollection GetAllowedNodeTypes () { ObjectDescription ob = GetExtendedObject (); ExtensionPoint ep = ob as ExtensionPoint; if (ep != null) return ep.NodeSet.GetAllowedNodeTypes (); ExtensionNodeDescription node = ob as ExtensionNodeDescription; if (node != null) { ExtensionNodeType nt = node.GetNodeType (); if (nt != null) return nt.GetAllowedNodeTypes (); } return new ExtensionNodeTypeCollection (); } ExtensionPoint FindExtensionPoint (AddinDescription desc, string path) { foreach (ExtensionPoint ep in desc.ExtensionPoints) { if (ep.Path == path || path.StartsWith (ep.Path + "/")) return ep; } return null; } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "Extension", errors, path, "path"); ExtensionNodes.Verify (location + "Extension (" + path + ")/", errors); foreach (ExtensionNodeDescription cnode in ExtensionNodes) VerifyNode (location, cnode, errors); } void VerifyNode (string location, ExtensionNodeDescription node, StringCollection errors) { string id = node.GetAttribute ("id"); if (id.Length > 0) id = "(" + id + ")"; if (node.NodeName == "Condition" && node.GetAttribute ("id").Length == 0) { errors.Add (location + node.NodeName + id + ": Missing 'id' attribute in Condition element."); } if (node.NodeName == "ComplexCondition") { if (node.ChildNodes.Count > 0) { VerifyConditionNode (location, node.ChildNodes[0], errors); for (int n=1; n /// Initializes a new instance of the class. /// /// /// XML that describes the extension. /// public Extension (XmlElement element) { Element = element; path = element.GetAttribute ("path"); } /// /// Gets or sets the path that identifies the extension point being extended. /// /// /// The path. /// public string Path { get { return path; } set { path = value; } } internal override void SaveXml (XmlElement parent) { if (Element == null) { Element = parent.OwnerDocument.CreateElement ("Extension"); parent.AppendChild (Element); } Element.SetAttribute ("path", path); if (nodes != null) nodes.SaveXml (Element); } /// /// Gets the extension nodes. /// /// /// The extension nodes. /// public ExtensionNodeDescriptionCollection ExtensionNodes { get { if (nodes == null) { nodes = new ExtensionNodeDescriptionCollection (this); if (Element != null) { foreach (XmlNode node in Element.ChildNodes) { XmlElement e = node as XmlElement; if (e != null) nodes.Add (new ExtensionNodeDescription (e)); } } } return nodes; } } int IComparable.CompareTo (object obj) { Extension other = (Extension) obj; return Path.CompareTo (other.Path); } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("path", path); writer.WriteValue ("Nodes", ExtensionNodes); } internal override void Read (BinaryXmlReader reader) { path = reader.ReadStringValue ("path"); nodes = (ExtensionNodeDescriptionCollection) reader.ReadValue ("Nodes", new ExtensionNodeDescriptionCollection (this)); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeType.cs0000664000175000017500000001745712136523632030304 0ustar00directhexdirecthex00000000000000// // ExtensionNodeType.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Reflection; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// An extension node type definition. /// public sealed class ExtensionNodeType: ExtensionNodeSet { string typeName; string objectTypeName; string description; string addinId; NodeTypeAttributeCollection attributes; string customAttributeTypeName; // Cached clr type [NonSerialized] internal Type Type; // Cached serializable fields [NonSerialized] internal Dictionary Fields; // Cached serializable fields for the custom attribute [NonSerialized] internal Dictionary CustomAttributeFields; [NonSerialized] internal FieldData CustomAttributeMember; internal class FieldData { public MemberInfo Member; public bool Required; public bool Localizable; public void SetValue (object target, object val) { if (Member is FieldInfo) ((FieldInfo)Member).SetValue (target, val); else ((PropertyInfo)Member).SetValue (target, val, null); } public Type MemberType { get { return (Member is FieldInfo) ? ((FieldInfo)Member).FieldType : ((PropertyInfo)Member).PropertyType; } } } // Addin where this extension type is implemented internal string AddinId { get { return addinId; } set { addinId = value; } } /// /// Type that implements the extension node. /// /// /// The full name of the type. /// public string TypeName { get { return typeName != null ? typeName : string.Empty; } set { typeName = value; } } /// /// Element name to be used when defining an extension in an XML manifest. The default name is "Type". /// /// /// The name of the node. /// public string NodeName { get { return Id; } set { Id = value; } } /// /// Type of the object that the extension creates (only valid for TypeNodeExtension). /// public string ObjectTypeName { get { return objectTypeName != null ? objectTypeName : string.Empty; } set { objectTypeName = value; } } /// /// Name of the custom attribute that can be used to declare nodes of this type /// public string ExtensionAttributeTypeName { get { return customAttributeTypeName ?? string.Empty; } set { customAttributeTypeName = value; } } /// /// Long description of the node type /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } /// /// Attributes supported by the extension node type. /// public NodeTypeAttributeCollection Attributes { get { if (attributes == null) { attributes = new NodeTypeAttributeCollection (this); if (Element != null) { XmlElement atts = Element ["Attributes"]; if (atts != null) { foreach (XmlNode node in atts.ChildNodes) { XmlElement e = node as XmlElement; if (e != null) attributes.Add (new NodeTypeAttribute (e)); } } } } return attributes; } } internal ExtensionNodeType (XmlElement element): base (element) { XmlAttribute at = element.Attributes ["type"]; if (at != null) typeName = at.Value; at = element.Attributes ["objectType"]; if (at != null) objectTypeName = at.Value; at = element.Attributes ["customAttributeType"]; if (at != null) customAttributeTypeName = at.Value; XmlElement de = element ["Description"]; if (de != null) description = de.InnerText; } /// /// Initializes a new instance of the class. /// public ExtensionNodeType () { } /// /// Copies data from another node set /// public void CopyFrom (ExtensionNodeType ntype) { base.CopyFrom (ntype); this.typeName = ntype.TypeName; this.objectTypeName = ntype.ObjectTypeName; this.description = ntype.Description; this.addinId = ntype.AddinId; Attributes.Clear (); foreach (NodeTypeAttribute att in ntype.Attributes) { NodeTypeAttribute catt = new NodeTypeAttribute (); catt.CopyFrom (att); Attributes.Add (catt); } } internal override string IdAttribute { get { return "name"; } } internal override void Verify (string location, StringCollection errors) { base.Verify (location, errors); } internal override void SaveXml (XmlElement parent, string nodeName) { base.SaveXml (parent, "ExtensionNode"); XmlElement atts = Element ["Attributes"]; if (Attributes.Count > 0) { if (atts == null) { atts = parent.OwnerDocument.CreateElement ("Attributes"); Element.AppendChild (atts); } Attributes.SaveXml (atts); } else { if (atts != null) Element.RemoveChild (atts); } if (TypeName.Length > 0) Element.SetAttribute ("type", TypeName); else Element.RemoveAttribute ("type"); if (ObjectTypeName.Length > 0) Element.SetAttribute ("objectType", ObjectTypeName); else Element.RemoveAttribute ("objectType"); if (ExtensionAttributeTypeName.Length > 0) Element.SetAttribute ("customAttributeType", ExtensionAttributeTypeName); else Element.RemoveAttribute ("customAttributeType"); SaveXmlDescription (Description); } internal override void Write (BinaryXmlWriter writer) { base.Write (writer); if (Id.Length == 0) Id = "Type"; if (TypeName.Length == 0) typeName = "Mono.Addins.TypeExtensionNode"; writer.WriteValue ("typeName", typeName); writer.WriteValue ("objectTypeName", objectTypeName); writer.WriteValue ("description", description); writer.WriteValue ("addinId", addinId); writer.WriteValue ("Attributes", attributes); writer.WriteValue ("customAttributeType", customAttributeTypeName); } internal override void Read (BinaryXmlReader reader) { base.Read (reader); typeName = reader.ReadStringValue ("typeName"); objectTypeName = reader.ReadStringValue ("objectTypeName"); if (!reader.IgnoreDescriptionData) description = reader.ReadStringValue ("description"); addinId = reader.ReadStringValue ("addinId"); if (!reader.IgnoreDescriptionData) attributes = (NodeTypeAttributeCollection) reader.ReadValue ("Attributes", new NodeTypeAttributeCollection (this)); customAttributeTypeName = reader.ReadStringValue ("customAttributeType"); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/NodeTypeAttributeCollection.cs0000664000175000017500000000366412136523632032302 0ustar00directhexdirecthex00000000000000// // NodeTypeAttributeCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Description { /// /// A collection of node attributes /// public class NodeTypeAttributeCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public NodeTypeAttributeCollection () { } internal NodeTypeAttributeCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public NodeTypeAttribute this [int n] { get { return (NodeTypeAttribute) List [n]; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionPoint.cs0000664000175000017500000002151412136523632027633 0ustar00directhexdirecthex00000000000000// // ExtensionPoint.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Xml; using Mono.Addins.Serialization; using System.Collections.Specialized; using System.Collections.Generic; namespace Mono.Addins.Description { /// /// An extension point definition. /// public sealed class ExtensionPoint: ObjectDescription { string path; string name; string description; ExtensionNodeSet nodeSet; ConditionTypeDescriptionCollection conditions; // Information gathered from others addins: List addins; // Add-ins which extend this extension point string rootAddin; // Add-in which defines this extension point internal ExtensionPoint (XmlElement elem): base (elem) { path = elem.GetAttribute ("path"); name = elem.GetAttribute ("name"); description = ReadXmlDescription (); } /// /// Initializes a new instance of the class. /// public ExtensionPoint () { } /// /// Copies another extension point. /// /// /// Extension point from which to copy. /// public void CopyFrom (ExtensionPoint ep) { path = ep.path; name = ep.name; description = ep.description; NodeSet.CopyFrom (ep.NodeSet); Conditions.Clear (); foreach (ConditionTypeDescription cond in ep.Conditions) { ConditionTypeDescription cc = new ConditionTypeDescription (); cc.CopyFrom (cond); Conditions.Add (cc); } Addins.Clear (); foreach (string s in ep.Addins) Addins.Add (s); rootAddin = ep.rootAddin; } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "ExtensionPoint", errors, Path, "path"); NodeSet.Verify (location + "ExtensionPoint (" + Path + ")/", errors); Conditions.Verify (location + "ExtensionPoint (" + Path + ")/", errors); } internal void SetExtensionsAddinId (string addinId) { NodeSet.SetExtensionsAddinId (addinId); foreach (ConditionTypeDescription cond in Conditions) cond.AddinId = addinId; Addins.Add (addinId); } internal void MergeWith (string thisAddinId, ExtensionPoint ep) { NodeSet.MergeWith (thisAddinId, ep.NodeSet); foreach (ConditionTypeDescription cond in ep.Conditions) { if (cond.AddinId != thisAddinId && !Conditions.Contains (cond)) Conditions.Add (cond); } foreach (string s in ep.Addins) { if (!Addins.Contains (s)) Addins.Add (s); } } internal void UnmergeExternalData (string thisAddinId, Hashtable addinsToUnmerge) { NodeSet.UnmergeExternalData (thisAddinId, addinsToUnmerge); ArrayList todel = new ArrayList (); foreach (ConditionTypeDescription cond in Conditions) { if (cond.AddinId != thisAddinId && (addinsToUnmerge == null || addinsToUnmerge.Contains (cond.AddinId))) todel.Add (cond); } foreach (ConditionTypeDescription cond in todel) Conditions.Remove (cond); if (addinsToUnmerge == null) Addins.Clear (); else { foreach (string s in addinsToUnmerge.Keys) Addins.Remove (s); } if (thisAddinId != null && !Addins.Contains (thisAddinId)) Addins.Add (thisAddinId); } internal void Clear () { NodeSet.Clear (); Conditions.Clear (); Addins.Clear (); } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "ExtensionPoint"); Element.SetAttribute ("path", Path); if (Name.Length > 0) Element.SetAttribute ("name", Name); else Element.RemoveAttribute ("name"); SaveXmlDescription (Description); if (nodeSet != null) { nodeSet.Element = Element; nodeSet.SaveXml (parent); } } /// /// Gets or sets the path that identifies the extension point. /// /// /// The path. /// public string Path { get { return path != null ? path : string.Empty; } set { path = value; } } /// /// Gets or sets the display name of the extension point. /// /// /// The name. /// public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } /// /// Gets or sets the description of the extension point. /// /// /// The description. /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } /// /// Gets a list of add-ins that extend this extension point. /// /// /// This value is only available when the add-in description is loaded from an add-in registry. /// public string[] ExtenderAddins { get { return Addins.ToArray (); } } internal List Addins { get { if (addins == null) addins = new List (); return addins; } } internal string RootAddin { get { return rootAddin; } set { rootAddin = value; } } /// /// A node set which specifies the node types allowed in this extension point. /// /// /// The node set. /// public ExtensionNodeSet NodeSet { get { if (nodeSet == null) { if (Element != null) nodeSet = new ExtensionNodeSet (Element); else nodeSet = new ExtensionNodeSet (); nodeSet.SetParent (this); } return nodeSet; } } internal void SetNodeSet (ExtensionNodeSet nset) { // Used only by the addin updater nodeSet = nset; nodeSet.SetParent (this); } /// /// Gets the conditions available in this node set. /// /// /// The conditions. /// public ConditionTypeDescriptionCollection Conditions { get { if (conditions == null) { conditions = new ConditionTypeDescriptionCollection (this); if (Element != null) { foreach (XmlElement elem in Element.SelectNodes ("ConditionType")) conditions.Add (new ConditionTypeDescription (elem)); } } return conditions; } } /// /// Adds an extension node type. /// /// /// The extension node type. /// /// /// Name of the node /// /// /// Name of the type that implements the extension node. /// /// /// This method can be used to register a new allowed node type for the extension point. /// public ExtensionNodeType AddExtensionNode (string name, string typeName) { ExtensionNodeType ntype = new ExtensionNodeType (); ntype.Id = name; ntype.TypeName = typeName; NodeSet.NodeTypes.Add (ntype); return ntype; } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("path", path); writer.WriteValue ("name", name); writer.WriteValue ("description", Description); writer.WriteValue ("rootAddin", rootAddin); writer.WriteValue ("addins", Addins); writer.WriteValue ("NodeSet", NodeSet); writer.WriteValue ("Conditions", Conditions); } internal override void Read (BinaryXmlReader reader) { path = reader.ReadStringValue ("path"); name = reader.ReadStringValue ("name"); if (!reader.IgnoreDescriptionData) description = reader.ReadStringValue ("description"); rootAddin = reader.ReadStringValue ("rootAddin"); addins = (List) reader.ReadValue ("addins", new List ()); nodeSet = (ExtensionNodeSet) reader.ReadValue ("NodeSet"); conditions = (ConditionTypeDescriptionCollection) reader.ReadValue ("Conditions", new ConditionTypeDescriptionCollection (this)); if (nodeSet != null) nodeSet.SetParent (this); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionPointCollection.cs0000664000175000017500000000451112136523632031645 0ustar00directhexdirecthex00000000000000// // ExtensionPointCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of extension point definitions. /// public class ExtensionPointCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ExtensionPointCollection () { } internal ExtensionPointCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public ExtensionPoint this [int n] { get { return (ExtensionPoint) List [n]; } } /// /// Gets the with the specified path. /// /// /// Path. /// public ExtensionPoint this [string path] { get { for (int n=0; n /// Description of the attribute of a node type. /// public sealed class NodeTypeAttribute: ObjectDescription { string name; string type; bool required; bool localizable; string description; /// /// Initializes a new instance of the class. /// public NodeTypeAttribute() { } /// /// Copies data from another node attribute. /// /// /// The attribute from which to copy. /// public void CopyFrom (NodeTypeAttribute att) { name = att.name; type = att.type; required = att.required; localizable = att.localizable; description = att.description; } /// /// Gets or sets the name of the attribute. /// /// /// The name. /// public string Name { get { return name != null ? name : string.Empty; } set { name = value; } } /// /// Gets or sets a value indicating whether this is required. /// /// /// true if required; otherwise, false. /// public bool Required { get { return required; } set { required = value; } } /// /// Gets or sets a value indicating whether this is localizable. /// /// /// true if localizable; otherwise, false. /// public bool Localizable { get { return localizable; } set { localizable = value; } } /// /// Gets or sets the type of the attribute. /// /// /// The type. /// public string Type { get { return type != null ? type : string.Empty; } set { type = value; } } /// /// Gets or sets the description of the attribute. /// /// /// The description. /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } /// /// Gets or sets the type of the content. /// /// /// Allows specifying the type of the content of a string attribute. /// The value of this property is only informative, and it doesn't /// have any effect on how add-ins are packaged or loaded. /// public ContentType ContentType { get; set; } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "Attribute", errors, Name, "name"); } internal NodeTypeAttribute (XmlElement elem): base (elem) { name = elem.GetAttribute ("name"); type = elem.GetAttribute ("type"); required = elem.GetAttribute ("required").ToLower () == "true"; localizable = elem.GetAttribute ("localizable").ToLower () == "true"; string ct = elem.GetAttribute ("contentType"); if (!string.IsNullOrEmpty (ct)) ContentType = (ContentType) Enum.Parse (typeof(ContentType), ct); description = ReadXmlDescription (); } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "Attribute"); Element.SetAttribute ("name", name); if (Type.Length > 0) Element.SetAttribute ("type", Type); else Element.RemoveAttribute ("type"); if (required) Element.SetAttribute ("required", "True"); else Element.RemoveAttribute ("required"); if (localizable) Element.SetAttribute ("localizable", "True"); else Element.RemoveAttribute ("localizable"); if (ContentType != ContentType.Text) Element.SetAttribute ("contentType", ContentType.ToString ()); else Element.RemoveAttribute ("contentType"); SaveXmlDescription (description); } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("name", name); writer.WriteValue ("type", type); writer.WriteValue ("required", required); writer.WriteValue ("description", description); writer.WriteValue ("localizable", localizable); writer.WriteValue ("contentType", ContentType.ToString ()); } internal override void Read (BinaryXmlReader reader) { name = reader.ReadStringValue ("name"); type = reader.ReadStringValue ("type"); required = reader.ReadBooleanValue ("required"); if (!reader.IgnoreDescriptionData) description = reader.ReadStringValue ("description"); localizable = reader.ReadBooleanValue ("localizable"); string ct = reader.ReadStringValue ("contentType"); try { ContentType = (ContentType) Enum.Parse (typeof(ContentType), ct); } catch { ContentType = ContentType.Text; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/DependencyCollection.cs0000664000175000017500000000450112136523632030734 0ustar00directhexdirecthex00000000000000// // DependencyCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of dependency definitions. /// public class DependencyCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public DependencyCollection () { } internal DependencyCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The idnex. /// public Dependency this [int n] { get { return (Dependency) List [n]; } } /// /// Adds a dependency to the collection /// /// /// The dependency to add. /// public void Add (Dependency dep) { List.Add (dep); } /// /// Remove the specified dependency. /// /// /// Dependency to remove. /// public void Remove (Dependency dep) { List.Remove (dep); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/NativeDependency.cs0000664000175000017500000000322712136523632030073 0ustar00directhexdirecthex00000000000000// // NativeDependency.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Xml; using System.Xml.Serialization; using Mono.Addins.Description; namespace Mono.Addins.Description { #pragma warning disable 1591 [Obsolete] [XmlType ("NativeReference")] public class NativeDependency: Dependency { public override string Name { get { return "Native dependency"; } } internal override bool CheckInstalled (AddinRegistry registry) { return false; } } #pragma warning restore 1591 } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ObjectDescription.cs0000664000175000017500000000746012136524015030257 0ustar00directhexdirecthex00000000000000// // ObjectDescription.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Specialized; using System.Xml; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// Base class for add-in description definitions. /// public class ObjectDescription: IBinaryXmlElement { internal XmlElement Element; object parent; internal ObjectDescription (XmlElement elem) { Element = elem; } internal ObjectDescription () { } /// /// Gets the parent object. /// /// /// The parent object. /// public object Parent { get { return parent; } } /// /// Gets the parent add-in description. /// /// /// The parent add-in description. /// public AddinDescription ParentAddinDescription { get { if (parent is AddinDescription) return (AddinDescription) parent; else if (parent is ObjectDescription) return ((ObjectDescription)parent).ParentAddinDescription; else return null; } } internal string ParseString (string s) { var desc = ParentAddinDescription; if (desc != null) return desc.ParseString (s); else return s; } internal void SetParent (object ob) { parent = ob; } void IBinaryXmlElement.Write (BinaryXmlWriter writer) { Write (writer); } void IBinaryXmlElement.Read (BinaryXmlReader reader) { Read (reader); } internal virtual void Write (BinaryXmlWriter writer) { } internal virtual void Read (BinaryXmlReader reader) { } internal virtual void SaveXml (XmlElement parent) { } internal void CreateElement (XmlElement parent, string nodeName) { if (Element == null) { Element = parent.OwnerDocument.CreateElement (nodeName); parent.AppendChild (Element); } } internal string ReadXmlDescription () { XmlElement de = Element ["Description"]; if (de != null) return de.InnerText; else return null; } internal void SaveXmlDescription (string desc) { XmlElement de = Element ["Description"]; if (desc != null && desc.Length > 0) { if (de == null) { de = Element.OwnerDocument.CreateElement ("Description"); Element.AppendChild (de); } de.InnerText = desc; } else { if (de != null) Element.RemoveChild (de); } } internal virtual void Verify (string location, StringCollection errors) { } internal void VerifyNotEmpty (string location, StringCollection errors, string attr, string val) { if (val == null || val.Length == 0) errors.Add (location + ": attribute '" + attr + "' can't be empty."); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ConditionTypeDescriptionCollection.cs0000664000175000017500000000403612136523632033655 0ustar00directhexdirecthex00000000000000// // ConditionTypeDescriptionCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Description { /// /// A collection of condition types /// public class ConditionTypeDescriptionCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ConditionTypeDescriptionCollection () { } internal ConditionTypeDescriptionCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// Index. /// /// /// The condition. /// public ConditionTypeDescription this [int n] { get { return (ConditionTypeDescription) List [n]; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/AddinDescription.cs0000664000175000017500000011135212136524015030064 0ustar00directhexdirecthex00000000000000// // AddinDescription.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Xml; using System.Xml.Serialization; using System.Collections.Specialized; using Mono.Addins.Serialization; using Mono.Addins.Database; using System.Text; namespace Mono.Addins.Description { /// /// An add-in description /// /// /// This class represent an add-in manifest. It has properties for getting /// all information, and methods for loading and saving files. /// public class AddinDescription: IBinaryXmlElement { XmlDocument configDoc; string configFile; AddinDatabase ownerDatabase; string id; string name; string ns; string version; string compatVersion; string author; string url; string copyright; string description; string category; string basePath; string sourceAddinFile; bool isroot; bool hasUserId; bool canWrite = true; bool defaultEnabled = true; AddinFlags flags = AddinFlags.None; string domain; ModuleDescription mainModule; ModuleCollection optionalModules; ExtensionNodeSetCollection nodeSets; ConditionTypeDescriptionCollection conditionTypes; ExtensionPointCollection extensionPoints; ExtensionNodeDescription localizer; object[] fileInfo; AddinPropertyCollectionImpl properties; Dictionary variables; internal static BinaryXmlTypeMap typeMap; static AddinDescription () { typeMap = new BinaryXmlTypeMap (); typeMap.RegisterType (typeof(AddinDescription), "AddinDescription"); typeMap.RegisterType (typeof(Extension), "Extension"); typeMap.RegisterType (typeof(ExtensionNodeDescription), "Node"); typeMap.RegisterType (typeof(ExtensionNodeSet), "NodeSet"); typeMap.RegisterType (typeof(ExtensionNodeType), "NodeType"); typeMap.RegisterType (typeof(ExtensionPoint), "ExtensionPoint"); typeMap.RegisterType (typeof(ModuleDescription), "ModuleDescription"); typeMap.RegisterType (typeof(ConditionTypeDescription), "ConditionType"); typeMap.RegisterType (typeof(Condition), "Condition"); typeMap.RegisterType (typeof(AddinDependency), "AddinDependency"); typeMap.RegisterType (typeof(AssemblyDependency), "AssemblyDependency"); typeMap.RegisterType (typeof(NodeTypeAttribute), "NodeTypeAttribute"); typeMap.RegisterType (typeof(AddinFileInfo), "FileInfo"); typeMap.RegisterType (typeof(AddinProperty), "Property"); } internal AddinDatabase OwnerDatabase { get { return ownerDatabase; } set { ownerDatabase = value; } } /// /// Gets or sets the path to the main addin file. /// /// /// The addin file. /// /// /// The add-in file can be either the main assembly of an add-in or an xml manifest. /// public string AddinFile { get { return sourceAddinFile; } set { sourceAddinFile = value; } } /// /// Gets the addin identifier. /// /// /// The addin identifier. /// public string AddinId { get { return Addin.GetFullId (Namespace, LocalId, Version); } } /// /// Gets or sets the local identifier. /// /// /// The local identifier. /// public string LocalId { get { return id != null ? ParseString (id) : string.Empty; } set { id = value; hasUserId = true; } } /// /// Gets or sets the namespace. /// /// /// The namespace. /// public string Namespace { get { return ns != null ? ParseString (ns) : string.Empty; } set { ns = value; } } /// /// Gets or sets the display name of the add-in. /// /// /// The name. /// public string Name { get { string val = Properties.GetPropertyValue ("Name"); if (val.Length > 0) return val; if (name != null && name.Length > 0) return ParseString (name); if (HasUserId) return AddinId; else if (sourceAddinFile != null) return Path.GetFileNameWithoutExtension (sourceAddinFile); else return string.Empty; } set { name = value; } } /// /// Gets or sets the version. /// /// /// The version. /// public string Version { get { return version != null ? ParseString (version) : string.Empty; } set { version = value; } } /// /// Gets or sets the version of the add-in with which this add-in is backwards compatible. /// /// /// The compat version. /// public string CompatVersion { get { return compatVersion != null ? ParseString (compatVersion) : string.Empty; } set { compatVersion = value; } } /// /// Gets or sets the author. /// /// /// The author. /// public string Author { get { string val = Properties.GetPropertyValue ("Author"); if (val.Length > 0) return val; return ParseString (author) ?? string.Empty; } set { author = value; } } /// /// Gets or sets the Url where more information about the add-in can be found. /// /// /// The URL. /// public string Url { get { string val = Properties.GetPropertyValue ("Url"); if (val.Length > 0) return val; return ParseString (url) ?? string.Empty; } set { url = value; } } /// /// Gets or sets the copyright. /// /// /// The copyright. /// public string Copyright { get { string val = Properties.GetPropertyValue ("Copyright"); if (val.Length > 0) return val; return ParseString (copyright) ?? string.Empty; } set { copyright = value; } } /// /// Gets or sets the description of the add-in. /// /// /// The description. /// public string Description { get { string val = Properties.GetPropertyValue ("Description"); if (val.Length > 0) return val; return ParseString (description) ?? string.Empty; } set { description = value; } } /// /// Gets or sets the category of the add-in. /// /// /// The category. /// public string Category { get { string val = Properties.GetPropertyValue ("Category"); if (val.Length > 0) return val; return ParseString (category) ?? string.Empty; } set { category = value; } } /// /// Gets the base path for locating external files relative to the add-in. /// /// /// The base path. /// public string BasePath { get { return basePath != null ? basePath : string.Empty; } } internal void SetBasePath (string path) { basePath = path; } /// /// Gets or sets a value indicating whether this instance is an add-in root. /// /// /// true if this instance is an add-in root; otherwise, false. /// public bool IsRoot { get { return isroot; } set { isroot = value; } } /// /// Gets or sets a value indicating whether this add-in is enabled by default. /// /// /// true if enabled by default; otherwise, false. /// public bool EnabledByDefault { get { return defaultEnabled; } set { defaultEnabled = value; } } /// /// Gets or sets the add-in flags. /// /// /// The flags. /// public AddinFlags Flags { get { return flags; } set { flags = value; } } internal bool HasUserId { get { return hasUserId; } set { hasUserId = value; } } /// /// Gets a value indicating whether this add-in can be disabled. /// /// /// true if this add-in can be disabled; otherwise, false. /// public bool CanDisable { get { return (flags & AddinFlags.CantDisable) == 0 && !IsHidden; } } /// /// Gets a value indicating whether this add-in can be uninstalled. /// /// /// true if this instance can be uninstalled; otherwise, false. /// public bool CanUninstall { get { return (flags & AddinFlags.CantUninstall) == 0 && !IsHidden; } } /// /// Gets a value indicating whether this add-in is hidden. /// /// /// true if this add-in is hidden; otherwise, false. /// public bool IsHidden { get { return (flags & AddinFlags.Hidden) != 0; } } internal bool SupportsVersion (string ver) { return Addin.CompareVersions (ver, Version) >= 0 && (CompatVersion.Length == 0 || Addin.CompareVersions (ver, CompatVersion) <= 0); } /// /// Gets all external files /// /// /// All files. /// /// /// External files are data files and assemblies explicitly referenced in the Runtime section of the add-in manifest. /// public StringCollection AllFiles { get { StringCollection col = new StringCollection (); foreach (string s in MainModule.AllFiles) col.Add (s); foreach (ModuleDescription mod in OptionalModules) { foreach (string s in mod.AllFiles) col.Add (s); } return col; } } /// /// Gets all paths to be ignored by the add-in scanner. /// /// /// All paths to be ignored. /// public StringCollection AllIgnorePaths { get { StringCollection col = new StringCollection (); foreach (string s in MainModule.IgnorePaths) col.Add (s); foreach (ModuleDescription mod in OptionalModules) { foreach (string s in mod.IgnorePaths) col.Add (s); } return col; } } /// /// Gets the main module. /// /// /// The main module. /// public ModuleDescription MainModule { get { if (mainModule == null) { if (RootElement == null) mainModule = new ModuleDescription (); else mainModule = new ModuleDescription (RootElement); mainModule.SetParent (this); } return mainModule; } } /// /// Gets the optional modules. /// /// /// The optional modules. /// /// /// Optional modules can be used to declare extensions which will be registered only if some specified /// add-in dependencies can be satisfied. Dependencies specified in optional modules are 'soft dependencies', /// which means that they don't need to be satisfied in order to load the add-in. /// public ModuleCollection OptionalModules { get { if (optionalModules == null) { optionalModules = new ModuleCollection (this); if (RootElement != null) { foreach (XmlElement mod in RootElement.SelectNodes ("Module")) optionalModules.Add (new ModuleDescription (mod)); } } return optionalModules; } } /// /// Gets all modules (including the main module and all optional modules) /// /// /// All modules. /// public ModuleCollection AllModules { get { ModuleCollection col = new ModuleCollection (this); col.Add (MainModule); foreach (ModuleDescription mod in OptionalModules) col.Add (mod); return col; } } /// /// Gets the extension node sets. /// /// /// The extension node sets. /// public ExtensionNodeSetCollection ExtensionNodeSets { get { if (nodeSets == null) { nodeSets = new ExtensionNodeSetCollection (this); if (RootElement != null) { foreach (XmlElement elem in RootElement.SelectNodes ("ExtensionNodeSet")) nodeSets.Add (new ExtensionNodeSet (elem)); } } return nodeSets; } } /// /// Gets the extension points. /// /// /// The extension points. /// public ExtensionPointCollection ExtensionPoints { get { if (extensionPoints == null) { extensionPoints = new ExtensionPointCollection (this); if (RootElement != null) { foreach (XmlElement elem in RootElement.SelectNodes ("ExtensionPoint")) extensionPoints.Add (new ExtensionPoint (elem)); } } return extensionPoints; } } /// /// Gets the condition types. /// /// /// The condition types. /// public ConditionTypeDescriptionCollection ConditionTypes { get { if (conditionTypes == null) { conditionTypes = new ConditionTypeDescriptionCollection (this); if (RootElement != null) { foreach (XmlElement elem in RootElement.SelectNodes ("ConditionType")) conditionTypes.Add (new ConditionTypeDescription (elem)); } } return conditionTypes; } } /// /// Gets or sets the add-in localizer. /// /// /// The description of the add-in localizer for this add-in. /// public ExtensionNodeDescription Localizer { get { return localizer; } set { localizer = value; } } /// /// Custom properties specified in the add-in header /// public AddinPropertyCollection Properties { get { if (properties == null) properties = new AddinPropertyCollectionImpl (this); return properties; } } /// /// Adds an extension point. /// /// /// The extension point. /// /// /// Path that identifies the new extension point. /// public ExtensionPoint AddExtensionPoint (string path) { ExtensionPoint ep = new ExtensionPoint (); ep.Path = path; ExtensionPoints.Add (ep); return ep; } internal ExtensionNodeDescription FindExtensionNode (string path, bool lookInDeps) { // Look in the extensions of this add-in foreach (Extension ext in MainModule.Extensions) { if (path.StartsWith (ext.Path + "/")) { string subp = path.Substring (ext.Path.Length).Trim ('/'); ExtensionNodeDescriptionCollection nodes = ext.ExtensionNodes; ExtensionNodeDescription node = null; foreach (string p in subp.Split ('/')) { if (p.Length == 0) continue; node = nodes [p]; if (node == null) break; nodes = node.ChildNodes; } if (node != null) return node; } } if (!lookInDeps || OwnerDatabase == null) return null; // Look in dependencies foreach (Dependency dep in MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; Addin ad = OwnerDatabase.GetInstalledAddin (Domain, adep.FullAddinId); if (ad != null && ad.Description != null) { ExtensionNodeDescription node = ad.Description.FindExtensionNode (path, false); if (node != null) return node; } } return null; } XmlElement RootElement { get { if (configDoc != null) return configDoc.DocumentElement; else return null; } } /// /// Gets or sets file where this description is stored /// /// /// The file path. /// public string FileName { get { return configFile; } set { configFile = value; } } internal string Domain { get { return domain; } set { domain = value; } } internal void StoreFileInfo () { ArrayList list = new ArrayList (); foreach (string f in AllFiles) { string file = Path.Combine (this.BasePath, f); AddinFileInfo fi = new AddinFileInfo (); fi.FileName = f; fi.Timestamp = File.GetLastWriteTime (file); list.Add (fi); } fileInfo = list.ToArray (); } internal bool FilesChanged () { // Checks if the files of the add-in have changed. if (fileInfo == null) return true; foreach (AddinFileInfo f in fileInfo) { string file = Path.Combine (this.BasePath, f.FileName); if (!File.Exists (file)) return true; if (f.Timestamp != File.GetLastWriteTime (file)) return true; } return false; } void TransferCoreProperties (bool removeProperties) { if (properties == null) return; string val = properties.ExtractCoreProperty ("Id", removeProperties); if (val != null) id = val; val = properties.ExtractCoreProperty ("Namespace", removeProperties); if (val != null) ns = val; val = properties.ExtractCoreProperty ("Version", removeProperties); if (val != null) version = val; val = properties.ExtractCoreProperty ("CompatVersion", removeProperties); if (val != null) compatVersion = val; val = properties.ExtractCoreProperty ("DefaultEnabled", removeProperties); if (val != null) defaultEnabled = GetBool (val, true); val = properties.ExtractCoreProperty ("IsRoot", removeProperties); if (val != null) isroot = GetBool (val, true); val = properties.ExtractCoreProperty ("Flags", removeProperties); if (val != null) flags = (AddinFlags) Enum.Parse (typeof(AddinFlags), val); } /// /// Saves the add-in description. /// /// /// File name where to save this instance /// /// /// Saves the add-in description to the specified file and sets the FileName property. /// public void Save (string fileName) { configFile = fileName; Save (); } /// /// Saves the add-in description. /// /// /// It is thrown if FileName is not set /// /// /// The description is saved to the file specified in the FileName property. /// public void Save () { if (configFile == null) throw new InvalidOperationException ("File name not specified."); SaveXml (); using (StreamWriter sw = new StreamWriter (configFile)) { XmlTextWriter tw = new XmlTextWriter (sw); tw.Formatting = Formatting.Indented; configDoc.Save (tw); } } /// /// Generates an XML representation of the add-in description /// /// /// An XML manifest. /// public XmlDocument SaveToXml () { SaveXml (); return configDoc; } void SaveXml () { if (!canWrite) throw new InvalidOperationException ("Can't write incomplete description."); XmlElement elem; if (configDoc == null) { configDoc = new XmlDocument (); configDoc.AppendChild (configDoc.CreateElement ("Addin")); } elem = configDoc.DocumentElement; SaveCoreProperty (elem, HasUserId ? id : null, "id", "Id"); SaveCoreProperty (elem, version, "version", "Version"); SaveCoreProperty (elem, ns, "namespace", "Namespace"); SaveCoreProperty (elem, isroot ? "true" : null, "isroot", "IsRoot"); // Name will return the file name when HasUserId=false if (!string.IsNullOrEmpty (name)) elem.SetAttribute ("name", name); else elem.RemoveAttribute ("name"); SaveCoreProperty (elem, compatVersion, "compatVersion", "CompatVersion"); SaveCoreProperty (elem, defaultEnabled ? null : "false", "defaultEnabled", "DefaultEnabled"); SaveCoreProperty (elem, flags != AddinFlags.None ? flags.ToString () : null, "flags", "Flags"); if (author != null && author.Length > 0) elem.SetAttribute ("author", author); else elem.RemoveAttribute ("author"); if (url != null && url.Length > 0) elem.SetAttribute ("url", url); else elem.RemoveAttribute ("url"); if (copyright != null && copyright.Length > 0) elem.SetAttribute ("copyright", copyright); else elem.RemoveAttribute ("copyright"); if (description != null && description.Length > 0) elem.SetAttribute ("description", description); else elem.RemoveAttribute ("description"); if (category != null && category.Length > 0) elem.SetAttribute ("category", category); else elem.RemoveAttribute ("category"); if (localizer == null || localizer.Element == null) { // Remove old element if it exists XmlElement oldLoc = (XmlElement) elem.SelectSingleNode ("Localizer"); if (oldLoc != null) elem.RemoveChild (oldLoc); } if (localizer != null) localizer.SaveXml (elem); if (mainModule != null) { mainModule.Element = elem; mainModule.SaveXml (elem); } if (optionalModules != null) optionalModules.SaveXml (elem); if (nodeSets != null) nodeSets.SaveXml (elem); if (extensionPoints != null) extensionPoints.SaveXml (elem); XmlElement oldHeader = (XmlElement) elem.SelectSingleNode ("Header"); if (properties == null || properties.Count == 0) { if (oldHeader != null) elem.RemoveChild (oldHeader); } else { if (oldHeader == null) { oldHeader = elem.OwnerDocument.CreateElement ("Header"); if (elem.FirstChild != null) elem.InsertBefore (oldHeader, elem.FirstChild); else elem.AppendChild (oldHeader); } else oldHeader.RemoveAll (); foreach (var prop in properties) { XmlElement propElem = elem.OwnerDocument.CreateElement (prop.Name); if (!string.IsNullOrEmpty (prop.Locale)) propElem.SetAttribute ("locale", prop.Locale); propElem.InnerText = prop.Value ?? string.Empty; oldHeader.AppendChild (propElem); } } XmlElement oldVars = (XmlElement) elem.SelectSingleNode ("Variables"); if (variables == null || variables.Count == 0) { if (oldVars != null) elem.RemoveChild (oldVars); } else { if (oldVars == null) { oldVars = elem.OwnerDocument.CreateElement ("Variables"); if (elem.FirstChild != null) elem.InsertBefore (oldVars, elem.FirstChild); else elem.AppendChild (oldVars); } else oldVars.RemoveAll (); foreach (var prop in variables) { XmlElement propElem = elem.OwnerDocument.CreateElement (prop.Key); propElem.InnerText = prop.Value ?? string.Empty; oldVars.AppendChild (propElem); } } } void SaveCoreProperty (XmlElement elem, string val, string attr, string prop) { if (properties != null && properties.HasProperty (prop)) { elem.RemoveAttribute (attr); if (!string.IsNullOrEmpty (val)) properties.SetPropertyValue (prop, val); else properties.RemoveProperty (prop); } else if (string.IsNullOrEmpty (val)) elem.RemoveAttribute (attr); else elem.SetAttribute (attr, val); } /// /// Load an add-in description from a file /// /// /// The file. /// public static AddinDescription Read (string configFile) { AddinDescription config; using (Stream s = File.OpenRead (configFile)) { config = Read (s, Path.GetDirectoryName (configFile)); } config.configFile = configFile; return config; } /// /// Load an add-in description from a stream /// /// /// The stream /// /// /// The path to be used to resolve relative file paths. /// public static AddinDescription Read (Stream stream, string basePath) { return Read (new StreamReader (stream), basePath); } /// /// Load an add-in description from a text reader /// /// /// The text reader /// /// /// The path to be used to resolve relative file paths. /// public static AddinDescription Read (TextReader reader, string basePath) { AddinDescription config = new AddinDescription (); try { config.configDoc = new XmlDocument (); config.configDoc.Load (reader); } catch (Exception ex) { throw new InvalidOperationException ("The add-in configuration file is invalid: " + ex.Message, ex); } XmlElement elem = config.configDoc.DocumentElement; if (elem.LocalName == "ExtensionModel") return config; XmlElement varsElem = (XmlElement) elem.SelectSingleNode ("Variables"); if (varsElem != null) { foreach (XmlNode node in varsElem.ChildNodes) { XmlElement prop = node as XmlElement; if (prop == null) continue; if (config.variables == null) config.variables = new Dictionary (); config.variables [prop.LocalName] = prop.InnerText; } } config.id = elem.GetAttribute ("id"); config.ns = elem.GetAttribute ("namespace"); config.name = elem.GetAttribute ("name"); config.version = elem.GetAttribute ("version"); config.compatVersion = elem.GetAttribute ("compatVersion"); config.author = elem.GetAttribute ("author"); config.url = elem.GetAttribute ("url"); config.copyright = elem.GetAttribute ("copyright"); config.description = elem.GetAttribute ("description"); config.category = elem.GetAttribute ("category"); config.basePath = elem.GetAttribute ("basePath"); config.domain = "global"; string s = elem.GetAttribute ("isRoot"); if (s.Length == 0) s = elem.GetAttribute ("isroot"); config.isroot = GetBool (s, false); config.defaultEnabled = GetBool (elem.GetAttribute ("defaultEnabled"), true); string prot = elem.GetAttribute ("flags"); if (prot.Length == 0) config.flags = AddinFlags.None; else config.flags = (AddinFlags) Enum.Parse (typeof(AddinFlags), prot); XmlElement localizerElem = (XmlElement) elem.SelectSingleNode ("Localizer"); if (localizerElem != null) config.localizer = new ExtensionNodeDescription (localizerElem); XmlElement headerElem = (XmlElement) elem.SelectSingleNode ("Header"); if (headerElem != null) { foreach (XmlNode node in headerElem.ChildNodes) { XmlElement prop = node as XmlElement; if (prop == null) continue; config.Properties.SetPropertyValue (prop.LocalName, prop.InnerText, prop.GetAttribute ("locale")); } } config.TransferCoreProperties (false); if (config.id.Length > 0) config.hasUserId = true; return config; } internal string ParseString (string input) { if (input == null || input.Length < 4 || variables == null || variables.Count == 0) return input; int i = input.IndexOf ("$("); if (i == -1) return input; StringBuilder result = new StringBuilder (input.Substring (0, i), input.Length); while (i < input.Length) { if (input [i] == '$') { i++; if (i >= input.Length || input[i] != '(') { result.Append ('$'); continue; } i++; int start = i; while (i < input.Length && input [i] != ')') i++; string tag = input.Substring (start, i - start); string tagValue; if (variables.TryGetValue (tag, out tagValue)) result.Append (tagValue); else { result.Append ('$'); i = start - 1; } } else { result.Append (input [i]); } i++; } return result.ToString (); } static bool GetBool (string s, bool defval) { if (s.Length == 0) return defval; else return s == "true" || s == "yes"; } internal static AddinDescription ReadBinary (FileDatabase fdb, string configFile) { AddinDescription description = (AddinDescription) fdb.ReadSharedObject (configFile, typeMap); if (description != null) { description.FileName = configFile; description.canWrite = !fdb.IgnoreDescriptionData; } return description; } internal void SaveBinary (FileDatabase fdb, string file) { configFile = file; SaveBinary (fdb); } internal void SaveBinary (FileDatabase fdb) { if (!canWrite) throw new InvalidOperationException ("Can't write incomplete description."); fdb.WriteSharedObject (AddinFile, FileName, typeMap, this); // BinaryXmlReader.DumpFile (configFile); } /// /// Verify this instance. /// /// /// This method checks all the definitions in the description and returns a list of errors. /// If the returned list is empty, it means that the description is valid. /// public StringCollection Verify () { return Verify (new AddinFileSystemExtension ()); } internal StringCollection Verify (AddinFileSystemExtension fs) { StringCollection errors = new StringCollection (); if (IsRoot) { if (OptionalModules.Count > 0) errors.Add ("Root add-in hosts can't have optional modules."); } if (AddinId.Length == 0 || Version.Length == 0) { if (ExtensionPoints.Count > 0) errors.Add ("Add-ins which define new extension points must have an Id and Version."); } MainModule.Verify ("", errors); OptionalModules.Verify ("", errors); ExtensionNodeSets.Verify ("", errors); ExtensionPoints.Verify ("", errors); ConditionTypes.Verify ("", errors); foreach (ExtensionNodeSet nset in ExtensionNodeSets) { if (nset.Id.Length == 0) errors.Add ("Attribute 'id' can't be empty for global node sets."); } string bp = null; if (BasePath.Length > 0) bp = BasePath; else if (sourceAddinFile != null && sourceAddinFile.Length > 0) bp = Path.GetDirectoryName (AddinFile); else if (configFile != null && configFile.Length > 0) bp = Path.GetDirectoryName (configFile); if (bp != null) { foreach (string file in AllFiles) { string asmFile = Path.Combine (bp, file); if (!fs.FileExists (asmFile)) errors.Add ("The file '" + asmFile + "' referenced in the manifest could not be found."); } } if (localizer != null && localizer.GetAttribute ("type").Length == 0) { errors.Add ("The attribute 'type' in the Location element is required."); } // Ensure that there are no duplicated properties if (properties != null) { HashSet props = new HashSet (); foreach (var prop in properties) { if (!props.Add (prop.Name + " " + prop.Locale)) errors.Add (string.Format ("Property {0} specified more than once", prop.Name + (prop.Locale != null ? " (" + prop.Locale + ")" : ""))); } } return errors; } internal void SetExtensionsAddinId (string addinId) { foreach (ExtensionPoint ep in ExtensionPoints) ep.SetExtensionsAddinId (addinId); foreach (ExtensionNodeSet ns in ExtensionNodeSets) ns.SetExtensionsAddinId (addinId); } internal void UnmergeExternalData (Hashtable addins) { // Removes extension types and extension sets coming from other add-ins. foreach (ExtensionPoint ep in ExtensionPoints) ep.UnmergeExternalData (AddinId, addins); foreach (ExtensionNodeSet ns in ExtensionNodeSets) ns.UnmergeExternalData (AddinId, addins); } internal void MergeExternalData (AddinDescription other) { // Removes extension types and extension sets coming from other add-ins. foreach (ExtensionPoint ep in other.ExtensionPoints) { ExtensionPoint tep = ExtensionPoints [ep.Path]; if (tep != null) tep.MergeWith (AddinId, ep); } foreach (ExtensionNodeSet ns in other.ExtensionNodeSets) { ExtensionNodeSet tns = ExtensionNodeSets [ns.Id]; if (tns != null) tns.MergeWith (AddinId, ns); } } internal bool IsExtensionModel { get { return RootElement.LocalName == "ExtensionModel"; } } internal static AddinDescription Merge (AddinDescription desc1, AddinDescription desc2) { if (!desc2.IsExtensionModel) { AddinDescription tmp = desc1; desc1 = desc2; desc2 = tmp; } ((AddinPropertyCollectionImpl)desc1.Properties).AddRange (desc2.Properties); desc1.ExtensionPoints.AddRange (desc2.ExtensionPoints); desc1.ExtensionNodeSets.AddRange (desc2.ExtensionNodeSets); desc1.ConditionTypes.AddRange (desc2.ConditionTypes); desc1.OptionalModules.AddRange (desc2.OptionalModules); foreach (string s in desc2.MainModule.Assemblies) desc1.MainModule.Assemblies.Add (s); foreach (string s in desc2.MainModule.DataFiles) desc1.MainModule.DataFiles.Add (s); desc1.MainModule.Dependencies.AddRange (desc2.MainModule.Dependencies); desc1.MainModule.Extensions.AddRange (desc2.MainModule.Extensions); return desc1; } void IBinaryXmlElement.Write (BinaryXmlWriter writer) { TransferCoreProperties (true); writer.WriteValue ("id", ParseString (id)); writer.WriteValue ("ns", ParseString (ns)); writer.WriteValue ("isroot", isroot); writer.WriteValue ("name", ParseString (name)); writer.WriteValue ("version", ParseString (version)); writer.WriteValue ("compatVersion", ParseString (compatVersion)); writer.WriteValue ("hasUserId", hasUserId); writer.WriteValue ("author", ParseString (author)); writer.WriteValue ("url", ParseString (url)); writer.WriteValue ("copyright", ParseString (copyright)); writer.WriteValue ("description", ParseString (description)); writer.WriteValue ("category", ParseString (category)); writer.WriteValue ("basePath", basePath); writer.WriteValue ("sourceAddinFile", sourceAddinFile); writer.WriteValue ("defaultEnabled", defaultEnabled); writer.WriteValue ("domain", domain); writer.WriteValue ("MainModule", MainModule); writer.WriteValue ("OptionalModules", OptionalModules); writer.WriteValue ("NodeSets", ExtensionNodeSets); writer.WriteValue ("ExtensionPoints", ExtensionPoints); writer.WriteValue ("ConditionTypes", ConditionTypes); writer.WriteValue ("FilesInfo", fileInfo); writer.WriteValue ("Localizer", localizer); writer.WriteValue ("flags", (int)flags); writer.WriteValue ("Properties", properties); } void IBinaryXmlElement.Read (BinaryXmlReader reader) { id = reader.ReadStringValue ("id"); ns = reader.ReadStringValue ("ns"); isroot = reader.ReadBooleanValue ("isroot"); name = reader.ReadStringValue ("name"); version = reader.ReadStringValue ("version"); compatVersion = reader.ReadStringValue ("compatVersion"); hasUserId = reader.ReadBooleanValue ("hasUserId"); author = reader.ReadStringValue ("author"); url = reader.ReadStringValue ("url"); copyright = reader.ReadStringValue ("copyright"); description = reader.ReadStringValue ("description"); category = reader.ReadStringValue ("category"); basePath = reader.ReadStringValue ("basePath"); sourceAddinFile = reader.ReadStringValue ("sourceAddinFile"); defaultEnabled = reader.ReadBooleanValue ("defaultEnabled"); domain = reader.ReadStringValue ("domain"); mainModule = (ModuleDescription) reader.ReadValue ("MainModule"); optionalModules = (ModuleCollection) reader.ReadValue ("OptionalModules", new ModuleCollection (this)); nodeSets = (ExtensionNodeSetCollection) reader.ReadValue ("NodeSets", new ExtensionNodeSetCollection (this)); extensionPoints = (ExtensionPointCollection) reader.ReadValue ("ExtensionPoints", new ExtensionPointCollection (this)); conditionTypes = (ConditionTypeDescriptionCollection) reader.ReadValue ("ConditionTypes", new ConditionTypeDescriptionCollection (this)); fileInfo = (object[]) reader.ReadValue ("FilesInfo", null); localizer = (ExtensionNodeDescription) reader.ReadValue ("Localizer"); flags = (AddinFlags) reader.ReadInt32Value ("flags"); properties = (AddinPropertyCollectionImpl) reader.ReadValue ("Properties", new AddinPropertyCollectionImpl (this)); if (mainModule != null) mainModule.SetParent (this); } } class AddinFileInfo: IBinaryXmlElement { string fileName; DateTime timestamp; public string FileName { get { return fileName; } set { fileName = value; } } public System.DateTime Timestamp { get { return timestamp; } set { timestamp = value; } } public void Read (BinaryXmlReader reader) { fileName = reader.ReadStringValue ("fileName"); timestamp = reader.ReadDateTimeValue ("timestamp"); } public void Write (BinaryXmlWriter writer) { writer.WriteValue ("fileName", fileName); writer.WriteValue ("timestamp", timestamp); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeSetCollection.cs0000664000175000017500000000451312136523632032117 0ustar00directhexdirecthex00000000000000// // ExtensionNodeSetCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of node sets. /// public class ExtensionNodeSetCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ExtensionNodeSetCollection () { } internal ExtensionNodeSetCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public ExtensionNodeSet this [int n] { get { return (ExtensionNodeSet) List [n]; } } /// /// Gets the with the specified id. /// /// /// Identifier. /// public ExtensionNodeSet this [string id] { get { for (int n=0; n // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Linq; using System.Collections.Generic; namespace Mono.Addins.Description { /// /// A collection of add-in properties /// public interface AddinPropertyCollection: IEnumerable { /// /// Gets the value of a property /// /// /// The property value. /// /// /// Name of the property. /// /// /// If the property is localized, it will return the value for the current language if exists, or the /// default value if it doesn't. /// string GetPropertyValue (string name); /// /// Gets the value of a property /// /// /// The property value. /// /// /// Name of the property. /// /// /// Locale for which the value must be returned. /// string GetPropertyValue (string name, string locale); /// /// Sets the value of a property /// /// /// Name of the property /// /// /// New value. /// void SetPropertyValue (string name, string value); /// /// Sets the value of a property for a specific locale /// /// /// Name of the property. /// /// /// New value. /// /// /// Locale of the property to be set. /// void SetPropertyValue (string name, string value, string locale); /// /// Removes a property. /// /// /// Name of the property. /// /// /// This method only removes properties which have no locale set. /// void RemoveProperty (string name); /// /// Removes a property with a specified locale /// /// /// Name of the property /// /// /// Locale of the property /// void RemoveProperty (string name, string locale); } class AddinPropertyCollectionImpl: List, AddinPropertyCollection { AddinDescription desc; public AddinPropertyCollectionImpl () { } public AddinPropertyCollectionImpl (AddinDescription desc) { this.desc = desc; } public AddinPropertyCollectionImpl (AddinPropertyCollection col) { AddRange (col); } public string GetPropertyValue (string name) { return GetPropertyValue (name, System.Threading.Thread.CurrentThread.CurrentCulture.ToString ()); } public string GetPropertyValue (string name, string locale) { locale = NormalizeLocale (locale); string lang = GetLocaleLang (locale); AddinProperty sameLangDifCountry = null; AddinProperty sameLang = null; AddinProperty defaultLoc = null; foreach (var p in this) { if (p.Name == name) { if (p.Locale == locale) return ParseString (p.Value); string plang = GetLocaleLang (p.Locale); if (plang == p.Locale && plang == lang) // No country specified sameLang = p; else if (plang == lang) sameLangDifCountry = p; else if (p.Locale == null) defaultLoc = p; } } if (sameLang != null) return ParseString (sameLang.Value); else if (sameLangDifCountry != null) return ParseString (sameLangDifCountry.Value); else if (defaultLoc != null) return ParseString (defaultLoc.Value); else return string.Empty; } string ParseString (string s) { if (desc != null) return desc.ParseString (s); else return s; } string NormalizeLocale (string loc) { if (string.IsNullOrEmpty (loc)) return null; return loc.Replace ('_','-'); } string GetLocaleLang (string loc) { if (loc == null) return null; int i = loc.IndexOf ('-'); if (i != -1) return loc.Substring (0, i); else return loc; } public void SetPropertyValue (string name, string value) { SetPropertyValue (name, value, null); } public void SetPropertyValue (string name, string value, string locale) { if (string.IsNullOrEmpty (name)) throw new ArgumentException ("name can't be null or empty"); if (value == null) throw new ArgumentNullException ("value"); locale = NormalizeLocale (locale); foreach (var p in this) { if (p.Name == name && p.Locale == locale) { p.Value = value; return; } } AddinProperty prop = new AddinProperty (); prop.Name = name; prop.Value = value; prop.Locale = locale; Add (prop); } public void RemoveProperty (string name) { RemoveProperty (name, null); } public void RemoveProperty (string name, string locale) { locale = NormalizeLocale (locale); foreach (var p in this) { if (p.Name == name && p.Locale == locale) { Remove (p); return; } } } internal bool HasProperty (string name) { return this.Any (p => p.Name == name); } internal string ExtractCoreProperty (string name, bool removeProperty) { foreach (var p in this) { if (p.Name == name && p.Locale == null) { if (removeProperty) Remove (p); return p.Value; } } return null; } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeTypeCollection.cs0000664000175000017500000000453012136523632032304 0ustar00directhexdirecthex00000000000000// // ExtensionNodeTypeCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of node types. /// public class ExtensionNodeTypeCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ExtensionNodeTypeCollection () { } internal ExtensionNodeTypeCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public ExtensionNodeType this [int n] { get { return (ExtensionNodeType) List [n]; } } /// /// Gets the with the specified id. /// /// /// Identifier. /// public ExtensionNodeType this [string id] { get { for (int n=0; n /// Base class for add-in description collections. /// public class ObjectDescriptionCollection: CollectionBase { object owner; internal ObjectDescriptionCollection (object owner) { this.owner = owner; } /// /// Initializes a new instance of the class. /// public ObjectDescriptionCollection () { } /// /// Add an object. /// /// /// The object. /// public void Add (ObjectDescription ep) { List.Add (ep); } /// /// Adds a collection of objects. /// /// /// The objects to add. /// public void AddRange (ObjectDescriptionCollection collection) { foreach (ObjectDescription ob in collection) Add (ob); } /// /// Insert an object. /// /// /// Insertion index. /// /// /// The object. /// public void Insert (int index, ObjectDescription ep) { List.Insert (index, ep); } /// /// Removes an object. /// /// /// Object to remove. /// public void Remove (ObjectDescription ep) { List.Remove (ep); } /// /// Checks if an object is present in the collection. /// /// /// Objecect to check. /// public bool Contains (ObjectDescription ob) { return List.Contains (ob); } #pragma warning disable 1591 protected override void OnRemove (int index, object value) { ObjectDescription ep = (ObjectDescription) value; if (ep.Element != null) { ep.Element.ParentNode.RemoveChild (ep.Element); ep.Element = null; } if (owner != null) ep.SetParent (null); } protected override void OnInsertComplete (int index, object value) { if (owner != null) ((ObjectDescription)value).SetParent (owner); } protected override void OnSetComplete (int index, object oldValue, object newValue) { if (owner != null) { ((ObjectDescription)newValue).SetParent (owner); ((ObjectDescription)oldValue).SetParent (null); } } protected override void OnClear () { if (owner != null) { foreach (ObjectDescription ob in List) ob.SetParent (null); } } #pragma warning restore 1591 internal void SaveXml (XmlElement parent) { foreach (ObjectDescription ob in this) ob.SaveXml (parent); } internal void Verify (string location, StringCollection errors) { int n=0; foreach (ObjectDescription ob in this) { ob.Verify (location + "[" + n + "]/", errors); n++; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescriptionCollection.cs0000664000175000017500000000500212136523632033641 0ustar00directhexdirecthex00000000000000// // ExtensionNodeDescriptionCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of extension nodes /// public class ExtensionNodeDescriptionCollection: ObjectDescriptionCollection, NodeElementCollection { /// /// Initializes a new instance of the class. /// public ExtensionNodeDescriptionCollection () { } internal ExtensionNodeDescriptionCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public ExtensionNodeDescription this [int n] { get { return (ExtensionNodeDescription) List [n]; } } /// /// Gets the with the specified identifier. /// /// /// Identifier. /// public ExtensionNodeDescription this [string id] { get { foreach (ExtensionNodeDescription node in List) if (node.Id == id) return node; return null; } } NodeElement NodeElementCollection.this [int n] { get { return (NodeElement) List [n]; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/AssemblyDependency.cs0000664000175000017500000000715612136523632030431 0ustar00directhexdirecthex00000000000000// // AssemblyDependency.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Specialized; using System.Xml; using System.Xml.Serialization; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// Definition of a dependency of an add-in on an assembly. /// [XmlType ("AssemblyDependency")] public class AssemblyDependency: Dependency { string fullName; string package; /// /// Initializes a new instance of the class. /// public AssemblyDependency () { } internal AssemblyDependency (XmlElement elem): base (elem) { fullName = elem.GetAttribute ("name"); package = elem.GetAttribute ("package"); } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "Dependencies/Assembly/", errors, "name", FullName); } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "Assembly"); Element.SetAttribute ("name", FullName); Element.SetAttribute ("package", Package); } /// /// Gets or sets the full name of the assembly /// /// /// The full name of the assembly. /// public string FullName { get { return fullName != null ? fullName : string.Empty; } set { fullName = value; } } /// /// Gets or sets the name of the package that provides the assembly. /// /// /// The name of the package that provides the assembly. /// public string Package { get { return package != null ? package : string.Empty; } set { package = value; } } /// /// Display name of the dependency /// /// /// The name. /// public override string Name { get { if (Package.Length > 0) return FullName + " " + GettextCatalog.GetString ("(provided by {0})", Package); else return FullName; } } internal override bool CheckInstalled (AddinRegistry registry) { // TODO return true; } internal override void Write (BinaryXmlWriter writer) { base.Write (writer); writer.WriteValue ("fullName", fullName); writer.WriteValue ("package", package); } internal override void Read (BinaryXmlReader reader) { base.Read (reader); fullName = reader.ReadStringValue ("fullName"); package = reader.ReadStringValue ("package"); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/AddinFlags.cs0000664000175000017500000000323012136523632026634 0ustar00directhexdirecthex00000000000000// AddinFlags.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Description { /// /// Add-in flags /// [Flags] public enum AddinFlags { /// /// No flags /// None = 0, /// /// The add-in can't be uninstalled /// CantUninstall = 1, /// /// The add-in can't be disabled /// CantDisable = 2, /// /// The add-in is not visible to end users /// Hidden = 4 } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeDescription.cs0000664000175000017500000002414412136523632031635 0ustar00directhexdirecthex00000000000000// // ExtensionNodeDescription.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Collections.Specialized; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// An extension node definition. /// public class ExtensionNodeDescription: ObjectDescription, NodeElement { ExtensionNodeDescriptionCollection childNodes; string[] attributes; string nodeName; /// /// Initializes a new instance of the class. /// /// /// Node name. /// public ExtensionNodeDescription (string nodeName) { this.nodeName = nodeName; } internal ExtensionNodeDescription (XmlElement elem) { Element = elem; nodeName = elem.LocalName; } internal ExtensionNodeDescription () { } /// /// Gets the type of the node. /// /// /// The node type. /// /// /// This method only works when the add-in description to which the node belongs has been /// loaded from an add-in registry. /// public ExtensionNodeType GetNodeType () { if (Parent is Extension) { Extension ext = (Extension) Parent; object ob = ext.GetExtendedObject (); if (ob is ExtensionPoint) { ExtensionPoint ep = (ExtensionPoint) ob; return ep.NodeSet.GetAllowedNodeTypes () [NodeName]; } else if (ob is ExtensionNodeDescription) { ExtensionNodeDescription pn = (ExtensionNodeDescription) ob; ExtensionNodeType pt = ((ExtensionNodeDescription) pn).GetNodeType (); if (pt != null) return pt.GetAllowedNodeTypes () [NodeName]; } } else if (Parent is ExtensionNodeDescription) { ExtensionNodeType pt = ((ExtensionNodeDescription) Parent).GetNodeType (); if (pt != null) return pt.GetAllowedNodeTypes () [NodeName]; } return null; } /// /// Gets the extension path under which this node is registered /// /// /// The parent path. /// /// /// For example, if the id of the node is 'ThisNode', and the node is a child of another node with id 'ParentNode', and /// that parent node is defined in an extension with the path '/Core/MainExtension', then the parent path is 'Core/MainExtension/ParentNode'. /// public string GetParentPath () { if (Parent is Extension) return ((Extension)Parent).Path; else if (Parent is ExtensionNodeDescription) { ExtensionNodeDescription pn = (ExtensionNodeDescription) Parent; return pn.GetParentPath () + "/" + pn.Id; } else return string.Empty; } internal override void Verify (string location, StringCollection errors) { if (nodeName == null || nodeName.Length == 0) errors.Add (location + "Node: NodeName can't be empty."); ChildNodes.Verify (location + NodeName + "/", errors); } /// /// Gets or sets the name of the node. /// /// /// The name of the node. /// public string NodeName { get { return nodeName; } internal set { if (Element != null) throw new InvalidOperationException ("Can't change node name of xml element"); nodeName = value; } } /// /// Gets or sets the identifier of the node. /// /// /// The identifier. /// public string Id { get { return GetAttribute ("id"); } set { SetAttribute ("id", value); } } /// /// Gets or sets the identifier of the node after which this node has to be inserted /// /// /// The identifier of the reference node /// public string InsertAfter { get { return GetAttribute ("insertafter"); } set { if (value == null || value.Length == 0) RemoveAttribute ("insertafter"); else SetAttribute ("insertafter", value); } } /// /// Gets or sets the identifier of the node before which this node has to be inserted /// /// /// The identifier of the reference node /// public string InsertBefore { get { return GetAttribute ("insertbefore"); } set { if (value == null || value.Length == 0) RemoveAttribute ("insertbefore"); else SetAttribute ("insertbefore", value); } } /// /// Gets a value indicating whether this node is a condition. /// /// /// true if this node is a condition; otherwise, false. /// public bool IsCondition { get { return nodeName == "Condition" || nodeName == "ComplexCondition"; } } internal override void SaveXml (XmlElement parent) { if (Element == null) { Element = parent.OwnerDocument.CreateElement (nodeName); parent.AppendChild (Element); if (attributes != null) { for (int n=0; n /// Gets the value of an attribute. /// /// /// The value of the attribute, or an empty string if the attribute is not defined. /// /// /// Name of the attribute. /// public string GetAttribute (string key) { if (Element != null) return Element.GetAttribute (key); if (attributes == null) return string.Empty; for (int n=0; n /// Sets the value of an attribute. /// /// /// Name of the attribute /// /// /// The value. /// public void SetAttribute (string key, string value) { if (Element != null) { Element.SetAttribute (key, value); return; } if (value == null) value = string.Empty; if (attributes == null) { attributes = new string [2]; attributes [0] = key; attributes [1] = value; return; } for (int n=0; n /// Removes an attribute. /// /// /// Name of the attribute to remove. /// public void RemoveAttribute (string name) { if (Element != null) { Element.RemoveAttribute (name); return; } if (attributes == null) return; for (int n=0; n /// Gets the attributes of the node. /// /// /// The attributes. /// public NodeAttribute[] Attributes { get { if (Element != null) SaveXmlAttributes (); if (attributes == null) return new NodeAttribute [0]; NodeAttribute[] ats = new NodeAttribute [attributes.Length / 2]; for (int n=0; n /// Gets the child nodes. /// /// /// The child nodes. /// public ExtensionNodeDescriptionCollection ChildNodes { get { if (childNodes == null) { childNodes = new ExtensionNodeDescriptionCollection (this); if (Element != null) { foreach (XmlNode nod in Element.ChildNodes) { if (nod is XmlElement) childNodes.Add (new ExtensionNodeDescription ((XmlElement)nod)); } } } return childNodes; } } NodeElementCollection NodeElement.ChildNodes { get { return ChildNodes; } } void SaveXmlAttributes () { attributes = new string [Element.Attributes.Count * 2]; for (int n=0; n /// Definition of a dependency of an add-in on another add-in. /// [XmlType ("AddinReference")] public class AddinDependency: Dependency { string id; string version; /// /// Initializes a new instance of the class. /// public AddinDependency () { } /// /// Initializes a new instance of the class. /// /// /// Full identifier of the add-in (includes version) /// public AddinDependency (string fullId) { Addin.GetIdParts (fullId, out id, out version); id = "::" + id; } /// /// Initializes a new instance of the class. /// /// /// Identifier of the add-in. /// /// /// Version of the add-in. /// public AddinDependency (string id, string version) { this.id = id; this.version = version; } internal AddinDependency (XmlElement elem): base (elem) { id = elem.GetAttribute ("id"); version = elem.GetAttribute ("version"); } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "Dependencies/Addin/", errors, "id", AddinId); VerifyNotEmpty (location + "Dependencies/Addin/", errors, "version", Version); } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "Addin"); Element.SetAttribute ("id", AddinId); Element.SetAttribute ("version", Version); } /// /// Gets the full addin identifier. /// /// /// The full addin identifier. /// /// /// Includes namespace and version number. For example: MonoDevelop.TextEditor,1.0 /// public string FullAddinId { get { AddinDescription desc = ParentAddinDescription; if (desc == null) return Addin.GetFullId (null, AddinId, Version); else return Addin.GetFullId (desc.Namespace, AddinId, Version); } } /// /// Gets or sets the addin identifier. /// /// /// The addin identifier. /// public string AddinId { get { return id != null ? ParseString (id) : string.Empty; } set { id = value; } } /// /// Gets or sets the version. /// /// /// The version. /// public string Version { get { return version != null ? ParseString (version) : string.Empty; } set { version = value; } } /// /// Display name of the dependency. /// /// /// The name. /// public override string Name { get { return AddinId + " v" + Version; } } internal override bool CheckInstalled (AddinRegistry registry) { Addin[] addins = registry.GetAddins (); foreach (Addin addin in addins) { if (addin.Id == id && addin.SupportsVersion (version)) { return true; } } return false; } internal override void Write (BinaryXmlWriter writer) { base.Write (writer); writer.WriteValue ("id", ParseString (id)); writer.WriteValue ("version", ParseString (version)); } internal override void Read (BinaryXmlReader reader) { base.Read (reader); id = reader.ReadStringValue ("id"); version = reader.ReadStringValue ("version"); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ConditionTypeDescription.cs0000664000175000017500000001013412136523632031635 0ustar00directhexdirecthex00000000000000// // ConditionTypeDescription.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml; using System.Collections.Specialized; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// A condition type definition. /// public sealed class ConditionTypeDescription: ObjectDescription { string id; string typeName; string addinId; string description; /// /// Initializes a new instance of the class. /// public ConditionTypeDescription () { } internal ConditionTypeDescription (XmlElement elem): base (elem) { id = elem.GetAttribute ("id"); typeName = elem.GetAttribute ("type"); description = ReadXmlDescription (); } /// /// Copies data from another condition type definition /// /// /// Condition from which to copy /// public void CopyFrom (ConditionTypeDescription cond) { id = cond.id; typeName = cond.typeName; addinId = cond.AddinId; description = cond.description; } internal override void Verify (string location, StringCollection errors) { VerifyNotEmpty (location + "ConditionType", errors, Id, "id"); VerifyNotEmpty (location + "ConditionType (" + Id + ")", errors, TypeName, "type"); } /// /// Gets or sets the identifier of the condition type /// /// /// The identifier. /// public string Id { get { return id != null ? id : string.Empty; } set { id = value; } } /// /// Gets or sets the name of the type that implements the condition /// /// /// The name of the type. /// public string TypeName { get { return typeName != null ? typeName : string.Empty; } set { typeName = value; } } /// /// Gets or sets the description of the condition. /// /// /// The description. /// public string Description { get { return description != null ? description : string.Empty; } set { description = value; } } internal string AddinId { get { return addinId; } set { addinId = value; } } internal override void SaveXml (XmlElement parent) { CreateElement (parent, "ConditionType"); Element.SetAttribute ("id", id); Element.SetAttribute ("type", typeName); SaveXmlDescription (description); } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("Id", Id); writer.WriteValue ("TypeName", TypeName); writer.WriteValue ("Description", Description); writer.WriteValue ("AddinId", AddinId); } internal override void Read (BinaryXmlReader reader) { Id = reader.ReadStringValue ("Id"); TypeName = reader.ReadStringValue ("TypeName"); if (!reader.IgnoreDescriptionData) Description = reader.ReadStringValue ("Description"); AddinId = reader.ReadStringValue ("AddinId"); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionNodeSet.cs0000664000175000017500000002733112136523632030106 0ustar00directhexdirecthex00000000000000// // ExtensionNodeSet.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Xml; using Mono.Addins.Serialization; using System.Collections.Specialized; namespace Mono.Addins.Description { /// /// An extension node set definition. /// /// /// Node sets allow grouping a set of extension node declarations and give an identifier to that group /// (the node set). Once a node set is declared, it can be referenced from several extension points /// which use the same extension node structure. Extension node sets also allow declaring recursive /// extension nodes, that is, extension nodes with a tree structure. /// public class ExtensionNodeSet: ObjectDescription { string id; ExtensionNodeTypeCollection nodeTypes; NodeSetIdCollection nodeSets; bool missingNodeSetId; ExtensionNodeTypeCollection cachedAllowedTypes; internal string SourceAddinId { get; set; } internal ExtensionNodeSet (XmlElement element) { Element = element; id = element.GetAttribute (IdAttribute); } /// /// Copies data from another node set /// /// /// Node set from which to copy /// public void CopyFrom (ExtensionNodeSet nset) { id = nset.id; NodeTypes.Clear (); foreach (ExtensionNodeType nt in nset.NodeTypes) { ExtensionNodeType cnt = new ExtensionNodeType (); cnt.CopyFrom (nt); NodeTypes.Add (cnt); } NodeSets.Clear (); foreach (string ns in nset.NodeSets) NodeSets.Add (ns); missingNodeSetId = nset.missingNodeSetId; } internal override void Verify (string location, StringCollection errors) { if (missingNodeSetId) errors.Add (location + "Missing id attribute in extension set reference"); NodeTypes.Verify (location + "ExtensionNodeSet (" + Id + ")/", errors); } internal override void SaveXml (XmlElement parent) { SaveXml (parent, "ExtensionNodeSet"); } internal virtual void SaveXml (XmlElement parent, string nodeName) { if (Element == null) { Element = parent.OwnerDocument.CreateElement (nodeName); parent.AppendChild (Element); } if (Id.Length > 0) Element.SetAttribute (IdAttribute, Id); if (nodeTypes != null) nodeTypes.SaveXml (Element); if (nodeSets != null) { foreach (string s in nodeSets) { if (Element.SelectSingleNode ("ExtensionNodeSet[@id='" + s + "']") == null) { XmlElement e = Element.OwnerDocument.CreateElement ("ExtensionNodeSet"); e.SetAttribute ("id", s); Element.AppendChild (e); } } ArrayList list = new ArrayList (); foreach (XmlElement e in Element.SelectNodes ("ExtensionNodeSet")) { if (!nodeSets.Contains (e.GetAttribute ("id"))) list.Add (e); } foreach (XmlElement e in list) Element.RemoveChild (e); } } /// /// Initializes a new instance of the class. /// public ExtensionNodeSet () { } /// /// Gets or sets the identifier of the node set. /// /// /// The identifier. /// public string Id { get { return id != null ? id : string.Empty; } set { id = value; } } internal virtual string IdAttribute { get { return "id"; } } /// /// Gets the node types allowed in this node set. /// /// /// The node types. /// public ExtensionNodeTypeCollection NodeTypes { get { if (nodeTypes == null) { if (Element != null) InitCollections (); else nodeTypes = new ExtensionNodeTypeCollection (this); } return nodeTypes; } } /// /// Gets a list of other node sets included in this node set. /// /// /// The node sets. /// public NodeSetIdCollection NodeSets { get { if (nodeSets == null) { if (Element != null) InitCollections (); else nodeSets = new NodeSetIdCollection (); } return nodeSets; } } /// /// Gets all the allowed node types. /// /// /// The allowed node types. /// /// /// Gets all allowed node types, including those defined in included node sets. /// This method only works for descriptions loaded from a registry. /// public ExtensionNodeTypeCollection GetAllowedNodeTypes () { if (cachedAllowedTypes == null) { cachedAllowedTypes = new ExtensionNodeTypeCollection (); GetAllowedNodeTypes (new Hashtable (), cachedAllowedTypes); } return cachedAllowedTypes; } void GetAllowedNodeTypes (Hashtable visitedSets, ExtensionNodeTypeCollection col) { if (Id.Length > 0) { if (visitedSets.Contains (Id)) return; visitedSets [Id] = Id; } // Gets all allowed node types, including those defined in node sets // It only works for descriptions generated from a registry foreach (ExtensionNodeType nt in NodeTypes) col.Add (nt); AddinDescription desc = ParentAddinDescription; if (desc == null || desc.OwnerDatabase == null) return; foreach (string[] ns in NodeSets.InternalList) { string startAddin = ns [1]; if (startAddin == null || startAddin.Length == 0) startAddin = desc.AddinId; ExtensionNodeSet nset = desc.OwnerDatabase.FindNodeSet (ParentAddinDescription.Domain, startAddin, ns[0]); if (nset != null) nset.GetAllowedNodeTypes (visitedSets, col); } } internal void Clear () { Element = null; nodeSets = null; nodeTypes = null; } internal void SetExtensionsAddinId (string addinId) { foreach (ExtensionNodeType nt in NodeTypes) { nt.AddinId = addinId; nt.SetExtensionsAddinId (addinId); } NodeSets.SetExtensionsAddinId (addinId); } internal void MergeWith (string thisAddinId, ExtensionNodeSet other) { foreach (ExtensionNodeType nt in other.NodeTypes) { if (nt.AddinId != thisAddinId && !NodeTypes.Contains (nt)) NodeTypes.Add (nt); } NodeSets.MergeWith (thisAddinId, other.NodeSets); } internal void UnmergeExternalData (string thisAddinId, Hashtable addinsToUnmerge) { // Removes extension types and extension sets coming from other add-ins. ArrayList todelete = new ArrayList (); foreach (ExtensionNodeType nt in NodeTypes) { if (nt.AddinId != thisAddinId && (addinsToUnmerge == null || addinsToUnmerge.Contains (nt.AddinId))) todelete.Add (nt); } foreach (ExtensionNodeType nt in todelete) NodeTypes.Remove (nt); NodeSets.UnmergeExternalData (thisAddinId, addinsToUnmerge); } void InitCollections () { nodeTypes = new ExtensionNodeTypeCollection (this); nodeSets = new NodeSetIdCollection (); foreach (XmlNode n in Element.ChildNodes) { XmlElement nt = n as XmlElement; if (nt == null) continue; if (nt.LocalName == "ExtensionNode") { ExtensionNodeType etype = new ExtensionNodeType (nt); nodeTypes.Add (etype); } else if (nt.LocalName == "ExtensionNodeSet") { string id = nt.GetAttribute ("id"); if (id.Length > 0) nodeSets.Add (id); else missingNodeSetId = true; } } } internal override void Write (BinaryXmlWriter writer) { writer.WriteValue ("Id", id); writer.WriteValue ("NodeTypes", NodeTypes); writer.WriteValue ("NodeSets", NodeSets.InternalList); } internal override void Read (BinaryXmlReader reader) { id = reader.ReadStringValue ("Id"); nodeTypes = (ExtensionNodeTypeCollection) reader.ReadValue ("NodeTypes", new ExtensionNodeTypeCollection (this)); reader.ReadValue ("NodeSets", NodeSets.InternalList); } } /// /// A collection of node set identifiers /// public class NodeSetIdCollection: IEnumerable { // A list of string[2]. Item 0 is the node set id, item 1 is the addin that defines it. ArrayList list = new ArrayList (); /// /// Gets the node set identifier at the specified index. /// /// /// An index. /// public string this [int n] { get { return ((string[])list [n])[0]; } } /// /// Gets the item count. /// /// /// The count. /// public int Count { get { return list.Count; } } /// /// Gets the collection enumerator. /// /// /// The enumerator. /// public IEnumerator GetEnumerator () { ArrayList ll = new ArrayList (list.Count); foreach (string[] ns in list) ll.Add (ns [0]); return ll.GetEnumerator (); } /// /// Add the specified node set identifier. /// /// /// Node set identifier. /// public void Add (string nodeSetId) { if (!Contains (nodeSetId)) list.Add (new string [] { nodeSetId, null }); } /// /// Remove a node set identifier /// /// /// Node set identifier. /// public void Remove (string nodeSetId) { int i = IndexOf (nodeSetId); if (i != -1) list.RemoveAt (i); } /// /// Clears the collection /// public void Clear () { list.Clear (); } /// /// Checks if the specified identifier is present in the collection /// /// /// true if the node set identifier is present. /// public bool Contains (string nodeSetId) { return IndexOf (nodeSetId) != -1; } /// /// Returns the index of the specified node set identifier /// /// /// The index. /// /// /// A node set identifier. /// public int IndexOf (string nodeSetId) { for (int n=0; n /// A collection of module descriptions /// public class ModuleCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ModuleCollection () { } internal ModuleCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public ModuleDescription this [int n] { get { return (ModuleDescription) List [n]; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/ExtensionCollection.cs0000664000175000017500000000361112136523632030633 0ustar00directhexdirecthex00000000000000// // ExtensionCollection.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Addins.Description { /// /// A collection of extensions /// public class ExtensionCollection: ObjectDescriptionCollection { /// /// Initializes a new instance of the class. /// public ExtensionCollection () { } internal ExtensionCollection (object owner): base (owner) { } /// /// Gets the at the specified index. /// /// /// The index. /// public Extension this [int n] { get { return (Extension) List [n]; } } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/AddinProperty.cs0000664000175000017500000000430612136523632027431 0ustar00directhexdirecthex00000000000000// // AddinProperty.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Xml.Serialization; using Mono.Addins.Serialization; namespace Mono.Addins.Description { /// /// An add-in property. /// public class AddinProperty: IBinaryXmlElement { /// /// Name of the property /// [XmlAttribute ("name")] public string Name { get; set; } /// /// Locale of the property. It is null if the property is not localized. /// [XmlAttribute ("locale")] public string Locale { get; set; } /// /// Value of the property. /// [XmlText] public string Value { get; set; } void IBinaryXmlElement.Read (BinaryXmlReader reader) { Name = reader.ReadStringValue ("name"); Locale = reader.ReadStringValue ("locale"); Value = reader.ReadStringValue ("value"); } void IBinaryXmlElement.Write (BinaryXmlWriter writer) { writer.WriteValue ("name", Name); writer.WriteValue ("locale", Locale); writer.WriteValue ("value", Value); } } } mono-addins-1.0/Mono.Addins/Mono.Addins.Description/Dependency.cs0000664000175000017500000000346012136523632026723 0ustar00directhexdirecthex00000000000000// // Dependency.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Xml.Serialization; using Mono.Addins.Serialization; using System.Xml; namespace Mono.Addins.Description { /// /// Definition of an add-in dependency. /// [XmlInclude (typeof(AddinDependency))] public abstract class Dependency: ObjectDescription { internal Dependency (XmlElement elem): base (elem) { } internal Dependency () { } /// /// Gets the display name of the dependency. /// /// /// The name. /// public abstract string Name { get; } internal abstract bool CheckInstalled (AddinRegistry registry); } } mono-addins-1.0/aclocal.m40000664000175000017500000007516412136523720017462 0ustar00directhexdirecthex00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.69],, [m4_warning([this file was generated for autoconf 2.69. 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 -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # 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|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) 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. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have 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_default([$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` test "x$?" != "x0" && pkg_failed=yes ], [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 AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [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])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [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 .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 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 1 # 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.6], [], [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.6])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, 2011 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 1 # 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` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 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 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # 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, 2011 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 1 # 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])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, # 2011 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_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # 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, 2011 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 1 # 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, 2010 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_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, 2011 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 1 # 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, 2011 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 1 # 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, 2010 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 3 # _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, 2012 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. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} 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 /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 mono-addins-1.0/Makefile.in0000664000175000017500000006162312136523721017663 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/mono-addins.spec.in \ $(srcdir)/policy.config.in $(top_srcdir)/configure AUTHORS \ COPYING ChangeLog NEWS 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 = mono-addins.spec policy.config CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ SUBDIRS = Mono.Addins Mono.Addins.CecilReflector Mono.Addins.Setup Mono.Addins.MSBuild Mono.Addins.Gui mautil Test docs EXTRA_DIST = COPYING mono-addins.snk Mono.Addins.sln SRC_PACKAGE_DIR = Mono.Addins-source-@VERSION@ BIN_PACKAGE_DIR = Mono.Addins-binary-@VERSION@ all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): mono-addins.spec: $(top_builddir)/config.status $(srcdir)/mono-addins.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ policy.config: $(top_builddir)/config.status $(srcdir)/policy.config.in cd $(top_builddir) && $(SHELL) ./config.status $@ # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || 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=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(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_OPT=$${XZ_OPT--e} 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.lz*) \ lzip -dc $(distdir).tar.lz | $(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 u+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" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(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: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { 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-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -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-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ distcheck distclean distclean-generic distclean-tags \ 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 installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am src-zip: rm -rf $(SRC_PACKAGE_DIR) rm -f $(SRC_PACKAGE_DIR).zip mkdir $(SRC_PACKAGE_DIR) mdtool project-export Mono.Addins.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR) -p:mautil -p:Mono.Addins -p:Mono.Addins.CecilReflector -p:Mono.Addins.Setup mdtool project-export Samples/HelloWorld/HelloWorld.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/HelloWorld mdtool project-export Samples/HelloWorldWithManifest/HelloWorldWithManifest.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/HelloWorldWithManifest mdtool project-export Samples/TextEditorSWF/TextEditorSWF.sln -f:"MSBuild (Visual Studio 2008)" -d:$(SRC_PACKAGE_DIR)/Samples/TextEditorSWF cp support/README-src $(SRC_PACKAGE_DIR)/README.txt cp AUTHORS $(SRC_PACKAGE_DIR)/AUTHORS.txt cp COPYING $(SRC_PACKAGE_DIR)/COPYING.txt cp mono-addins.snk $(SRC_PACKAGE_DIR)/mono-addins.snk unix2dos $(SRC_PACKAGE_DIR)/README.txt unix2dos $(SRC_PACKAGE_DIR)/AUTHORS.txt unix2dos $(SRC_PACKAGE_DIR)/COPYING.txt rm -rf $(SRC_PACKAGE_DIR)/Test rm -f $(SRC_PACKAGE_DIR)/configure.ac cd $(SRC_PACKAGE_DIR) && for fi in `find . -name Makefile.am`; do rm $$fi; done cd $(SRC_PACKAGE_DIR) && zip -r ../$(SRC_PACKAGE_DIR).zip * bin-zip: rm -rf $(BIN_PACKAGE_DIR) rm -f $(BIN_PACKAGE_DIR).zip mkdir $(BIN_PACKAGE_DIR) cp support/README-bin $(BIN_PACKAGE_DIR)/README.txt cp AUTHORS $(BIN_PACKAGE_DIR)/AUTHORS.txt cp COPYING $(BIN_PACKAGE_DIR)/COPYING.txt unix2dos $(BIN_PACKAGE_DIR)/README.txt unix2dos $(BIN_PACKAGE_DIR)/AUTHORS.txt unix2dos $(BIN_PACKAGE_DIR)/COPYING.txt cp bin/mautil.exe $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.dll $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.xml $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.Setup.dll $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.Setup.xml $(BIN_PACKAGE_DIR) cp bin/Mono.Addins.CecilReflector.dll $(BIN_PACKAGE_DIR) cp support/ICSharpCode.SharpZipLib.license.txt $(BIN_PACKAGE_DIR) cp support/ICSharpCode.SharpZipLib.dll $(BIN_PACKAGE_DIR) cd $(BIN_PACKAGE_DIR) && zip -r ../$(BIN_PACKAGE_DIR).zip * # 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: mono-addins-1.0/xbuild.include0000664000175000017500000000307712136523632020452 0ustar00directhexdirecthex00000000000000ALL_CSPROJ=$(wildcard *.csproj) MAIN_SLN=$(top_builddir)/Mono.Addins.sln if ENABLE_GUI PROFILE_NAME=Debug else PROFILE_NAME=DebugNotGui endif XBUILD=xbuild XBUILD_VERBOSITY=quiet XBUILD_ARGS=/verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE=/property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH=$(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) EXTS:=*.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES:= $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES:=$(wildcard $(ALL_FILES)) EXTRA_DIST = \ $(wildcard $(ALL_FILES)) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean mono-addins-1.0/Mono.Addins.CecilReflector/0000775000175000017500000000000012136524043022601 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/AssemblyInfo.cs0000664000175000017500000000117612136523632025533 0ustar00directhexdirecthex00000000000000using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("Mono.Addins.CecilReflector")] [assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.0.0")] mono-addins-1.0/Mono.Addins.CecilReflector/Makefile.am0000664000175000017500000000043612136523632024643 0ustar00directhexdirecthex00000000000000ASSEMBLY = ../bin/Mono.Addins.CecilReflector.dll ASSEMBLY_NAME=Mono.Addins.CecilReflector install-data-local: gac-install uninstall-local: gac-uninstall include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include CLEANFILES += $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Addins.CecilReflector.csproj0000664000175000017500000002632012136524015031022 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 {42D1CE65-A14B-4218-B787-58AD7AA68513} Library Mono.Addins.CecilReflector 2.0 Mono.Addins.CecilReflector True ..\mono-addins.snk v4.0 True full True ..\bin READ_ONLY prompt 4 True False none True ..\bin READ_ONLY prompt 4 True False {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Mono.Addins mono-addins-1.0/Mono.Addins.CecilReflector/Makefile.in0000664000175000017500000004176212136523720024661 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include \ ChangeLog subdir = ./Mono.Addins.CecilReflector 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/Mono.Addins.CecilReflector.dll ASSEMBLY_NAME = Mono.Addins.CecilReflector pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) EXTRA_DIST = \ $(wildcard $(ALL_FILES)) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) \ $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) ALL_CSPROJ = $(wildcard *.csproj) MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_FALSE@PROFILE_NAME = DebugNotGui @ENABLE_GUI_TRUE@PROFILE_NAME = Debug XBUILD = xbuild XBUILD_VERBOSITY = quiet XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES := $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES := $(wildcard $(ALL_FILES)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Mono.Addins.CecilReflector/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Mono.Addins.CecilReflector/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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: distclean-am -rm -f Makefile 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-data-local install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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 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: uninstall-binSCRIPTS uninstall-local \ uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-data-local 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-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-local uninstall-pkgconfigDATA install-data-local: gac-install uninstall-local: gac-uninstall $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Addins.CecilReflector/0000775000175000017500000000000012136524043027576 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Addins.CecilReflector/Reflector.cs0000664000175000017500000003636312136523632032070 0ustar00directhexdirecthex00000000000000// Reflector.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; using System.Collections; using System.Reflection; using Mono.Addins; using Mono.Addins.Database; using Mono.Cecil; using CustomAttribute = Mono.Cecil.CustomAttribute; using MA = Mono.Addins.Database; using System.Collections.Generic; namespace Mono.Addins.CecilReflector { public class Reflector: IAssemblyReflector { IAssemblyLocator locator; Hashtable cachedAssemblies = new Hashtable (); public void Initialize (IAssemblyLocator locator) { this.locator = locator; } public object[] GetCustomAttributes (object obj, Type type, bool inherit) { Mono.Cecil.ICustomAttributeProvider aprov = obj as Mono.Cecil.ICustomAttributeProvider; if (aprov == null) return new object [0]; ArrayList atts = new ArrayList (); foreach (CustomAttribute att in aprov.CustomAttributes) { object catt = ConvertAttribute (att, type); if (catt != null) atts.Add (catt); } if (inherit && (obj is TypeDefinition)) { TypeDefinition td = (TypeDefinition) obj; if (td.BaseType != null && td.BaseType.FullName != "System.Object") { TypeDefinition bt = FindTypeDefinition (td.Module.Assembly, td.BaseType); if (bt != null) atts.AddRange (GetCustomAttributes (bt, type, true)); } } return atts.ToArray (); } object ConvertAttribute (CustomAttribute att, Type expectedType) { Type attype = typeof(IAssemblyReflector).Assembly.GetType (att.Constructor.DeclaringType.FullName); if (attype == null || !expectedType.IsAssignableFrom (attype)) return null; object ob; if (att.ConstructorArguments.Count > 0) { object[] cargs = new object [att.ConstructorArguments.Count]; ArrayList typeParameters = null; // Constructor parameters of type System.Type can't be set because types from the assembly // can't be loaded. The parameter value will be set later using a type name property. for (int n=0; n GetRawCustomAttributes (object obj, Type type, bool inherit) { List atts = new List (); Mono.Cecil.ICustomAttributeProvider aprov = obj as Mono.Cecil.ICustomAttributeProvider; if (aprov == null) return atts; foreach (CustomAttribute att in aprov.CustomAttributes) { MA.CustomAttribute catt = ConvertToRawAttribute (att, type.FullName); if (catt != null) atts.Add (catt); } if (inherit && (obj is TypeDefinition)) { TypeDefinition td = (TypeDefinition) obj; if (td.BaseType != null && td.BaseType.FullName != "System.Object") { TypeDefinition bt = FindTypeDefinition (td.Module.Assembly, td.BaseType); if (bt != null) atts.AddRange (GetRawCustomAttributes (bt, type, true)); } } return atts; } MA.CustomAttribute ConvertToRawAttribute (CustomAttribute att, string expectedType) { TypeDefinition attType = FindTypeDefinition (att.Constructor.DeclaringType.Module.Assembly, att.Constructor.DeclaringType); if (attType == null || !TypeIsAssignableFrom (expectedType, attType)) return null; MA.CustomAttribute mat = new MA.CustomAttribute (); mat.TypeName = att.Constructor.DeclaringType.FullName; if (att.ConstructorArguments.Count > 0) { var arguments = att.ConstructorArguments; MethodReference constructor = FindConstructor (att); if (constructor == null) throw new InvalidOperationException ("Custom attribute constructor not found"); for (int n=0; n (ICollection members, string name) where TMember : class, IMemberDefinition { foreach (var member in members) if (member.Name == name) return member; return null; } IEnumerable GetInheritanceChain (TypeDefinition td) { yield return td; while (td != null && td.BaseType != null && td.BaseType.FullName != "System.Object") { td = FindTypeDefinition (td.Module.Assembly, td.BaseType); if (td != null) yield return td; } } MethodReference FindConstructor (CustomAttribute att) { // The constructor provided by CustomAttribute.Constructor is lacking some information, such as the parameter // name and custom attributes. Since we need the full info, we have to look it up in the declaring type. TypeDefinition atd = FindTypeDefinition (att.Constructor.DeclaringType.Module.Assembly, att.Constructor.DeclaringType); foreach (MethodReference met in atd.Methods) { if (met.Name != ".ctor") continue; if (met.Parameters.Count == att.Constructor.Parameters.Count) { for (int n = met.Parameters.Count - 1; n >= 0; n--) { if (met.Parameters[n].ParameterType.FullName != att.Constructor.Parameters[n].ParameterType.FullName) break; if (n == 0) return met; } } } return null; } public object LoadAssembly (string file) { return LoadAssembly (file, false); } public AssemblyDefinition LoadAssembly (string file, bool cache) { AssemblyDefinition adef = (AssemblyDefinition) cachedAssemblies [file]; if (adef != null) return adef; adef = AssemblyDefinition.ReadAssembly (file); if (adef != null && cache) cachedAssemblies [file] = adef; return adef; } public string[] GetResourceNames (object asm) { AssemblyDefinition adef = (AssemblyDefinition) asm; List names = new List (adef.MainModule.Resources.Count); foreach (Resource res in adef.MainModule.Resources) { if (res is EmbeddedResource) names.Add (res.Name); } return names.ToArray (); } public System.IO.Stream GetResourceStream (object asm, string resourceName) { AssemblyDefinition adef = (AssemblyDefinition) asm; foreach (Resource res in adef.MainModule.Resources) { EmbeddedResource r = res as EmbeddedResource; if (r != null && r.Name == resourceName) return r.GetResourceStream (); } throw new InvalidOperationException ("Resource not found: " + resourceName); } public object LoadAssemblyFromReference (object asmReference) { AssemblyNameReference aref = (AssemblyNameReference) asmReference; string loc = locator.GetAssemblyLocation (aref.FullName); if (loc != null) return LoadAssembly (loc); else return null; } public System.Collections.IEnumerable GetAssemblyTypes (object asm) { return ((AssemblyDefinition)asm).MainModule.Types; } public System.Collections.IEnumerable GetAssemblyReferences (object asm) { return ((AssemblyDefinition)asm).MainModule.AssemblyReferences; } public object GetType (object asm, string typeName) { if (typeName.IndexOf ('`') != -1) { foreach (TypeDefinition td in ((AssemblyDefinition)asm).MainModule.Types) { if (td.FullName == typeName) { return td; } } } TypeDefinition t = ((AssemblyDefinition)asm).MainModule.GetType (typeName); if (t != null) { return t; } else { return null; } } public object GetCustomAttribute (object obj, Type type, bool inherit) { foreach (object att in GetCustomAttributes (obj, type, inherit)) if (type.IsInstanceOfType (att)) return att; return null; } public string GetTypeName (object type) { return ((TypeDefinition)type).Name; } public string GetTypeFullName (object type) { return ((TypeDefinition)type).FullName; } public string GetTypeAssemblyQualifiedName (object type) { AssemblyDefinition asm = GetAssemblyDefinition ((TypeDefinition)type); return ((TypeDefinition)type).FullName + ", " + asm.Name.FullName; } AssemblyDefinition GetAssemblyDefinition (TypeDefinition t) { return t.Module.Assembly; } public System.Collections.IEnumerable GetBaseTypeFullNameList (object type) { TypeDefinition t = (TypeDefinition) type; AssemblyDefinition asm = GetAssemblyDefinition (t); ArrayList list = new ArrayList (); Hashtable visited = new Hashtable (); GetBaseTypeFullNameList (visited, list, asm, t); list.Remove (t.FullName); return list; } void GetBaseTypeFullNameList (Hashtable visited, ArrayList list, AssemblyDefinition asm, TypeReference tr) { if (tr.FullName == "System.Object" || visited.Contains (tr.FullName)) return; visited [tr.FullName] = tr; list.Add (tr.FullName); TypeDefinition type = FindTypeDefinition (asm, tr); if (type == null) return; asm = GetAssemblyDefinition (type); if (type.BaseType != null) GetBaseTypeFullNameList (visited, list, asm, type.BaseType); foreach (TypeReference interf in type.Interfaces) GetBaseTypeFullNameList (visited, list, asm, interf); } TypeDefinition FindTypeDefinition (AssemblyDefinition referencer, TypeReference rt) { if (rt is TypeDefinition) return (TypeDefinition) rt; string name = rt.FullName; TypeDefinition td = GetType (referencer, name) as TypeDefinition; if (td != null) return td; int i = name.IndexOf ('<'); if (i != -1) { name = name.Substring (0, i); td = GetType (referencer, name) as TypeDefinition; if (td != null) return td; } foreach (AssemblyNameReference aref in referencer.MainModule.AssemblyReferences) { string loc = locator.GetAssemblyLocation (aref.FullName); if (loc == null) continue; AssemblyDefinition asm = LoadAssembly (loc, true); td = GetType (asm, name) as TypeDefinition; if (td != null) return td; } return null; } public bool TypeIsAssignableFrom (object baseType, object type) { string baseName = ((TypeDefinition)baseType).FullName; foreach (string bt in GetBaseTypeFullNameList (type)) if (bt == baseName) return true; return false; } public bool TypeIsAssignableFrom (string baseTypeName, object type) { foreach (string bt in GetBaseTypeFullNameList (type)) if (bt == baseTypeName) return true; return false; } public IEnumerable GetFields (object type) { return ((TypeDefinition)type).Fields; } public string GetFieldName (object field) { return ((FieldDefinition)field).Name; } public string GetFieldTypeFullName (object field) { return ((FieldDefinition)field).FieldType.FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/0000775000175000017500000000000012136524043024527 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/mono.snk0000664000175000017500000000112412136523632026215 0ustar00directhexdirecthex00000000000000$RSA2y™wÒÐ:Žkêz.tèѯ̓è…t•+´€¡,‘4GM$GÃ~hÀ€SoÏNF^úÙÕ—.öžŸm6pª—/³ ±‰MŒñH‹Ö±/·F_I÷ ûµ.dËÄ/^d%F+øŠŠ¥±øŒ=Q¡Ð¢YåÚ_êz³®œÏ{õ i¬sÿ9­~À \¿@9Oñ©Ïmono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/0000775000175000017500000000000012136524043026760 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/BinaryStreamWriter.cs0000664000175000017500000000421612136523632033112 0ustar00directhexdirecthex00000000000000// // BinaryStreamWriter.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; #if !READ_ONLY namespace Mono.Cecil.PE { class BinaryStreamWriter : BinaryWriter { public BinaryStreamWriter (Stream stream) : base (stream) { } public void WriteByte (byte value) { Write (value); } public void WriteUInt16 (ushort value) { Write (value); } public void WriteInt16 (short value) { Write (value); } public void WriteUInt32 (uint value) { Write (value); } public void WriteInt32 (int value) { Write (value); } public void WriteUInt64 (ulong value) { Write (value); } public void WriteBytes (byte [] bytes) { Write (bytes); } public void WriteDataDirectory (DataDirectory directory) { Write (directory.VirtualAddress); Write (directory.Size); } public void WriteBuffer (ByteBuffer buffer) { Write (buffer.buffer, 0, buffer.length); } protected void Advance (int bytes) { BaseStream.Seek (bytes, SeekOrigin.Current); } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/Section.cs0000664000175000017500000000265112136523632030722 0ustar00directhexdirecthex00000000000000// // Section.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using RVA = System.UInt32; namespace Mono.Cecil.PE { sealed class Section { public string Name; public RVA VirtualAddress; public uint VirtualSize; public uint SizeOfRawData; public uint PointerToRawData; public byte [] Data; } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs0000664000175000017500000000421712136523632034562 0ustar00directhexdirecthex00000000000000// // ByteBufferEqualityComparer.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; namespace Mono.Cecil.PE { sealed class ByteBufferEqualityComparer : IEqualityComparer { public bool Equals (ByteBuffer x, ByteBuffer y) { if (x.length != y.length) return false; var x_buffer = x.buffer; var y_buffer = y.buffer; for (int i = 0; i < x.length; i++) if (x_buffer [i] != y_buffer [i]) return false; return true; } public int GetHashCode (ByteBuffer buffer) { #if !BYTE_BUFFER_WELL_DISTRIBUTED_HASH var hash = 0; var bytes = buffer.buffer; for (int i = 0; i < buffer.length; i++) hash = (hash * 37) ^ bytes [i]; return hash; #else const uint p = 16777619; uint hash = 2166136261; var bytes = buffer.buffer; for (int i = 0; i < buffer.length; i++) hash = (hash ^ bytes [i]) * p; hash += hash << 13; hash ^= hash >> 7; hash += hash << 3; hash ^= hash >> 17; hash += hash << 5; return (int) hash; #endif } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/ImageWriter.cs0000664000175000017500000005512212136523632031536 0ustar00directhexdirecthex00000000000000// // ImageWriter.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; #if !READ_ONLY using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using RVA = System.UInt32; namespace Mono.Cecil.PE { sealed class ImageWriter : BinaryStreamWriter { readonly ModuleDefinition module; readonly MetadataBuilder metadata; readonly TextMap text_map; ImageDebugDirectory debug_directory; byte [] debug_data; ByteBuffer win32_resources; const uint pe_header_size = 0x178u; const uint section_header_size = 0x28u; const uint file_alignment = 0x200; const uint section_alignment = 0x2000; const ulong image_base = 0x00400000; internal const RVA text_rva = 0x2000; readonly bool pe64; readonly uint time_stamp; internal Section text; internal Section rsrc; internal Section reloc; ushort sections; ImageWriter (ModuleDefinition module, MetadataBuilder metadata, Stream stream) : base (stream) { this.module = module; this.metadata = metadata; this.GetDebugHeader (); this.GetWin32Resources (); this.text_map = BuildTextMap (); this.sections = 2; // text + reloc this.pe64 = module.Architecture != TargetArchitecture.I386; this.time_stamp = (uint) DateTime.UtcNow.Subtract (new DateTime (1970, 1, 1)).TotalSeconds; } void GetDebugHeader () { var symbol_writer = metadata.symbol_writer; if (symbol_writer == null) return; if (!symbol_writer.GetDebugHeader (out debug_directory, out debug_data)) debug_data = Empty.Array; } void GetWin32Resources () { var rsrc = GetImageResourceSection (); if (rsrc == null) return; var raw_resources = new byte [rsrc.Data.Length]; Buffer.BlockCopy (rsrc.Data, 0, raw_resources, 0, rsrc.Data.Length); win32_resources = new ByteBuffer (raw_resources); } Section GetImageResourceSection () { if (!module.HasImage) return null; const string rsrc_section = ".rsrc"; return module.Image.GetSection (rsrc_section); } public static ImageWriter CreateWriter (ModuleDefinition module, MetadataBuilder metadata, Stream stream) { var writer = new ImageWriter (module, metadata, stream); writer.BuildSections (); return writer; } void BuildSections () { var has_win32_resources = win32_resources != null; if (has_win32_resources) sections++; text = CreateSection (".text", text_map.GetLength (), null); var previous = text; if (has_win32_resources) { rsrc = CreateSection (".rsrc", (uint) win32_resources.length, previous); PatchWin32Resources (win32_resources); previous = rsrc; } reloc = CreateSection (".reloc", 12u, previous); } Section CreateSection (string name, uint size, Section previous) { return new Section { Name = name, VirtualAddress = previous != null ? previous.VirtualAddress + Align (previous.VirtualSize, section_alignment) : text_rva, VirtualSize = size, PointerToRawData = previous != null ? previous.PointerToRawData + previous.SizeOfRawData : Align (GetHeaderSize (), file_alignment), SizeOfRawData = Align (size, file_alignment) }; } static uint Align (uint value, uint align) { align--; return (value + align) & ~align; } void WriteDOSHeader () { Write (new byte [] { // dos header start 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // lfanew 0x80, 0x00, 0x00, 0x00, // dos header end 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); } void WritePEFileHeader () { WriteUInt32 (0x00004550); // Magic WriteUInt16 (GetMachine ()); // Machine WriteUInt16 (sections); // NumberOfSections WriteUInt32 (time_stamp); WriteUInt32 (0); // PointerToSymbolTable WriteUInt32 (0); // NumberOfSymbols WriteUInt16 ((ushort) (!pe64 ? 0xe0 : 0xf0)); // SizeOfOptionalHeader // ExecutableImage | (pe64 ? 32BitsMachine : LargeAddressAware) var characteristics = (ushort) (0x0002 | (!pe64 ? 0x0100 : 0x0020)); if (module.Kind == ModuleKind.Dll || module.Kind == ModuleKind.NetModule) characteristics |= 0x2000; WriteUInt16 (characteristics); // Characteristics } ushort GetMachine () { switch (module.Architecture) { case TargetArchitecture.I386: return 0x014c; case TargetArchitecture.AMD64: return 0x8664; case TargetArchitecture.IA64: return 0x0200; } throw new NotSupportedException (); } void WriteOptionalHeaders () { WriteUInt16 ((ushort) (!pe64 ? 0x10b : 0x20b)); // Magic WriteByte (8); // LMajor WriteByte (0); // LMinor WriteUInt32 (text.SizeOfRawData); // CodeSize WriteUInt32 (reloc.SizeOfRawData + (rsrc != null ? rsrc.SizeOfRawData : 0)); // InitializedDataSize WriteUInt32 (0); // UninitializedDataSize var entry_point_rva = text_map.GetRVA (TextSegment.StartupStub); if (module.Architecture == TargetArchitecture.IA64) entry_point_rva += 0x20; WriteUInt32 (entry_point_rva); // EntryPointRVA WriteUInt32 (text_rva); // BaseOfCode if (!pe64) { WriteUInt32 (0); // BaseOfData WriteUInt32 ((uint) image_base); // ImageBase } else { WriteUInt64 (image_base); // ImageBase } WriteUInt32 (section_alignment); // SectionAlignment WriteUInt32 (file_alignment); // FileAlignment WriteUInt16 (4); // OSMajor WriteUInt16 (0); // OSMinor WriteUInt16 (0); // UserMajor WriteUInt16 (0); // UserMinor WriteUInt16 (4); // SubSysMajor WriteUInt16 (0); // SubSysMinor WriteUInt32 (0); // Reserved WriteUInt32 (reloc.VirtualAddress + Align (reloc.VirtualSize, section_alignment)); // ImageSize WriteUInt32 (text.PointerToRawData); // HeaderSize WriteUInt32 (0); // Checksum WriteUInt16 (GetSubSystem ()); // SubSystem WriteUInt16 (0x8540); // DLLFlags const ulong stack_reserve = 0x100000; const ulong stack_commit = 0x1000; const ulong heap_reserve = 0x100000; const ulong heap_commit = 0x1000; if (!pe64) { WriteUInt32 ((uint) stack_reserve); WriteUInt32 ((uint) stack_commit); WriteUInt32 ((uint) heap_reserve); WriteUInt32 ((uint) heap_commit); } else { WriteUInt64 (stack_reserve); WriteUInt64 (stack_commit); WriteUInt64 (heap_reserve); WriteUInt64 (heap_commit); } WriteUInt32 (0); // LoaderFlags WriteUInt32 (16); // NumberOfDataDir WriteZeroDataDirectory (); // ExportTable WriteDataDirectory (text_map.GetDataDirectory (TextSegment.ImportDirectory)); // ImportTable if (rsrc != null) { // ResourceTable WriteUInt32 (rsrc.VirtualAddress); WriteUInt32 (rsrc.VirtualSize); } else WriteZeroDataDirectory (); WriteZeroDataDirectory (); // ExceptionTable WriteZeroDataDirectory (); // CertificateTable WriteUInt32 (reloc.VirtualAddress); // BaseRelocationTable WriteUInt32 (reloc.VirtualSize); if (text_map.GetLength (TextSegment.DebugDirectory) > 0) { WriteUInt32 (text_map.GetRVA (TextSegment.DebugDirectory)); WriteUInt32 (28u); } else WriteZeroDataDirectory (); WriteZeroDataDirectory (); // Copyright WriteZeroDataDirectory (); // GlobalPtr WriteZeroDataDirectory (); // TLSTable WriteZeroDataDirectory (); // LoadConfigTable WriteZeroDataDirectory (); // BoundImport WriteDataDirectory (text_map.GetDataDirectory (TextSegment.ImportAddressTable)); // IAT WriteZeroDataDirectory (); // DelayImportDesc WriteDataDirectory (text_map.GetDataDirectory (TextSegment.CLIHeader)); // CLIHeader WriteZeroDataDirectory (); // Reserved } void WriteZeroDataDirectory () { WriteUInt32 (0); WriteUInt32 (0); } ushort GetSubSystem () { switch (module.Kind) { case ModuleKind.Console: case ModuleKind.Dll: case ModuleKind.NetModule: return 0x3; case ModuleKind.Windows: return 0x2; default: throw new ArgumentOutOfRangeException (); } } void WriteSectionHeaders () { WriteSection (text, 0x60000020); if (rsrc != null) WriteSection (rsrc, 0x40000040); WriteSection (reloc, 0x42000040); } void WriteSection (Section section, uint characteristics) { var name = new byte [8]; var sect_name = section.Name; for (int i = 0; i < sect_name.Length; i++) name [i] = (byte) sect_name [i]; WriteBytes (name); WriteUInt32 (section.VirtualSize); WriteUInt32 (section.VirtualAddress); WriteUInt32 (section.SizeOfRawData); WriteUInt32 (section.PointerToRawData); WriteUInt32 (0); // PointerToRelocations WriteUInt32 (0); // PointerToLineNumbers WriteUInt16 (0); // NumberOfRelocations WriteUInt16 (0); // NumberOfLineNumbers WriteUInt32 (characteristics); } void MoveTo (uint pointer) { BaseStream.Seek (pointer, SeekOrigin.Begin); } void MoveToRVA (Section section, RVA rva) { BaseStream.Seek (section.PointerToRawData + rva - section.VirtualAddress, SeekOrigin.Begin); } void MoveToRVA (TextSegment segment) { MoveToRVA (text, text_map.GetRVA (segment)); } void WriteRVA (RVA rva) { if (!pe64) WriteUInt32 (rva); else WriteUInt64 (rva); } void WriteText () { MoveTo (text.PointerToRawData); // ImportAddressTable WriteRVA (text_map.GetRVA (TextSegment.ImportHintNameTable)); WriteRVA (0); // CLIHeader WriteUInt32 (0x48); WriteUInt16 (2); WriteUInt16 ((ushort) ((module.Runtime <= TargetRuntime.Net_1_1) ? 0 : 5)); WriteUInt32 (text_map.GetRVA (TextSegment.MetadataHeader)); WriteUInt32 (GetMetadataLength ()); WriteUInt32 ((uint) module.Attributes); WriteUInt32 (metadata.entry_point.ToUInt32 ()); WriteDataDirectory (text_map.GetDataDirectory (TextSegment.Resources)); WriteDataDirectory (text_map.GetDataDirectory (TextSegment.StrongNameSignature)); WriteZeroDataDirectory (); // CodeManagerTable WriteZeroDataDirectory (); // VTableFixups WriteZeroDataDirectory (); // ExportAddressTableJumps WriteZeroDataDirectory (); // ManagedNativeHeader // Code MoveToRVA (TextSegment.Code); WriteBuffer (metadata.code); // Resources MoveToRVA (TextSegment.Resources); WriteBuffer (metadata.resources); // Data if (metadata.data.length > 0) { MoveToRVA (TextSegment.Data); WriteBuffer (metadata.data); } // StrongNameSignature // stays blank // MetadataHeader MoveToRVA (TextSegment.MetadataHeader); WriteMetadataHeader (); WriteMetadata (); // DebugDirectory if (text_map.GetLength (TextSegment.DebugDirectory) > 0) { MoveToRVA (TextSegment.DebugDirectory); WriteDebugDirectory (); } // ImportDirectory MoveToRVA (TextSegment.ImportDirectory); WriteImportDirectory (); // StartupStub MoveToRVA (TextSegment.StartupStub); WriteStartupStub (); } uint GetMetadataLength () { return text_map.GetRVA (TextSegment.DebugDirectory) - text_map.GetRVA (TextSegment.MetadataHeader); } void WriteMetadataHeader () { WriteUInt32 (0x424a5342); // Signature WriteUInt16 (1); // MajorVersion WriteUInt16 (1); // MinorVersion WriteUInt32 (0); // Reserved var version = GetZeroTerminatedString (GetVersion ()); WriteUInt32 ((uint) version.Length); WriteBytes (version); WriteUInt16 (0); // Flags WriteUInt16 (GetStreamCount ()); uint offset = text_map.GetRVA (TextSegment.TableHeap) - text_map.GetRVA (TextSegment.MetadataHeader); WriteStreamHeader (ref offset, TextSegment.TableHeap, "#~"); WriteStreamHeader (ref offset, TextSegment.StringHeap, "#Strings"); WriteStreamHeader (ref offset, TextSegment.UserStringHeap, "#US"); WriteStreamHeader (ref offset, TextSegment.GuidHeap, "#GUID"); WriteStreamHeader (ref offset, TextSegment.BlobHeap, "#Blob"); } string GetVersion () { switch (module.Runtime) { case TargetRuntime.Net_1_0: return "v1.0.3705"; case TargetRuntime.Net_1_1: return "v1.1.4322"; case TargetRuntime.Net_2_0: return "v2.0.50727"; case TargetRuntime.Net_4_0: default: return "v4.0.30319"; } } ushort GetStreamCount () { return (ushort) ( 1 // #~ + 1 // #Strings + (metadata.user_string_heap.IsEmpty ? 0 : 1) // #US + 1 // GUID + (metadata.blob_heap.IsEmpty ? 0 : 1)); // #Blob } void WriteStreamHeader (ref uint offset, TextSegment heap, string name) { var length = (uint) text_map.GetLength (heap); if (length == 0) return; WriteUInt32 (offset); WriteUInt32 (length); WriteBytes (GetZeroTerminatedString (name)); offset += length; } static byte [] GetZeroTerminatedString (string @string) { return GetString (@string, (@string.Length + 1 + 3) & ~3); } static byte [] GetSimpleString (string @string) { return GetString (@string, @string.Length); } static byte [] GetString (string @string, int length) { var bytes = new byte [length]; for (int i = 0; i < @string.Length; i++) bytes [i] = (byte) @string [i]; return bytes; } void WriteMetadata () { WriteHeap (TextSegment.TableHeap, metadata.table_heap); WriteHeap (TextSegment.StringHeap, metadata.string_heap); WriteHeap (TextSegment.UserStringHeap, metadata.user_string_heap); WriteGuidHeap (); WriteHeap (TextSegment.BlobHeap, metadata.blob_heap); } void WriteHeap (TextSegment heap, HeapBuffer buffer) { if (buffer.IsEmpty) return; MoveToRVA (heap); WriteBuffer (buffer); } void WriteGuidHeap () { MoveToRVA (TextSegment.GuidHeap); WriteBytes (module.Mvid.ToByteArray ()); } void WriteDebugDirectory () { WriteInt32 (debug_directory.Characteristics); WriteUInt32 (time_stamp); WriteInt16 (debug_directory.MajorVersion); WriteInt16 (debug_directory.MinorVersion); WriteInt32 (debug_directory.Type); WriteInt32 (debug_directory.SizeOfData); WriteInt32 (debug_directory.AddressOfRawData); WriteInt32 ((int) BaseStream.Position + 4); WriteBytes (debug_data); } void WriteImportDirectory () { WriteUInt32 (text_map.GetRVA (TextSegment.ImportDirectory) + 40); // ImportLookupTable WriteUInt32 (0); // DateTimeStamp WriteUInt32 (0); // ForwarderChain WriteUInt32 (text_map.GetRVA (TextSegment.ImportHintNameTable) + 14); WriteUInt32 (text_map.GetRVA (TextSegment.ImportAddressTable)); Advance (20); // ImportLookupTable WriteUInt32 (text_map.GetRVA (TextSegment.ImportHintNameTable)); // ImportHintNameTable MoveToRVA (TextSegment.ImportHintNameTable); WriteUInt16 (0); // Hint WriteBytes (GetRuntimeMain ()); WriteByte (0); WriteBytes (GetSimpleString ("mscoree.dll")); WriteUInt16 (0); } byte [] GetRuntimeMain () { return module.Kind == ModuleKind.Dll || module.Kind == ModuleKind.NetModule ? GetSimpleString ("_CorDllMain") : GetSimpleString ("_CorExeMain"); } void WriteStartupStub () { switch (module.Architecture) { case TargetArchitecture.I386: WriteUInt16 (0x25ff); WriteUInt32 ((uint) image_base + text_map.GetRVA (TextSegment.ImportAddressTable)); return; case TargetArchitecture.AMD64: WriteUInt16 (0xa148); WriteUInt32 ((uint) image_base + text_map.GetRVA (TextSegment.ImportAddressTable)); WriteUInt16 (0xe0ff); return; case TargetArchitecture.IA64: WriteBytes (new byte [] { 0x0b, 0x48, 0x00, 0x02, 0x18, 0x10, 0xa0, 0x40, 0x24, 0x30, 0x28, 0x00, 0x00, 0x00, 0x04, 0x00, 0x10, 0x08, 0x00, 0x12, 0x18, 0x10, 0x60, 0x50, 0x04, 0x80, 0x03, 0x00, 0x60, 0x00, 0x80, 0x00 }); WriteUInt32 ((uint) image_base + text_map.GetRVA (TextSegment.StartupStub)); WriteUInt32 ((uint) image_base + text_rva); return; } } void WriteRsrc () { MoveTo (rsrc.PointerToRawData); WriteBuffer (win32_resources); } void WriteReloc () { MoveTo (reloc.PointerToRawData); var reloc_rva = text_map.GetRVA (TextSegment.StartupStub); reloc_rva += module.Architecture == TargetArchitecture.IA64 ? 0x20u : 2; var page_rva = reloc_rva & ~0xfffu; WriteUInt32 (page_rva); // PageRVA WriteUInt32 (0x000c); // Block Size switch (module.Architecture) { case TargetArchitecture.I386: WriteUInt32 (0x3000 + reloc_rva - page_rva); break; case TargetArchitecture.AMD64: WriteUInt32 (0xa000 + reloc_rva - page_rva); break; case TargetArchitecture.IA64: WriteUInt16 ((ushort) (0xa000 + reloc_rva - page_rva)); WriteUInt16 ((ushort) (0xa000 + reloc_rva - page_rva + 8)); break; } WriteBytes (new byte [file_alignment - reloc.VirtualSize]); } public void WriteImage () { WriteDOSHeader (); WritePEFileHeader (); WriteOptionalHeaders (); WriteSectionHeaders (); WriteText (); if (rsrc != null) WriteRsrc (); WriteReloc (); } TextMap BuildTextMap () { var map = metadata.text_map; map.AddMap (TextSegment.Code, metadata.code.length, !pe64 ? 4 : 16); map.AddMap (TextSegment.Resources, metadata.resources.length, 8); map.AddMap (TextSegment.Data, metadata.data.length, 4); if (metadata.data.length > 0) metadata.table_heap.FixupData (map.GetRVA (TextSegment.Data)); map.AddMap (TextSegment.StrongNameSignature, GetStrongNameLength (), 4); map.AddMap (TextSegment.MetadataHeader, GetMetadataHeaderLength ()); map.AddMap (TextSegment.TableHeap, metadata.table_heap.length, 4); map.AddMap (TextSegment.StringHeap, metadata.string_heap.length, 4); map.AddMap (TextSegment.UserStringHeap, metadata.user_string_heap.IsEmpty ? 0 : metadata.user_string_heap.length, 4); map.AddMap (TextSegment.GuidHeap, 16); map.AddMap (TextSegment.BlobHeap, metadata.blob_heap.IsEmpty ? 0 : metadata.blob_heap.length, 4); int debug_dir_len = 0; if (!debug_data.IsNullOrEmpty ()) { const int debug_dir_header_len = 28; debug_directory.AddressOfRawData = (int) map.GetNextRVA (TextSegment.BlobHeap) + debug_dir_header_len; debug_dir_len = debug_data.Length + debug_dir_header_len; } map.AddMap (TextSegment.DebugDirectory, debug_dir_len, 4); RVA import_dir_rva = map.GetNextRVA (TextSegment.DebugDirectory); RVA import_hnt_rva = import_dir_rva + (!pe64 ? 48u : 52u); import_hnt_rva = (import_hnt_rva + 15u) & ~15u; uint import_dir_len = (import_hnt_rva - import_dir_rva) + 27u; RVA startup_stub_rva = import_dir_rva + import_dir_len; startup_stub_rva = module.Architecture == TargetArchitecture.IA64 ? (startup_stub_rva + 15u) & ~15u : 2 + ((startup_stub_rva + 3u) & ~3u); map.AddMap (TextSegment.ImportDirectory, new Range (import_dir_rva, import_dir_len)); map.AddMap (TextSegment.ImportHintNameTable, new Range (import_hnt_rva, 0)); map.AddMap (TextSegment.StartupStub, new Range (startup_stub_rva, GetStartupStubLength ())); return map; } uint GetStartupStubLength () { switch (module.Architecture) { case TargetArchitecture.I386: return 6; case TargetArchitecture.AMD64: return 12; case TargetArchitecture.IA64: return 48; default: throw new InvalidOperationException (); } } int GetMetadataHeaderLength () { return // MetadataHeader 40 // #~ header + 12 // #Strings header + 20 // #US header + (metadata.user_string_heap.IsEmpty ? 0 : 12) // #GUID header + 16 // #Blob header + (metadata.blob_heap.IsEmpty ? 0 : 16); } int GetStrongNameLength () { if ((module.Attributes & ModuleAttributes.StrongNameSigned) == 0) return 0; if (module.Assembly == null) throw new InvalidOperationException (); var public_key = module.Assembly.Name.PublicKey; if (public_key != null) { // in fx 2.0 the key may be from 384 to 16384 bits // so we must calculate the signature size based on // the size of the public key (minus the 32 byte header) int size = public_key.Length; if (size > 32) return size - 32; // note: size == 16 for the ECMA "key" which is replaced // by the runtime with a 1024 bits key (128 bytes) } return 128; // default strongname signature size } public DataDirectory GetStrongNameSignatureDirectory () { return text_map.GetDataDirectory (TextSegment.StrongNameSignature); } public uint GetHeaderSize () { return pe_header_size + (sections * section_header_size); } void PatchWin32Resources (ByteBuffer resources) { PatchResourceDirectoryTable (resources); } void PatchResourceDirectoryTable (ByteBuffer resources) { resources.Advance (12); var entries = resources.ReadUInt16 () + resources.ReadUInt16 (); for (int i = 0; i < entries; i++) PatchResourceDirectoryEntry (resources); } void PatchResourceDirectoryEntry (ByteBuffer resources) { resources.Advance (4); var child = resources.ReadUInt32 (); var position = resources.position; resources.position = (int) child & 0x7fffffff; if ((child & 0x80000000) != 0) PatchResourceDirectoryTable (resources); else PatchResourceDataEntry (resources); resources.position = position; } void PatchResourceDataEntry (ByteBuffer resources) { var old_rsrc = GetImageResourceSection (); var rva = resources.ReadUInt32 (); resources.position -= 4; resources.WriteUInt32 (rva - old_rsrc.VirtualAddress + rsrc.VirtualAddress); } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/TextMap.cs0000664000175000017500000000576212136523632030706 0ustar00directhexdirecthex00000000000000// // TextMap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; #if !READ_ONLY using RVA = System.UInt32; namespace Mono.Cecil.PE { enum TextSegment { ImportAddressTable, CLIHeader, Code, Resources, Data, StrongNameSignature, // Metadata MetadataHeader, TableHeap, StringHeap, UserStringHeap, GuidHeap, BlobHeap, // End Metadata DebugDirectory, ImportDirectory, ImportHintNameTable, StartupStub, } sealed class TextMap { readonly Range [] map = new Range [16 /*Enum.GetValues (typeof (TextSegment)).Length*/]; public void AddMap (TextSegment segment, int length) { map [(int) segment] = new Range (GetStart (segment), (uint) length); } public void AddMap (TextSegment segment, int length, int align) { align--; AddMap (segment, (length + align) & ~align); } public void AddMap (TextSegment segment, Range range) { map [(int) segment] = range; } public Range GetRange (TextSegment segment) { return map [(int) segment]; } public DataDirectory GetDataDirectory (TextSegment segment) { var range = map [(int) segment]; return new DataDirectory (range.Length == 0 ? 0 : range.Start, range.Length); } public RVA GetRVA (TextSegment segment) { return map [(int) segment].Start; } public RVA GetNextRVA (TextSegment segment) { var i = (int) segment; return map [i].Start + map [i].Length; } public int GetLength (TextSegment segment) { return (int) map [(int) segment].Length; } RVA GetStart (TextSegment segment) { var index = (int) segment; return index == 0 ? ImageWriter.text_rva : ComputeStart (index); } RVA ComputeStart (int index) { index--; return map [index].Start + map [index].Length; } public uint GetLength () { var range = map [(int) TextSegment.StartupStub]; return range.Start - ImageWriter.text_rva + range.Length; } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/BinaryStreamReader.cs0000664000175000017500000000306412136523632033040 0ustar00directhexdirecthex00000000000000// // BinaryStreamReader.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Cecil.PE { class BinaryStreamReader : BinaryReader { public BinaryStreamReader (Stream stream) : base (stream) { } protected void Advance (int bytes) { BaseStream.Seek (bytes, SeekOrigin.Current); } protected DataDirectory ReadDataDirectory () { return new DataDirectory (ReadUInt32 (), ReadUInt32 ()); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/ImageReader.cs0000664000175000017500000004134212136523632031463 0ustar00directhexdirecthex00000000000000// // ImageReader.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using Mono.Cecil.Metadata; using RVA = System.UInt32; namespace Mono.Cecil.PE { sealed class ImageReader : BinaryStreamReader { readonly Image image; DataDirectory cli; DataDirectory metadata; public ImageReader (Stream stream) : base (stream) { image = new Image (); image.FileName = stream.GetFullyQualifiedName (); } void MoveTo (DataDirectory directory) { BaseStream.Position = image.ResolveVirtualAddress (directory.VirtualAddress); } void MoveTo (uint position) { BaseStream.Position = position; } void ReadImage () { if (BaseStream.Length < 128) throw new BadImageFormatException (); // - DOSHeader // PE 2 // Start 58 // Lfanew 4 // End 64 if (ReadUInt16 () != 0x5a4d) throw new BadImageFormatException (); Advance (58); MoveTo (ReadUInt32 ()); if (ReadUInt32 () != 0x00004550) throw new BadImageFormatException (); // - PEFileHeader // Machine 2 image.Architecture = ReadArchitecture (); // NumberOfSections 2 ushort sections = ReadUInt16 (); // TimeDateStamp 4 // PointerToSymbolTable 4 // NumberOfSymbols 4 // OptionalHeaderSize 2 Advance (14); // Characteristics 2 ushort characteristics = ReadUInt16 (); ushort subsystem; ReadOptionalHeaders (out subsystem); ReadSections (sections); ReadCLIHeader (); ReadMetadata (); image.Kind = GetModuleKind (characteristics, subsystem); } TargetArchitecture ReadArchitecture () { var machine = ReadUInt16 (); switch (machine) { case 0x014c: return TargetArchitecture.I386; case 0x8664: return TargetArchitecture.AMD64; case 0x0200: return TargetArchitecture.IA64; } throw new NotSupportedException (); } static ModuleKind GetModuleKind (ushort characteristics, ushort subsystem) { if ((characteristics & 0x2000) != 0) // ImageCharacteristics.Dll return ModuleKind.Dll; if (subsystem == 0x2 || subsystem == 0x9) // SubSystem.WindowsGui || SubSystem.WindowsCeGui return ModuleKind.Windows; return ModuleKind.Console; } void ReadOptionalHeaders (out ushort subsystem) { // - PEOptionalHeader // - StandardFieldsHeader // Magic 2 bool pe64 = ReadUInt16 () == 0x20b; // pe32 || pe64 // LMajor 1 // LMinor 1 // CodeSize 4 // InitializedDataSize 4 // UninitializedDataSize4 // EntryPointRVA 4 // BaseOfCode 4 // BaseOfData 4 || 0 // - NTSpecificFieldsHeader // ImageBase 4 || 8 // SectionAlignment 4 // FileAlignement 4 // OSMajor 2 // OSMinor 2 // UserMajor 2 // UserMinor 2 // SubSysMajor 2 // SubSysMinor 2 // Reserved 4 // ImageSize 4 // HeaderSize 4 // FileChecksum 4 Advance (66); // SubSystem 2 subsystem = ReadUInt16 (); // DLLFlags 2 // StackReserveSize 4 || 8 // StackCommitSize 4 || 8 // HeapReserveSize 4 || 8 // HeapCommitSize 4 || 8 // LoaderFlags 4 // NumberOfDataDir 4 // - DataDirectoriesHeader // ExportTable 8 // ImportTable 8 // ResourceTable 8 // ExceptionTable 8 // CertificateTable 8 // BaseRelocationTable 8 Advance (pe64 ? 90 : 74); // Debug 8 image.Debug = ReadDataDirectory (); // Copyright 8 // GlobalPtr 8 // TLSTable 8 // LoadConfigTable 8 // BoundImport 8 // IAT 8 // DelayImportDescriptor8 Advance (56); // CLIHeader 8 cli = ReadDataDirectory (); if (cli.IsZero) throw new BadImageFormatException (); // Reserved 8 Advance (8); } string ReadAlignedString (int length) { int read = 0; var buffer = new char [length]; while (read < length) { var current = ReadByte (); if (current == 0) break; buffer [read++] = (char) current; } Advance (-1 + ((read + 4) & ~3) - read); return new string (buffer, 0, read); } string ReadZeroTerminatedString (int length) { int read = 0; var buffer = new char [length]; var bytes = ReadBytes (length); while (read < length) { var current = bytes [read]; if (current == 0) break; buffer [read++] = (char) current; } return new string (buffer, 0, read); } void ReadSections (ushort count) { var sections = new Section [count]; for (int i = 0; i < count; i++) { var section = new Section (); // Name section.Name = ReadZeroTerminatedString (8); // VirtualSize 4 Advance (4); // VirtualAddress 4 section.VirtualAddress = ReadUInt32 (); // SizeOfRawData 4 section.SizeOfRawData = ReadUInt32 (); // PointerToRawData 4 section.PointerToRawData = ReadUInt32 (); // PointerToRelocations 4 // PointerToLineNumbers 4 // NumberOfRelocations 2 // NumberOfLineNumbers 2 // Characteristics 4 Advance (16); sections [i] = section; if (section.Name == ".reloc") continue; ReadSectionData (section); } image.Sections = sections; } void ReadSectionData (Section section) { var position = BaseStream.Position; MoveTo (section.PointerToRawData); var length = (int) section.SizeOfRawData; var data = new byte [length]; int offset = 0, read; while ((read = Read (data, offset, length - offset)) > 0) offset += read; section.Data = data; BaseStream.Position = position; } void ReadCLIHeader () { MoveTo (cli); // - CLIHeader // Cb 4 // MajorRuntimeVersion 2 // MinorRuntimeVersion 2 Advance (8); // Metadata 8 metadata = ReadDataDirectory (); // Flags 4 image.Attributes = (ModuleAttributes) ReadUInt32 (); // EntryPointToken 4 image.EntryPointToken = ReadUInt32 (); // Resources 8 image.Resources = ReadDataDirectory (); // StrongNameSignature 8 // CodeManagerTable 8 // VTableFixups 8 // ExportAddressTableJumps 8 // ManagedNativeHeader 8 } void ReadMetadata () { MoveTo (metadata); if (ReadUInt32 () != 0x424a5342) throw new BadImageFormatException (); // MajorVersion 2 // MinorVersion 2 // Reserved 4 Advance (8); var version = ReadZeroTerminatedString (ReadInt32 ()); image.Runtime = version.ParseRuntime (); // Flags 2 Advance (2); var streams = ReadUInt16 (); var section = image.GetSectionAtVirtualAddress (metadata.VirtualAddress); if (section == null) throw new BadImageFormatException (); image.MetadataSection = section; for (int i = 0; i < streams; i++) ReadMetadataStream (section); if (image.TableHeap != null) ReadTableHeap (); } void ReadMetadataStream (Section section) { // Offset 4 uint start = metadata.VirtualAddress - section.VirtualAddress + ReadUInt32 (); // relative to the section start // Size 4 uint size = ReadUInt32 (); var name = ReadAlignedString (16); switch (name) { case "#~": case "#-": image.TableHeap = new TableHeap (section, start, size); break; case "#Strings": image.StringHeap = new StringHeap (section, start, size); break; case "#Blob": image.BlobHeap = new BlobHeap (section, start, size); break; case "#GUID": image.GuidHeap = new GuidHeap (section, start, size); break; case "#US": image.UserStringHeap = new UserStringHeap (section, start, size); break; } } void ReadTableHeap () { var heap = image.TableHeap; uint start = heap.Section.PointerToRawData; MoveTo (heap.Offset + start); // Reserved 4 // MajorVersion 1 // MinorVersion 1 Advance (6); // HeapSizes 1 var sizes = ReadByte (); // Reserved2 1 Advance (1); // Valid 8 heap.Valid = ReadInt64 (); // Sorted 8 heap.Sorted = ReadInt64 (); for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { var table = TableHeap.TableIdentifiers [i]; if (!heap.HasTable (table)) continue; heap.Tables [(int) table].Length = ReadUInt32 (); } SetIndexSize (image.StringHeap, sizes, 0x1); SetIndexSize (image.GuidHeap, sizes, 0x2); SetIndexSize (image.BlobHeap, sizes, 0x4); ComputeTableInformations (); } static void SetIndexSize (Heap heap, uint sizes, byte flag) { if (heap == null) return; heap.IndexSize = (sizes & flag) > 0 ? 4 : 2; } int GetTableIndexSize (Table table) { return image.GetTableIndexSize (table); } int GetCodedIndexSize (CodedIndex index) { return image.GetCodedIndexSize (index); } void ComputeTableInformations () { uint offset = (uint) BaseStream.Position - image.MetadataSection.PointerToRawData; // header int stridx_size = image.StringHeap.IndexSize; int blobidx_size = image.BlobHeap != null ? image.BlobHeap.IndexSize : 2; var heap = image.TableHeap; var tables = heap.Tables; for (int i = 0; i < TableHeap.TableIdentifiers.Length; i++) { var table = TableHeap.TableIdentifiers [i]; if (!heap.HasTable (table)) continue; int size; switch (table) { case Table.Module: size = 2 // Generation + stridx_size // Name + (image.GuidHeap.IndexSize * 3); // Mvid, EncId, EncBaseId break; case Table.TypeRef: size = GetCodedIndexSize (CodedIndex.ResolutionScope) // ResolutionScope + (stridx_size * 2); // Name, Namespace break; case Table.TypeDef: size = 4 // Flags + (stridx_size * 2) // Name, Namespace + GetCodedIndexSize (CodedIndex.TypeDefOrRef) // BaseType + GetTableIndexSize (Table.Field) // FieldList + GetTableIndexSize (Table.Method); // MethodList break; case Table.FieldPtr: size = GetTableIndexSize (Table.Field); // Field break; case Table.Field: size = 2 // Flags + stridx_size // Name + blobidx_size; // Signature break; case Table.MethodPtr: size = GetTableIndexSize (Table.Method); // Method break; case Table.Method: size = 8 // Rva 4, ImplFlags 2, Flags 2 + stridx_size // Name + blobidx_size // Signature + GetTableIndexSize (Table.Param); // ParamList break; case Table.ParamPtr: size = GetTableIndexSize (Table.Param); // Param break; case Table.Param: size = 4 // Flags 2, Sequence 2 + stridx_size; // Name break; case Table.InterfaceImpl: size = GetTableIndexSize (Table.TypeDef) // Class + GetCodedIndexSize (CodedIndex.TypeDefOrRef); // Interface break; case Table.MemberRef: size = GetCodedIndexSize (CodedIndex.MemberRefParent) // Class + stridx_size // Name + blobidx_size; // Signature break; case Table.Constant: size = 2 // Type + GetCodedIndexSize (CodedIndex.HasConstant) // Parent + blobidx_size; // Value break; case Table.CustomAttribute: size = GetCodedIndexSize (CodedIndex.HasCustomAttribute) // Parent + GetCodedIndexSize (CodedIndex.CustomAttributeType) // Type + blobidx_size; // Value break; case Table.FieldMarshal: size = GetCodedIndexSize (CodedIndex.HasFieldMarshal) // Parent + blobidx_size; // NativeType break; case Table.DeclSecurity: size = 2 // Action + GetCodedIndexSize (CodedIndex.HasDeclSecurity) // Parent + blobidx_size; // PermissionSet break; case Table.ClassLayout: size = 6 // PackingSize 2, ClassSize 4 + GetTableIndexSize (Table.TypeDef); // Parent break; case Table.FieldLayout: size = 4 // Offset + GetTableIndexSize (Table.Field); // Field break; case Table.StandAloneSig: size = blobidx_size; // Signature break; case Table.EventMap: size = GetTableIndexSize (Table.TypeDef) // Parent + GetTableIndexSize (Table.Event); // EventList break; case Table.EventPtr: size = GetTableIndexSize (Table.Event); // Event break; case Table.Event: size = 2 // Flags + stridx_size // Name + GetCodedIndexSize (CodedIndex.TypeDefOrRef); // EventType break; case Table.PropertyMap: size = GetTableIndexSize (Table.TypeDef) // Parent + GetTableIndexSize (Table.Property); // PropertyList break; case Table.PropertyPtr: size = GetTableIndexSize (Table.Property); // Property break; case Table.Property: size = 2 // Flags + stridx_size // Name + blobidx_size; // Type break; case Table.MethodSemantics: size = 2 // Semantics + GetTableIndexSize (Table.Method) // Method + GetCodedIndexSize (CodedIndex.HasSemantics); // Association break; case Table.MethodImpl: size = GetTableIndexSize (Table.TypeDef) // Class + GetCodedIndexSize (CodedIndex.MethodDefOrRef) // MethodBody + GetCodedIndexSize (CodedIndex.MethodDefOrRef); // MethodDeclaration break; case Table.ModuleRef: size = stridx_size; // Name break; case Table.TypeSpec: size = blobidx_size; // Signature break; case Table.ImplMap: size = 2 // MappingFlags + GetCodedIndexSize (CodedIndex.MemberForwarded) // MemberForwarded + stridx_size // ImportName + GetTableIndexSize (Table.ModuleRef); // ImportScope break; case Table.FieldRVA: size = 4 // RVA + GetTableIndexSize (Table.Field); // Field break; case Table.Assembly: size = 16 // HashAlgId 4, Version 4 * 2, Flags 4 + blobidx_size // PublicKey + (stridx_size * 2); // Name, Culture break; case Table.AssemblyProcessor: size = 4; // Processor break; case Table.AssemblyOS: size = 12; // Platform 4, Version 2 * 4 break; case Table.AssemblyRef: size = 12 // Version 2 * 4 + Flags 4 + (blobidx_size * 2) // PublicKeyOrToken, HashValue + (stridx_size * 2); // Name, Culture break; case Table.AssemblyRefProcessor: size = 4 // Processor + GetTableIndexSize (Table.AssemblyRef); // AssemblyRef break; case Table.AssemblyRefOS: size = 12 // Platform 4, Version 2 * 4 + GetTableIndexSize (Table.AssemblyRef); // AssemblyRef break; case Table.File: size = 4 // Flags + stridx_size // Name + blobidx_size; // HashValue break; case Table.ExportedType: size = 8 // Flags 4, TypeDefId 4 + (stridx_size * 2) // Name, Namespace + GetCodedIndexSize (CodedIndex.Implementation); // Implementation break; case Table.ManifestResource: size = 8 // Offset, Flags + stridx_size // Name + GetCodedIndexSize (CodedIndex.Implementation); // Implementation break; case Table.NestedClass: size = GetTableIndexSize (Table.TypeDef) // NestedClass + GetTableIndexSize (Table.TypeDef); // EnclosingClass break; case Table.GenericParam: size = 4 // Number, Flags + GetCodedIndexSize (CodedIndex.TypeOrMethodDef) // Owner + stridx_size; // Name break; case Table.MethodSpec: size = GetCodedIndexSize (CodedIndex.MethodDefOrRef) // Method + blobidx_size; // Instantiation break; case Table.GenericParamConstraint: size = GetTableIndexSize (Table.GenericParam) // Owner + GetCodedIndexSize (CodedIndex.TypeDefOrRef); // Constraint break; default: throw new NotSupportedException (); } int index = (int) table; tables [index].RowSize = (uint) size; tables [index].Offset = offset; offset += (uint) size * tables [index].Length; } } public static Image ReadImageFrom (Stream stream) { try { var reader = new ImageReader (stream); reader.ReadImage (); return reader.image; } catch (EndOfStreamException e) { throw new BadImageFormatException (stream.GetFullyQualifiedName (), e); } } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/ByteBuffer.cs0000664000175000017500000001647512136523632031364 0ustar00directhexdirecthex00000000000000// // ByteBuffer.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil.PE { class ByteBuffer { internal byte [] buffer; internal int length; internal int position; public ByteBuffer () { this.buffer = Empty.Array; } public ByteBuffer (int length) { this.buffer = new byte [length]; } public ByteBuffer (byte [] buffer) { this.buffer = buffer ?? Empty.Array; this.length = this.buffer.Length; } public void Reset (byte [] buffer) { this.buffer = buffer ?? Empty.Array; this.length = this.buffer.Length; } public void Advance (int length) { position += length; } public byte ReadByte () { return buffer [position++]; } public sbyte ReadSByte () { return (sbyte) ReadByte (); } public byte [] ReadBytes (int length) { var bytes = new byte [length]; Buffer.BlockCopy (buffer, position, bytes, 0, length); position += length; return bytes; } public ushort ReadUInt16 () { ushort value = (ushort) (buffer [position] | (buffer [position + 1] << 8)); position += 2; return value; } public short ReadInt16 () { return (short) ReadUInt16 (); } public uint ReadUInt32 () { uint value = (uint) (buffer [position] | (buffer [position + 1] << 8) | (buffer [position + 2] << 16) | (buffer [position + 3] << 24)); position += 4; return value; } public int ReadInt32 () { return (int) ReadUInt32 (); } public ulong ReadUInt64 () { uint low = ReadUInt32 (); uint high = ReadUInt32 (); return (((ulong) high) << 32) | low; } public long ReadInt64 () { return (long) ReadUInt64 (); } public uint ReadCompressedUInt32 () { byte first = ReadByte (); if ((first & 0x80) == 0) return first; if ((first & 0x40) == 0) return ((uint) (first & ~0x80) << 8) | ReadByte (); return ((uint) (first & ~0xc0) << 24) | (uint) ReadByte () << 16 | (uint) ReadByte () << 8 | ReadByte (); } public int ReadCompressedInt32 () { var value = (int) ReadCompressedUInt32 (); return (value & 1) != 0 ? -(value >> 1) : value >> 1; } public float ReadSingle () { if (!BitConverter.IsLittleEndian) { var bytes = ReadBytes (4); Array.Reverse (bytes); return BitConverter.ToSingle (bytes, 0); } float value = BitConverter.ToSingle (buffer, position); position += 4; return value; } public double ReadDouble () { if (!BitConverter.IsLittleEndian) { var bytes = ReadBytes (8); Array.Reverse (bytes); return BitConverter.ToDouble (bytes, 0); } double value = BitConverter.ToDouble (buffer, position); position += 8; return value; } #if !READ_ONLY public void WriteByte (byte value) { if (position == buffer.Length) Grow (1); buffer [position++] = value; if (position > length) length = position; } public void WriteSByte (sbyte value) { WriteByte ((byte) value); } public void WriteUInt16 (ushort value) { if (position + 2 > buffer.Length) Grow (2); buffer [position++] = (byte) value; buffer [position++] = (byte) (value >> 8); if (position > length) length = position; } public void WriteInt16 (short value) { WriteUInt16 ((ushort) value); } public void WriteUInt32 (uint value) { if (position + 4 > buffer.Length) Grow (4); buffer [position++] = (byte) value; buffer [position++] = (byte) (value >> 8); buffer [position++] = (byte) (value >> 16); buffer [position++] = (byte) (value >> 24); if (position > length) length = position; } public void WriteInt32 (int value) { WriteUInt32 ((uint) value); } public void WriteUInt64 (ulong value) { if (position + 8 > buffer.Length) Grow (8); buffer [position++] = (byte) value; buffer [position++] = (byte) (value >> 8); buffer [position++] = (byte) (value >> 16); buffer [position++] = (byte) (value >> 24); buffer [position++] = (byte) (value >> 32); buffer [position++] = (byte) (value >> 40); buffer [position++] = (byte) (value >> 48); buffer [position++] = (byte) (value >> 56); if (position > length) length = position; } public void WriteInt64 (long value) { WriteUInt64 ((ulong) value); } public void WriteCompressedUInt32 (uint value) { if (value < 0x80) WriteByte ((byte) value); else if (value < 0x4000) { WriteByte ((byte) (0x80 | (value >> 8))); WriteByte ((byte) (value & 0xff)); } else { WriteByte ((byte) ((value >> 24) | 0xc0)); WriteByte ((byte) ((value >> 16) & 0xff)); WriteByte ((byte) ((value >> 8) & 0xff)); WriteByte ((byte) (value & 0xff)); } } public void WriteCompressedInt32 (int value) { WriteCompressedUInt32 ((uint) ((value < 0) ? ((-value) << 1) | 1 : value << 1)); } public void WriteBytes (byte [] bytes) { var length = bytes.Length; if (position + length > buffer.Length) Grow (length); Buffer.BlockCopy (bytes, 0, buffer, position, length); position += length; if (position > this.length) this.length = position; } public void WriteBytes (int length) { if (position + length > buffer.Length) Grow (length); position += length; if (position > this.length) this.length = position; } public void WriteBytes (ByteBuffer buffer) { if (position + buffer.length > this.buffer.Length) Grow (buffer.length); Buffer.BlockCopy (buffer.buffer, 0, this.buffer, position, buffer.length); position += buffer.length; if (position > this.length) this.length = position; } public void WriteSingle (float value) { var bytes = BitConverter.GetBytes (value); if (!BitConverter.IsLittleEndian) Array.Reverse (bytes); WriteBytes (bytes); } public void WriteDouble (double value) { var bytes = BitConverter.GetBytes (value); if (!BitConverter.IsLittleEndian) Array.Reverse (bytes); WriteBytes (bytes); } void Grow (int desired) { var current = this.buffer; var current_length = current.Length; var buffer = new byte [System.Math.Max (current_length + desired, current_length * 2)]; Buffer.BlockCopy (current, 0, buffer, 0, current_length); this.buffer = buffer; } #endif } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/Image.cs0000664000175000017500000001032412136523632030334 0ustar00directhexdirecthex00000000000000// // Image.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono; using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using RVA = System.UInt32; namespace Mono.Cecil.PE { sealed class Image { public ModuleKind Kind; public TargetRuntime Runtime; public TargetArchitecture Architecture; public string FileName; public Section [] Sections; public Section MetadataSection; public uint EntryPointToken; public ModuleAttributes Attributes; public DataDirectory Debug; public DataDirectory Resources; public StringHeap StringHeap; public BlobHeap BlobHeap; public UserStringHeap UserStringHeap; public GuidHeap GuidHeap; public TableHeap TableHeap; readonly int [] coded_index_sizes = new int [13]; readonly Func counter; public Image () { counter = GetTableLength; } public bool HasTable (Table table) { return GetTableLength (table) > 0; } public int GetTableLength (Table table) { return (int) TableHeap [table].Length; } public int GetTableIndexSize (Table table) { return GetTableLength (table) < 65536 ? 2 : 4; } public int GetCodedIndexSize (CodedIndex coded_index) { var index = (int) coded_index; var size = coded_index_sizes [index]; if (size != 0) return size; return coded_index_sizes [index] = coded_index.GetSize (counter); } public uint ResolveVirtualAddress (RVA rva) { var section = GetSectionAtVirtualAddress (rva); if (section == null) throw new ArgumentOutOfRangeException (); return ResolveVirtualAddressInSection (rva, section); } public uint ResolveVirtualAddressInSection (RVA rva, Section section) { return rva + section.PointerToRawData - section.VirtualAddress; } public Section GetSection (string name) { var sections = this.Sections; for (int i = 0; i < sections.Length; i++) { var section = sections [i]; if (section.Name == name) return section; } return null; } public Section GetSectionAtVirtualAddress (RVA rva) { var sections = this.Sections; for (int i = 0; i < sections.Length; i++) { var section = sections [i]; if (rva >= section.VirtualAddress && rva < section.VirtualAddress + section.SizeOfRawData) return section; } return null; } public ImageDebugDirectory GetDebugHeader (out byte [] header) { var section = GetSectionAtVirtualAddress (Debug.VirtualAddress); var buffer = new ByteBuffer (section.Data); buffer.position = (int) (Debug.VirtualAddress - section.VirtualAddress); var directory = new ImageDebugDirectory { Characteristics = buffer.ReadInt32 (), TimeDateStamp = buffer.ReadInt32 (), MajorVersion = buffer.ReadInt16 (), MinorVersion = buffer.ReadInt16 (), Type = buffer.ReadInt32 (), SizeOfData = buffer.ReadInt32 (), AddressOfRawData = buffer.ReadInt32 (), PointerToRawData = buffer.ReadInt32 (), }; buffer.position = (int) (directory.PointerToRawData - section.PointerToRawData); header = new byte [directory.SizeOfData]; Buffer.BlockCopy (buffer.buffer, buffer.position, header, 0, header.Length); return directory; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.PE/DataDirectory.cs0000664000175000017500000000301112136523632032043 0ustar00directhexdirecthex00000000000000// // DataDirectory.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using RVA = System.UInt32; namespace Mono.Cecil.PE { struct DataDirectory { public readonly RVA VirtualAddress; public readonly uint Size; public bool IsZero { get { return VirtualAddress == 0 && Size == 0; } } public DataDirectory (RVA rva, uint size) { this.VirtualAddress = rva; this.Size = size; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Collections.Generic/0000775000175000017500000000000012136524043031267 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Collections.Generic/ReadOnlyCollection.cs0000664000175000017500000000501612136523632035354 0ustar00directhexdirecthex00000000000000// // ReadOnlyCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; namespace Mono.Collections.Generic { public sealed class ReadOnlyCollection : Collection, IList { static ReadOnlyCollection empty; public static ReadOnlyCollection Empty { get { return empty ?? (empty = new ReadOnlyCollection ()); } } bool IList.IsReadOnly { get { return true; } } private ReadOnlyCollection () { } public ReadOnlyCollection (T [] array) { if (array == null) throw new ArgumentNullException (); this.items = array; this.size = array.Length; } public ReadOnlyCollection (Collection collection) { if (collection == null) throw new ArgumentNullException (); this.items = collection.items; this.size = collection.size; } internal override void Grow (int desired) { throw new InvalidOperationException (); } protected override void OnAdd (T item, int index) { throw new InvalidOperationException (); } protected override void OnClear () { throw new InvalidOperationException (); } protected override void OnInsert (T item, int index) { throw new InvalidOperationException (); } protected override void OnRemove (T item, int index) { throw new InvalidOperationException (); } protected override void OnSet (T item, int index) { throw new InvalidOperationException (); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Collections.Generic/Collection.cs0000664000175000017500000001667312136523632033731 0ustar00directhexdirecthex00000000000000// // Collection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; namespace Mono.Collections.Generic { public class Collection : IList, IList { internal T [] items; internal int size; int version; public int Count { get { return size; } } public T this [int index] { get { if (index >= size) throw new ArgumentOutOfRangeException (); return items [index]; } set { CheckIndex (index); if (index == size) throw new ArgumentOutOfRangeException (); OnSet (value, index); items [index] = value; } } bool ICollection.IsReadOnly { get { return false; } } bool IList.IsFixedSize { get { return false; } } bool IList.IsReadOnly { get { return false; } } object IList.this [int index] { get { return this [index]; } set { CheckIndex (index); try { this [index] = (T) value; return; } catch (InvalidCastException) { } catch (NullReferenceException) { } throw new ArgumentException (); } } int ICollection.Count { get { return Count; } } bool ICollection.IsSynchronized { get { return false; } } object ICollection.SyncRoot { get { return this; } } public Collection () { items = Empty.Array; } public Collection (int capacity) { if (capacity < 0) throw new ArgumentOutOfRangeException (); items = new T [capacity]; } public Collection (ICollection items) { this.items = new T [items.Count]; items.CopyTo (this.items, 0); this.size = this.items.Length; } public void Add (T item) { if (size == items.Length) Grow (1); OnAdd (item, size); items [size++] = item; version++; } public bool Contains (T item) { return IndexOf (item) != -1; } public int IndexOf (T item) { return Array.IndexOf (items, item, 0, size); } public void Insert (int index, T item) { CheckIndex (index); if (size == items.Length) Grow (1); OnInsert (item, index); Shift (index, 1); items [index] = item; version++; } public void RemoveAt (int index) { if (index < 0 || index >= size) throw new ArgumentOutOfRangeException (); var item = items [index]; OnRemove (item, index); Shift (index, -1); Array.Clear (items, size, 1); version++; } public bool Remove (T item) { var index = IndexOf (item); if (index == -1) return false; OnRemove (item, index); Shift (index, -1); Array.Clear (items, size, 1); version++; return true; } public void Clear () { OnClear (); Array.Clear (items, 0, size); size = 0; version++; } public void CopyTo (T [] array, int arrayIndex) { Array.Copy (items, 0, array, arrayIndex, size); } public T [] ToArray () { var array = new T [size]; Array.Copy (items, 0, array, 0, size); return array; } void CheckIndex (int index) { if (index < 0 || index > size) throw new ArgumentOutOfRangeException (); } void Shift (int start, int delta) { if (delta < 0) start -= delta; if (start < size) Array.Copy (items, start, items, start + delta, size - start); size += delta; if (delta < 0) Array.Clear (items, size, -delta); } protected virtual void OnAdd (T item, int index) { } protected virtual void OnInsert (T item, int index) { } protected virtual void OnSet (T item, int index) { } protected virtual void OnRemove (T item, int index) { } protected virtual void OnClear () { } internal virtual void Grow (int desired) { int new_size = size + desired; if (new_size <= items.Length) return; const int default_capacity = 4; new_size = System.Math.Max ( System.Math.Max (items.Length * 2, default_capacity), new_size); #if !CF Array.Resize (ref items, new_size); #else var array = new T [new_size]; Array.Copy (items, array, size); items = array; #endif } int IList.Add (object value) { try { Add ((T) value); return size - 1; } catch (InvalidCastException) { } catch (NullReferenceException) { } throw new ArgumentException (); } void IList.Clear () { Clear (); } bool IList.Contains (object value) { return ((IList) this).IndexOf (value) > -1; } int IList.IndexOf (object value) { try { return IndexOf ((T) value); } catch (InvalidCastException) { } catch (NullReferenceException) { } return -1; } void IList.Insert (int index, object value) { CheckIndex (index); try { Insert (index, (T) value); return; } catch (InvalidCastException) { } catch (NullReferenceException) { } throw new ArgumentException (); } void IList.Remove (object value) { try { Remove ((T) value); } catch (InvalidCastException) { } catch (NullReferenceException) { } } void IList.RemoveAt (int index) { RemoveAt (index); } void ICollection.CopyTo (Array array, int index) { Array.Copy (items, 0, array, index, size); } public Enumerator GetEnumerator () { return new Enumerator (this); } IEnumerator IEnumerable.GetEnumerator () { return new Enumerator (this); } IEnumerator IEnumerable.GetEnumerator () { return new Enumerator (this); } public struct Enumerator : IEnumerator, IDisposable { Collection collection; T current; int next; readonly int version; public T Current { get { return current; } } object IEnumerator.Current { get { CheckState (); if (next <= 0) throw new InvalidOperationException (); return current; } } internal Enumerator (Collection collection) : this () { this.collection = collection; this.version = collection.version; } public bool MoveNext () { CheckState (); if (next < 0) return false; if (next < collection.size) { current = collection.items [next++]; return true; } next = -1; return false; } public void Reset () { CheckState (); next = 0; } void CheckState () { if (collection == null) throw new ObjectDisposedException (GetType ().FullName); if (version != collection.version) throw new InvalidOperationException (); } public void Dispose () { collection = null; } } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/0000775000175000017500000000000012136524043026455 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeSpecification.cs0000664000175000017500000000503012136523632032427 0ustar00directhexdirecthex00000000000000// // TypeSpecification.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.Metadata; namespace Mono.Cecil { public abstract class TypeSpecification : TypeReference { readonly TypeReference element_type; public TypeReference ElementType { get { return element_type; } } public override string Name { get { return element_type.Name; } set { throw new NotSupportedException (); } } public override string Namespace { get { return element_type.Namespace; } set { throw new NotSupportedException (); } } public override IMetadataScope Scope { get { return element_type.Scope; } } public override ModuleDefinition Module { get { return element_type.Module; } } public override string FullName { get { return element_type.FullName; } } internal override bool ContainsGenericParameter { get { return element_type.ContainsGenericParameter; } } public override MetadataType MetadataType { get { return (MetadataType) etype; } } internal TypeSpecification (TypeReference type) : base (null, null) { this.element_type = type; this.token = new MetadataToken (TokenType.TypeSpec); } public override TypeReference GetElementType () { return element_type.GetElementType (); } } static partial class Mixin { public static void CheckType (TypeReference type) { if (type == null) throw new ArgumentNullException ("type"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PinnedType.cs0000664000175000017500000000314412136523632031070 0ustar00directhexdirecthex00000000000000// // PinnedType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class PinnedType : TypeSpecification { public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsPinned { get { return true; } } public PinnedType (TypeReference type) : base (type) { Mixin.CheckType (type); this.etype = MD.ElementType.Pinned; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyDefinition.cs0000664000175000017500000001235312136523632032603 0ustar00directhexdirecthex00000000000000// // AssemblyDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class AssemblyDefinition : ICustomAttributeProvider, ISecurityDeclarationProvider { AssemblyNameDefinition name; internal ModuleDefinition main_module; Collection modules; Collection custom_attributes; Collection security_declarations; public AssemblyNameDefinition Name { get { return name; } set { name = value; } } public string FullName { get { return name != null ? name.FullName : string.Empty; } } public MetadataToken MetadataToken { get { return new MetadataToken (TokenType.Assembly, 1); } set { } } public Collection Modules { get { if (modules != null) return modules; if (main_module.HasImage) return modules = main_module.Read (this, (_, reader) => reader.ReadModules ()); return modules = new Collection { main_module }; } } public ModuleDefinition MainModule { get { return main_module; } } public MethodDefinition EntryPoint { get { return main_module.EntryPoint; } set { main_module.EntryPoint = value; } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (main_module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (main_module)); } } public bool HasSecurityDeclarations { get { if (security_declarations != null) return security_declarations.Count > 0; return this.GetHasSecurityDeclarations (main_module); } } public Collection SecurityDeclarations { get { return security_declarations ?? (security_declarations = this.GetSecurityDeclarations (main_module)); } } internal AssemblyDefinition () { } #if !READ_ONLY public static AssemblyDefinition CreateAssembly (AssemblyNameDefinition assemblyName, string moduleName, ModuleKind kind) { return CreateAssembly (assemblyName, moduleName, new ModuleParameters { Kind = kind }); } public static AssemblyDefinition CreateAssembly (AssemblyNameDefinition assemblyName, string moduleName, ModuleParameters parameters) { if (assemblyName == null) throw new ArgumentNullException ("assemblyName"); if (moduleName == null) throw new ArgumentNullException ("moduleName"); Mixin.CheckParameters (parameters); if (parameters.Kind == ModuleKind.NetModule) throw new ArgumentException ("kind"); var assembly = ModuleDefinition.CreateModule (moduleName, parameters).Assembly; assembly.Name = assemblyName; return assembly; } #endif public static AssemblyDefinition ReadAssembly (string fileName) { return ReadAssembly (ModuleDefinition.ReadModule (fileName)); } public static AssemblyDefinition ReadAssembly (string fileName, ReaderParameters parameters) { return ReadAssembly (ModuleDefinition.ReadModule (fileName, parameters)); } public static AssemblyDefinition ReadAssembly (Stream stream) { return ReadAssembly (ModuleDefinition.ReadModule (stream)); } public static AssemblyDefinition ReadAssembly (Stream stream, ReaderParameters parameters) { return ReadAssembly (ModuleDefinition.ReadModule (stream, parameters)); } static AssemblyDefinition ReadAssembly (ModuleDefinition module) { var assembly = module.Assembly; if (assembly == null) throw new ArgumentException (); return assembly; } #if !READ_ONLY public void Write (string fileName) { Write (fileName, new WriterParameters ()); } public void Write (Stream stream) { Write (stream, new WriterParameters ()); } public void Write (string fileName, WriterParameters parameters) { main_module.Write (fileName, parameters); } public void Write (Stream stream, WriterParameters parameters) { main_module.Write (stream, parameters); } #endif public override string ToString () { return this.FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyInfo.cs0000664000175000017500000000614412136523632031407 0ustar00directhexdirecthex00000000000000// // AssemblyInfo.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle ("Mono.Cecil")] [assembly: AssemblyProduct ("Mono.Cecil")] [assembly: AssemblyCopyright ("Copyright © 2008 - 2010 Jb Evain")] [assembly: ComVisible (false)] [assembly: Guid ("fd225bb4-fa53-44b2-a6db-85f5e48dcb54")] [assembly: AssemblyVersion ("0.9.4.0")] #if !CF [assembly: AssemblyFileVersion ("0.9.4.0")] #endif [assembly: InternalsVisibleTo ("Mono.Cecil.Pdb, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Cecil.Mdb, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Cecil.Rocks, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] [assembly: InternalsVisibleTo ("Mono.Cecil.Tests, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ArrayType.cs0000664000175000017500000000714612136523632030737 0ustar00directhexdirecthex00000000000000// // ArrayType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Collections.Generic; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public struct ArrayDimension { int? lower_bound; int? upper_bound; public int? LowerBound { get { return lower_bound; } set { lower_bound = value; } } public int? UpperBound { get { return upper_bound; } set { upper_bound = value; } } public bool IsSized { get { return lower_bound.HasValue || upper_bound.HasValue; } } public ArrayDimension (int? lowerBound, int? upperBound) { this.lower_bound = lowerBound; this.upper_bound = upperBound; } public override string ToString () { return !IsSized ? string.Empty : lower_bound + "..." + upper_bound; } } public sealed class ArrayType : TypeSpecification { Collection dimensions; public Collection Dimensions { get { if (dimensions != null) return dimensions; dimensions = new Collection (); dimensions.Add (new ArrayDimension ()); return dimensions; } } public int Rank { get { return dimensions == null ? 1 : dimensions.Count; } } public bool IsVector { get { if (dimensions == null) return true; if (dimensions.Count > 1) return false; var dimension = dimensions [0]; return !dimension.IsSized; } } public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override string Name { get { return base.Name + Suffix; } } public override string FullName { get { return base.FullName + Suffix; } } string Suffix { get { if (IsVector) return "[]"; var suffix = new StringBuilder (); suffix.Append ("["); for (int i = 0; i < dimensions.Count; i++) { if (i > 0) suffix.Append (","); suffix.Append (dimensions [i].ToString ()); } suffix.Append ("]"); return suffix.ToString (); } } public override bool IsArray { get { return true; } } public ArrayType (TypeReference type) : base (type) { Mixin.CheckType (type); this.etype = MD.ElementType.Array; } public ArrayType (TypeReference type, int rank) : this (type) { Mixin.CheckType (type); if (rank == 1) return; dimensions = new Collection (rank); for (int i = 0; i < rank; i++) dimensions.Add (new ArrayDimension ()); this.etype = MD.ElementType.Array; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PropertyDefinition.cs0000664000175000017500000001460312136523632032650 0ustar00directhexdirecthex00000000000000// // PropertyDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class PropertyDefinition : PropertyReference, IMemberDefinition, IConstantProvider { bool? has_this; ushort attributes; Collection custom_attributes; internal MethodDefinition get_method; internal MethodDefinition set_method; internal Collection other_methods; object constant = Mixin.NotResolved; public PropertyAttributes Attributes { get { return (PropertyAttributes) attributes; } set { attributes = (ushort) value; } } public bool HasThis { get { if (has_this.HasValue) return has_this.Value; if (GetMethod != null) return get_method.HasThis; if (SetMethod != null) return set_method.HasThis; return false; } set { has_this = value; } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } public MethodDefinition GetMethod { get { if (get_method != null) return get_method; InitializeMethods (); return get_method; } set { get_method = value; } } public MethodDefinition SetMethod { get { if (set_method != null) return set_method; InitializeMethods (); return set_method; } set { set_method = value; } } public bool HasOtherMethods { get { if (other_methods != null) return other_methods.Count > 0; InitializeMethods (); return !other_methods.IsNullOrEmpty (); } } public Collection OtherMethods { get { if (other_methods != null) return other_methods; InitializeMethods (); if (other_methods != null) return other_methods; return other_methods = new Collection (); } } public bool HasParameters { get { if (get_method != null) return get_method.HasParameters; if (set_method != null) return set_method.HasParameters && set_method.Parameters.Count > 1; return false; } } public override Collection Parameters { get { InitializeMethods (); if (get_method != null) return MirrorParameters (get_method, 0); if (set_method != null) return MirrorParameters (set_method, 1); return new Collection (); } } static Collection MirrorParameters (MethodDefinition method, int bound) { var parameters = new Collection (); if (!method.HasParameters) return parameters; var original_parameters = method.Parameters; var end = original_parameters.Count - bound; for (int i = 0; i < end; i++) parameters.Add (original_parameters [i]); return parameters; } public bool HasConstant { get { ResolveConstant (); return constant != Mixin.NoValue; } set { if (!value) constant = Mixin.NoValue; } } public object Constant { get { return HasConstant ? constant : null; } set { constant = value; } } void ResolveConstant () { if (constant != Mixin.NotResolved) return; this.ResolveConstant (ref constant, Module); } #region PropertyAttributes public bool IsSpecialName { get { return attributes.GetAttributes ((ushort) PropertyAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((ushort) PropertyAttributes.SpecialName, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((ushort) PropertyAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((ushort) PropertyAttributes.RTSpecialName, value); } } public bool HasDefault { get { return attributes.GetAttributes ((ushort) PropertyAttributes.HasDefault); } set { attributes = attributes.SetAttributes ((ushort) PropertyAttributes.HasDefault, value); } } #endregion public new TypeDefinition DeclaringType { get { return (TypeDefinition) base.DeclaringType; } set { base.DeclaringType = value; } } public override bool IsDefinition { get { return true; } } public override string FullName { get { var builder = new StringBuilder (); builder.Append (PropertyType.ToString ()); builder.Append (' '); builder.Append (MemberFullName ()); builder.Append ('('); if (HasParameters) { var parameters = Parameters; for (int i = 0; i < parameters.Count; i++) { if (i > 0) builder.Append (','); builder.Append (parameters [i].ParameterType.FullName); } } builder.Append (')'); return builder.ToString (); } } public PropertyDefinition (string name, PropertyAttributes attributes, TypeReference propertyType) : base (name, propertyType) { this.attributes = (ushort) attributes; this.token = new MetadataToken (TokenType.Property); } void InitializeMethods () { if (get_method != null || set_method != null) return; var module = this.Module; if (!module.HasImage ()) return; module.Read (this, (property, reader) => reader.ReadMethods (property)); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyNameDefinition.cs0000664000175000017500000000316612136523632033406 0ustar00directhexdirecthex00000000000000// // AssemblyNameDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public sealed class AssemblyNameDefinition : AssemblyNameReference { public override byte [] Hash { get { return Empty.Array; } } internal AssemblyNameDefinition () { this.token = new MetadataToken (TokenType.Assembly, 1); } public AssemblyNameDefinition (string name, Version version) : base (name, version) { this.token = new MetadataToken (TokenType.Assembly, 1); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/NativeType.cs0000664000175000017500000000352512136523632031104 0ustar00directhexdirecthex00000000000000// // NativeType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum NativeType { None = 0x66, Boolean = 0x02, I1 = 0x03, U1 = 0x04, I2 = 0x05, U2 = 0x06, I4 = 0x07, U4 = 0x08, I8 = 0x09, U8 = 0x0a, R4 = 0x0b, R8 = 0x0c, LPStr = 0x14, Int = 0x1f, UInt = 0x20, Func = 0x26, Array = 0x2a, // Msft specific Currency = 0x0f, BStr = 0x13, LPWStr = 0x15, LPTStr = 0x16, FixedSysString = 0x17, IUnknown = 0x19, IDispatch = 0x1a, Struct = 0x1b, IntF = 0x1c, SafeArray = 0x1d, FixedArray = 0x1e, ByValStr = 0x22, ANSIBStr = 0x23, TBStr = 0x24, VariantBool = 0x25, ASAny = 0x28, LPStruct = 0x2b, CustomMarshaler = 0x2c, Error = 0x2d, Max = 0x50 } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MemberDefinitionCollection.cs0000664000175000017500000000454712136523632034255 0ustar00directhexdirecthex00000000000000// // MemberDefinitionCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { class MemberDefinitionCollection : Collection where T : IMemberDefinition { TypeDefinition container; internal MemberDefinitionCollection (TypeDefinition container) { this.container = container; } internal MemberDefinitionCollection (TypeDefinition container, int capacity) : base (capacity) { this.container = container; } protected override void OnAdd (T item, int index) { Attach (item); } protected sealed override void OnSet (T item, int index) { Attach (item); } protected sealed override void OnInsert (T item, int index) { Attach (item); } protected sealed override void OnRemove (T item, int index) { Detach (item); } protected sealed override void OnClear () { foreach (var definition in this) Detach (definition); } void Attach (T element) { if (element.DeclaringType == container) return; if (element.DeclaringType != null) throw new ArgumentException ("Member already attached"); element.DeclaringType = this.container; } static void Detach (T element) { element.DeclaringType = null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/Import.cs0000664000175000017500000004257312136523632030274 0ustar00directhexdirecthex00000000000000// // Import.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using SR = System.Reflection; using Mono.Cecil.Metadata; namespace Mono.Cecil { enum ImportGenericKind { Definition, Open, } class MetadataImporter { readonly ModuleDefinition module; public MetadataImporter (ModuleDefinition module) { this.module = module; } #if !CF static readonly Dictionary type_etype_mapping = new Dictionary (18) { { typeof (void), ElementType.Void }, { typeof (bool), ElementType.Boolean }, { typeof (char), ElementType.Char }, { typeof (sbyte), ElementType.I1 }, { typeof (byte), ElementType.U1 }, { typeof (short), ElementType.I2 }, { typeof (ushort), ElementType.U2 }, { typeof (int), ElementType.I4 }, { typeof (uint), ElementType.U4 }, { typeof (long), ElementType.I8 }, { typeof (ulong), ElementType.U8 }, { typeof (float), ElementType.R4 }, { typeof (double), ElementType.R8 }, { typeof (string), ElementType.String }, { typeof (TypedReference), ElementType.TypedByRef }, { typeof (IntPtr), ElementType.I }, { typeof (UIntPtr), ElementType.U }, { typeof (object), ElementType.Object }, }; public TypeReference ImportType (Type type, IGenericContext context) { return ImportType (type, context, ImportGenericKind.Open); } public TypeReference ImportType (Type type, IGenericContext context, ImportGenericKind import_kind) { if (IsTypeSpecification (type) || ImportOpenGenericType (type, import_kind)) return ImportTypeSpecification (type, context); var reference = new TypeReference ( string.Empty, type.Name, module, ImportScope (type.Assembly), type.IsValueType); reference.etype = ImportElementType (type); if (IsNestedType (type)) reference.DeclaringType = ImportType (type.DeclaringType, context, import_kind); else reference.Namespace = type.Namespace; if (type.IsGenericType) ImportGenericParameters (reference, type.GetGenericArguments ()); return reference; } static bool ImportOpenGenericType (Type type, ImportGenericKind import_kind) { return type.IsGenericType && type.IsGenericTypeDefinition && import_kind == ImportGenericKind.Open; } static bool ImportOpenGenericMethod (SR.MethodBase method, ImportGenericKind import_kind) { return method.IsGenericMethod && method.IsGenericMethodDefinition && import_kind == ImportGenericKind.Open; } static bool IsNestedType (Type type) { #if !SILVERLIGHT return type.IsNested; #else return type.DeclaringType != null; #endif } TypeReference ImportTypeSpecification (Type type, IGenericContext context) { if (type.IsByRef) return new ByReferenceType (ImportType (type.GetElementType (), context)); if (type.IsPointer) return new PointerType (ImportType (type.GetElementType (), context)); if (type.IsArray) return new ArrayType (ImportType (type.GetElementType (), context), type.GetArrayRank ()); if (type.IsGenericType) return ImportGenericInstance (type, context); if (type.IsGenericParameter) return ImportGenericParameter (type, context); throw new NotSupportedException (type.FullName); } static TypeReference ImportGenericParameter (Type type, IGenericContext context) { if (context == null) throw new InvalidOperationException (); var owner = type.DeclaringMethod != null ? context.Method : context.Type; if (owner == null) throw new InvalidOperationException (); return owner.GenericParameters [type.GenericParameterPosition]; } TypeReference ImportGenericInstance (Type type, IGenericContext context) { var element_type = ImportType (type.GetGenericTypeDefinition (), context, ImportGenericKind.Definition); var instance = new GenericInstanceType (element_type); var arguments = type.GetGenericArguments (); var instance_arguments = instance.GenericArguments; for (int i = 0; i < arguments.Length; i++) instance_arguments.Add (ImportType (arguments [i], context ?? element_type)); return instance; } static bool IsTypeSpecification (Type type) { return type.HasElementType || IsGenericInstance (type) || type.IsGenericParameter; } static bool IsGenericInstance (Type type) { return type.IsGenericType && !type.IsGenericTypeDefinition; } static ElementType ImportElementType (Type type) { ElementType etype; if (!type_etype_mapping.TryGetValue (type, out etype)) return ElementType.None; return etype; } AssemblyNameReference ImportScope (SR.Assembly assembly) { AssemblyNameReference scope; #if !SILVERLIGHT var name = assembly.GetName (); if (TryGetAssemblyNameReference (name, out scope)) return scope; scope = new AssemblyNameReference (name.Name, name.Version) { Culture = name.CultureInfo.Name, PublicKeyToken = name.GetPublicKeyToken (), HashAlgorithm = (AssemblyHashAlgorithm) name.HashAlgorithm, }; module.AssemblyReferences.Add (scope); return scope; #else var name = AssemblyNameReference.Parse (assembly.FullName); if (TryGetAssemblyNameReference (name, out scope)) return scope; module.AssemblyReferences.Add (name); return name; #endif } #if !SILVERLIGHT bool TryGetAssemblyNameReference (SR.AssemblyName name, out AssemblyNameReference assembly_reference) { var references = module.AssemblyReferences; for (int i = 0; i < references.Count; i++) { var reference = references [i]; if (name.FullName != reference.FullName) // TODO compare field by field continue; assembly_reference = reference; return true; } assembly_reference = null; return false; } #endif public FieldReference ImportField (SR.FieldInfo field, IGenericContext context) { var declaring_type = ImportType (field.DeclaringType, context); if (IsGenericInstance (field.DeclaringType)) field = ResolveFieldDefinition (field); return new FieldReference { Name = field.Name, DeclaringType = declaring_type, FieldType = ImportType (field.FieldType, context ?? declaring_type), }; } static SR.FieldInfo ResolveFieldDefinition (SR.FieldInfo field) { #if !SILVERLIGHT return field.Module.ResolveField (field.MetadataToken); #else return field.DeclaringType.GetGenericTypeDefinition ().GetField (field.Name, SR.BindingFlags.Public | SR.BindingFlags.NonPublic | (field.IsStatic ? SR.BindingFlags.Static : SR.BindingFlags.Instance)); #endif } public MethodReference ImportMethod (SR.MethodBase method, IGenericContext context, ImportGenericKind import_kind) { if (IsMethodSpecification (method) || ImportOpenGenericMethod (method, import_kind)) return ImportMethodSpecification (method, context); var declaring_type = ImportType (method.DeclaringType, context); if (IsGenericInstance (method.DeclaringType)) method = method.Module.ResolveMethod (method.MetadataToken); var reference = new MethodReference { Name = method.Name, HasThis = HasCallingConvention (method, SR.CallingConventions.HasThis), ExplicitThis = HasCallingConvention (method, SR.CallingConventions.ExplicitThis), DeclaringType = ImportType (method.DeclaringType, context, ImportGenericKind.Definition), }; if (HasCallingConvention (method, SR.CallingConventions.VarArgs)) reference.CallingConvention &= MethodCallingConvention.VarArg; if (method.IsGenericMethod) ImportGenericParameters (reference, method.GetGenericArguments ()); var method_info = method as SR.MethodInfo; reference.ReturnType = method_info != null ? ImportType (method_info.ReturnType, context ?? reference) : ImportType (typeof (void), null); var parameters = method.GetParameters (); var reference_parameters = reference.Parameters; for (int i = 0; i < parameters.Length; i++) reference_parameters.Add ( new ParameterDefinition (ImportType (parameters [i].ParameterType, context ?? reference))); reference.DeclaringType = declaring_type; return reference; } static void ImportGenericParameters (IGenericParameterProvider provider, Type [] arguments) { var provider_parameters = provider.GenericParameters; for (int i = 0; i < arguments.Length; i++) provider_parameters.Add (new GenericParameter (arguments [i].Name, provider)); } static bool IsMethodSpecification (SR.MethodBase method) { return method.IsGenericMethod && !method.IsGenericMethodDefinition; } MethodReference ImportMethodSpecification (SR.MethodBase method, IGenericContext context) { var method_info = method as SR.MethodInfo; if (method_info == null) throw new InvalidOperationException (); var element_method = ImportMethod (method_info.GetGenericMethodDefinition (), context, ImportGenericKind.Definition); var instance = new GenericInstanceMethod (element_method); var arguments = method.GetGenericArguments (); var instance_arguments = instance.GenericArguments; for (int i = 0; i < arguments.Length; i++) instance_arguments.Add (ImportType (arguments [i], context ?? element_method)); return instance; } static bool HasCallingConvention (SR.MethodBase method, SR.CallingConventions conventions) { return (method.CallingConvention & conventions) != 0; } #endif public TypeReference ImportType (TypeReference type, IGenericContext context) { if (type.IsTypeSpecification ()) return ImportTypeSpecification (type, context); var reference = new TypeReference ( type.Namespace, type.Name, module, ImportScope (type.Scope), type.IsValueType); MetadataSystem.TryProcessPrimitiveType (reference); if (type.IsNested) reference.DeclaringType = ImportType (type.DeclaringType, context); if (type.HasGenericParameters) ImportGenericParameters (reference, type); return reference; } IMetadataScope ImportScope (IMetadataScope scope) { switch (scope.MetadataScopeType) { case MetadataScopeType.AssemblyNameReference: return ImportAssemblyName ((AssemblyNameReference) scope); case MetadataScopeType.ModuleDefinition: return ImportAssemblyName (((ModuleDefinition) scope).Assembly.Name); case MetadataScopeType.ModuleReference: throw new NotImplementedException (); } throw new NotSupportedException (); } AssemblyNameReference ImportAssemblyName (AssemblyNameReference name) { AssemblyNameReference reference; if (TryGetAssemblyNameReference (name, out reference)) return reference; reference = new AssemblyNameReference (name.Name, name.Version) { Culture = name.Culture, HashAlgorithm = name.HashAlgorithm, }; var pk_token = !name.PublicKeyToken.IsNullOrEmpty () ? new byte [name.PublicKeyToken.Length] : Empty.Array; if (pk_token.Length > 0) Buffer.BlockCopy (name.PublicKeyToken, 0, pk_token, 0, pk_token.Length); reference.PublicKeyToken = pk_token; module.AssemblyReferences.Add (reference); return reference; } bool TryGetAssemblyNameReference (AssemblyNameReference name_reference, out AssemblyNameReference assembly_reference) { var references = module.AssemblyReferences; for (int i = 0; i < references.Count; i++) { var reference = references [i]; if (name_reference.FullName != reference.FullName) // TODO compare field by field continue; assembly_reference = reference; return true; } assembly_reference = null; return false; } static void ImportGenericParameters (IGenericParameterProvider imported, IGenericParameterProvider original) { var parameters = original.GenericParameters; var imported_parameters = imported.GenericParameters; for (int i = 0; i < parameters.Count; i++) imported_parameters.Add (new GenericParameter (parameters [i].Name, imported)); } TypeReference ImportTypeSpecification (TypeReference type, IGenericContext context) { switch (type.etype) { case ElementType.SzArray: var vector = (ArrayType) type; return new ArrayType (ImportType (vector.ElementType, context)); case ElementType.Ptr: var pointer = (PointerType) type; return new PointerType (ImportType (pointer.ElementType, context)); case ElementType.ByRef: var byref = (ByReferenceType) type; return new ByReferenceType (ImportType (byref.ElementType, context)); case ElementType.Pinned: var pinned = (PinnedType) type; return new PinnedType (ImportType (pinned.ElementType, context)); case ElementType.Sentinel: var sentinel = (SentinelType) type; return new SentinelType (ImportType (sentinel.ElementType, context)); case ElementType.CModOpt: var modopt = (OptionalModifierType) type; return new OptionalModifierType ( ImportType (modopt.ModifierType, context), ImportType (modopt.ElementType, context)); case ElementType.CModReqD: var modreq = (RequiredModifierType) type; return new RequiredModifierType ( ImportType (modreq.ModifierType, context), ImportType (modreq.ElementType, context)); case ElementType.Array: var array = (ArrayType) type; var imported_array = new ArrayType (ImportType (array.ElementType, context)); if (array.IsVector) return imported_array; var dimensions = array.Dimensions; var imported_dimensions = imported_array.Dimensions; imported_dimensions.Clear (); for (int i = 0; i < dimensions.Count; i++) { var dimension = dimensions [i]; imported_dimensions.Add (new ArrayDimension (dimension.LowerBound, dimension.UpperBound)); } return imported_array; case ElementType.GenericInst: var instance = (GenericInstanceType) type; var element_type = ImportType (instance.ElementType, context); var imported_instance = new GenericInstanceType (element_type); var arguments = instance.GenericArguments; var imported_arguments = imported_instance.GenericArguments; for (int i = 0; i < arguments.Count; i++) imported_arguments.Add (ImportType (arguments [i], context)); return imported_instance; case ElementType.Var: if (context == null || context.Type == null) throw new InvalidOperationException (); return ((TypeReference) context.Type).GetElementType ().GenericParameters [((GenericParameter) type).Position]; case ElementType.MVar: if (context == null || context.Method == null) throw new InvalidOperationException (); return context.Method.GenericParameters [((GenericParameter) type).Position]; } throw new NotSupportedException (type.etype.ToString ()); } public FieldReference ImportField (FieldReference field, IGenericContext context) { var declaring_type = ImportType (field.DeclaringType, context); return new FieldReference { Name = field.Name, DeclaringType = declaring_type, FieldType = ImportType (field.FieldType, context ?? declaring_type), }; } public MethodReference ImportMethod (MethodReference method, IGenericContext context) { if (method.IsGenericInstance) return ImportMethodSpecification (method, context); var declaring_type = ImportType (method.DeclaringType, context); var reference = new MethodReference { Name = method.Name, HasThis = method.HasThis, ExplicitThis = method.ExplicitThis, DeclaringType = declaring_type, }; reference.CallingConvention = method.CallingConvention; if (method.HasGenericParameters) ImportGenericParameters (reference, method); reference.ReturnType = ImportType (method.ReturnType, context ?? reference); if (!method.HasParameters) return reference; var reference_parameters = reference.Parameters; var parameters = method.Parameters; for (int i = 0; i < parameters.Count; i++) reference_parameters.Add ( new ParameterDefinition (ImportType (parameters [i].ParameterType, context ?? reference))); return reference; } MethodSpecification ImportMethodSpecification (MethodReference method, IGenericContext context) { if (!method.IsGenericInstance) throw new NotSupportedException (); var instance = (GenericInstanceMethod) method; var element_method = ImportMethod (instance.ElementMethod, context); var imported_instance = new GenericInstanceMethod (element_method); var arguments = instance.GenericArguments; var imported_arguments = imported_instance.GenericArguments; for (int i = 0; i < arguments.Count; i++) imported_arguments.Add (ImportType (arguments [i], context)); return imported_instance; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IMemberDefinition.cs0000664000175000017500000000543712136523632032351 0ustar00directhexdirecthex00000000000000// // IMemberDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public interface IMemberDefinition : ICustomAttributeProvider { string Name { get; set; } string FullName { get; } bool IsSpecialName { get; set; } bool IsRuntimeSpecialName { get; set; } TypeDefinition DeclaringType { get; set; } } static partial class Mixin { public static bool GetAttributes (this uint self, uint attributes) { return (self & attributes) != 0; } public static uint SetAttributes (this uint self, uint attributes, bool value) { if (value) return self | attributes; return self & ~attributes; } public static bool GetMaskedAttributes (this uint self, uint mask, uint attributes) { return (self & mask) == attributes; } public static uint SetMaskedAttributes (this uint self, uint mask, uint attributes, bool value) { if (value) { self &= ~mask; return self | attributes; } return self & ~(mask & attributes); } public static bool GetAttributes (this ushort self, ushort attributes) { return (self & attributes) != 0; } public static ushort SetAttributes (this ushort self, ushort attributes, bool value) { if (value) return (ushort) (self | attributes); return (ushort) (self & ~attributes); } public static bool GetMaskedAttributes (this ushort self, ushort mask, uint attributes) { return (self & mask) == attributes; } public static ushort SetMaskedAttributes (this ushort self, ushort mask, uint attributes, bool value) { if (value) { self = (ushort) (self & ~mask); return (ushort) (self | attributes); } return (ushort) (self & ~(mask & attributes)); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ParameterDefinitionCollection.cs0000664000175000017500000000436212136523632034761 0ustar00directhexdirecthex00000000000000// // ParameterDefinitionCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { sealed class ParameterDefinitionCollection : Collection { readonly IMethodSignature method; internal ParameterDefinitionCollection (IMethodSignature method) { this.method = method; } internal ParameterDefinitionCollection (IMethodSignature method, int capacity) : base (capacity) { this.method = method; } protected override void OnAdd (ParameterDefinition item, int index) { item.method = method; item.index = index; } protected override void OnInsert (ParameterDefinition item, int index) { item.method = method; item.index = index; for (int i = index; i < size; i++) items [i].index = i + 1; } protected override void OnSet (ParameterDefinition item, int index) { item.method = method; item.index = index; } protected override void OnRemove (ParameterDefinition item, int index) { item.method = null; item.index = -1; for (int i = index + 1; i < size; i++) items [i].index = i - 1; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/EmbeddedResource.cs0000664000175000017500000000536612136523632032222 0ustar00directhexdirecthex00000000000000// // EmbeddedResource.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; namespace Mono.Cecil { public sealed class EmbeddedResource : Resource { readonly MetadataReader reader; uint? offset; byte [] data; Stream stream; public override ResourceType ResourceType { get { return ResourceType.Embedded; } } public EmbeddedResource (string name, ManifestResourceAttributes attributes, byte [] data) : base (name, attributes) { this.data = data; } public EmbeddedResource (string name, ManifestResourceAttributes attributes, Stream stream) : base (name, attributes) { this.stream = stream; } internal EmbeddedResource (string name, ManifestResourceAttributes attributes, uint offset, MetadataReader reader) : base (name, attributes) { this.offset = offset; this.reader = reader; } public Stream GetResourceStream () { if (stream != null) return stream; if (data != null) return new MemoryStream (data); if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value); throw new InvalidOperationException (); } public byte [] GetResourceData () { if (stream != null) return ReadStream (stream); if (data != null) return data; if (offset.HasValue) return reader.GetManagedResourceStream (offset.Value).ToArray (); throw new InvalidOperationException (); } static byte [] ReadStream (Stream stream) { var length = (int) stream.Length; var data = new byte [length]; int offset = 0, read; while ((read = stream.Read (data, offset, length - offset)) > 0) offset += read; return data; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ExportedType.cs0000664000175000017500000002212512136523632031445 0ustar00directhexdirecthex00000000000000// // ExportedType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public class ExportedType : IMetadataTokenProvider { string @namespace; string name; uint attributes; IMetadataScope scope; int identifier; ExportedType declaring_type; internal MetadataToken token; public string Namespace { get { return @namespace; } set { @namespace = value; } } public string Name { get { return name; } set { name = value; } } public TypeAttributes Attributes { get { return (TypeAttributes) attributes; } set { attributes = (uint) value; } } public IMetadataScope Scope { get { if (declaring_type != null) return declaring_type.Scope; return scope; } } public ExportedType DeclaringType { get { return declaring_type; } set { declaring_type = value; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } public int Identifier { get { return identifier; } set { identifier = value; } } #region TypeAttributes public bool IsNotPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NotPublic); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NotPublic, value); } } public bool IsPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.Public); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.Public, value); } } public bool IsNestedPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPublic); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPublic, value); } } public bool IsNestedPrivate { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPrivate); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPrivate, value); } } public bool IsNestedFamily { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamily); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamily, value); } } public bool IsNestedAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedAssembly); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedAssembly, value); } } public bool IsNestedFamilyAndAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamANDAssem); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamANDAssem, value); } } public bool IsNestedFamilyOrAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamORAssem); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamORAssem, value); } } public bool IsAutoLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.AutoLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.AutoLayout, value); } } public bool IsSequentialLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.SequentialLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.SequentialLayout, value); } } public bool IsExplicitLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.ExplicitLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.ExplicitLayout, value); } } public bool IsClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Class); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Class, value); } } public bool IsInterface { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Interface); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Interface, value); } } public bool IsAbstract { get { return attributes.GetAttributes ((uint) TypeAttributes.Abstract); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Abstract, value); } } public bool IsSealed { get { return attributes.GetAttributes ((uint) TypeAttributes.Sealed); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Sealed, value); } } public bool IsSpecialName { get { return attributes.GetAttributes ((uint) TypeAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.SpecialName, value); } } public bool IsImport { get { return attributes.GetAttributes ((uint) TypeAttributes.Import); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Import, value); } } public bool IsSerializable { get { return attributes.GetAttributes ((uint) TypeAttributes.Serializable); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Serializable, value); } } public bool IsAnsiClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass, value); } } public bool IsUnicodeClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.UnicodeClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.UnicodeClass, value); } } public bool IsAutoClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AutoClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AutoClass, value); } } public bool IsBeforeFieldInit { get { return attributes.GetAttributes ((uint) TypeAttributes.BeforeFieldInit); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.BeforeFieldInit, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((uint) TypeAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.RTSpecialName, value); } } public bool HasSecurity { get { return attributes.GetAttributes ((uint) TypeAttributes.HasSecurity); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.HasSecurity, value); } } #endregion public bool IsForwarder { get { return attributes.GetAttributes ((uint) TypeAttributes.Forwarder); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Forwarder, value); } } public string FullName { get { if (declaring_type != null) return declaring_type.FullName + "/" + name; if (string.IsNullOrEmpty (@namespace)) return name; return @namespace + "." + name; } } public ExportedType (string @namespace, string name, IMetadataScope scope) { this.@namespace = @namespace; this.name = name; this.scope = scope; } public override string ToString () { return FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodCallingConvention.cs0000664000175000017500000000257012136523632033570 0ustar00directhexdirecthex00000000000000// // MethodCallingConvention.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum MethodCallingConvention : byte { Default = 0x0, C = 0x1, StdCall = 0x2, ThisCall = 0x3, FastCall = 0x4, VarArg = 0x5, Generic = 0x10, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/GenericParameterAttributes.cs0000664000175000017500000000303712136523632034276 0ustar00directhexdirecthex00000000000000// // GenericParameterAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum GenericParameterAttributes : ushort { VarianceMask = 0x0003, NonVariant = 0x0000, Covariant = 0x0001, Contravariant = 0x0002, SpecialConstraintMask = 0x001c, ReferenceTypeConstraint = 0x0004, NotNullableValueTypeConstraint = 0x0008, DefaultConstructorConstraint = 0x0010 } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MarshalInfo.cs0000664000175000017500000000746112136523632031222 0ustar00directhexdirecthex00000000000000// // MarshalInfo.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public class MarshalInfo { internal NativeType native; public NativeType NativeType { get { return native; } set { native = value; } } public MarshalInfo (NativeType native) { this.native = native; } } public sealed class ArrayMarshalInfo : MarshalInfo { internal NativeType element_type; internal int size_parameter_index; internal int size; internal int size_parameter_multiplier; public NativeType ElementType { get { return element_type; } set { element_type = value; } } public int SizeParameterIndex { get { return size_parameter_index; } set { size_parameter_index = value; } } public int Size { get { return size; } set { size = value; } } public int SizeParameterMultiplier { get { return size_parameter_multiplier; } set { size_parameter_multiplier = value; } } public ArrayMarshalInfo () : base (NativeType.Array) { element_type = NativeType.None; size_parameter_index = -1; size = -1; size_parameter_multiplier = -1; } } public sealed class CustomMarshalInfo : MarshalInfo { internal Guid guid; internal string unmanaged_type; internal TypeReference managed_type; internal string cookie; public Guid Guid { get { return guid; } set { guid = value; } } public string UnmanagedType { get { return unmanaged_type; } set { unmanaged_type = value; } } public TypeReference ManagedType { get { return managed_type; } set { managed_type = value; } } public string Cookie { get { return cookie; } set { cookie = value; } } public CustomMarshalInfo () : base (NativeType.CustomMarshaler) { } } public sealed class SafeArrayMarshalInfo : MarshalInfo { internal VariantType element_type; public VariantType ElementType { get { return element_type; } set { element_type = value; } } public SafeArrayMarshalInfo () : base (NativeType.SafeArray) { element_type = VariantType.None; } } public sealed class FixedArrayMarshalInfo : MarshalInfo { internal NativeType element_type; internal int size; public NativeType ElementType { get { return element_type; } set { element_type = value; } } public int Size { get { return size; } set { size = value; } } public FixedArrayMarshalInfo () : base (NativeType.FixedArray) { element_type = NativeType.None; } } public sealed class FixedSysStringMarshalInfo : MarshalInfo { internal int size; public int Size { get { return size; } set { size = value; } } public FixedSysStringMarshalInfo () : base (NativeType.FixedSysString) { size = -1; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/Modifiers.cs0000664000175000017500000000717112136523632030736 0ustar00directhexdirecthex00000000000000// // Modifiers.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public interface IModifierType { TypeReference ModifierType { get; } TypeReference ElementType { get; } } public sealed class OptionalModifierType : TypeSpecification, IModifierType { TypeReference modifier_type; public TypeReference ModifierType { get { return modifier_type; } set { modifier_type = value; } } public override string Name { get { return base.Name + Suffix; } } public override string FullName { get { return base.FullName + Suffix; } } string Suffix { get { return " modopt(" + modifier_type + ")"; } } public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsOptionalModifier { get { return true; } } internal override bool ContainsGenericParameter { get { return modifier_type.ContainsGenericParameter || base.ContainsGenericParameter; } } public OptionalModifierType (TypeReference modifierType, TypeReference type) : base (type) { Mixin.CheckModifier (modifierType, type); this.modifier_type = modifierType; this.etype = MD.ElementType.CModOpt; } } public sealed class RequiredModifierType : TypeSpecification, IModifierType { TypeReference modifier_type; public TypeReference ModifierType { get { return modifier_type; } set { modifier_type = value; } } public override string Name { get { return base.Name + Suffix; } } public override string FullName { get { return base.FullName + Suffix; } } string Suffix { get { return " modreq(" + modifier_type + ")"; } } public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsRequiredModifier { get { return true; } } internal override bool ContainsGenericParameter { get { return modifier_type.ContainsGenericParameter || base.ContainsGenericParameter; } } public RequiredModifierType (TypeReference modifierType, TypeReference type) : base (type) { Mixin.CheckModifier (modifierType, type); this.modifier_type = modifierType; this.etype = MD.ElementType.CModReqD; } } static partial class Mixin { public static void CheckModifier (TypeReference modifierType, TypeReference type) { if (modifierType == null) throw new ArgumentNullException ("modifierType"); if (type == null) throw new ArgumentNullException ("type"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/GenericInstanceMethod.cs0000664000175000017500000000513512136523632033215 0ustar00directhexdirecthex00000000000000// // GenericInstanceMethod.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class GenericInstanceMethod : MethodSpecification, IGenericInstance, IGenericContext { Collection arguments; public bool HasGenericArguments { get { return !arguments.IsNullOrEmpty (); } } public Collection GenericArguments { get { if (arguments == null) arguments = new Collection (); return arguments; } } public override bool IsGenericInstance { get { return true; } } IGenericParameterProvider IGenericContext.Method { get { return ElementMethod; } } IGenericParameterProvider IGenericContext.Type { get { return ElementMethod.DeclaringType; } } internal override bool ContainsGenericParameter { get { return this.ContainsGenericParameter () || base.ContainsGenericParameter; } } public override string FullName { get { var signature = new StringBuilder (); var method = this.ElementMethod; signature.Append (method.ReturnType.FullName); signature.Append (" "); signature.Append (method.DeclaringType.FullName); signature.Append ("::"); signature.Append (method.Name); this.GenericInstanceFullName (signature); this.MethodSignatureFullName (signature); return signature.ToString (); } } public GenericInstanceMethod (MethodReference method) : base (method) { } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/FunctionPointerType.cs0000664000175000017500000000663712136523632033013 0ustar00directhexdirecthex00000000000000// // FunctionPointerType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Collections.Generic; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class FunctionPointerType : TypeSpecification, IMethodSignature { readonly MethodReference function; public bool HasThis { get { return function.HasThis; } set { function.HasThis = value; } } public bool ExplicitThis { get { return function.ExplicitThis; } set { function.ExplicitThis = value; } } public MethodCallingConvention CallingConvention { get { return function.CallingConvention; } set { function.CallingConvention = value; } } public bool HasParameters { get { return function.HasParameters; } } public Collection Parameters { get { return function.Parameters; } } public TypeReference ReturnType { get { return function.MethodReturnType.ReturnType; } set { function.MethodReturnType.ReturnType = value; } } public MethodReturnType MethodReturnType { get { return function.MethodReturnType; } } public override string Name { get { return function.Name; } set { throw new InvalidOperationException (); } } public override string Namespace { get { return string.Empty; } set { throw new InvalidOperationException (); } } public override ModuleDefinition Module { get { return ReturnType.Module; } } public override IMetadataScope Scope { get { return function.ReturnType.Scope; } } public override bool IsFunctionPointer { get { return true; } } internal override bool ContainsGenericParameter { get { return function.ContainsGenericParameter; } } public override string FullName { get { var signature = new StringBuilder (); signature.Append (function.Name); signature.Append (" "); signature.Append (function.ReturnType.FullName); signature.Append (" *"); this.MethodSignatureFullName (signature); return signature.ToString (); } } public FunctionPointerType () : base (null) { this.function = new MethodReference (); this.function.Name = "method"; this.etype = MD.ElementType.FnPtr; } public override TypeDefinition Resolve () { return null; } public override TypeReference GetElementType () { return this; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/EventAttributes.cs0000664000175000017500000000265412136523632032146 0ustar00directhexdirecthex00000000000000// // EventAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum EventAttributes : ushort { None = 0x0000, SpecialName = 0x0200, // Event is special RTSpecialName = 0x0400 // CLI provides 'special' behavior, depending upon the name of the event } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ModuleDefinition.cs0000664000175000017500000005457112136523632032261 0ustar00directhexdirecthex00000000000000// // ModuleDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.IO; using SR = System.Reflection; using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using Mono.Cecil.PE; using Mono.Collections.Generic; namespace Mono.Cecil { public enum ReadingMode { Immediate = 1, Deferred = 2, } public sealed class ReaderParameters { ReadingMode reading_mode; IAssemblyResolver assembly_resolver; Stream symbol_stream; ISymbolReaderProvider symbol_reader_provider; bool read_symbols; public ReadingMode ReadingMode { get { return reading_mode; } set { reading_mode = value; } } public IAssemblyResolver AssemblyResolver { get { return assembly_resolver; } set { assembly_resolver = value; } } public Stream SymbolStream { get { return symbol_stream; } set { symbol_stream = value; } } public ISymbolReaderProvider SymbolReaderProvider { get { return symbol_reader_provider; } set { symbol_reader_provider = value; } } public bool ReadSymbols { get { return read_symbols; } set { read_symbols = value; } } public ReaderParameters () : this (ReadingMode.Deferred) { } public ReaderParameters (ReadingMode readingMode) { this.reading_mode = readingMode; } } #if !READ_ONLY public sealed class ModuleParameters { ModuleKind kind; TargetRuntime runtime; TargetArchitecture architecture; IAssemblyResolver assembly_resolver; public ModuleKind Kind { get { return kind; } set { kind = value; } } public TargetRuntime Runtime { get { return runtime; } set { runtime = value; } } public TargetArchitecture Architecture { get { return architecture; } set { architecture = value; } } public IAssemblyResolver AssemblyResolver { get { return assembly_resolver; } set { assembly_resolver = value; } } public ModuleParameters () { this.kind = ModuleKind.Dll; this.runtime = GetCurrentRuntime (); this.architecture = TargetArchitecture.I386; } static TargetRuntime GetCurrentRuntime () { #if !CF return typeof (object).Assembly.ImageRuntimeVersion.ParseRuntime (); #else var corlib_version = typeof (object).Assembly.GetName ().Version; switch (corlib_version.Major) { case 1: return corlib_version.Minor == 0 ? TargetRuntime.Net_1_0 : TargetRuntime.Net_1_1; case 2: return TargetRuntime.Net_2_0; case 4: return TargetRuntime.Net_4_0; default: throw new NotSupportedException (); } #endif } } public sealed class WriterParameters { Stream symbol_stream; ISymbolWriterProvider symbol_writer_provider; bool write_symbols; #if !SILVERLIGHT && !CF SR.StrongNameKeyPair key_pair; #endif public Stream SymbolStream { get { return symbol_stream; } set { symbol_stream = value; } } public ISymbolWriterProvider SymbolWriterProvider { get { return symbol_writer_provider; } set { symbol_writer_provider = value; } } public bool WriteSymbols { get { return write_symbols; } set { write_symbols = value; } } #if !SILVERLIGHT && !CF public SR.StrongNameKeyPair StrongNameKeyPair { get { return key_pair; } set { key_pair = value; } } #endif } #endif public sealed class ModuleDefinition : ModuleReference, ICustomAttributeProvider { internal Image Image; internal MetadataSystem MetadataSystem; internal ReadingMode ReadingMode; internal ISymbolReaderProvider SymbolReaderProvider; internal ISymbolReader SymbolReader; internal IAssemblyResolver assembly_resolver; internal TypeSystem type_system; readonly MetadataReader reader; readonly string fq_name; internal ModuleKind kind; TargetRuntime runtime; TargetArchitecture architecture; ModuleAttributes attributes; Guid mvid; internal AssemblyDefinition assembly; MethodDefinition entry_point; #if !READ_ONLY MetadataImporter importer; #endif Collection custom_attributes; Collection references; Collection modules; Collection resources; Collection exported_types; TypeDefinitionCollection types; public bool IsMain { get { return kind != ModuleKind.NetModule; } } public ModuleKind Kind { get { return kind; } set { kind = value; } } public TargetRuntime Runtime { get { return runtime; } set { runtime = value; } } public TargetArchitecture Architecture { get { return architecture; } set { architecture = value; } } public ModuleAttributes Attributes { get { return attributes; } set { attributes = value; } } public string FullyQualifiedName { get { return fq_name; } } public Guid Mvid { get { return mvid; } set { mvid = value; } } internal bool HasImage { get { return Image != null; } } public bool HasSymbols { get { return SymbolReader != null; } } public override MetadataScopeType MetadataScopeType { get { return MetadataScopeType.ModuleDefinition; } } public AssemblyDefinition Assembly { get { return assembly; } } #if !READ_ONLY internal MetadataImporter MetadataImporter { get { return importer ?? (importer = new MetadataImporter (this)); } } #endif public IAssemblyResolver AssemblyResolver { get { return assembly_resolver; } } public TypeSystem TypeSystem { get { return type_system ?? (type_system = TypeSystem.CreateTypeSystem (this)); } } public bool HasAssemblyReferences { get { if (references != null) return references.Count > 0; return HasImage && Image.HasTable (Table.AssemblyRef); } } public Collection AssemblyReferences { get { if (references != null) return references; if (HasImage) return references = Read (this, (_, reader) => reader.ReadAssemblyReferences ()); return references = new Collection (); } } public bool HasModuleReferences { get { if (modules != null) return modules.Count > 0; return HasImage && Image.HasTable (Table.ModuleRef); } } public Collection ModuleReferences { get { if (modules != null) return modules; if (HasImage) return modules = Read (this, (_, reader) => reader.ReadModuleReferences ()); return modules = new Collection (); } } public bool HasResources { get { if (resources != null) return resources.Count > 0; if (HasImage) return Image.HasTable (Table.ManifestResource) || Read (this, (_, reader) => reader.HasFileResource ()); return false; } } public Collection Resources { get { if (resources != null) return resources; if (HasImage) return resources = Read (this, (_, reader) => reader.ReadResources ()); return resources = new Collection (); } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (this); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (this)); } } public bool HasTypes { get { if (types != null) return types.Count > 0; return HasImage && Image.HasTable (Table.TypeDef); } } public Collection Types { get { if (types != null) return types; if (HasImage) return types = Read (this, (_, reader) => reader.ReadTypes ()); return types = new TypeDefinitionCollection (this); } } public bool HasExportedTypes { get { if (exported_types != null) return exported_types.Count > 0; return HasImage && Image.HasTable (Table.ExportedType); } } public Collection ExportedTypes { get { if (exported_types != null) return exported_types; if (HasImage) return exported_types = Read (this, (_, reader) => reader.ReadExportedTypes ()); return exported_types = new Collection (); } } public MethodDefinition EntryPoint { get { if (entry_point != null) return entry_point; if (HasImage) return entry_point = Read (this, (_, reader) => reader.ReadEntryPoint ()); return entry_point = null; } set { entry_point = value; } } internal ModuleDefinition () { this.MetadataSystem = new MetadataSystem (); this.token = new MetadataToken (TokenType.Module, 1); this.assembly_resolver = GlobalAssemblyResolver.Instance; } internal ModuleDefinition (Image image) : this () { this.Image = image; this.kind = image.Kind; this.runtime = image.Runtime; this.architecture = image.Architecture; this.attributes = image.Attributes; this.fq_name = image.FileName; this.reader = new MetadataReader (this); } public bool HasTypeReference (string fullName) { return HasTypeReference (string.Empty, fullName); } public bool HasTypeReference (string scope, string fullName) { CheckFullName (fullName); if (!HasImage) return false; return Read (this, (_, reader) => reader.GetTypeReference (scope, fullName) != null); } public bool TryGetTypeReference (string fullName, out TypeReference type) { return TryGetTypeReference (string.Empty, fullName, out type); } public bool TryGetTypeReference (string scope, string fullName, out TypeReference type) { CheckFullName (fullName); if (!HasImage) { type = null; return false; } return (type = Read (this, (_, reader) => reader.GetTypeReference (scope, fullName))) != null; } public IEnumerable GetTypeReferences () { if (!HasImage) return Empty.Array; return Read (this, (_, reader) => reader.GetTypeReferences ()); } public IEnumerable GetMemberReferences () { if (!HasImage) return Empty.Array; return Read (this, (_, reader) => reader.GetMemberReferences ()); } public TypeDefinition GetType (string fullName) { CheckFullName (fullName); var position = fullName.IndexOf ('/'); if (position > 0) return GetNestedType (fullName); return ((TypeDefinitionCollection) this.Types).GetType (fullName); } public TypeDefinition GetType (string @namespace, string name) { Mixin.CheckName (name); return ((TypeDefinitionCollection) this.Types).GetType (@namespace ?? string.Empty, name); } static void CheckFullName (string fullName) { if (fullName == null) throw new ArgumentNullException ("fullName"); if (fullName.Length == 0) throw new ArgumentException (); } TypeDefinition GetNestedType (string fullname) { var names = fullname.Split ('/'); var type = GetType (names [0]); if (type == null) return null; for (int i = 1; i < names.Length; i++) { var nested_type = type.GetNestedType (names [i]); if (nested_type == null) return null; type = nested_type; } return type; } internal FieldDefinition Resolve (FieldReference field) { return MetadataResolver.Resolve (AssemblyResolver, field); } internal MethodDefinition Resolve (MethodReference method) { return MetadataResolver.Resolve (AssemblyResolver, method); } internal TypeDefinition Resolve (TypeReference type) { return MetadataResolver.Resolve (AssemblyResolver, type); } #if !READ_ONLY static void CheckType (object type) { if (type == null) throw new ArgumentNullException ("type"); } static void CheckField (object field) { if (field == null) throw new ArgumentNullException ("field"); } static void CheckMethod (object method) { if (method == null) throw new ArgumentNullException ("method"); } static void CheckContext (IGenericParameterProvider context, ModuleDefinition module) { if (context == null) return; if (context.Module != module) throw new ArgumentException (); } #if !CF public TypeReference Import (Type type) { CheckType (type); return MetadataImporter.ImportType (type, null, ImportGenericKind.Definition); } public TypeReference Import (Type type, TypeReference context) { return Import (type, (IGenericParameterProvider) context); } public TypeReference Import (Type type, MethodReference context) { return Import (type, (IGenericParameterProvider) context); } TypeReference Import (Type type, IGenericParameterProvider context) { CheckType (type); CheckContext (context, this); return MetadataImporter.ImportType ( type, (IGenericContext) context, context != null ? ImportGenericKind.Open : ImportGenericKind.Definition); } public FieldReference Import (SR.FieldInfo field) { CheckField (field); return MetadataImporter.ImportField (field, null); } public FieldReference Import (SR.FieldInfo field, TypeReference context) { return Import (field, (IGenericParameterProvider) context); } public FieldReference Import (SR.FieldInfo field, MethodReference context) { return Import (field, (IGenericParameterProvider) context); } FieldReference Import (SR.FieldInfo field, IGenericParameterProvider context) { CheckField (field); CheckContext (context, this); return MetadataImporter.ImportField (field, (IGenericContext) context); } public MethodReference Import (SR.MethodBase method) { CheckMethod (method); return MetadataImporter.ImportMethod (method, null, ImportGenericKind.Definition); } public MethodReference Import (SR.MethodBase method, TypeReference context) { return Import (method, (IGenericParameterProvider) context); } public MethodReference Import (SR.MethodBase method, MethodReference context) { return Import (method, (IGenericParameterProvider) context); } MethodReference Import (SR.MethodBase method, IGenericParameterProvider context) { CheckMethod (method); CheckContext (context, this); return MetadataImporter.ImportMethod (method, (IGenericContext) context, context != null ? ImportGenericKind.Open : ImportGenericKind.Definition); } #endif public TypeReference Import (TypeReference type) { CheckType (type); if (type.Module == this) return type; return MetadataImporter.ImportType (type, null); } public TypeReference Import (TypeReference type, TypeReference context) { return Import (type, (IGenericParameterProvider) context); } public TypeReference Import (TypeReference type, MethodReference context) { return Import (type, (IGenericParameterProvider) context); } TypeReference Import (TypeReference type, IGenericParameterProvider context) { CheckType (type); if (type.Module == this) return type; CheckContext (context, this); return MetadataImporter.ImportType (type, (IGenericContext) context); } public FieldReference Import (FieldReference field) { CheckField (field); if (field.Module == this) return field; return MetadataImporter.ImportField (field, null); } public FieldReference Import (FieldReference field, TypeReference context) { return Import (field, (IGenericParameterProvider) context); } public FieldReference Import (FieldReference field, MethodReference context) { return Import (field, (IGenericParameterProvider) context); } FieldReference Import (FieldReference field, IGenericParameterProvider context) { CheckField (field); if (field.Module == this) return field; CheckContext (context, this); return MetadataImporter.ImportField (field, (IGenericContext) context); } public MethodReference Import (MethodReference method) { CheckMethod (method); if (method.Module == this) return method; return MetadataImporter.ImportMethod (method, null); } public MethodReference Import (MethodReference method, TypeReference context) { return Import (method, (IGenericParameterProvider) context); } public MethodReference Import (MethodReference method, MethodReference context) { return Import (method, (IGenericParameterProvider) context); } MethodReference Import (MethodReference method, IGenericParameterProvider context) { CheckMethod (method); if (method.Module == this) return method; CheckContext (context, this); return MetadataImporter.ImportMethod (method, (IGenericContext) context); } #endif public IMetadataTokenProvider LookupToken (int token) { return LookupToken (new MetadataToken ((uint) token)); } public IMetadataTokenProvider LookupToken (MetadataToken token) { return Read (this, (_, reader) => reader.LookupToken (token)); } internal TRet Read (TItem item, Func read) { var position = reader.position; var context = reader.context; var ret = read (item, reader); reader.position = position; reader.context = context; return ret; } void ProcessDebugHeader () { if (Image == null || Image.Debug.IsZero) return; byte [] header; var directory = Image.GetDebugHeader (out header); if (!SymbolReader.ProcessDebugHeader (directory, header)) throw new InvalidOperationException (); } #if !READ_ONLY public static ModuleDefinition CreateModule (string name, ModuleKind kind) { return CreateModule (name, new ModuleParameters { Kind = kind }); } public static ModuleDefinition CreateModule (string name, ModuleParameters parameters) { Mixin.CheckName (name); Mixin.CheckParameters (parameters); var module = new ModuleDefinition { Name = name, kind = parameters.Kind, runtime = parameters.Runtime, architecture = parameters.Architecture, mvid = Guid.NewGuid (), Attributes = ModuleAttributes.ILOnly, }; if (parameters.AssemblyResolver != null) module.assembly_resolver = parameters.AssemblyResolver; if (parameters.Kind != ModuleKind.NetModule) { var assembly = new AssemblyDefinition (); module.assembly = assembly; module.assembly.Name = new AssemblyNameDefinition (name, new Version (0, 0)); assembly.main_module = module; } module.Types.Add (new TypeDefinition (string.Empty, "", TypeAttributes.NotPublic)); return module; } #endif public void ReadSymbols () { if (string.IsNullOrEmpty (fq_name)) throw new InvalidOperationException (); var provider = SymbolProvider.GetPlatformReaderProvider (); SymbolReader = provider.GetSymbolReader (this, fq_name); ProcessDebugHeader (); } public void ReadSymbols (ISymbolReader reader) { if (reader == null) throw new ArgumentNullException ("reader"); SymbolReader = reader; ProcessDebugHeader (); } public static ModuleDefinition ReadModule (string fileName) { return ReadModule (fileName, new ReaderParameters (ReadingMode.Deferred)); } public static ModuleDefinition ReadModule (Stream stream) { return ReadModule (stream, new ReaderParameters (ReadingMode.Deferred)); } public static ModuleDefinition ReadModule (string fileName, ReaderParameters parameters) { using (var stream = GetFileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { return ReadModule (stream, parameters); } } static void CheckStream (object stream) { if (stream == null) throw new ArgumentNullException ("stream"); } public static ModuleDefinition ReadModule (Stream stream, ReaderParameters parameters) { CheckStream (stream); if (!stream.CanRead || !stream.CanSeek) throw new ArgumentException (); Mixin.CheckParameters (parameters); return ModuleReader.CreateModuleFrom ( ImageReader.ReadImageFrom (stream), parameters); } static Stream GetFileStream (string fileName, FileMode mode, FileAccess access, FileShare share) { if (fileName == null) throw new ArgumentNullException ("fileName"); if (fileName.Length == 0) throw new ArgumentException (); return new FileStream (fileName, mode, access, share); } #if !READ_ONLY public void Write (string fileName) { Write (fileName, new WriterParameters ()); } public void Write (Stream stream) { Write (stream, new WriterParameters ()); } public void Write (string fileName, WriterParameters parameters) { using (var stream = GetFileStream (fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None)) { Write (stream, parameters); } } public void Write (Stream stream, WriterParameters parameters) { CheckStream (stream); if (!stream.CanWrite || !stream.CanSeek) throw new ArgumentException (); Mixin.CheckParameters (parameters); ModuleWriter.WriteModuleTo (this, stream, parameters); } #endif } static partial class Mixin { public static void CheckParameters (object parameters) { if (parameters == null) throw new ArgumentNullException ("parameters"); } public static bool HasImage (this ModuleDefinition self) { return self != null && self.HasImage; } public static string GetFullyQualifiedName (this Stream self) { #if !SILVERLIGHT var file_stream = self as FileStream; if (file_stream == null) return string.Empty; return Path.GetFullPath (file_stream.Name); #else return string.Empty; #endif } public static TargetRuntime ParseRuntime (this string self) { switch (self [1]) { case '1': return self [3] == '0' ? TargetRuntime.Net_1_0 : TargetRuntime.Net_1_1; case '2': return TargetRuntime.Net_2_0; case '4': default: return TargetRuntime.Net_4_0; } } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyFlags.cs0000664000175000017500000000266212136523632031551 0ustar00directhexdirecthex00000000000000// // AssemblyFlags.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum AssemblyAttributes : uint { PublicKey = 0x0001, SideBySideCompatible = 0x0000, Retargetable = 0x0100, DisableJITCompileOptimizer = 0x4000, EnableJITCompileTracking = 0x8000, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/GenericParameter.cs0000664000175000017500000001430212136523632032224 0ustar00directhexdirecthex00000000000000// // GenericParameter.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; using Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class GenericParameter : TypeReference, ICustomAttributeProvider { readonly IGenericParameterProvider owner; ushort attributes; Collection constraints; Collection custom_attributes; public GenericParameterAttributes Attributes { get { return (GenericParameterAttributes) attributes; } set { attributes = (ushort) value; } } public int Position { get { if (owner == null) return -1; return owner.GenericParameters.IndexOf (this); } } public IGenericParameterProvider Owner { get { return owner; } } public bool HasConstraints { get { if (constraints != null) return constraints.Count > 0; if (HasImage) return Module.Read (this, (generic_parameter, reader) => reader.HasGenericConstraints (generic_parameter)); return false; } } public Collection Constraints { get { if (constraints != null) return constraints; if (HasImage) return constraints = Module.Read (this, (generic_parameter, reader) => reader.ReadGenericConstraints (generic_parameter)); return constraints = new Collection (); } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } internal new bool HasImage { get { return Module != null && Module.HasImage; } } public override IMetadataScope Scope { get { if (owner.GenericParameterType == GenericParameterType.Method) return ((MethodReference) owner).DeclaringType.Scope; return ((TypeReference) owner).Scope; } } public override ModuleDefinition Module { get { return ((MemberReference) owner).Module; } } public override string Name { get { if (!string.IsNullOrEmpty (base.Name)) return base.Name; return base.Name = (owner.GenericParameterType == GenericParameterType.Type ? "!" : "!!") + Position; } } public override string Namespace { get { return string.Empty; } set { throw new InvalidOperationException (); } } public override string FullName { get { return Name; } } public override bool IsGenericParameter { get { return true; } } internal override bool ContainsGenericParameter { get { return true; } } public override MetadataType MetadataType { get { return (MetadataType) etype; } } #region GenericParameterAttributes public bool IsNonVariant { get { return attributes.GetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.NonVariant); } set { attributes = attributes.SetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.NonVariant, value); } } public bool IsCovariant { get { return attributes.GetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.Covariant); } set { attributes = attributes.SetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.Covariant, value); } } public bool IsContravariant { get { return attributes.GetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.Contravariant); } set { attributes = attributes.SetMaskedAttributes ((ushort) GenericParameterAttributes.VarianceMask, (ushort) GenericParameterAttributes.Contravariant, value); } } public bool HasReferenceTypeConstraint { get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.ReferenceTypeConstraint); } set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.ReferenceTypeConstraint, value); } } public bool HasNotNullableValueTypeConstraint { get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.NotNullableValueTypeConstraint); } set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.NotNullableValueTypeConstraint, value); } } public bool HasDefaultConstructorConstraint { get { return attributes.GetAttributes ((ushort) GenericParameterAttributes.DefaultConstructorConstraint); } set { attributes = attributes.SetAttributes ((ushort) GenericParameterAttributes.DefaultConstructorConstraint, value); } } #endregion public GenericParameter (IGenericParameterProvider owner) : this (string.Empty, owner) { } public GenericParameter (string name, IGenericParameterProvider owner) : base (string.Empty, name) { if (owner == null) throw new ArgumentNullException (); this.owner = owner; this.etype = owner.GenericParameterType == GenericParameterType.Type ? ElementType.Var : ElementType.MVar; } public override TypeDefinition Resolve () { return null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/FieldDefinition.cs0000664000175000017500000002025512136523632032047 0ustar00directhexdirecthex00000000000000// // FieldDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class FieldDefinition : FieldReference, IMemberDefinition, IConstantProvider, IMarshalInfoProvider { ushort attributes; Collection custom_attributes; int offset = Mixin.NotResolvedMarker; internal int rva = Mixin.NotResolvedMarker; byte [] initial_value; object constant = Mixin.NotResolved; MarshalInfo marshal_info; void ResolveLayout () { if (offset != Mixin.NotResolvedMarker) return; if (!HasImage) { offset = Mixin.NoDataMarker; return; } offset = Module.Read (this, (field, reader) => reader.ReadFieldLayout (field)); } public bool HasLayoutInfo { get { if (offset >= 0) return true; ResolveLayout (); return offset >= 0; } } public int Offset { get { if (offset >= 0) return offset; ResolveLayout (); return offset >= 0 ? offset : -1; } set { offset = value; } } void ResolveRVA () { if (rva != Mixin.NotResolvedMarker) return; if (!HasImage) return; rva = Module.Read (this, (field, reader) => reader.ReadFieldRVA (field)); } public int RVA { get { if (rva > 0) return rva; ResolveRVA (); return rva > 0 ? rva : 0; } } public byte [] InitialValue { get { if (initial_value != null) return initial_value; ResolveRVA (); if (initial_value == null) initial_value = Empty.Array; return initial_value; } set { initial_value = value; } } public FieldAttributes Attributes { get { return (FieldAttributes) attributes; } set { attributes = (ushort) value; } } public bool HasConstant { get { ResolveConstant (); return constant != Mixin.NoValue; } set { if (!value) constant = Mixin.NoValue; } } public object Constant { get { return HasConstant ? constant : null; } set { constant = value; } } void ResolveConstant () { if (constant != Mixin.NotResolved) return; this.ResolveConstant (ref constant, Module); } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } public bool HasMarshalInfo { get { if (marshal_info != null) return true; return this.GetHasMarshalInfo (Module); } } public MarshalInfo MarshalInfo { get { return marshal_info ?? (marshal_info = this.GetMarshalInfo (Module)); } set { marshal_info = value; } } #region FieldAttributes public bool IsCompilerControlled { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.CompilerControlled); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.CompilerControlled, value); } } public bool IsPrivate { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Private); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Private, value); } } public bool IsFamilyAndAssembly { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.FamANDAssem); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.FamANDAssem, value); } } public bool IsAssembly { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Assembly); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Assembly, value); } } public bool IsFamily { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Family); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Family, value); } } public bool IsFamilyOrAssembly { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.FamORAssem); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.FamORAssem, value); } } public bool IsPublic { get { return attributes.GetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Public); } set { attributes = attributes.SetMaskedAttributes ((ushort) FieldAttributes.FieldAccessMask, (ushort) FieldAttributes.Public, value); } } public bool IsStatic { get { return attributes.GetAttributes ((ushort) FieldAttributes.Static); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.Static, value); } } public bool IsInitOnly { get { return attributes.GetAttributes ((ushort) FieldAttributes.InitOnly); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.InitOnly, value); } } public bool IsLiteral { get { return attributes.GetAttributes ((ushort) FieldAttributes.Literal); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.Literal, value); } } public bool IsNotSerialized { get { return attributes.GetAttributes ((ushort) FieldAttributes.NotSerialized); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.NotSerialized, value); } } public bool IsSpecialName { get { return attributes.GetAttributes ((ushort) FieldAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.SpecialName, value); } } public bool IsPInvokeImpl { get { return attributes.GetAttributes ((ushort) FieldAttributes.PInvokeImpl); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.PInvokeImpl, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((ushort) FieldAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.RTSpecialName, value); } } public bool HasDefault { get { return attributes.GetAttributes ((ushort) FieldAttributes.HasDefault); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.HasDefault, value); } } #endregion public override bool IsDefinition { get { return true; } } public new TypeDefinition DeclaringType { get { return (TypeDefinition) base.DeclaringType; } set { base.DeclaringType = value; } } public FieldDefinition (string name, FieldAttributes attributes, TypeReference fieldType) : base (name, fieldType) { this.attributes = (ushort) attributes; } public override FieldDefinition Resolve () { return this; } } static partial class Mixin { public const int NotResolvedMarker = -2; public const int NoDataMarker = -1; } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/DefaultAssemblyResolver.cs0000664000175000017500000000432312136523632033617 0ustar00directhexdirecthex00000000000000// // DefaultAssemblyResolver.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; namespace Mono.Cecil { public static class GlobalAssemblyResolver { public static readonly IAssemblyResolver Instance = new DefaultAssemblyResolver (); } public class DefaultAssemblyResolver : BaseAssemblyResolver { readonly IDictionary cache; public DefaultAssemblyResolver () { cache = new Dictionary (); } public override AssemblyDefinition Resolve (AssemblyNameReference name) { if (name == null) throw new ArgumentNullException ("name"); AssemblyDefinition assembly; if (cache.TryGetValue (name.FullName, out assembly)) return assembly; assembly = base.Resolve (name); cache [name.FullName] = assembly; return assembly; } protected void RegisterAssembly (AssemblyDefinition assembly) { if (assembly == null) throw new ArgumentNullException ("assembly"); var name = assembly.Name.FullName; if (cache.ContainsKey (name)) return; cache [name] = assembly; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodSpecification.cs0000664000175000017500000000565512136523632032743 0ustar00directhexdirecthex00000000000000// // MethodSpecification.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public abstract class MethodSpecification : MethodReference { readonly MethodReference method; public MethodReference ElementMethod { get { return method; } } public override string Name { get { return method.Name; } set { throw new InvalidOperationException (); } } public override MethodCallingConvention CallingConvention { get { return method.CallingConvention; } set { throw new InvalidOperationException (); } } public override bool HasThis { get { return method.HasThis; } set { throw new InvalidOperationException (); } } public override bool ExplicitThis { get { return method.ExplicitThis; } set { throw new InvalidOperationException (); } } public override MethodReturnType MethodReturnType { get { return method.MethodReturnType; } set { throw new InvalidOperationException (); } } public override TypeReference DeclaringType { get { return method.DeclaringType; } set { throw new InvalidOperationException (); } } public override ModuleDefinition Module { get { return method.Module; } } public override bool HasParameters { get { return method.HasParameters; } } public override Collection Parameters { get { return method.Parameters; } } internal override bool ContainsGenericParameter { get { return method.ContainsGenericParameter; } } internal MethodSpecification (MethodReference method) { if (method == null) throw new ArgumentNullException ("method"); this.method = method; this.token = new MetadataToken (TokenType.MethodSpec); } public sealed override MethodReference GetElementMethod () { return method.GetElementMethod (); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/EventReference.cs0000664000175000017500000000330212136523632031705 0ustar00directhexdirecthex00000000000000// // EventReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public abstract class EventReference : MemberReference { TypeReference event_type; public TypeReference EventType { get { return event_type; } set { event_type = value; } } public override string FullName { get { return event_type.FullName + " " + MemberFullName (); } } protected EventReference (string name, TypeReference eventType) : base (name) { if (eventType == null) throw new ArgumentNullException ("eventType"); event_type = eventType; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyWriter.cs0000664000175000017500000021150712136523632031771 0ustar00directhexdirecthex00000000000000// // AssemblyWriter.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.IO; using System.Text; using Mono.Collections.Generic; using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using Mono.Cecil.PE; using RVA = System.UInt32; using RID = System.UInt32; using CodedRID = System.UInt32; using StringIndex = System.UInt32; using BlobIndex = System.UInt32; namespace Mono.Cecil { #if !READ_ONLY using TypeRefRow = Row; using TypeDefRow = Row; using FieldRow = Row; using MethodRow = Row; using ParamRow = Row; using InterfaceImplRow = Row; using MemberRefRow = Row; using ConstantRow = Row; using CustomAttributeRow = Row; using FieldMarshalRow = Row; using DeclSecurityRow = Row; using ClassLayoutRow = Row; using FieldLayoutRow = Row; using EventMapRow = Row; using EventRow = Row; using PropertyMapRow = Row; using PropertyRow = Row; using MethodSemanticsRow = Row; using MethodImplRow = Row; using ImplMapRow = Row; using FieldRVARow = Row; using AssemblyRow = Row; using AssemblyRefRow = Row; using FileRow = Row; using ExportedTypeRow = Row; using ManifestResourceRow = Row; using NestedClassRow = Row; using GenericParamRow = Row; using MethodSpecRow = Row; using GenericParamConstraintRow = Row; static class ModuleWriter { public static void WriteModuleTo (ModuleDefinition module, Stream stream, WriterParameters parameters) { if ((module.Attributes & ModuleAttributes.ILOnly) == 0) throw new ArgumentException (); if (module.HasImage && module.ReadingMode == ReadingMode.Deferred) ImmediateModuleReader.ReadModule (module); module.MetadataSystem.Clear (); var name = module.assembly != null ? module.assembly.Name : null; var fq_name = stream.GetFullyQualifiedName (); var symbol_writer_provider = parameters.SymbolWriterProvider; if (symbol_writer_provider == null && parameters.WriteSymbols) symbol_writer_provider = SymbolProvider.GetPlatformWriterProvider (); var symbol_writer = GetSymbolWriter (module, fq_name, symbol_writer_provider); #if !SILVERLIGHT && !CF if (parameters.StrongNameKeyPair != null && name != null) name.PublicKey = parameters.StrongNameKeyPair.PublicKey; #endif if (name != null && name.HasPublicKey) module.Attributes |= ModuleAttributes.StrongNameSigned; var metadata = new MetadataBuilder (module, fq_name, symbol_writer_provider, symbol_writer); BuildMetadata (module, metadata); if (module.SymbolReader != null) module.SymbolReader.Dispose (); var writer = ImageWriter.CreateWriter (module, metadata, stream); writer.WriteImage (); #if !SILVERLIGHT && !CF if (parameters.StrongNameKeyPair != null) CryptoService.StrongName (stream, writer, parameters.StrongNameKeyPair); #endif if (symbol_writer != null) symbol_writer.Dispose (); } static void BuildMetadata (ModuleDefinition module, MetadataBuilder metadata) { if (!module.HasImage) { metadata.BuildMetadata (); return; } module.Read (metadata, (builder, _) => { builder.BuildMetadata (); return builder; }); } static ISymbolWriter GetSymbolWriter (ModuleDefinition module, string fq_name, ISymbolWriterProvider symbol_writer_provider) { if (symbol_writer_provider == null) return null; return symbol_writer_provider.GetSymbolWriter (module, fq_name); } } abstract class MetadataTable { public abstract int Length { get; } public bool IsLarge { get { return Length > 65535; } } public abstract void Write (TableHeapBuffer buffer); public abstract void Sort (); } abstract class OneRowTable : MetadataTable where TRow : struct { internal TRow row; public sealed override int Length { get { return 1; } } public sealed override void Sort () { } } abstract class MetadataTable : MetadataTable where TRow : struct { internal TRow [] rows = new TRow [2]; internal int length; public sealed override int Length { get { return length; } } public int AddRow (TRow row) { if (rows.Length == length) Grow (); rows [length++] = row; return length; } void Grow () { var rows = new TRow [this.rows.Length * 2]; Array.Copy (this.rows, rows, this.rows.Length); this.rows = rows; } public override void Sort () { } } abstract class SortedTable : MetadataTable, IComparer where TRow : struct { public sealed override void Sort () { Array.Sort (rows, 0, length, this); } protected int Compare (uint x, uint y) { return x == y ? 0 : x > y ? 1 : -1; } public abstract int Compare (TRow x, TRow y); } sealed class ModuleTable : OneRowTable { public override void Write (TableHeapBuffer buffer) { buffer.WriteUInt16 (0); // Generation buffer.WriteString (row); // Name buffer.WriteUInt16 (1); // Mvid buffer.WriteUInt16 (0); // EncId buffer.WriteUInt16 (0); // EncBaseId } } sealed class TypeRefTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteCodedRID ( rows [i].Col1, CodedIndex.ResolutionScope); // Scope buffer.WriteString (rows [i].Col2); // Name buffer.WriteString (rows [i].Col3); // Namespace } } } sealed class TypeDefTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 ((uint) rows [i].Col1); // Attributes buffer.WriteString (rows [i].Col2); // Name buffer.WriteString (rows [i].Col3); // Namespace buffer.WriteCodedRID ( rows [i].Col4, CodedIndex.TypeDefOrRef); // Extends buffer.WriteRID (rows [i].Col5, Table.Field); // FieldList buffer.WriteRID (rows [i].Col6, Table.Method); // MethodList } } } sealed class FieldTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Attributes buffer.WriteString (rows [i].Col2); // Name buffer.WriteBlob (rows [i].Col3); // Signature } } } sealed class MethodTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 (rows [i].Col1); // RVA buffer.WriteUInt16 ((ushort) rows [i].Col2); // ImplFlags buffer.WriteUInt16 ((ushort) rows [i].Col3); // Flags buffer.WriteString (rows [i].Col4); // Name buffer.WriteBlob (rows [i].Col5); // Signature buffer.WriteRID (rows [i].Col6, Table.Param); // ParamList } } } sealed class ParamTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Attributes buffer.WriteUInt16 (rows [i].Col2); // Sequence buffer.WriteString (rows [i].Col3); // Name } } } sealed class InterfaceImplTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.TypeDef); // Class buffer.WriteCodedRID (rows [i].Col2, CodedIndex.TypeDefOrRef); // Interface } } /*public override int Compare (InterfaceImplRow x, InterfaceImplRow y) { return (int) (x.Col1 == y.Col1 ? y.Col2 - x.Col2 : x.Col1 - y.Col1); }*/ } sealed class MemberRefTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteCodedRID (rows [i].Col1, CodedIndex.MemberRefParent); buffer.WriteString (rows [i].Col2); buffer.WriteBlob (rows [i].Col3); } } } sealed class ConstantTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); buffer.WriteCodedRID (rows [i].Col2, CodedIndex.HasConstant); buffer.WriteBlob (rows [i].Col3); } } public override int Compare (ConstantRow x, ConstantRow y) { return Compare (x.Col2, y.Col2); } } sealed class CustomAttributeTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteCodedRID (rows [i].Col1, CodedIndex.HasCustomAttribute); // Parent buffer.WriteCodedRID (rows [i].Col2, CodedIndex.CustomAttributeType); // Type buffer.WriteBlob (rows [i].Col3); } } public override int Compare (CustomAttributeRow x, CustomAttributeRow y) { return Compare (x.Col1, y.Col1); } } sealed class FieldMarshalTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteCodedRID (rows [i].Col1, CodedIndex.HasFieldMarshal); buffer.WriteBlob (rows [i].Col2); } } public override int Compare (FieldMarshalRow x, FieldMarshalRow y) { return Compare (x.Col1, y.Col1); } } sealed class DeclSecurityTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); buffer.WriteCodedRID (rows [i].Col2, CodedIndex.HasDeclSecurity); buffer.WriteBlob (rows [i].Col3); } } public override int Compare (DeclSecurityRow x, DeclSecurityRow y) { return Compare (x.Col2, y.Col2); } } sealed class ClassLayoutTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 (rows [i].Col1); // PackingSize buffer.WriteUInt32 (rows [i].Col2); // ClassSize buffer.WriteRID (rows [i].Col3, Table.TypeDef); // Parent } } public override int Compare (ClassLayoutRow x, ClassLayoutRow y) { return Compare (x.Col3, y.Col3); } } sealed class FieldLayoutTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 (rows [i].Col1); // Offset buffer.WriteRID (rows [i].Col2, Table.Field); // Parent } } public override int Compare (FieldLayoutRow x, FieldLayoutRow y) { return Compare (x.Col2, y.Col2); } } sealed class StandAloneSigTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) buffer.WriteBlob (rows [i]); } } sealed class EventMapTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.TypeDef); // Parent buffer.WriteRID (rows [i].Col2, Table.Event); // EventList } } } sealed class EventTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Flags buffer.WriteString (rows [i].Col2); // Name buffer.WriteCodedRID (rows [i].Col3, CodedIndex.TypeDefOrRef); // EventType } } } sealed class PropertyMapTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.TypeDef); // Parent buffer.WriteRID (rows [i].Col2, Table.Property); // PropertyList } } } sealed class PropertyTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Flags buffer.WriteString (rows [i].Col2); // Name buffer.WriteBlob (rows [i].Col3); // Type } } } sealed class MethodSemanticsTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Flags buffer.WriteRID (rows [i].Col2, Table.Method); // Method buffer.WriteCodedRID (rows [i].Col3, CodedIndex.HasSemantics); // Association } } public override int Compare (MethodSemanticsRow x, MethodSemanticsRow y) { return Compare (x.Col3, y.Col3); } } sealed class MethodImplTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.TypeDef); // Class buffer.WriteCodedRID (rows [i].Col2, CodedIndex.MethodDefOrRef); // MethodBody buffer.WriteCodedRID (rows [i].Col3, CodedIndex.MethodDefOrRef); // MethodDeclaration } } } sealed class ModuleRefTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) buffer.WriteString (rows [i]); // Name } } sealed class TypeSpecTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) buffer.WriteBlob (rows [i]); // Signature } } sealed class ImplMapTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 ((ushort) rows [i].Col1); // Flags buffer.WriteCodedRID (rows [i].Col2, CodedIndex.MemberForwarded); // MemberForwarded buffer.WriteString (rows [i].Col3); // ImportName buffer.WriteRID (rows [i].Col4, Table.ModuleRef); // ImportScope } } public override int Compare (ImplMapRow x, ImplMapRow y) { return Compare (x.Col2, y.Col2); } } sealed class FieldRVATable : SortedTable { internal int position; public override void Write (TableHeapBuffer buffer) { position = buffer.position; for (int i = 0; i < length; i++) { buffer.WriteUInt32 (rows [i].Col1); // RVA buffer.WriteRID (rows [i].Col2, Table.Field); // Field } } public override int Compare (FieldRVARow x, FieldRVARow y) { return Compare (x.Col2, y.Col2); } } sealed class AssemblyTable : OneRowTable { public override void Write (TableHeapBuffer buffer) { buffer.WriteUInt32 ((uint) row.Col1); // AssemblyHashAlgorithm buffer.WriteUInt16 (row.Col2); // MajorVersion buffer.WriteUInt16 (row.Col3); // MinorVersion buffer.WriteUInt16 (row.Col4); // Build buffer.WriteUInt16 (row.Col5); // Revision buffer.WriteUInt32 ((uint) row.Col6); // Flags buffer.WriteBlob (row.Col7); // PublicKey buffer.WriteString (row.Col8); // Name buffer.WriteString (row.Col9); // Culture } } sealed class AssemblyRefTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 (rows [i].Col1); // MajorVersion buffer.WriteUInt16 (rows [i].Col2); // MinorVersion buffer.WriteUInt16 (rows [i].Col3); // Build buffer.WriteUInt16 (rows [i].Col4); // Revision buffer.WriteUInt32 ((uint) rows [i].Col5); // Flags buffer.WriteBlob (rows [i].Col6); // PublicKeyOrToken buffer.WriteString (rows [i].Col7); // Name buffer.WriteString (rows [i].Col8); // Culture buffer.WriteBlob (rows [i].Col9); // Hash } } } sealed class FileTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 ((uint) rows [i].Col1); buffer.WriteString (rows [i].Col2); buffer.WriteBlob (rows [i].Col3); } } } sealed class ExportedTypeTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 ((uint) rows [i].Col1); buffer.WriteUInt32 (rows [i].Col2); buffer.WriteString (rows [i].Col3); buffer.WriteString (rows [i].Col4); buffer.WriteCodedRID (rows [i].Col5, CodedIndex.Implementation); } } } sealed class ManifestResourceTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt32 (rows [i].Col1); buffer.WriteUInt32 ((uint) rows [i].Col2); buffer.WriteString (rows [i].Col3); buffer.WriteCodedRID (rows [i].Col4, CodedIndex.Implementation); } } } sealed class NestedClassTable : SortedTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.TypeDef); // NestedClass buffer.WriteRID (rows [i].Col2, Table.TypeDef); // EnclosingClass } } public override int Compare (NestedClassRow x, NestedClassRow y) { return Compare (x.Col1, y.Col1); } } sealed class GenericParamTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteUInt16 (rows [i].Col1); // Number buffer.WriteUInt16 ((ushort) rows [i].Col2); // Flags buffer.WriteCodedRID (rows [i].Col3, CodedIndex.TypeOrMethodDef); // Owner buffer.WriteString (rows [i].Col4); // Name } } } sealed class MethodSpecTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteCodedRID (rows [i].Col1, CodedIndex.MethodDefOrRef); // Method buffer.WriteBlob (rows [i].Col2); // Instantiation } } } sealed class GenericParamConstraintTable : MetadataTable { public override void Write (TableHeapBuffer buffer) { for (int i = 0; i < length; i++) { buffer.WriteRID (rows [i].Col1, Table.GenericParam); // Owner buffer.WriteCodedRID (rows [i].Col2, CodedIndex.TypeDefOrRef); // Constraint } } } sealed class MetadataBuilder { readonly internal ModuleDefinition module; readonly internal ISymbolWriterProvider symbol_writer_provider; readonly internal ISymbolWriter symbol_writer; readonly internal TextMap text_map; readonly internal string fq_name; readonly Dictionary type_ref_map; readonly Dictionary type_spec_map; readonly Dictionary member_ref_map; readonly Dictionary method_spec_map; readonly Collection generic_parameters; readonly Dictionary method_def_map; readonly internal CodeWriter code; readonly internal DataBuffer data; readonly internal ResourceBuffer resources; readonly internal StringHeapBuffer string_heap; readonly internal UserStringHeapBuffer user_string_heap; readonly internal BlobHeapBuffer blob_heap; readonly internal TableHeapBuffer table_heap; internal MetadataToken entry_point; RID type_rid = 1; RID field_rid = 1; RID method_rid = 1; RID param_rid = 1; RID property_rid = 1; RID event_rid = 1; readonly TypeRefTable type_ref_table; readonly TypeDefTable type_def_table; readonly FieldTable field_table; readonly MethodTable method_table; readonly ParamTable param_table; readonly InterfaceImplTable iface_impl_table; readonly MemberRefTable member_ref_table; readonly ConstantTable constant_table; readonly CustomAttributeTable custom_attribute_table; readonly DeclSecurityTable declsec_table; readonly StandAloneSigTable standalone_sig_table; readonly EventMapTable event_map_table; readonly EventTable event_table; readonly PropertyMapTable property_map_table; readonly PropertyTable property_table; readonly TypeSpecTable typespec_table; readonly MethodSpecTable method_spec_table; readonly internal bool write_symbols; public MetadataBuilder (ModuleDefinition module, string fq_name, ISymbolWriterProvider symbol_writer_provider, ISymbolWriter symbol_writer) { this.module = module; this.text_map = CreateTextMap (); this.fq_name = fq_name; this.symbol_writer_provider = symbol_writer_provider; this.symbol_writer = symbol_writer; this.write_symbols = symbol_writer != null; this.code = new CodeWriter (this); this.data = new DataBuffer (); this.resources = new ResourceBuffer (); this.string_heap = new StringHeapBuffer (); this.user_string_heap = new UserStringHeapBuffer (); this.blob_heap = new BlobHeapBuffer (); this.table_heap = new TableHeapBuffer (module, this); this.type_ref_table = GetTable (Table.TypeRef); this.type_def_table = GetTable (Table.TypeDef); this.field_table = GetTable (Table.Field); this.method_table = GetTable (Table.Method); this.param_table = GetTable (Table.Param); this.iface_impl_table = GetTable (Table.InterfaceImpl); this.member_ref_table = GetTable (Table.MemberRef); this.constant_table = GetTable (Table.Constant); this.custom_attribute_table = GetTable (Table.CustomAttribute); this.declsec_table = GetTable (Table.DeclSecurity); this.standalone_sig_table = GetTable (Table.StandAloneSig); this.event_map_table = GetTable (Table.EventMap); this.event_table = GetTable (Table.Event); this.property_map_table = GetTable (Table.PropertyMap); this.property_table = GetTable (Table.Property); this.typespec_table = GetTable (Table.TypeSpec); this.method_spec_table = GetTable (Table.MethodSpec); var row_equality_comparer = new RowEqualityComparer (); type_ref_map = new Dictionary (row_equality_comparer); type_spec_map = new Dictionary (); member_ref_map = new Dictionary (row_equality_comparer); method_spec_map = new Dictionary (row_equality_comparer); generic_parameters = new Collection (); if (write_symbols) method_def_map = new Dictionary (); } TextMap CreateTextMap () { var map = new TextMap (); map.AddMap (TextSegment.ImportAddressTable, module.Architecture == TargetArchitecture.I386 ? 8 : 16); map.AddMap (TextSegment.CLIHeader, 0x48, 8); return map; } TTable GetTable (Table table) where TTable : MetadataTable, new () { return table_heap.GetTable (table); } uint GetStringIndex (string @string) { if (string.IsNullOrEmpty (@string)) return 0; return string_heap.GetStringIndex (@string); } uint GetBlobIndex (ByteBuffer blob) { if (blob.length == 0) return 0; return blob_heap.GetBlobIndex (blob); } uint GetBlobIndex (byte [] blob) { if (blob.IsNullOrEmpty ()) return 0; return GetBlobIndex (new ByteBuffer (blob)); } public void BuildMetadata () { BuildModule (); table_heap.WriteTableHeap (); } void BuildModule () { var table = GetTable (Table.Module); table.row = GetStringIndex (module.Name); var assembly = module.Assembly; if (assembly != null) BuildAssembly (); if (module.HasAssemblyReferences) AddAssemblyReferences (); if (module.HasModuleReferences) AddModuleReferences (); if (module.HasResources) AddResources (); if (module.HasExportedTypes) AddExportedTypes (); BuildTypes (); if (assembly != null) { if (assembly.HasCustomAttributes) AddCustomAttributes (assembly); if (assembly.HasSecurityDeclarations) AddSecurityDeclarations (assembly); } if (module.HasCustomAttributes) AddCustomAttributes (module); if (module.EntryPoint != null) entry_point = LookupToken (module.EntryPoint); } void BuildAssembly () { var assembly = module.Assembly; var name = assembly.Name; var table = GetTable (Table.Assembly); table.row = new AssemblyRow ( name.HashAlgorithm, (ushort) name.Version.Major, (ushort) name.Version.Minor, (ushort) name.Version.Build, (ushort) name.Version.Revision, name.Attributes, GetBlobIndex (name.PublicKey), GetStringIndex (name.Name), GetStringIndex (name.Culture)); if (assembly.Modules.Count > 1) BuildModules (); } void BuildModules () { var modules = this.module.Assembly.Modules; var table = GetTable (Table.File); for (int i = 0; i < modules.Count; i++) { var module = modules [i]; if (module.IsMain) continue; var parameters = new WriterParameters { SymbolWriterProvider = symbol_writer_provider, }; var file_name = GetModuleFileName (module.Name); module.Write (file_name, parameters); var hash = CryptoService.ComputeHash (file_name); table.AddRow (new FileRow ( FileAttributes.ContainsMetaData, GetStringIndex (module.Name), GetBlobIndex (hash))); } } string GetModuleFileName (string name) { if (string.IsNullOrEmpty (name)) throw new NotSupportedException (); var path = Path.GetDirectoryName (fq_name); return Path.Combine (path, name); } void AddAssemblyReferences () { var references = module.AssemblyReferences; var table = GetTable (Table.AssemblyRef); for (int i = 0; i < references.Count; i++) { var reference = references [i]; var key_or_token = reference.PublicKey.IsNullOrEmpty () ? reference.PublicKeyToken : reference.PublicKey; var rid = table.AddRow (new AssemblyRefRow ( (ushort) reference.Version.Major, (ushort) reference.Version.Minor, (ushort) reference.Version.Build, (ushort) reference.Version.Revision, reference.Attributes, GetBlobIndex (key_or_token), GetStringIndex (reference.Name), GetStringIndex (reference.Culture), GetBlobIndex (reference.Hash))); reference.token = new MetadataToken (TokenType.AssemblyRef, rid); } } void AddModuleReferences () { var references = module.ModuleReferences; var table = GetTable (Table.ModuleRef); for (int i = 0; i < references.Count; i++) { var reference = references [i]; reference.token = new MetadataToken ( TokenType.ModuleRef, table.AddRow (GetStringIndex (reference.Name))); } } void AddResources () { var resources = module.Resources; var table = GetTable (Table.ManifestResource); for (int i = 0; i < resources.Count; i++) { var resource = resources [i]; var row = new ManifestResourceRow ( 0, resource.Attributes, GetStringIndex (resource.Name), 0); switch (resource.ResourceType) { case ResourceType.Embedded: row.Col1 = AddEmbeddedResource ((EmbeddedResource) resource); break; case ResourceType.Linked: row.Col4 = CodedIndex.Implementation.CompressMetadataToken ( new MetadataToken ( TokenType.File, AddLinkedResource ((LinkedResource) resource))); break; case ResourceType.AssemblyLinked: row.Col4 = CodedIndex.Implementation.CompressMetadataToken ( ((AssemblyLinkedResource) resource).Assembly.MetadataToken); break; default: throw new NotSupportedException (); } table.AddRow (row); } } uint AddLinkedResource (LinkedResource resource) { var table = GetTable (Table.File); var hash = resource.Hash.IsNullOrEmpty () ? CryptoService.ComputeHash (resource.File) : resource.Hash; return (uint) table.AddRow (new FileRow ( FileAttributes.ContainsNoMetaData, GetStringIndex (resource.File), GetBlobIndex (hash))); } uint AddEmbeddedResource (EmbeddedResource resource) { return resources.AddResource (resource.GetResourceData ()); } void AddExportedTypes () { var exported_types = module.ExportedTypes; var table = GetTable (Table.ExportedType); for (int i = 0; i < exported_types.Count; i++) { var exported_type = exported_types [i]; var rid = table.AddRow (new ExportedTypeRow ( exported_type.Attributes, (uint) exported_type.Identifier, GetStringIndex (exported_type.Name), GetStringIndex (exported_type.Namespace), MakeCodedRID (GetExportedTypeScope (exported_type), CodedIndex.Implementation))); exported_type.token = new MetadataToken (TokenType.ExportedType, rid); } } MetadataToken GetExportedTypeScope (ExportedType exported_type) { if (exported_type.DeclaringType != null) return exported_type.DeclaringType.MetadataToken; var scope = exported_type.Scope; switch (scope.MetadataToken.TokenType) { case TokenType.AssemblyRef: return scope.MetadataToken; case TokenType.ModuleRef: var file_table = GetTable (Table.File); for (int i = 0; i < file_table.length; i++) if (file_table.rows [i].Col2 == GetStringIndex (scope.Name)) return new MetadataToken (TokenType.File, i + 1); break; } throw new NotSupportedException (); } void BuildTypes () { if (!module.HasTypes) return; AttachTokens (); AddTypeDefs (); AddGenericParameters (); } void AttachTokens () { var types = module.Types; for (int i = 0; i < types.Count; i++) AttachTypeDefToken (types [i]); } void AttachTypeDefToken (TypeDefinition type) { type.token = new MetadataToken (TokenType.TypeDef, type_rid++); type.fields_range.Start = field_rid; type.methods_range.Start = method_rid; if (type.HasFields) AttachFieldsDefToken (type); if (type.HasMethods) AttachMethodsDefToken (type); if (type.HasNestedTypes) AttachNestedTypesDefToken (type); } void AttachNestedTypesDefToken (TypeDefinition type) { var nested_types = type.NestedTypes; for (int i = 0; i < nested_types.Count; i++) AttachTypeDefToken (nested_types [i]); } void AttachFieldsDefToken (TypeDefinition type) { var fields = type.Fields; type.fields_range.Length = (uint) fields.Count; for (int i = 0; i < fields.Count; i++) fields [i].token = new MetadataToken (TokenType.Field, field_rid++); } void AttachMethodsDefToken (TypeDefinition type) { var methods = type.Methods; type.methods_range.Length = (uint) methods.Count; for (int i = 0; i < methods.Count; i++) { var method = methods [i]; var new_token = new MetadataToken (TokenType.Method, method_rid++); if (write_symbols && method.token != MetadataToken.Zero) method_def_map.Add (new_token, method.token); method.token = new_token; } } public bool TryGetOriginalMethodToken (MetadataToken new_token, out MetadataToken original) { return method_def_map.TryGetValue (new_token, out original); } MetadataToken GetTypeToken (TypeReference type) { if (type == null) return MetadataToken.Zero; if (type.IsDefinition) return type.token; if (type.IsTypeSpecification ()) return GetTypeSpecToken (type); return GetTypeRefToken (type); } MetadataToken GetTypeSpecToken (TypeReference type) { var row = GetBlobIndex (GetTypeSpecSignature (type)); MetadataToken token; if (type_spec_map.TryGetValue (row, out token)) return token; return AddTypeSpecification (type, row); } MetadataToken AddTypeSpecification (TypeReference type, uint row) { type.token = new MetadataToken (TokenType.TypeSpec, typespec_table.AddRow (row)); var token = type.token; type_spec_map.Add (row, token); return token; } MetadataToken GetTypeRefToken (TypeReference type) { var row = CreateTypeRefRow (type); MetadataToken token; if (type_ref_map.TryGetValue (row, out token)) return token; return AddTypeReference (type, row); } TypeRefRow CreateTypeRefRow (TypeReference type) { var scope_token = type.IsNested ? GetTypeRefToken (type.DeclaringType) : type.Scope.MetadataToken; return new TypeRefRow ( MakeCodedRID (scope_token, CodedIndex.ResolutionScope), GetStringIndex (type.Name), GetStringIndex (type.Namespace)); } static CodedRID MakeCodedRID (IMetadataTokenProvider provider, CodedIndex index) { return MakeCodedRID (provider.MetadataToken, index); } static CodedRID MakeCodedRID (MetadataToken token, CodedIndex index) { return index.CompressMetadataToken (token); } MetadataToken AddTypeReference (TypeReference type, TypeRefRow row) { type.token = new MetadataToken (TokenType.TypeRef, type_ref_table.AddRow (row)); var token = type.token; type_ref_map.Add (row, token); return token; } void AddTypeDefs () { var types = module.Types; for (int i = 0; i < types.Count; i++) AddType (types [i]); } void AddType (TypeDefinition type) { type_def_table.AddRow (new TypeDefRow ( type.Attributes, GetStringIndex (type.Name), GetStringIndex (type.Namespace), MakeCodedRID (GetTypeToken (type.BaseType), CodedIndex.TypeDefOrRef), type.fields_range.Start, type.methods_range.Start)); if (type.HasGenericParameters) AddGenericParameters (type); if (type.HasInterfaces) AddInterfaces (type); if (type.HasLayoutInfo) AddLayoutInfo (type); if (type.HasFields) AddFields (type); if (type.HasMethods) AddMethods (type); if (type.HasProperties) AddProperties (type); if (type.HasEvents) AddEvents (type); if (type.HasCustomAttributes) AddCustomAttributes (type); if (type.HasSecurityDeclarations) AddSecurityDeclarations (type); if (type.HasNestedTypes) AddNestedTypes (type); } void AddGenericParameters (IGenericParameterProvider owner) { var parameters = owner.GenericParameters; for (int i = 0; i < parameters.Count; i++) generic_parameters.Add (parameters [i]); } sealed class GenericParameterComparer : IComparer { public int Compare (GenericParameter a, GenericParameter b) { var a_owner = MakeCodedRID (a.Owner, CodedIndex.TypeOrMethodDef); var b_owner = MakeCodedRID (b.Owner, CodedIndex.TypeOrMethodDef); if (a_owner == b_owner) { var a_pos = a.Position; var b_pos = b.Position; return a_pos == b_pos ? 0 : a_pos > b_pos ? 1 : -1; } return a_owner > b_owner ? 1 : -1; } } void AddGenericParameters () { var items = this.generic_parameters.items; var size = this.generic_parameters.size; Array.Sort (items, 0, size, new GenericParameterComparer ()); var generic_param_table = GetTable (Table.GenericParam); var generic_param_constraint_table = GetTable (Table.GenericParamConstraint); for (int i = 0; i < size; i++) { var generic_parameter = items [i]; var rid = generic_param_table.AddRow (new GenericParamRow ( (ushort) generic_parameter.Position, generic_parameter.Attributes, MakeCodedRID (generic_parameter.Owner, CodedIndex.TypeOrMethodDef), GetStringIndex (generic_parameter.Name))); generic_parameter.token = new MetadataToken (TokenType.GenericParam, rid); if (generic_parameter.HasConstraints) AddConstraints (generic_parameter, generic_param_constraint_table); if (generic_parameter.HasCustomAttributes) AddCustomAttributes (generic_parameter); } } void AddConstraints (GenericParameter generic_parameter, GenericParamConstraintTable table) { var constraints = generic_parameter.Constraints; var rid = generic_parameter.token.RID; for (int i = 0; i < constraints.Count; i++) table.AddRow (new GenericParamConstraintRow ( rid, MakeCodedRID (GetTypeToken (constraints [i]), CodedIndex.TypeDefOrRef))); } void AddInterfaces (TypeDefinition type) { var interfaces = type.Interfaces; var type_rid = type.token.RID; for (int i = 0; i < interfaces.Count; i++) iface_impl_table.AddRow (new InterfaceImplRow ( type_rid, MakeCodedRID (GetTypeToken (interfaces [i]), CodedIndex.TypeDefOrRef))); } void AddLayoutInfo (TypeDefinition type) { var table = GetTable (Table.ClassLayout); table.AddRow (new ClassLayoutRow ( (ushort) type.PackingSize, (uint) type.ClassSize, type.token.RID)); } void AddNestedTypes (TypeDefinition type) { var nested_types = type.NestedTypes; var nested_table = GetTable (Table.NestedClass); for (int i = 0; i < nested_types.Count; i++) { var nested = nested_types [i]; AddType (nested); nested_table.AddRow (new NestedClassRow (nested.token.RID, type.token.RID)); } } void AddFields (TypeDefinition type) { var fields = type.Fields; for (int i = 0; i < fields.Count; i++) AddField (fields [i]); } void AddField (FieldDefinition field) { field_table.AddRow (new FieldRow ( field.Attributes, GetStringIndex (field.Name), GetBlobIndex (GetFieldSignature (field)))); if (!field.InitialValue.IsNullOrEmpty ()) AddFieldRVA (field); if (field.HasLayoutInfo) AddFieldLayout (field); if (field.HasCustomAttributes) AddCustomAttributes (field); if (field.HasConstant) AddConstant (field, field.FieldType); if (field.HasMarshalInfo) AddMarshalInfo (field); } void AddFieldRVA (FieldDefinition field) { var table = GetTable (Table.FieldRVA); table.AddRow (new FieldRVARow ( data.AddData (field.InitialValue), field.token.RID)); } void AddFieldLayout (FieldDefinition field) { var table = GetTable (Table.FieldLayout); table.AddRow (new FieldLayoutRow ((uint) field.Offset, field.token.RID)); } void AddMethods (TypeDefinition type) { var methods = type.Methods; for (int i = 0; i < methods.Count; i++) AddMethod (methods [i]); } void AddMethod (MethodDefinition method) { method_table.AddRow (new MethodRow ( method.HasBody ? code.WriteMethodBody (method) : 0, method.ImplAttributes, method.Attributes, GetStringIndex (method.Name), GetBlobIndex (GetMethodSignature (method)), param_rid)); AddParameters (method); if (method.HasGenericParameters) AddGenericParameters (method); if (method.IsPInvokeImpl) AddPInvokeInfo (method); if (method.HasCustomAttributes) AddCustomAttributes (method); if (method.HasSecurityDeclarations) AddSecurityDeclarations (method); if (method.HasOverrides) AddOverrides (method); } void AddParameters (MethodDefinition method) { var return_parameter = method.MethodReturnType.parameter; if (return_parameter != null && RequiresParameterRow (return_parameter)) AddParameter (0, return_parameter, param_table); if (!method.HasParameters) return; var parameters = method.Parameters; for (int i = 0; i < parameters.Count; i++) { var parameter = parameters [i]; if (!RequiresParameterRow (parameter)) continue; AddParameter ((ushort) (i + 1), parameter, param_table); } } void AddPInvokeInfo (MethodDefinition method) { var pinvoke = method.PInvokeInfo; if (pinvoke == null) throw new ArgumentException (); var table = GetTable (Table.ImplMap); table.AddRow (new ImplMapRow ( pinvoke.Attributes, MakeCodedRID (method, CodedIndex.MemberForwarded), GetStringIndex (pinvoke.EntryPoint), pinvoke.Module.MetadataToken.RID)); } void AddOverrides (MethodDefinition method) { var overrides = method.Overrides; var table = GetTable (Table.MethodImpl); for (int i = 0; i < overrides.Count; i++) { table.AddRow (new MethodImplRow ( method.DeclaringType.token.RID, MakeCodedRID (method, CodedIndex.MethodDefOrRef), MakeCodedRID (LookupToken (overrides [i]), CodedIndex.MethodDefOrRef))); } } static bool RequiresParameterRow (ParameterDefinition parameter) { return !string.IsNullOrEmpty (parameter.Name) || parameter.Attributes != ParameterAttributes.None || parameter.HasMarshalInfo || parameter.HasConstant || parameter.HasCustomAttributes; } void AddParameter (ushort sequence, ParameterDefinition parameter, ParamTable table) { table.AddRow (new ParamRow ( parameter.Attributes, sequence, GetStringIndex (parameter.Name))); parameter.token = new MetadataToken (TokenType.Param, param_rid++); if (parameter.HasCustomAttributes) AddCustomAttributes (parameter); if (parameter.HasConstant) AddConstant (parameter, parameter.ParameterType); if (parameter.HasMarshalInfo) AddMarshalInfo (parameter); } void AddMarshalInfo (IMarshalInfoProvider owner) { var table = GetTable (Table.FieldMarshal); table.AddRow (new FieldMarshalRow ( MakeCodedRID (owner, CodedIndex.HasFieldMarshal), GetBlobIndex (GetMarshalInfoSignature (owner)))); } void AddProperties (TypeDefinition type) { var properties = type.Properties; property_map_table.AddRow (new PropertyMapRow (type.token.RID, property_rid)); for (int i = 0; i < properties.Count; i++) AddProperty (properties [i]); } void AddProperty (PropertyDefinition property) { property_table.AddRow (new PropertyRow ( property.Attributes, GetStringIndex (property.Name), GetBlobIndex (GetPropertySignature (property)))); property.token = new MetadataToken (TokenType.Property, property_rid++); var method = property.GetMethod; if (method != null) AddSemantic (MethodSemanticsAttributes.Getter, property, method); method = property.SetMethod; if (method != null) AddSemantic (MethodSemanticsAttributes.Setter, property, method); if (property.HasOtherMethods) AddOtherSemantic (property, property.OtherMethods); if (property.HasCustomAttributes) AddCustomAttributes (property); if (property.HasConstant) AddConstant (property, property.PropertyType); } void AddOtherSemantic (IMetadataTokenProvider owner, Collection others) { for (int i = 0; i < others.Count; i++) AddSemantic (MethodSemanticsAttributes.Other, owner, others [i]); } void AddEvents (TypeDefinition type) { var events = type.Events; event_map_table.AddRow (new EventMapRow (type.token.RID, event_rid)); for (int i = 0; i < events.Count; i++) AddEvent (events [i]); } void AddEvent (EventDefinition @event) { event_table.AddRow (new EventRow ( @event.Attributes, GetStringIndex (@event.Name), MakeCodedRID (GetTypeToken (@event.EventType), CodedIndex.TypeDefOrRef))); @event.token = new MetadataToken (TokenType.Event, event_rid++); var method = @event.AddMethod; if (method != null) AddSemantic (MethodSemanticsAttributes.AddOn, @event, method); method = @event.InvokeMethod; if (method != null) AddSemantic (MethodSemanticsAttributes.Fire, @event, method); method = @event.RemoveMethod; if (method != null) AddSemantic (MethodSemanticsAttributes.RemoveOn, @event, method); if (@event.HasOtherMethods) AddOtherSemantic (@event, @event.OtherMethods); if (@event.HasCustomAttributes) AddCustomAttributes (@event); } void AddSemantic (MethodSemanticsAttributes semantics, IMetadataTokenProvider provider, MethodDefinition method) { method.SemanticsAttributes = semantics; var table = GetTable (Table.MethodSemantics); table.AddRow (new MethodSemanticsRow ( semantics, method.token.RID, MakeCodedRID (provider, CodedIndex.HasSemantics))); } void AddConstant (IConstantProvider owner, TypeReference type) { var constant = owner.Constant; var etype = GetConstantType (type, constant); constant_table.AddRow (new ConstantRow ( etype, MakeCodedRID (owner.MetadataToken, CodedIndex.HasConstant), GetBlobIndex (GetConstantSignature (etype, constant)))); } static ElementType GetConstantType (TypeReference constant_type, object constant) { if (constant == null) return ElementType.Class; var etype = constant_type.etype; switch (etype) { case ElementType.None: var type = constant_type.CheckedResolve (); if (type.IsEnum) return GetConstantType (type.GetEnumUnderlyingType (), constant); return ElementType.Class; case ElementType.String: return ElementType.String; case ElementType.Object: return GetConstantType (constant.GetType ()); case ElementType.Array: case ElementType.SzArray: case ElementType.MVar: case ElementType.Var: return ElementType.Class; case ElementType.GenericInst: case ElementType.CModOpt: case ElementType.CModReqD: case ElementType.ByRef: case ElementType.Sentinel: return GetConstantType (((TypeSpecification) constant_type).ElementType, constant); case ElementType.Boolean: case ElementType.Char: case ElementType.I: case ElementType.I1: case ElementType.I2: case ElementType.I4: case ElementType.I8: case ElementType.U: case ElementType.U1: case ElementType.U2: case ElementType.U4: case ElementType.U8: case ElementType.R4: case ElementType.R8: return GetConstantType (constant.GetType ()); default: return etype; } } static ElementType GetConstantType (Type type) { switch (Type.GetTypeCode (type)) { case TypeCode.Boolean: return ElementType.Boolean; case TypeCode.Byte: return ElementType.U1; case TypeCode.SByte: return ElementType.I1; case TypeCode.Char: return ElementType.Char; case TypeCode.Int16: return ElementType.I2; case TypeCode.UInt16: return ElementType.U2; case TypeCode.Int32: return ElementType.I4; case TypeCode.UInt32: return ElementType.U4; case TypeCode.Int64: return ElementType.I8; case TypeCode.UInt64: return ElementType.U8; case TypeCode.Single: return ElementType.R4; case TypeCode.Double: return ElementType.R8; case TypeCode.String: return ElementType.String; default: throw new NotSupportedException (type.FullName); } } void AddCustomAttributes (ICustomAttributeProvider owner) { var custom_attributes = owner.CustomAttributes; for (int i = 0; i < custom_attributes.Count; i++) { var attribute = custom_attributes [i]; custom_attribute_table.AddRow (new CustomAttributeRow ( MakeCodedRID (owner, CodedIndex.HasCustomAttribute), MakeCodedRID (LookupToken (attribute.Constructor), CodedIndex.CustomAttributeType), GetBlobIndex (GetCustomAttributeSignature (attribute)))); } } void AddSecurityDeclarations (ISecurityDeclarationProvider owner) { var declarations = owner.SecurityDeclarations; for (int i = 0; i < declarations.Count; i++) { var declaration = declarations [i]; declsec_table.AddRow (new DeclSecurityRow ( declaration.Action, MakeCodedRID (owner, CodedIndex.HasDeclSecurity), GetBlobIndex (GetSecurityDeclarationSignature (declaration)))); } } MetadataToken GetMemberRefToken (MemberReference member) { var row = CreateMemberRefRow (member); MetadataToken token; if (member_ref_map.TryGetValue (row, out token)) return token; AddMemberReference (member, row); return member.token; } MemberRefRow CreateMemberRefRow (MemberReference member) { return new MemberRefRow ( MakeCodedRID (GetTypeToken (member.DeclaringType), CodedIndex.MemberRefParent), GetStringIndex (member.Name), GetBlobIndex (GetMemberRefSignature (member))); } void AddMemberReference (MemberReference member, MemberRefRow row) { member.token = new MetadataToken (TokenType.MemberRef, member_ref_table.AddRow (row)); member_ref_map.Add (row, member.token); } MetadataToken GetMethodSpecToken (MethodSpecification method_spec) { var row = CreateMethodSpecRow (method_spec); MetadataToken token; if (method_spec_map.TryGetValue (row, out token)) return token; AddMethodSpecification (method_spec, row); return method_spec.token; } void AddMethodSpecification (MethodSpecification method_spec, MethodSpecRow row) { method_spec.token = new MetadataToken (TokenType.MethodSpec, method_spec_table.AddRow (row)); method_spec_map.Add (row, method_spec.token); } MethodSpecRow CreateMethodSpecRow (MethodSpecification method_spec) { return new MethodSpecRow ( MakeCodedRID (LookupToken (method_spec.ElementMethod), CodedIndex.MethodDefOrRef), GetBlobIndex (GetMethodSpecSignature (method_spec))); } SignatureWriter CreateSignatureWriter () { return new SignatureWriter (this); } SignatureWriter GetMethodSpecSignature (MethodSpecification method_spec) { if (!method_spec.IsGenericInstance) throw new NotSupportedException (); var generic_instance = (GenericInstanceMethod) method_spec; var signature = CreateSignatureWriter (); signature.WriteByte (0x0a); signature.WriteGenericInstanceSignature (generic_instance); return signature; } public uint AddStandAloneSignature (uint signature) { return (uint) standalone_sig_table.AddRow (signature); } public uint GetLocalVariableBlobIndex (Collection variables) { return GetBlobIndex (GetVariablesSignature (variables)); } public uint GetCallSiteBlobIndex (CallSite call_site) { return GetBlobIndex (GetMethodSignature (call_site)); } SignatureWriter GetVariablesSignature (Collection variables) { var signature = CreateSignatureWriter (); signature.WriteByte (0x7); signature.WriteCompressedUInt32 ((uint) variables.Count); for (int i = 0; i < variables.Count; i++) signature.WriteTypeSignature (variables [i].VariableType); return signature; } SignatureWriter GetFieldSignature (FieldReference field) { var signature = CreateSignatureWriter (); signature.WriteByte (0x6); signature.WriteTypeSignature (field.FieldType); return signature; } SignatureWriter GetMethodSignature (IMethodSignature method) { var signature = CreateSignatureWriter (); signature.WriteMethodSignature (method); return signature; } SignatureWriter GetMemberRefSignature (MemberReference member) { var field = member as FieldReference; if (field != null) return GetFieldSignature (field); var method = member as MethodReference; if (method != null) return GetMethodSignature (method); throw new NotSupportedException (); } SignatureWriter GetPropertySignature (PropertyDefinition property) { var signature = CreateSignatureWriter (); byte calling_convention = 0x8; if (property.HasThis) calling_convention |= 0x20; uint param_count = 0; Collection parameters = null; if (property.HasParameters) { parameters = property.Parameters; param_count = (uint) parameters.Count; } signature.WriteByte (calling_convention); signature.WriteCompressedUInt32 (param_count); signature.WriteTypeSignature (property.PropertyType); if (param_count == 0) return signature; for (int i = 0; i < param_count; i++) signature.WriteTypeSignature (parameters [i].ParameterType); return signature; } SignatureWriter GetTypeSpecSignature (TypeReference type) { var signature = CreateSignatureWriter (); signature.WriteTypeSignature (type); return signature; } SignatureWriter GetConstantSignature (ElementType type, object value) { var signature = CreateSignatureWriter (); switch (type) { case ElementType.Array: case ElementType.SzArray: case ElementType.Class: case ElementType.Object: case ElementType.Var: case ElementType.MVar: signature.WriteInt32 (0); break; case ElementType.String: signature.WriteConstantString ((string) value); break; default: signature.WriteConstantPrimitive (value); break; } return signature; } SignatureWriter GetCustomAttributeSignature (CustomAttribute attribute) { var signature = CreateSignatureWriter (); if (!attribute.resolved) { signature.WriteBytes (attribute.GetBlob ()); return signature; } signature.WriteUInt16 (0x0001); signature.WriteCustomAttributeConstructorArguments (attribute); signature.WriteCustomAttributeNamedArguments (attribute); return signature; } SignatureWriter GetSecurityDeclarationSignature (SecurityDeclaration declaration) { var signature = CreateSignatureWriter (); if (!declaration.resolved) { signature.WriteBytes (declaration.GetBlob ()); return signature; } signature.WriteByte ((byte) '.'); var attributes = declaration.security_attributes; if (attributes == null) throw new NotSupportedException (); signature.WriteCompressedUInt32 ((uint) attributes.Count); for (int i = 0; i < attributes.Count; i++) signature.WriteSecurityAttribute (attributes [i]); return signature; } SignatureWriter GetMarshalInfoSignature (IMarshalInfoProvider owner) { var signature = CreateSignatureWriter (); signature.WriteMarshalInfo (owner.MarshalInfo); return signature; } static Exception CreateForeignMemberException (MemberReference member) { return new ArgumentException (string.Format ("Member '{0}' is declared in another module and needs to be imported", member)); } public MetadataToken LookupToken (IMetadataTokenProvider provider) { if (provider == null) throw new ArgumentNullException (); var member = provider as MemberReference; if (member == null || member.Module != module) throw CreateForeignMemberException (member); var token = provider.MetadataToken; switch (token.TokenType) { case TokenType.TypeDef: case TokenType.Method: case TokenType.Field: case TokenType.Event: case TokenType.Property: return token; case TokenType.TypeRef: case TokenType.TypeSpec: case TokenType.GenericParam: return GetTypeToken ((TypeReference) provider); case TokenType.MethodSpec: return GetMethodSpecToken ((MethodSpecification) provider); case TokenType.MemberRef: return GetMemberRefToken (member); default: throw new NotSupportedException (); } } } sealed class SignatureWriter : ByteBuffer { readonly MetadataBuilder metadata; public SignatureWriter (MetadataBuilder metadata) : base (6) { this.metadata = metadata; } public void WriteElementType (ElementType element_type) { WriteByte ((byte) element_type); } public void WriteUTF8String (string @string) { if (@string == null) { WriteByte (0xff); return; } var bytes = Encoding.UTF8.GetBytes (@string); WriteCompressedUInt32 ((uint) bytes.Length); WriteBytes (bytes); } public void WriteMethodSignature (IMethodSignature method) { byte calling_convention = (byte) method.CallingConvention; if (method.HasThis) calling_convention |= 0x20; if (method.ExplicitThis) calling_convention |= 0x40; var generic_provider = method as IGenericParameterProvider; var generic_arity = generic_provider != null && generic_provider.HasGenericParameters ? generic_provider.GenericParameters.Count : 0; if (generic_arity > 0) calling_convention |= 0x10; var param_count = method.HasParameters ? method.Parameters.Count : 0; WriteByte (calling_convention); if (generic_arity > 0) WriteCompressedUInt32 ((uint) generic_arity); WriteCompressedUInt32 ((uint) param_count); WriteTypeSignature (method.ReturnType); if (param_count == 0) return; var parameters = method.Parameters; for (int i = 0; i < param_count; i++) WriteTypeSignature (parameters [i].ParameterType); } uint MakeTypeDefOrRefCodedRID (TypeReference type) { return CodedIndex.TypeDefOrRef.CompressMetadataToken (metadata.LookupToken (type)); } public void WriteTypeSignature (TypeReference type) { if (type == null) throw new ArgumentNullException (); var etype = type.etype; switch (etype) { case ElementType.MVar: case ElementType.Var: { var generic_parameter = (GenericParameter) type; WriteElementType (etype); var position = generic_parameter.Position; if (position == -1) throw new NotSupportedException (); WriteCompressedUInt32 ((uint) position); break; } case ElementType.GenericInst: { var generic_instance = (GenericInstanceType) type; WriteElementType (ElementType.GenericInst); WriteElementType (generic_instance.IsValueType ? ElementType.ValueType : ElementType.Class); WriteCompressedUInt32 (MakeTypeDefOrRefCodedRID (generic_instance.ElementType)); WriteGenericInstanceSignature (generic_instance); break; } case ElementType.Ptr: case ElementType.ByRef: case ElementType.Pinned: case ElementType.Sentinel: { var type_spec = (TypeSpecification) type; WriteElementType (etype); WriteTypeSignature (type_spec.ElementType); break; } case ElementType.FnPtr: { var fptr = (FunctionPointerType) type; WriteElementType (ElementType.FnPtr); WriteMethodSignature (fptr); break; } case ElementType.CModOpt: case ElementType.CModReqD: { var modifier = (IModifierType) type; WriteModifierSignature (etype, modifier); break; } case ElementType.Array: { var array = (ArrayType) type; if (!array.IsVector) { WriteArrayTypeSignature (array); break; } WriteElementType (ElementType.SzArray); WriteTypeSignature (array.ElementType); break; } case ElementType.None: { WriteElementType (type.IsValueType ? ElementType.ValueType : ElementType.Class); WriteCompressedUInt32 (MakeTypeDefOrRefCodedRID (type)); break; } default: if (!TryWriteElementType (type)) throw new NotSupportedException (); break; } } void WriteArrayTypeSignature (ArrayType array) { WriteElementType (ElementType.Array); WriteTypeSignature (array.ElementType); var dimensions = array.Dimensions; var rank = dimensions.Count; WriteCompressedUInt32 ((uint) rank); var sized = 0; var lbounds = 0; for (int i = 0; i < rank; i++) { var dimension = dimensions [i]; if (dimension.UpperBound.HasValue) { sized++; lbounds++; } else if (dimension.LowerBound.HasValue) lbounds++; } var sizes = new int [sized]; var low_bounds = new int [lbounds]; for (int i = 0; i < lbounds; i++) { var dimension = dimensions [i]; low_bounds [i] = dimension.LowerBound.GetValueOrDefault (); if (dimension.UpperBound.HasValue) sizes [i] = dimension.UpperBound.Value - low_bounds [i] + 1; } WriteCompressedUInt32 ((uint) sized); for (int i = 0; i < sized; i++) WriteCompressedUInt32 ((uint) sizes [i]); WriteCompressedUInt32 ((uint) lbounds); for (int i = 0; i < lbounds; i++) WriteCompressedInt32 (low_bounds [i]); } public void WriteGenericInstanceSignature (IGenericInstance instance) { var generic_arguments = instance.GenericArguments; var arity = generic_arguments.Count; WriteCompressedUInt32 ((uint) arity); for (int i = 0; i < arity; i++) WriteTypeSignature (generic_arguments [i]); } void WriteModifierSignature (ElementType element_type, IModifierType type) { WriteElementType (element_type); WriteCompressedUInt32 (MakeTypeDefOrRefCodedRID (type.ModifierType)); WriteTypeSignature (type.ElementType); } bool TryWriteElementType (TypeReference type) { var element = type.etype; if (element == ElementType.None) return false; WriteElementType (element); return true; } public void WriteConstantString (string value) { WriteBytes (Encoding.Unicode.GetBytes (value)); } public void WriteConstantPrimitive (object value) { WritePrimitiveValue (value); } public void WriteCustomAttributeConstructorArguments (CustomAttribute attribute) { if (!attribute.HasConstructorArguments) return; var arguments = attribute.ConstructorArguments; var parameters = attribute.Constructor.Parameters; if (parameters.Count != arguments.Count) throw new InvalidOperationException (); for (int i = 0; i < arguments.Count; i++) WriteCustomAttributeFixedArgument (parameters [i].ParameterType, arguments [i]); } void WriteCustomAttributeFixedArgument (TypeReference type, CustomAttributeArgument argument) { if (type.IsArray) { WriteCustomAttributeFixedArrayArgument ((ArrayType) type, argument); return; } WriteCustomAttributeElement (type, argument); } void WriteCustomAttributeFixedArrayArgument (ArrayType type, CustomAttributeArgument argument) { var values = argument.Value as CustomAttributeArgument []; if (values == null) { WriteUInt32 (0xffffffff); return; } WriteInt32 (values.Length); if (values.Length == 0) return; var element_type = type.ElementType; for (int i = 0; i < values.Length; i++) WriteCustomAttributeElement (element_type, values [i]); } void WriteCustomAttributeElement (TypeReference type, CustomAttributeArgument argument) { if (type.IsArray) { WriteCustomAttributeFixedArrayArgument ((ArrayType) type, argument); return; } if (type.etype == ElementType.Object) { WriteCustomAttributeFieldOrPropType (argument.Type); WriteCustomAttributeElement (argument.Type, argument); return; } WriteCustomAttributeValue (type, argument.Value); } void WriteCustomAttributeValue (TypeReference type, object value) { var etype = type.etype; switch (etype) { case ElementType.String: var @string = (string) value; if (@string == null) WriteByte (0xff); else WriteUTF8String (@string); break; case ElementType.None: if (type.IsTypeOf ("System", "Type")) WriteTypeReference ((TypeReference) value); else WriteCustomAttributeEnumValue (type, value); break; default: WritePrimitiveValue (value); break; } } void WritePrimitiveValue (object value) { if (value == null) throw new ArgumentNullException (); switch (Type.GetTypeCode (value.GetType ())) { case TypeCode.Boolean: WriteByte ((byte) (((bool) value) ? 1 : 0)); break; case TypeCode.Byte: WriteByte ((byte) value); break; case TypeCode.SByte: WriteSByte ((sbyte) value); break; case TypeCode.Int16: WriteInt16 ((short) value); break; case TypeCode.UInt16: WriteUInt16 ((ushort) value); break; case TypeCode.Char: WriteInt16 ((short) (char) value); break; case TypeCode.Int32: WriteInt32 ((int) value); break; case TypeCode.UInt32: WriteUInt32 ((uint) value); break; case TypeCode.Single: WriteSingle ((float) value); break; case TypeCode.Int64: WriteInt64 ((long) value); break; case TypeCode.UInt64: WriteUInt64 ((ulong) value); break; case TypeCode.Double: WriteDouble ((double) value); break; default: throw new NotSupportedException (value.GetType ().FullName); } } void WriteCustomAttributeEnumValue (TypeReference enum_type, object value) { var type = enum_type.CheckedResolve (); if (!type.IsEnum) throw new ArgumentException (); WriteCustomAttributeValue (type.GetEnumUnderlyingType (), value); } void WriteCustomAttributeFieldOrPropType (TypeReference type) { if (type.IsArray) { var array = (ArrayType) type; WriteElementType (ElementType.SzArray); WriteCustomAttributeFieldOrPropType (array.ElementType); return; } var etype = type.etype; switch (etype) { case ElementType.Object: WriteElementType (ElementType.Boxed); return; case ElementType.None: if (type.IsTypeOf ("System", "Type")) WriteElementType (ElementType.Type); else { WriteElementType (ElementType.Enum); WriteTypeReference (type); } return; default: WriteElementType (etype); return; } } public void WriteCustomAttributeNamedArguments (CustomAttribute attribute) { var count = GetNamedArgumentCount (attribute); WriteUInt16 ((ushort) count); if (count == 0) return; WriteICustomAttributeNamedArguments (attribute); } static int GetNamedArgumentCount (ICustomAttribute attribute) { int count = 0; if (attribute.HasFields) count += attribute.Fields.Count; if (attribute.HasProperties) count += attribute.Properties.Count; return count; } void WriteICustomAttributeNamedArguments (ICustomAttribute attribute) { if (attribute.HasFields) WriteCustomAttributeNamedArguments (0x53, attribute.Fields); if (attribute.HasProperties) WriteCustomAttributeNamedArguments (0x54, attribute.Properties); } void WriteCustomAttributeNamedArguments (byte kind, Collection named_arguments) { for (int i = 0; i < named_arguments.Count; i++) WriteCustomAttributeNamedArgument (kind, named_arguments [i]); } void WriteCustomAttributeNamedArgument (byte kind, CustomAttributeNamedArgument named_argument) { var argument = named_argument.Argument; WriteByte (kind); WriteCustomAttributeFieldOrPropType (argument.Type); WriteUTF8String (named_argument.Name); WriteCustomAttributeFixedArgument (argument.Type, argument); } public void WriteSecurityAttribute (SecurityAttribute attribute) { WriteTypeReference (attribute.AttributeType); var count = GetNamedArgumentCount (attribute); if (count == 0) { WriteCompressedUInt32 (0); // length WriteCompressedUInt32 (0); // count return; } var buffer = new SignatureWriter (metadata); buffer.WriteCompressedUInt32 ((uint) count); buffer.WriteICustomAttributeNamedArguments (attribute); WriteCompressedUInt32 ((uint) buffer.length); WriteBytes (buffer); } void WriteTypeReference (TypeReference type) { WriteUTF8String (TypeParser.ToParseable (type)); } public void WriteMarshalInfo (MarshalInfo marshal_info) { WriteNativeType (marshal_info.native); switch (marshal_info.native) { case NativeType.Array: { var array = (ArrayMarshalInfo) marshal_info; if (array.element_type != NativeType.None) WriteNativeType (array.element_type); if (array.size_parameter_index > -1) WriteCompressedUInt32 ((uint) array.size_parameter_index); if (array.size > -1) WriteCompressedUInt32 ((uint) array.size); if (array.size_parameter_multiplier > -1) WriteCompressedUInt32 ((uint) array.size_parameter_multiplier); return; } case NativeType.SafeArray: { var array = (SafeArrayMarshalInfo) marshal_info; if (array.element_type != VariantType.None) WriteVariantType (array.element_type); return; } case NativeType.FixedArray: { var array = (FixedArrayMarshalInfo) marshal_info; if (array.size > -1) WriteCompressedUInt32 ((uint) array.size); if (array.element_type != NativeType.None) WriteNativeType (array.element_type); return; } case NativeType.FixedSysString: var sys_string = (FixedSysStringMarshalInfo) marshal_info; if (sys_string.size > -1) WriteCompressedUInt32 ((uint) sys_string.size); return; case NativeType.CustomMarshaler: var marshaler = (CustomMarshalInfo) marshal_info; WriteUTF8String (marshaler.guid != Guid.Empty ? marshaler.guid.ToString () : string.Empty); WriteUTF8String (marshaler.unmanaged_type); WriteTypeReference (marshaler.managed_type); WriteUTF8String (marshaler.cookie); return; } } void WriteNativeType (NativeType native) { WriteByte ((byte) native); } void WriteVariantType (VariantType variant) { WriteByte ((byte) variant); } } #endif } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ParameterReference.cs0000664000175000017500000000411312136523632032545 0ustar00directhexdirecthex00000000000000// // ParameterReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public abstract class ParameterReference : IMetadataTokenProvider { string name; internal int index = -1; protected TypeReference parameter_type; internal MetadataToken token; public string Name { get { return name; } set { name = value; } } public int Index { get { return index; } } public TypeReference ParameterType { get { return parameter_type; } set { parameter_type = value; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } internal ParameterReference (string name, TypeReference parameterType) { if (parameterType == null) throw new ArgumentNullException ("parameterType"); this.name = name ?? string.Empty; this.parameter_type = parameterType; } public override string ToString () { return name; } public abstract ParameterDefinition Resolve (); } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodReference.cs0000664000175000017500000001276412136523632032060 0ustar00directhexdirecthex00000000000000// // MethodReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public class MethodReference : MemberReference, IMethodSignature, IGenericParameterProvider, IGenericContext { internal ParameterDefinitionCollection parameters; MethodReturnType return_type; bool has_this; bool explicit_this; MethodCallingConvention calling_convention; internal Collection generic_parameters; public virtual bool HasThis { get { return has_this; } set { has_this = value; } } public virtual bool ExplicitThis { get { return explicit_this; } set { explicit_this = value; } } public virtual MethodCallingConvention CallingConvention { get { return calling_convention; } set { calling_convention = value; } } public virtual bool HasParameters { get { return !parameters.IsNullOrEmpty (); } } public virtual Collection Parameters { get { if (parameters == null) parameters = new ParameterDefinitionCollection (this); return parameters; } } IGenericParameterProvider IGenericContext.Type { get { var declaring_type = this.DeclaringType; var instance = declaring_type as GenericInstanceType; if (instance != null) return instance.ElementType; return declaring_type; } } IGenericParameterProvider IGenericContext.Method { get { return this; } } GenericParameterType IGenericParameterProvider.GenericParameterType { get { return GenericParameterType.Method; } } public virtual bool HasGenericParameters { get { return !generic_parameters.IsNullOrEmpty (); } } public virtual Collection GenericParameters { get { if (generic_parameters != null) return generic_parameters; return generic_parameters = new Collection (); } } public TypeReference ReturnType { get { var return_type = MethodReturnType; return return_type != null ? return_type.ReturnType : null; } set { var return_type = MethodReturnType; if (return_type != null) return_type.ReturnType = value; } } public virtual MethodReturnType MethodReturnType { get { return return_type; } set { return_type = value; } } public override string FullName { get { var builder = new StringBuilder (); builder.Append (ReturnType.FullName); builder.Append (" "); builder.Append (MemberFullName ()); this.MethodSignatureFullName (builder); return builder.ToString (); } } public virtual bool IsGenericInstance { get { return false; } } internal override bool ContainsGenericParameter { get { if (this.ReturnType.ContainsGenericParameter || base.ContainsGenericParameter) return true; var parameters = this.Parameters; for (int i = 0; i < parameters.Count; i++) if (parameters [i].ParameterType.ContainsGenericParameter) return true; return false; } } internal MethodReference () { this.return_type = new MethodReturnType (this); this.token = new MetadataToken (TokenType.MemberRef); } public MethodReference (string name, TypeReference returnType) : base (name) { if (returnType == null) throw new ArgumentNullException ("returnType"); this.return_type = new MethodReturnType (this); this.return_type.ReturnType = returnType; this.token = new MetadataToken (TokenType.MemberRef); } public MethodReference (string name, TypeReference returnType, TypeReference declaringType) : this (name, returnType) { if (declaringType == null) throw new ArgumentNullException ("declaringType"); this.DeclaringType = declaringType; } public virtual MethodReference GetElementMethod () { return this; } public virtual MethodDefinition Resolve () { var module = this.Module; if (module == null) throw new NotSupportedException (); return module.Resolve (this); } } static partial class Mixin { public static bool IsVarArg (this IMethodSignature self) { return (self.CallingConvention & MethodCallingConvention.VarArg) != 0; } public static int GetSentinelPosition (this IMethodSignature self) { if (!self.HasParameters) return -1; var parameters = self.Parameters; for (int i = 0; i < parameters.Count; i++) if (parameters [i].ParameterType.IsSentinel) return i; return -1; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IGenericParameterProvider.cs0000664000175000017500000000445712136523632034062 0ustar00directhexdirecthex00000000000000// // IGenericParameterProvider.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public interface IGenericParameterProvider : IMetadataTokenProvider { bool HasGenericParameters { get; } bool IsDefinition { get; } ModuleDefinition Module { get; } Collection GenericParameters { get; } GenericParameterType GenericParameterType { get; } } public enum GenericParameterType { Type, Method } interface IGenericContext { bool IsDefinition { get; } IGenericParameterProvider Type { get; } IGenericParameterProvider Method { get; } } static partial class Mixin { public static bool GetHasGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasGenericParameters (provider)) : false; } public static Collection GetGenericParameters ( this IGenericParameterProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadGenericParameters (provider)) : new Collection (); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MetadataResolver.cs0000664000175000017500000001556712136523632032267 0ustar00directhexdirecthex00000000000000// // MetadataResolver.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Collections.Generic; namespace Mono.Cecil { public interface IAssemblyResolver { AssemblyDefinition Resolve (AssemblyNameReference name); AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters); AssemblyDefinition Resolve (string fullName); AssemblyDefinition Resolve (string fullName, ReaderParameters parameters); } static class MetadataResolver { public static TypeDefinition Resolve (IAssemblyResolver resolver, TypeReference type) { type = type.GetElementType (); var scope = type.Scope; switch (scope.MetadataScopeType) { case MetadataScopeType.AssemblyNameReference: var assembly = resolver.Resolve ((AssemblyNameReference) scope); if (assembly == null) return null; return GetType (assembly.MainModule, type); case MetadataScopeType.ModuleDefinition: return GetType ((ModuleDefinition) scope, type); case MetadataScopeType.ModuleReference: var modules = type.Module.Assembly.Modules; var module_ref = (ModuleReference) scope; for (int i = 0; i < modules.Count; i++) { var netmodule = modules [i]; if (netmodule.Name == module_ref.Name) return GetType (netmodule, type); } break; } throw new NotSupportedException (); } static TypeDefinition GetType (ModuleDefinition module, TypeReference type) { if (!type.IsNested) return module.GetType (type.Namespace, type.Name); var declaring_type = type.DeclaringType.Resolve (); if (declaring_type == null) return null; return declaring_type.GetNestedType (type.Name); } public static FieldDefinition Resolve (IAssemblyResolver resolver, FieldReference field) { var type = Resolve (resolver, field.DeclaringType); if (type == null) return null; if (!type.HasFields) return null; return GetField (resolver, type, field); } static FieldDefinition GetField (IAssemblyResolver resolver, TypeDefinition type, FieldReference reference) { while (type != null) { var field = GetField (type.Fields, reference); if (field != null) return field; if (type.BaseType == null) return null; type = Resolve (resolver, type.BaseType); } return null; } static FieldDefinition GetField (IList fields, FieldReference reference) { for (int i = 0; i < fields.Count; i++) { var field = fields [i]; if (field.Name != reference.Name) continue; if (!AreSame (field.FieldType, reference.FieldType)) continue; return field; } return null; } public static MethodDefinition Resolve (IAssemblyResolver resolver, MethodReference method) { var type = Resolve (resolver, method.DeclaringType); if (type == null) return null; method = method.GetElementMethod (); if (!type.HasMethods) return null; return GetMethod (resolver, type, method); } static MethodDefinition GetMethod (IAssemblyResolver resolver, TypeDefinition type, MethodReference reference) { while (type != null) { var method = GetMethod (type.Methods, reference); if (method != null) return method; if (type.BaseType == null) return null; type = Resolve (resolver, type.BaseType); } return null; } public static MethodDefinition GetMethod (IList methods, MethodReference reference) { for (int i = 0; i < methods.Count; i++) { var method = methods [i]; if (method.Name != reference.Name) continue; if (!AreSame (method.ReturnType, reference.ReturnType)) continue; if (method.HasParameters != reference.HasParameters) continue; if (!method.HasParameters && !reference.HasParameters) return method; if (!AreSame (method.Parameters, reference.Parameters)) continue; return method; } return null; } static bool AreSame (Collection a, Collection b) { var count = a.Count; if (count != b.Count) return false; if (count == 0) return true; for (int i = 0; i < count; i++) if (!AreSame (a [i].ParameterType, b [i].ParameterType)) return false; return true; } static bool AreSame (TypeSpecification a, TypeSpecification b) { if (!AreSame (a.ElementType, b.ElementType)) return false; if (a.IsGenericInstance) return AreSame ((GenericInstanceType) a, (GenericInstanceType) b); if (a.IsRequiredModifier || a.IsOptionalModifier) return AreSame ((IModifierType) a, (IModifierType) b); if (a.IsArray) return AreSame ((ArrayType) a, (ArrayType) b); return true; } static bool AreSame (ArrayType a, ArrayType b) { if (a.Rank != b.Rank) return false; // TODO: dimensions return true; } static bool AreSame (IModifierType a, IModifierType b) { return AreSame (a.ModifierType, b.ModifierType); } static bool AreSame (GenericInstanceType a, GenericInstanceType b) { if (!a.HasGenericArguments) return !b.HasGenericArguments; if (!b.HasGenericArguments) return false; if (a.GenericArguments.Count != b.GenericArguments.Count) return false; for (int i = 0; i < a.GenericArguments.Count; i++) if (!AreSame (a.GenericArguments [i], b.GenericArguments [i])) return false; return true; } static bool AreSame (GenericParameter a, GenericParameter b) { return a.Position == b.Position; } static bool AreSame (TypeReference a, TypeReference b) { if (a.etype != b.etype) return false; if (a.IsGenericParameter) return AreSame ((GenericParameter) a, (GenericParameter) b); if (a.IsTypeSpecification ()) return AreSame ((TypeSpecification) a, (TypeSpecification) b); return a.FullName == b.FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/CallSite.cs0000664000175000017500000000276312136523632030517 0ustar00directhexdirecthex00000000000000// // CallSite.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; namespace Mono.Cecil { public sealed class CallSite : MethodReference { public override string FullName { get { var signature = new StringBuilder (); signature.Append (ReturnType.FullName); this.MethodSignatureFullName (signature); return signature.ToString (); } } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/LinkedResource.cs0000664000175000017500000000336212136523632031731 0ustar00directhexdirecthex00000000000000// // LinkedResource.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public sealed class LinkedResource : Resource { internal byte [] hash; string file; public byte [] Hash { get { return hash; } } public string File { get { return file; } set { file = value; } } public override ResourceType ResourceType { get { return ResourceType.Linked; } } public LinkedResource (string name, ManifestResourceAttributes flags) : base (name, flags) { } public LinkedResource (string name, ManifestResourceAttributes flags, string file) : base (name, flags) { this.file = file; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IMetadataTokenProvider.cs0000664000175000017500000000245012136523632033355 0ustar00directhexdirecthex00000000000000// // IMetadataTokenProvider.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public interface IMetadataTokenProvider { MetadataToken MetadataToken { get; set; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ModuleReference.cs0000664000175000017500000000347012136523632032057 0ustar00directhexdirecthex00000000000000// // ModuleReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public class ModuleReference : IMetadataScope { string name; internal MetadataToken token; public string Name { get { return name; } set { name = value; } } public virtual MetadataScopeType MetadataScopeType { get { return MetadataScopeType.ModuleReference; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } internal ModuleReference () { this.token = new MetadataToken (TokenType.ModuleRef); } public ModuleReference (string name) : this () { this.name = name; } public override string ToString () { return name; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PInvokeAttributes.cs0000664000175000017500000000373312136523632032437 0ustar00directhexdirecthex00000000000000// // PInvokeAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum PInvokeAttributes : ushort { NoMangle = 0x0001, // PInvoke is to use the member name as specified // Character set CharSetMask = 0x0006, CharSetNotSpec = 0x0000, CharSetAnsi = 0x0002, CharSetUnicode = 0x0004, CharSetAuto = 0x0006, SupportsLastError = 0x0040, // Information about target function. Not relevant for fields // Calling convetion CallConvMask = 0x0700, CallConvWinapi = 0x0100, CallConvCdecl = 0x0200, CallConvStdCall = 0x0300, CallConvThiscall = 0x0400, CallConvFastcall = 0x0500, BestFitMask = 0x0030, BestFitEnabled = 0x0010, BestFidDisabled = 0x0020, ThrowOnUnmappableCharMask = 0x3000, ThrowOnUnmappableCharEnabled = 0x1000, ThrowOnUnmappableCharDisabled = 0x2000, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TargetRuntime.cs0000664000175000017500000000242012136523632031577 0ustar00directhexdirecthex00000000000000// // TargetRuntime.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum TargetRuntime { Net_1_0, Net_1_1, Net_2_0, Net_4_0, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/EventDefinition.cs0000664000175000017500000001033612136523632032104 0ustar00directhexdirecthex00000000000000// // EventDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class EventDefinition : EventReference, IMemberDefinition { ushort attributes; Collection custom_attributes; internal MethodDefinition add_method; internal MethodDefinition invoke_method; internal MethodDefinition remove_method; internal Collection other_methods; public EventAttributes Attributes { get { return (EventAttributes) attributes; } set { attributes = (ushort) value; } } public MethodDefinition AddMethod { get { if (add_method != null) return add_method; InitializeMethods (); return add_method; } set { add_method = value; } } public MethodDefinition InvokeMethod { get { if (invoke_method != null) return invoke_method; InitializeMethods (); return invoke_method; } set { invoke_method = value; } } public MethodDefinition RemoveMethod { get { if (remove_method != null) return remove_method; InitializeMethods (); return remove_method; } set { remove_method = value; } } public bool HasOtherMethods { get { if (other_methods != null) return other_methods.Count > 0; InitializeMethods (); return !other_methods.IsNullOrEmpty (); } } public Collection OtherMethods { get { if (other_methods != null) return other_methods; InitializeMethods (); if (other_methods != null) return other_methods; return other_methods = new Collection (); } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } #region EventAttributes public bool IsSpecialName { get { return attributes.GetAttributes ((ushort) EventAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((ushort) EventAttributes.SpecialName, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((ushort) FieldAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((ushort) FieldAttributes.RTSpecialName, value); } } #endregion public new TypeDefinition DeclaringType { get { return (TypeDefinition) base.DeclaringType; } set { base.DeclaringType = value; } } public override bool IsDefinition { get { return true; } } public EventDefinition (string name, EventAttributes attributes, TypeReference eventType) : base (name, eventType) { this.attributes = (ushort) attributes; this.token = new MetadataToken (TokenType.Event); } void InitializeMethods () { if (add_method != null || invoke_method != null || remove_method != null) return; var module = this.Module; if (!module.HasImage ()) return; module.Read (this, (@event, reader) => reader.ReadMethods (@event)); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IGenericInstance.cs0000664000175000017500000000401312136523632032157 0ustar00directhexdirecthex00000000000000// // IGenericInstance.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public interface IGenericInstance : IMetadataTokenProvider { bool HasGenericArguments { get; } Collection GenericArguments { get; } } static partial class Mixin { public static bool ContainsGenericParameter (this IGenericInstance self) { var arguments = self.GenericArguments; for (int i = 0; i < arguments.Count; i++) if (arguments [i].ContainsGenericParameter) return true; return false; } public static void GenericInstanceFullName (this IGenericInstance self, StringBuilder builder) { builder.Append ("<"); var arguments = self.GenericArguments; for (int i = 0; i < arguments.Count; i++) { if (i > 0) builder.Append (","); builder.Append (arguments [i].FullName); } builder.Append (">"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MemberReference.cs0000664000175000017500000000474112136523632032043 0ustar00directhexdirecthex00000000000000// // MemberReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public abstract class MemberReference : IMetadataTokenProvider { string name; TypeReference declaring_type; internal MetadataToken token; public virtual string Name { get { return name; } set { name = value; } } public abstract string FullName { get; } public virtual TypeReference DeclaringType { get { return declaring_type; } set { declaring_type = value; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } internal bool HasImage { get { var module = Module; if (module == null) return false; return module.HasImage; } } public virtual ModuleDefinition Module { get { return declaring_type != null ? declaring_type.Module : null; } } public virtual bool IsDefinition { get { return false; } } internal virtual bool ContainsGenericParameter { get { return declaring_type != null && declaring_type.ContainsGenericParameter; } } internal MemberReference () { } internal MemberReference (string name) { this.name = name ?? string.Empty; } internal string MemberFullName () { if (declaring_type == null) return name; return declaring_type.FullName + "::" + name; } public override string ToString () { return FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/VariantType.cs0000664000175000017500000000273012136523632031257 0ustar00directhexdirecthex00000000000000// // VariantType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum VariantType { None = 0, I2 = 2, I4 = 3, R4 = 4, R8 = 5, CY = 6, Date = 7, BStr = 8, Dispatch = 9, Error = 10, Bool = 11, Variant = 12, Unknown = 13, Decimal = 14, I1 = 16, UI1 = 17, UI2 = 18, UI4 = 19, Int = 22, UInt = 23 } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodSemanticsAttributes.cs0000664000175000017500000000311012136523632034140 0ustar00directhexdirecthex00000000000000// // MethodSemanticsattributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum MethodSemanticsAttributes : ushort { None = 0x0000, Setter = 0x0001, // Setter for property Getter = 0x0002, // Getter for property Other = 0x0004, // Other method for property or event AddOn = 0x0008, // AddOn method for event RemoveOn = 0x0010, // RemoveOn method for event Fire = 0x0020 // Fire method for event } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyNameReference.cs0000664000175000017500000001503612136523632033213 0ustar00directhexdirecthex00000000000000// // AssemblyNameReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Globalization; using System.Security.Cryptography; using System.Text; namespace Mono.Cecil { public class AssemblyNameReference : IMetadataScope { string name; string culture; Version version; uint attributes; byte [] public_key; byte [] public_key_token; AssemblyHashAlgorithm hash_algorithm; byte [] hash; internal MetadataToken token; string full_name; public string Name { get { return name; } set { name = value; full_name = null; } } public string Culture { get { return culture; } set { culture = value; full_name = null; } } public Version Version { get { return version; } set { version = value; full_name = null; } } public AssemblyAttributes Attributes { get { return (AssemblyAttributes) attributes; } set { attributes = (uint) value; } } public bool HasPublicKey { get { return attributes.GetAttributes ((uint) AssemblyAttributes.PublicKey); } set { attributes = attributes.SetAttributes ((uint) AssemblyAttributes.PublicKey, value); } } public bool IsSideBySideCompatible { get { return attributes.GetAttributes ((uint) AssemblyAttributes.SideBySideCompatible); } set { attributes = attributes.SetAttributes ((uint) AssemblyAttributes.SideBySideCompatible, value); } } public bool IsRetargetable { get { return attributes.GetAttributes ((uint) AssemblyAttributes.Retargetable); } set { attributes = attributes.SetAttributes ((uint) AssemblyAttributes.Retargetable, value); } } public byte [] PublicKey { get { return public_key; } set { public_key = value; HasPublicKey = !public_key.IsNullOrEmpty (); public_key_token = Empty.Array; full_name = null; } } public byte [] PublicKeyToken { get { if (public_key_token.IsNullOrEmpty () && !public_key.IsNullOrEmpty ()) { var hash = HashPublicKey (); // we need the last 8 bytes in reverse order public_key_token = new byte [8]; Array.Copy (hash, (hash.Length - 8), public_key_token, 0, 8); Array.Reverse (public_key_token, 0, 8); } return public_key_token; } set { public_key_token = value; full_name = null; } } byte [] HashPublicKey () { HashAlgorithm algorithm; switch (hash_algorithm) { case AssemblyHashAlgorithm.Reserved: #if SILVERLIGHT throw new NotSupportedException (); #else algorithm = MD5.Create (); break; #endif default: // None default to SHA1 #if SILVERLIGHT algorithm = new SHA1Managed (); break; #else algorithm = SHA1.Create (); break; #endif } using (algorithm) return algorithm.ComputeHash (public_key); } public virtual MetadataScopeType MetadataScopeType { get { return MetadataScopeType.AssemblyNameReference; } } public string FullName { get { if (full_name != null) return full_name; const string sep = ", "; var builder = new StringBuilder (); builder.Append (name); if (version != null) { builder.Append (sep); builder.Append ("Version="); builder.Append (version.ToString ()); } builder.Append (sep); builder.Append ("Culture="); builder.Append (string.IsNullOrEmpty (culture) ? "neutral" : culture); builder.Append (sep); builder.Append ("PublicKeyToken="); if (this.PublicKeyToken != null && public_key_token.Length > 0) { for (int i = 0 ; i < public_key_token.Length ; i++) { builder.Append (public_key_token [i].ToString ("x2")); } } else builder.Append ("null"); return full_name = builder.ToString (); } } public static AssemblyNameReference Parse (string fullName) { if (fullName == null) throw new ArgumentNullException ("fullName"); if (fullName.Length == 0) throw new ArgumentException ("Name can not be empty"); var name = new AssemblyNameReference (); var tokens = fullName.Split (','); for (int i = 0; i < tokens.Length; i++) { var token = tokens [i].Trim (); if (i == 0) { name.Name = token; continue; } var parts = token.Split ('='); if (parts.Length != 2) throw new ArgumentException ("Malformed name"); switch (parts [0]) { case "Version": name.Version = new Version (parts [1]); break; case "Culture": name.Culture = parts [1]; break; case "PublicKeyToken": string pk_token = parts [1]; if (pk_token == "null") break; name.PublicKeyToken = new byte [pk_token.Length / 2]; for (int j = 0; j < name.PublicKeyToken.Length; j++) { name.PublicKeyToken [j] = Byte.Parse (pk_token.Substring (j * 2, 2), NumberStyles.HexNumber); } break; } } return name; } public AssemblyHashAlgorithm HashAlgorithm { get { return hash_algorithm; } set { hash_algorithm = value; } } public virtual byte [] Hash { get { return hash; } set { hash = value; } } public MetadataToken MetadataToken { get { return token; } set { token = value; } } internal AssemblyNameReference () { } public AssemblyNameReference (string name, Version version) { if (name == null) throw new ArgumentNullException ("name"); this.name = name; this.version = version; this.hash_algorithm = AssemblyHashAlgorithm.None; this.token = new MetadataToken (TokenType.AssemblyRef); } public override string ToString () { return this.FullName; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ParameterAttributes.cs0000664000175000017500000000320112136523632032772 0ustar00directhexdirecthex00000000000000// // ParameterAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum ParameterAttributes : ushort { None = 0x0000, In = 0x0001, // Param is [In] Out = 0x0002, // Param is [Out] Lcid = 0x0004, Retval = 0x0008, Optional = 0x0010, // Param is optional HasDefault = 0x1000, // Param has default value HasFieldMarshal = 0x2000, // Param has field marshal Unused = 0xcfe0 // Reserved: shall be zero in a conforming implementation } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/SecurityDeclaration.cs0000664000175000017500000001127512136523632032772 0ustar00directhexdirecthex00000000000000// // SecurityDeclaration.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public enum SecurityAction : ushort { Request = 1, Demand = 2, Assert = 3, Deny = 4, PermitOnly = 5, LinkDemand = 6, InheritDemand = 7, RequestMinimum = 8, RequestOptional = 9, RequestRefuse = 10, PreJitGrant = 11, PreJitDeny = 12, NonCasDemand = 13, NonCasLinkDemand = 14, NonCasInheritance = 15 } public interface ISecurityDeclarationProvider : IMetadataTokenProvider { bool HasSecurityDeclarations { get; } Collection SecurityDeclarations { get; } } public sealed class SecurityAttribute : ICustomAttribute { TypeReference attribute_type; internal Collection fields; internal Collection properties; public TypeReference AttributeType { get { return attribute_type; } set { attribute_type = value; } } public bool HasFields { get { return !fields.IsNullOrEmpty (); } } public Collection Fields { get { return fields ?? (fields = new Collection ()); } } public bool HasProperties { get { return !properties.IsNullOrEmpty (); } } public Collection Properties { get { return properties ?? (properties = new Collection ()); } } public SecurityAttribute (TypeReference attributeType) { this.attribute_type = attributeType; } } public sealed class SecurityDeclaration { readonly internal uint signature; readonly ModuleDefinition module; internal bool resolved; SecurityAction action; internal Collection security_attributes; public SecurityAction Action { get { return action; } set { action = value; } } public bool HasSecurityAttributes { get { Resolve (); return !security_attributes.IsNullOrEmpty (); } } public Collection SecurityAttributes { get { Resolve (); return security_attributes ?? (security_attributes = new Collection ()); } } internal bool HasImage { get { return module != null && module.HasImage; } } internal SecurityDeclaration (SecurityAction action, uint signature, ModuleDefinition module) { this.action = action; this.signature = signature; this.module = module; } public SecurityDeclaration (SecurityAction action) { this.action = action; this.resolved = true; } public byte [] GetBlob () { if (!HasImage || signature == 0) throw new NotSupportedException (); return module.Read (this, (declaration, reader) => reader.ReadSecurityDeclarationBlob (declaration.signature)); ; } void Resolve () { if (resolved || !HasImage) return; module.Read (this, (declaration, reader) => { reader.ReadSecurityDeclarationSignature (declaration); return this; }); resolved = true; } } static partial class Mixin { public static bool GetHasSecurityDeclarations ( this ISecurityDeclarationProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasSecurityDeclarations (provider)) : false; } public static Collection GetSecurityDeclarations ( this ISecurityDeclarationProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadSecurityDeclarations (provider)) : new Collection (); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PInvokeInfo.cs0000664000175000017500000001475612136523632031213 0ustar00directhexdirecthex00000000000000// // PInvokeInfo.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public sealed class PInvokeInfo { ushort attributes; string entry_point; ModuleReference module; public PInvokeAttributes Attributes { get { return (PInvokeAttributes) attributes; } set { attributes = (ushort) value; } } public string EntryPoint { get { return entry_point; } set { entry_point = value; } } public ModuleReference Module { get { return module; } set { module = value; } } #region PInvokeAttributes public bool IsNoMangle { get { return attributes.GetAttributes ((ushort) PInvokeAttributes.NoMangle); } set { attributes = attributes.SetAttributes ((ushort) PInvokeAttributes.NoMangle, value); } } public bool IsCharSetNotSpec { get { return attributes.GetMaskedAttributes((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetNotSpec); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetNotSpec, value); } } public bool IsCharSetAnsi { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetAnsi); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetAnsi, value); } } public bool IsCharSetUnicode { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetUnicode); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetUnicode, value); } } public bool IsCharSetAuto { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetAuto); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CharSetMask, (ushort) PInvokeAttributes.CharSetAuto, value); } } public bool SupportsLastError { get { return attributes.GetAttributes ((ushort) PInvokeAttributes.SupportsLastError); } set { attributes = attributes.SetAttributes ((ushort) PInvokeAttributes.SupportsLastError, value); } } public bool IsCallConvWinapi { get { return attributes.GetMaskedAttributes((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvWinapi); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvWinapi, value); } } public bool IsCallConvCdecl { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvCdecl); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvCdecl, value); } } public bool IsCallConvStdCall { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvStdCall); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvStdCall, value); } } public bool IsCallConvThiscall { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvThiscall); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvThiscall, value); } } public bool IsCallConvFastcall { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvFastcall); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.CallConvMask, (ushort) PInvokeAttributes.CallConvFastcall, value); } } public bool IsBestFistEnabled { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.BestFitMask, (ushort) PInvokeAttributes.BestFitEnabled); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.BestFitMask, (ushort) PInvokeAttributes.BestFitEnabled, value); } } public bool IsBestFistDisabled { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.BestFitMask, (ushort) PInvokeAttributes.BestFidDisabled); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.BestFitMask, (ushort) PInvokeAttributes.BestFidDisabled, value); } } public bool IsThrowOnUnmappableCharEnabled { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.ThrowOnUnmappableCharMask, (ushort) PInvokeAttributes.ThrowOnUnmappableCharEnabled); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.ThrowOnUnmappableCharMask, (ushort) PInvokeAttributes.ThrowOnUnmappableCharEnabled, value); } } public bool IsThrowOnUnmappableCharDisabled { get { return attributes.GetMaskedAttributes ((ushort) PInvokeAttributes.ThrowOnUnmappableCharMask, (ushort) PInvokeAttributes.ThrowOnUnmappableCharDisabled); } set { attributes = attributes.SetMaskedAttributes ((ushort) PInvokeAttributes.ThrowOnUnmappableCharMask, (ushort) PInvokeAttributes.ThrowOnUnmappableCharDisabled, value); } } #endregion public PInvokeInfo (PInvokeAttributes attributes, string entryPoint, ModuleReference module) { this.attributes = (ushort) attributes; this.entry_point = entryPoint; this.module = module; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MetadataSystem.cs0000664000175000017500000002631312136523632031741 0ustar00directhexdirecthex00000000000000// // MetadataSystem.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Cecil.Metadata; namespace Mono.Cecil { struct Range { public uint Start; public uint Length; public Range (uint index, uint length) { this.Start = index; this.Length = length; } } sealed class MetadataSystem { internal TypeDefinition [] Types; internal TypeReference [] TypeReferences; internal FieldDefinition [] Fields; internal MethodDefinition [] Methods; internal MemberReference [] MemberReferences; internal Dictionary NestedTypes; internal Dictionary ReverseNestedTypes; internal Dictionary Interfaces; internal Dictionary> ClassLayouts; internal Dictionary FieldLayouts; internal Dictionary FieldRVAs; internal Dictionary FieldMarshals; internal Dictionary> Constants; internal Dictionary Overrides; internal Dictionary CustomAttributes; internal Dictionary SecurityDeclarations; internal Dictionary Events; internal Dictionary Properties; internal Dictionary> Semantics; internal Dictionary> PInvokes; internal Dictionary GenericParameters; internal Dictionary GenericConstraints; static Dictionary> primitive_value_types; static void InitializePrimitives () { primitive_value_types = new Dictionary> (18) { { "Void", new Row (ElementType.Void, false) }, { "Boolean", new Row (ElementType.Boolean, true) }, { "Char", new Row (ElementType.Char, true) }, { "SByte", new Row (ElementType.I1, true) }, { "Byte", new Row (ElementType.U1, true) }, { "Int16", new Row (ElementType.I2, true) }, { "UInt16", new Row (ElementType.U2, true) }, { "Int32", new Row (ElementType.I4, true) }, { "UInt32", new Row (ElementType.U4, true) }, { "Int64", new Row (ElementType.I8, true) }, { "UInt64", new Row (ElementType.U8, true) }, { "Single", new Row (ElementType.R4, true) }, { "Double", new Row (ElementType.R8, true) }, { "String", new Row (ElementType.String, false) }, { "TypedReference", new Row (ElementType.TypedByRef, false) }, { "IntPtr", new Row (ElementType.I, true) }, { "UIntPtr", new Row (ElementType.U, true) }, { "Object", new Row (ElementType.Object, false) }, }; } public static void TryProcessPrimitiveType (TypeReference type) { var scope = type.scope; if (scope == null) return; if (scope.MetadataScopeType != MetadataScopeType.AssemblyNameReference) return; if (scope.Name != "mscorlib") return; if (type.Namespace != "System") return; if (primitive_value_types == null) InitializePrimitives (); Row primitive_data; if (!primitive_value_types.TryGetValue (type.Name, out primitive_data)) return; type.etype = primitive_data.Col1; type.IsValueType = primitive_data.Col2; } public void Clear () { if (NestedTypes != null) NestedTypes.Clear (); if (ReverseNestedTypes != null) ReverseNestedTypes.Clear (); if (Interfaces != null) Interfaces.Clear (); if (ClassLayouts != null) ClassLayouts.Clear (); if (FieldLayouts != null) FieldLayouts.Clear (); if (FieldRVAs != null) FieldRVAs.Clear (); if (FieldMarshals != null) FieldMarshals.Clear (); if (Constants != null) Constants.Clear (); if (Overrides != null) Overrides.Clear (); if (CustomAttributes != null) CustomAttributes.Clear (); if (SecurityDeclarations != null) SecurityDeclarations.Clear (); if (Events != null) Events.Clear (); if (Properties != null) Properties.Clear (); if (Semantics != null) Semantics.Clear (); if (PInvokes != null) PInvokes.Clear (); if (GenericParameters != null) GenericParameters.Clear (); if (GenericConstraints != null) GenericConstraints.Clear (); } public TypeDefinition GetTypeDefinition (uint rid) { if (rid < 1 || rid > Types.Length) return null; return Types [rid - 1]; } public void AddTypeDefinition (TypeDefinition type) { Types [type.token.RID - 1] = type; } public TypeReference GetTypeReference (uint rid) { if (rid < 1 || rid > TypeReferences.Length) return null; return TypeReferences [rid - 1]; } public void AddTypeReference (TypeReference type) { TypeReferences [type.token.RID - 1] = type; } public FieldDefinition GetFieldDefinition (uint rid) { if (rid < 1 || rid > Fields.Length) return null; return Fields [rid - 1]; } public void AddFieldDefinition (FieldDefinition field) { Fields [field.token.RID - 1] = field; } public MethodDefinition GetMethodDefinition (uint rid) { if (rid < 1 || rid > Methods.Length) return null; return Methods [rid - 1]; } public void AddMethodDefinition (MethodDefinition method) { Methods [method.token.RID - 1] = method; } public MemberReference GetMemberReference (uint rid) { if (rid < 1 || rid > MemberReferences.Length) return null; return MemberReferences [rid - 1]; } public void AddMemberReference (MemberReference member) { MemberReferences [member.token.RID - 1] = member; } public bool TryGetNestedTypeMapping (TypeDefinition type, out uint [] mapping) { return NestedTypes.TryGetValue (type.token.RID, out mapping); } public void SetNestedTypeMapping (uint type_rid, uint [] mapping) { NestedTypes [type_rid] = mapping; } public void RemoveNestedTypeMapping (TypeDefinition type) { NestedTypes.Remove (type.token.RID); } public bool TryGetReverseNestedTypeMapping (TypeDefinition type, out uint declaring) { return ReverseNestedTypes.TryGetValue (type.token.RID, out declaring); } public void SetReverseNestedTypeMapping (uint nested, uint declaring) { ReverseNestedTypes.Add (nested, declaring); } public void RemoveReverseNestedTypeMapping (TypeDefinition type) { ReverseNestedTypes.Remove (type.token.RID); } public bool TryGetInterfaceMapping (TypeDefinition type, out MetadataToken [] mapping) { return Interfaces.TryGetValue (type.token.RID, out mapping); } public void SetInterfaceMapping (uint type_rid, MetadataToken [] mapping) { Interfaces [type_rid] = mapping; } public void RemoveInterfaceMapping (TypeDefinition type) { Interfaces.Remove (type.token.RID); } public void AddPropertiesRange (uint type_rid, Range range) { Properties.Add (type_rid, range); } public bool TryGetPropertiesRange (TypeDefinition type, out Range range) { return Properties.TryGetValue (type.token.RID, out range); } public void RemovePropertiesRange (TypeDefinition type) { Properties.Remove (type.token.RID); } public void AddEventsRange (uint type_rid, Range range) { Events.Add (type_rid, range); } public bool TryGetEventsRange (TypeDefinition type, out Range range) { return Events.TryGetValue (type.token.RID, out range); } public void RemoveEventsRange (TypeDefinition type) { Events.Remove (type.token.RID); } public bool TryGetGenericParameterRange (IGenericParameterProvider owner, out Range range) { return GenericParameters.TryGetValue (owner.MetadataToken, out range); } public void RemoveGenericParameterRange (IGenericParameterProvider owner) { GenericParameters.Remove (owner.MetadataToken); } public bool TryGetCustomAttributeRange (ICustomAttributeProvider owner, out Range range) { return CustomAttributes.TryGetValue (owner.MetadataToken, out range); } public void RemoveCustomAttributeRange (ICustomAttributeProvider owner) { CustomAttributes.Remove (owner.MetadataToken); } public bool TryGetSecurityDeclarationRange (ISecurityDeclarationProvider owner, out Range range) { return SecurityDeclarations.TryGetValue (owner.MetadataToken, out range); } public void RemoveSecurityDeclarationRange (ISecurityDeclarationProvider owner) { SecurityDeclarations.Remove (owner.MetadataToken); } public bool TryGetGenericConstraintMapping (GenericParameter generic_parameter, out MetadataToken [] mapping) { return GenericConstraints.TryGetValue (generic_parameter.token.RID, out mapping); } public void SetGenericConstraintMapping (uint gp_rid, MetadataToken [] mapping) { GenericConstraints [gp_rid] = mapping; } public void RemoveGenericConstraintMapping (GenericParameter generic_parameter) { GenericConstraints.Remove (generic_parameter.token.RID); } public bool TryGetOverrideMapping (MethodDefinition method, out MetadataToken [] mapping) { return Overrides.TryGetValue (method.token.RID, out mapping); } public void SetOverrideMapping (uint rid, MetadataToken [] mapping) { Overrides [rid] = mapping; } public void RemoveOverrideMapping (MethodDefinition method) { Overrides.Remove (method.token.RID); } public TypeDefinition GetFieldDeclaringType (uint field_rid) { return BinaryRangeSearch (Types, field_rid, true); } public TypeDefinition GetMethodDeclaringType (uint method_rid) { return BinaryRangeSearch (Types, method_rid, false); } static TypeDefinition BinaryRangeSearch (TypeDefinition [] types, uint rid, bool field) { int min = 0; int max = types.Length - 1; while (min <= max) { int mid = min + ((max - min) / 2); var type = types [mid]; var range = field ? type.fields_range : type.methods_range; if (rid < range.Start) max = mid - 1; else if (rid >= range.Start + range.Length) min = mid + 1; else return type; } return null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeDefinitionCollection.cs0000664000175000017500000000630512136523632033761 0ustar00directhexdirecthex00000000000000// // TypeDefinitionCollection.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Cecil.Metadata; using Mono.Collections.Generic; namespace Mono.Cecil { using Slot = Row; sealed class TypeDefinitionCollection : Collection { readonly ModuleDefinition container; readonly Dictionary name_cache; internal TypeDefinitionCollection (ModuleDefinition container) { this.container = container; this.name_cache = new Dictionary (new RowEqualityComparer ()); } internal TypeDefinitionCollection (ModuleDefinition container, int capacity) : base (capacity) { this.container = container; this.name_cache = new Dictionary (capacity, new RowEqualityComparer ()); } protected override void OnAdd (TypeDefinition item, int index) { Attach (item); } protected override void OnSet (TypeDefinition item, int index) { Attach (item); } protected override void OnInsert (TypeDefinition item, int index) { Attach (item); } protected override void OnRemove (TypeDefinition item, int index) { Detach (item); } protected override void OnClear () { foreach (var type in this) Detach (type); } void Attach (TypeDefinition type) { if (type.Module != null && type.Module != container) throw new ArgumentException ("Type already attached"); type.module = container; type.scope = container; name_cache [new Slot (type.Namespace, type.Name)] = type; } void Detach (TypeDefinition type) { type.module = null; type.scope = null; name_cache.Remove (new Slot (type.Namespace, type.Name)); } public TypeDefinition GetType (string fullname) { string @namespace, name; TypeParser.SplitFullName (fullname, out @namespace, out name); return GetType (@namespace, name); } public TypeDefinition GetType (string @namespace, string name) { TypeDefinition type; if (name_cache.TryGetValue (new Slot (@namespace, name), out type)) return type; return null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/FileAttributes.cs0000664000175000017500000000260312136523632031736 0ustar00directhexdirecthex00000000000000// // FileAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { enum FileAttributes : uint { ContainsMetaData = 0x0000, // This is not a resource file ContainsNoMetaData = 0x0001, // This is a resource file or other non-metadata-containing file } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PropertyAttributes.cs0000664000175000017500000000305112136523632032701 0ustar00directhexdirecthex00000000000000// // PropertyAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum PropertyAttributes : ushort { None = 0x0000, SpecialName = 0x0200, // Property is special RTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding HasDefault = 0x1000, // Property has default Unused = 0xe9ff // Reserved: shall be zero in a conforming implementation } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodImplAttributes.cs0000664000175000017500000000437012136523632033124 0ustar00directhexdirecthex00000000000000// // MethodImplAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum MethodImplAttributes : ushort { CodeTypeMask = 0x0003, IL = 0x0000, // Method impl is CIL Native = 0x0001, // Method impl is native OPTIL = 0x0002, // Reserved: shall be zero in conforming implementations Runtime = 0x0003, // Method impl is provided by the runtime ManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged Unmanaged = 0x0004, // Method impl is unmanaged, otherwise managed Managed = 0x0000, // Method impl is managed // Implementation info and interop ForwardRef = 0x0010, // Indicates method is defined; used primarily in merge scenarios PreserveSig = 0x0080, // Reserved: conforming implementations may ignore InternalCall = 0x1000, // Reserved: shall be zero in conforming implementations Synchronized = 0x0020, // Method is single threaded through the body NoOptimization = 0x0040, // Method is not optimized by the JIT. NoInlining = 0x0008, // Method may not be inlined MaxMethodImplVal = 0xffff // Range check value } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeSystem.cs0000664000175000017500000001655212136523632031146 0ustar00directhexdirecthex00000000000000// // TypeSystem.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.Metadata; namespace Mono.Cecil { public abstract class TypeSystem { sealed class CorlibTypeSystem : TypeSystem { public CorlibTypeSystem (ModuleDefinition module) : base (module) { } internal override TypeReference LookupType (string @namespace, string name) { var metadata = module.MetadataSystem; if (metadata.Types == null) Initialize (module.Types); return module.Read (this, (_, reader) => { var types = reader.metadata.Types; for (int i = 0; i < types.Length; i++) { if (types [i] == null) types [i] = reader.GetTypeDefinition ((uint) i + 1); var type = types [i]; if (type.Name == name && type.Namespace == @namespace) return type; } return null; }); } static void Initialize (object obj) { } } sealed class CommonTypeSystem : TypeSystem { AssemblyNameReference corlib; public CommonTypeSystem (ModuleDefinition module) : base (module) { } internal override TypeReference LookupType (string @namespace, string name) { return CreateTypeReference (@namespace, name); } public AssemblyNameReference GetCorlibReference () { if (corlib != null) return corlib; const string mscorlib = "mscorlib"; var references = module.AssemblyReferences; for (int i = 0; i < references.Count; i++) { var reference = references [i]; if (reference.Name == mscorlib) return corlib = reference; } corlib = new AssemblyNameReference { Name = mscorlib, Version = GetCorlibVersion (), PublicKeyToken = new byte [] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 }, }; references.Add (corlib); return corlib; } Version GetCorlibVersion () { switch (module.Runtime) { case TargetRuntime.Net_1_0: case TargetRuntime.Net_1_1: return new Version (1, 0, 0, 0); case TargetRuntime.Net_2_0: return new Version (2, 0, 0, 0); case TargetRuntime.Net_4_0: return new Version (4, 0, 0, 0); default: throw new NotSupportedException (); } } TypeReference CreateTypeReference (string @namespace, string name) { return new TypeReference (@namespace, name, module, GetCorlibReference ()); } } readonly ModuleDefinition module; TypeReference type_object; TypeReference type_void; TypeReference type_bool; TypeReference type_char; TypeReference type_sbyte; TypeReference type_byte; TypeReference type_int16; TypeReference type_uint16; TypeReference type_int32; TypeReference type_uint32; TypeReference type_int64; TypeReference type_uint64; TypeReference type_single; TypeReference type_double; TypeReference type_intptr; TypeReference type_uintptr; TypeReference type_string; TypeReference type_typedref; TypeSystem (ModuleDefinition module) { this.module = module; } internal static TypeSystem CreateTypeSystem (ModuleDefinition module) { if (IsCorlib (module)) return new CorlibTypeSystem (module); return new CommonTypeSystem (module); } static bool IsCorlib (ModuleDefinition module) { if (module.Assembly == null) return false; return module.Assembly.Name.Name == "mscorlib"; } internal abstract TypeReference LookupType (string @namespace, string name); TypeReference LookupSystemType (string name, ElementType element_type) { var type = LookupType ("System", name); type.etype = element_type; return type; } TypeReference LookupSystemValueType (string name, ElementType element_type) { var type = LookupSystemType (name, element_type); type.IsValueType = true; return type; } public IMetadataScope Corlib { get { var common = this as CommonTypeSystem; if (common == null) return module; return common.GetCorlibReference (); } } public TypeReference Object { get { return type_object ?? (type_object = LookupSystemType ("Object", ElementType.Object)); } } public TypeReference Void { get { return type_void ?? (type_void = LookupSystemType ("Void", ElementType.Void)); } } public TypeReference Boolean { get { return type_bool ?? (type_bool = LookupSystemValueType ("Boolean", ElementType.Boolean)); } } public TypeReference Char { get { return type_char ?? (type_char = LookupSystemValueType ("Char", ElementType.Char)); } } public TypeReference SByte { get { return type_sbyte ?? (type_sbyte = LookupSystemValueType ("SByte", ElementType.I1)); } } public TypeReference Byte { get { return type_byte ?? (type_byte = LookupSystemValueType ("Byte", ElementType.U1)); } } public TypeReference Int16 { get { return type_int16 ?? (type_int16 = LookupSystemValueType ("Int16", ElementType.I2)); } } public TypeReference UInt16 { get { return type_uint16 ?? (type_uint16 = LookupSystemValueType ("UInt16", ElementType.U2)); } } public TypeReference Int32 { get { return type_int32 ?? (type_int32 = LookupSystemValueType ("Int32", ElementType.I4)); } } public TypeReference UInt32 { get { return type_uint32 ?? (type_uint32 = LookupSystemValueType ("UInt32", ElementType.U4)); } } public TypeReference Int64 { get { return type_int64 ?? (type_int64 = LookupSystemValueType ("Int64", ElementType.I8)); } } public TypeReference UInt64 { get { return type_uint64 ?? (type_uint64 = LookupSystemValueType ("UInt64", ElementType.U8)); } } public TypeReference Single { get { return type_single ?? (type_single = LookupSystemValueType ("Single", ElementType.R4)); } } public TypeReference Double { get { return type_double ?? (type_double = LookupSystemValueType ("Double", ElementType.R8)); } } public TypeReference IntPtr { get { return type_intptr ?? (type_intptr = LookupSystemValueType ("IntPtr", ElementType.I)); } } public TypeReference UIntPtr { get { return type_uintptr ?? (type_uintptr = LookupSystemValueType ("UIntPtr", ElementType.U)); } } public TypeReference String { get { return type_string ?? (type_string = LookupSystemType ("String", ElementType.String)); } } public TypeReference TypedReference { get { return type_typedref ?? (type_typedref = LookupSystemValueType ("TypedReference", ElementType.TypedByRef)); } } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/BaseAssemblyResolver.cs0000664000175000017500000002277012136523632033113 0ustar00directhexdirecthex00000000000000// // BaseAssemblyResolver.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.IO; using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public delegate AssemblyDefinition AssemblyResolveEventHandler (object sender, AssemblyNameReference reference); public sealed class AssemblyResolveEventArgs : EventArgs { readonly AssemblyNameReference reference; public AssemblyNameReference AssemblyReference { get { return reference; } } public AssemblyResolveEventArgs (AssemblyNameReference reference) { this.reference = reference; } } public abstract class BaseAssemblyResolver : IAssemblyResolver { static readonly bool on_mono = Type.GetType ("Mono.Runtime") != null; readonly Collection directories; #if !SILVERLIGHT && !CF Collection gac_paths; #endif public void AddSearchDirectory (string directory) { directories.Add (directory); } public void RemoveSearchDirectory (string directory) { directories.Remove (directory); } public string [] GetSearchDirectories () { var directories = new string [this.directories.size]; Array.Copy (this.directories.items, directories, directories.Length); return directories; } public virtual AssemblyDefinition Resolve (string fullName) { return Resolve (fullName, new ReaderParameters ()); } public virtual AssemblyDefinition Resolve (string fullName, ReaderParameters parameters) { if (fullName == null) throw new ArgumentNullException ("fullName"); return Resolve (AssemblyNameReference.Parse (fullName), parameters); } public event AssemblyResolveEventHandler ResolveFailure; protected BaseAssemblyResolver () { directories = new Collection (2) { ".", "bin" }; } AssemblyDefinition GetAssembly (string file, ReaderParameters parameters) { if (parameters.AssemblyResolver == null) parameters.AssemblyResolver = this; return ModuleDefinition.ReadModule (file, parameters).Assembly; } public virtual AssemblyDefinition Resolve (AssemblyNameReference name) { return Resolve (name, new ReaderParameters ()); } public virtual AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters) { if (name == null) throw new ArgumentNullException ("name"); if (parameters == null) parameters = new ReaderParameters (); var assembly = SearchDirectory (name, directories, parameters); if (assembly != null) return assembly; #if !SILVERLIGHT && !CF var framework_dir = Path.GetDirectoryName (typeof (object).Module.FullyQualifiedName); if (IsZero (name.Version)) { assembly = SearchDirectory (name, new [] { framework_dir }, parameters); if (assembly != null) return assembly; } if (name.Name == "mscorlib") { assembly = GetCorlib (name, parameters); if (assembly != null) return assembly; } assembly = GetAssemblyInGac (name, parameters); if (assembly != null) return assembly; assembly = SearchDirectory (name, new [] { framework_dir }, parameters); if (assembly != null) return assembly; #endif if (ResolveFailure != null) { assembly = ResolveFailure (this, name); if (assembly != null) return assembly; } throw new FileNotFoundException ("Could not resolve: " + name); } AssemblyDefinition SearchDirectory (AssemblyNameReference name, IEnumerable directories, ReaderParameters parameters) { var extensions = new [] { ".exe", ".dll" }; foreach (var directory in directories) { foreach (var extension in extensions) { string file = Path.Combine (directory, name.Name + extension); if (File.Exists (file)) return GetAssembly (file, parameters); } } return null; } static bool IsZero (Version version) { return version == null || (version.Major == 0 && version.Minor == 0 && version.Build == 0 && version.Revision == 0); } #if !SILVERLIGHT && !CF AssemblyDefinition GetCorlib (AssemblyNameReference reference, ReaderParameters parameters) { var version = reference.Version; var corlib = typeof (object).Assembly.GetName (); if (corlib.Version == version || IsZero (version)) return GetAssembly (typeof (object).Module.FullyQualifiedName, parameters); var path = Directory.GetParent ( Directory.GetParent ( typeof (object).Module.FullyQualifiedName).FullName ).FullName; if (on_mono) { if (version.Major == 1) path = Path.Combine (path, "1.0"); else if (version.Major == 2) { if (version.MajorRevision == 5) path = Path.Combine (path, "2.1"); else path = Path.Combine (path, "2.0"); } else if (version.Major == 4) path = Path.Combine (path, "4.0"); else throw new NotSupportedException ("Version not supported: " + version); } else { switch (version.Major) { case 1: if (version.MajorRevision == 3300) path = Path.Combine (path, "v1.0.3705"); else path = Path.Combine (path, "v1.0.5000.0"); break; case 2: path = Path.Combine (path, "v2.0.50727"); break; case 4: path = Path.Combine (path, "v4.0.30319"); break; default: throw new NotSupportedException ("Version not supported: " + version); } } var file = Path.Combine (path, "mscorlib.dll"); if (File.Exists (file)) return GetAssembly (file, parameters); return null; } static Collection GetGacPaths () { if (on_mono) return GetDefaultMonoGacPaths (); var paths = new Collection (2); var windir = Environment.GetEnvironmentVariable ("WINDIR"); if (windir == null) return paths; paths.Add (Path.Combine (windir, "assembly")); paths.Add (Path.Combine (windir, Path.Combine ("Microsoft.NET", "assembly"))); return paths; } static Collection GetDefaultMonoGacPaths () { var paths = new Collection (1); var gac = GetCurrentMonoGac (); if (gac != null) paths.Add (gac); var gac_paths_env = Environment.GetEnvironmentVariable ("MONO_GAC_PREFIX"); if (string.IsNullOrEmpty (gac_paths_env)) return paths; var prefixes = gac_paths_env.Split (Path.PathSeparator); foreach (var prefix in prefixes) { if (string.IsNullOrEmpty (prefix)) continue; var gac_path = Path.Combine (Path.Combine (Path.Combine (prefix, "lib"), "mono"), "gac"); if (Directory.Exists (gac_path) && !paths.Contains (gac)) paths.Add (gac_path); } return paths; } static string GetCurrentMonoGac () { return Path.Combine ( Directory.GetParent ( Path.GetDirectoryName (typeof (object).Module.FullyQualifiedName)).FullName, "gac"); } AssemblyDefinition GetAssemblyInGac (AssemblyNameReference reference, ReaderParameters parameters) { if (reference.PublicKeyToken == null || reference.PublicKeyToken.Length == 0) return null; if (gac_paths == null) gac_paths = GetGacPaths (); if (on_mono) return GetAssemblyInMonoGac (reference, parameters); return GetAssemblyInNetGac (reference, parameters); } AssemblyDefinition GetAssemblyInMonoGac (AssemblyNameReference reference, ReaderParameters parameters) { for (int i = 0; i < gac_paths.Count; i++) { var gac_path = gac_paths [i]; var file = GetAssemblyFile (reference, string.Empty, gac_path); if (File.Exists (file)) return GetAssembly (file, parameters); } return null; } AssemblyDefinition GetAssemblyInNetGac (AssemblyNameReference reference, ReaderParameters parameters) { var gacs = new [] { "GAC_MSIL", "GAC_32", "GAC" }; var prefixes = new [] { string.Empty, "v4.0_" }; for (int i = 0; i < 2; i++) { for (int j = 0; j < gacs.Length; j++) { var gac = Path.Combine (gac_paths [i], gacs [j]); var file = GetAssemblyFile (reference, prefixes [i], gac); if (Directory.Exists (gac) && File.Exists (file)) return GetAssembly (file, parameters); } } return null; } static string GetAssemblyFile (AssemblyNameReference reference, string prefix, string gac) { var gac_folder = new StringBuilder (); gac_folder.Append (prefix); gac_folder.Append (reference.Version); gac_folder.Append ("__"); for (int i = 0; i < reference.PublicKeyToken.Length; i++) gac_folder.Append (reference.PublicKeyToken [i].ToString ("x2")); return Path.Combine ( Path.Combine ( Path.Combine (gac, reference.Name), gac_folder.ToString ()), reference.Name + ".dll"); } #endif } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ModuleKind.cs0000664000175000017500000000267612136523632031055 0ustar00directhexdirecthex00000000000000// // ModuleKind.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public enum ModuleKind { Dll, Console, Windows, NetModule, } public enum TargetArchitecture { I386, AMD64, IA64, } [Flags] public enum ModuleAttributes { ILOnly = 1, Required32Bit = 2, StrongNameSigned = 8, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ReferenceType.cs0000664000175000017500000000341712136523632031554 0ustar00directhexdirecthex00000000000000// // ByReferenceType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class ByReferenceType : TypeSpecification { public override string Name { get { return base.Name + "&"; } } public override string FullName { get { return base.FullName + "&"; } } public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsByReference { get { return true; } } public ByReferenceType (TypeReference type) : base (type) { Mixin.CheckType (type); this.etype = MD.ElementType.ByRef; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeDefinition.cs0000664000175000017500000003624212136523632031750 0ustar00directhexdirecthex00000000000000// // TypeDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class TypeDefinition : TypeReference, IMemberDefinition, ISecurityDeclarationProvider { uint attributes; TypeReference base_type; internal Range fields_range; internal Range methods_range; short packing_size = Mixin.NotResolvedMarker; int class_size = Mixin.NotResolvedMarker; Collection interfaces; Collection nested_types; Collection methods; Collection fields; Collection events; Collection properties; Collection custom_attributes; Collection security_declarations; public TypeAttributes Attributes { get { return (TypeAttributes) attributes; } set { attributes = (uint) value; } } public TypeReference BaseType { get { return base_type; } set { base_type = value; } } void ResolveLayout () { if (packing_size != Mixin.NotResolvedMarker || class_size != Mixin.NotResolvedMarker) return; if (!HasImage) { packing_size = Mixin.NoDataMarker; class_size = Mixin.NoDataMarker; return; } var row = Module.Read (this, (type, reader) => reader.ReadTypeLayout (type)); packing_size = row.Col1; class_size = row.Col2; } public bool HasLayoutInfo { get { if (packing_size >= 0 || class_size >= 0) return true; ResolveLayout (); return packing_size >= 0 || class_size >= 0; } } public short PackingSize { get { if (packing_size >= 0) return packing_size; ResolveLayout (); return packing_size >= 0 ? packing_size : (short) -1; } set { packing_size = value; } } public int ClassSize { get { if (class_size >= 0) return class_size; ResolveLayout (); return class_size >= 0 ? class_size : -1; } set { class_size = value; } } public bool HasInterfaces { get { if (interfaces != null) return interfaces.Count > 0; if (HasImage) return Module.Read (this, (type, reader) => reader.HasInterfaces (type)); return false; } } public Collection Interfaces { get { if (interfaces != null) return interfaces; if (HasImage) return interfaces = Module.Read (this, (type, reader) => reader.ReadInterfaces (type)); return interfaces = new Collection (); } } public bool HasNestedTypes { get { if (nested_types != null) return nested_types.Count > 0; if (HasImage) return Module.Read (this, (type, reader) => reader.HasNestedTypes (type)); return false; } } public Collection NestedTypes { get { if (nested_types != null) return nested_types; if (HasImage) return nested_types = Module.Read (this, (type, reader) => reader.ReadNestedTypes (type)); return nested_types = new MemberDefinitionCollection (this); } } internal new bool HasImage { get { return Module != null && Module.HasImage; } } public bool HasMethods { get { if (methods != null) return methods.Count > 0; if (HasImage) return methods_range.Length > 0; return false; } } public Collection Methods { get { if (methods != null) return methods; if (HasImage) return methods = Module.Read (this, (type, reader) => reader.ReadMethods (type)); return methods = new MemberDefinitionCollection (this); } } public bool HasFields { get { if (fields != null) return fields.Count > 0; if (HasImage) return fields_range.Length > 0; return false; } } public Collection Fields { get { if (fields != null) return fields; if (HasImage) return fields = Module.Read (this, (type, reader) => reader.ReadFields (type)); return fields = new MemberDefinitionCollection (this); } } public bool HasEvents { get { if (events != null) return events.Count > 0; if (HasImage) return Module.Read (this, (type, reader) => reader.HasEvents (type)); return false; } } public Collection Events { get { if (events != null) return events; if (HasImage) return events = Module.Read (this, (type, reader) => reader.ReadEvents (type)); return events = new MemberDefinitionCollection (this); } } public bool HasProperties { get { if (properties != null) return properties.Count > 0; if (HasImage) return Module.Read (this, (type, reader) => reader.HasProperties (type)); return false; } } public Collection Properties { get { if (properties != null) return properties; if (HasImage) return properties = Module.Read (this, (type, reader) => reader.ReadProperties (type)); return properties = new MemberDefinitionCollection (this); } } public bool HasSecurityDeclarations { get { if (security_declarations != null) return security_declarations.Count > 0; return this.GetHasSecurityDeclarations (Module); } } public Collection SecurityDeclarations { get { return security_declarations ?? (security_declarations = this.GetSecurityDeclarations (Module)); } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } public override bool HasGenericParameters { get { if (generic_parameters != null) return generic_parameters.Count > 0; return this.GetHasGenericParameters (Module); } } public override Collection GenericParameters { get { return generic_parameters ?? (generic_parameters = this.GetGenericParameters (Module)); } } #region TypeAttributes public bool IsNotPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NotPublic); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NotPublic, value); } } public bool IsPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.Public); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.Public, value); } } public bool IsNestedPublic { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPublic); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPublic, value); } } public bool IsNestedPrivate { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPrivate); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedPrivate, value); } } public bool IsNestedFamily { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamily); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamily, value); } } public bool IsNestedAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedAssembly); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedAssembly, value); } } public bool IsNestedFamilyAndAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamANDAssem); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamANDAssem, value); } } public bool IsNestedFamilyOrAssembly { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamORAssem); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.VisibilityMask, (uint) TypeAttributes.NestedFamORAssem, value); } } public bool IsAutoLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.AutoLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.AutoLayout, value); } } public bool IsSequentialLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.SequentialLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.SequentialLayout, value); } } public bool IsExplicitLayout { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.ExplicitLayout); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.LayoutMask, (uint) TypeAttributes.ExplicitLayout, value); } } public bool IsClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Class); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Class, value); } } public bool IsInterface { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Interface); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.ClassSemanticMask, (uint) TypeAttributes.Interface, value); } } public bool IsAbstract { get { return attributes.GetAttributes ((uint) TypeAttributes.Abstract); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Abstract, value); } } public bool IsSealed { get { return attributes.GetAttributes ((uint) TypeAttributes.Sealed); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Sealed, value); } } public bool IsSpecialName { get { return attributes.GetAttributes ((uint) TypeAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.SpecialName, value); } } public bool IsImport { get { return attributes.GetAttributes ((uint) TypeAttributes.Import); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Import, value); } } public bool IsSerializable { get { return attributes.GetAttributes ((uint) TypeAttributes.Serializable); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.Serializable, value); } } public bool IsAnsiClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AnsiClass, value); } } public bool IsUnicodeClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.UnicodeClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.UnicodeClass, value); } } public bool IsAutoClass { get { return attributes.GetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AutoClass); } set { attributes = attributes.SetMaskedAttributes ((uint) TypeAttributes.StringFormatMask, (uint) TypeAttributes.AutoClass, value); } } public bool IsBeforeFieldInit { get { return attributes.GetAttributes ((uint) TypeAttributes.BeforeFieldInit); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.BeforeFieldInit, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((uint) TypeAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.RTSpecialName, value); } } public bool HasSecurity { get { return attributes.GetAttributes ((uint) TypeAttributes.HasSecurity); } set { attributes = attributes.SetAttributes ((uint) TypeAttributes.HasSecurity, value); } } #endregion public bool IsEnum { get { return base_type != null && base_type.IsTypeOf ("System", "Enum"); } } public override bool IsValueType { get { if (base_type == null) return false; return base_type.IsTypeOf ("System", "Enum") || (base_type.IsTypeOf ("System", "ValueType") && !this.IsTypeOf ("System", "Enum")); } } public override bool IsDefinition { get { return true; } } public new TypeDefinition DeclaringType { get { return (TypeDefinition) base.DeclaringType; } set { base.DeclaringType = value; } } public TypeDefinition (string @namespace, string name, TypeAttributes attributes) : base (@namespace, name) { this.attributes = (uint) attributes; this.token = new MetadataToken (TokenType.TypeDef); } public TypeDefinition (string @namespace, string name, TypeAttributes attributes, TypeReference baseType) : this (@namespace, name, attributes) { this.BaseType = baseType; } public override TypeDefinition Resolve () { return this; } } static partial class Mixin { public static TypeReference GetEnumUnderlyingType (this TypeDefinition self) { var fields = self.Fields; for (int i = 0; i < fields.Count; i++) { var field = fields [i]; if (!field.IsStatic) return field.FieldType; } throw new ArgumentException (); } public static TypeDefinition GetNestedType (this TypeDefinition self, string name) { if (!self.HasNestedTypes) return null; var nested_types = self.NestedTypes; for (int i = 0; i < nested_types.Count; i++) { var nested_type = nested_types [i]; if (nested_type.Name == name) return nested_type; } return null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/GenericInstanceType.cs0000664000175000017500000000474212136523632032721 0ustar00directhexdirecthex00000000000000// // GenericInstanceType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Collections.Generic; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class GenericInstanceType : TypeSpecification, IGenericInstance, IGenericContext { Collection arguments; public bool HasGenericArguments { get { return !arguments.IsNullOrEmpty (); } } public Collection GenericArguments { get { if (arguments == null) arguments = new Collection (); return arguments; } } public override TypeReference DeclaringType { get { return ElementType.DeclaringType; } set { throw new NotSupportedException (); } } public override string FullName { get { var name = new StringBuilder (); name.Append (base.FullName); this.GenericInstanceFullName (name); return name.ToString (); } } public override bool IsGenericInstance { get { return true; } } internal override bool ContainsGenericParameter { get { return this.ContainsGenericParameter () || base.ContainsGenericParameter; } } IGenericParameterProvider IGenericContext.Type { get { return ElementType; } } public GenericInstanceType (TypeReference type) : base (type) { base.IsValueType = type.IsValueType; this.etype = MD.ElementType.GenericInst; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeReference.cs0000664000175000017500000001705012136523632031552 0ustar00directhexdirecthex00000000000000// // TypeReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.Metadata; using Mono.Collections.Generic; namespace Mono.Cecil { public enum MetadataType : byte { Void = ElementType.Void, Boolean = ElementType.Boolean, Char = ElementType.Char, SByte = ElementType.I1, Byte = ElementType.U1, Int16 = ElementType.I2, UInt16 = ElementType.U2, Int32 = ElementType.I4, UInt32 = ElementType.U4, Int64 = ElementType.I8, UInt64 = ElementType.U8, Single = ElementType.R4, Double = ElementType.R8, String = ElementType.String, Pointer = ElementType.Ptr, ByReference = ElementType.ByRef, ValueType = ElementType.ValueType, Class = ElementType.Class, Var = ElementType.Var, Array = ElementType.Array, GenericInstance = ElementType.GenericInst, TypedByReference = ElementType.TypedByRef, IntPtr = ElementType.I, UIntPtr = ElementType.U, FunctionPointer = ElementType.FnPtr, Object = ElementType.Object, MVar = ElementType.MVar, RequiredModifier = ElementType.CModReqD, OptionalModifier = ElementType.CModOpt, Sentinel = ElementType.Sentinel, Pinned = ElementType.Pinned, } public class TypeReference : MemberReference, IGenericParameterProvider, IGenericContext { string @namespace; bool value_type; internal IMetadataScope scope; internal ModuleDefinition module; internal ElementType etype = ElementType.None; string fullname; protected Collection generic_parameters; public override string Name { get { return base.Name; } set { base.Name = value; fullname = null; } } public virtual string Namespace { get { return @namespace; } set { @namespace = value; fullname = null; } } public virtual bool IsValueType { get { return value_type; } set { value_type = value; } } public override ModuleDefinition Module { get { if (module != null) return module; var declaring_type = this.DeclaringType; if (declaring_type != null) return declaring_type.Module; return null; } } IGenericParameterProvider IGenericContext.Type { get { return this; } } IGenericParameterProvider IGenericContext.Method { get { return null; } } GenericParameterType IGenericParameterProvider.GenericParameterType { get { return GenericParameterType.Type; } } public virtual bool HasGenericParameters { get { return !generic_parameters.IsNullOrEmpty (); } } public virtual Collection GenericParameters { get { if (generic_parameters != null) return generic_parameters; return generic_parameters = new Collection (); } } public virtual IMetadataScope Scope { get { var declaring_type = this.DeclaringType; if (declaring_type != null) return declaring_type.Scope; return scope; } } public bool IsNested { get { return this.DeclaringType != null; } } public override TypeReference DeclaringType { get { return base.DeclaringType; } set { base.DeclaringType = value; fullname = null; } } public override string FullName { get { if (fullname != null) return fullname; if (IsNested) return fullname = DeclaringType.FullName + "/" + Name; if (string.IsNullOrEmpty (@namespace)) return fullname = Name; return fullname = @namespace + "." + Name; } } public virtual bool IsByReference { get { return false; } } public virtual bool IsPointer { get { return false; } } public virtual bool IsSentinel { get { return false; } } public virtual bool IsArray { get { return false; } } public virtual bool IsGenericParameter { get { return false; } } public virtual bool IsGenericInstance { get { return false; } } public virtual bool IsRequiredModifier { get { return false; } } public virtual bool IsOptionalModifier { get { return false; } } public virtual bool IsPinned { get { return false; } } public virtual bool IsFunctionPointer { get { return false; } } public bool IsPrimitive { get { switch (etype) { case ElementType.Boolean: case ElementType.Char: case ElementType.I: case ElementType.U: case ElementType.I1: case ElementType.U1: case ElementType.I2: case ElementType.U2: case ElementType.I4: case ElementType.U4: case ElementType.I8: case ElementType.U8: case ElementType.R4: case ElementType.R8: return true; default: return false; } } } public virtual MetadataType MetadataType { get { switch (etype) { case ElementType.None: return IsValueType ? MetadataType.ValueType : MetadataType.Class; default: return (MetadataType) etype; } } } protected TypeReference (string @namespace, string name) : base (name) { this.@namespace = @namespace ?? string.Empty; this.token = new MetadataToken (TokenType.TypeRef, 0); } public TypeReference (string @namespace, string name, ModuleDefinition module, IMetadataScope scope) : this (@namespace, name) { this.module = module; this.scope = scope; } public TypeReference (string @namespace, string name, ModuleDefinition module, IMetadataScope scope, bool valueType) : this (@namespace, name, module, scope) { value_type = valueType; } public virtual TypeReference GetElementType () { return this; } public virtual TypeDefinition Resolve () { var module = this.Module; if (module == null) throw new NotSupportedException (); return module.Resolve (this); } } static partial class Mixin { public static bool IsTypeOf (this TypeReference self, string @namespace, string name) { return self.Name == name && self.Namespace == @namespace; } public static bool IsTypeSpecification (this TypeReference type) { switch (type.etype) { case ElementType.Array: case ElementType.ByRef: case ElementType.CModOpt: case ElementType.CModReqD: case ElementType.FnPtr: case ElementType.GenericInst: case ElementType.MVar: case ElementType.Pinned: case ElementType.Ptr: case ElementType.SzArray: case ElementType.Sentinel: case ElementType.Var: return true; } return false; } public static TypeDefinition CheckedResolve (this TypeReference self) { var type = self.Resolve (); if (type == null) throw new InvalidOperationException (string.Format ("Failed to resolve type: {0}", self.FullName)); return type; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IMarshalInfoProvider.cs0000664000175000017500000000352612136523632033044 0ustar00directhexdirecthex00000000000000// // IMarshalInfoProvider.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public interface IMarshalInfoProvider : IMetadataTokenProvider { bool HasMarshalInfo { get; } MarshalInfo MarshalInfo { get; set; } } static partial class Mixin { public static bool GetHasMarshalInfo ( this IMarshalInfoProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasMarshalInfo (provider)) : false; } public static MarshalInfo GetMarshalInfo ( this IMarshalInfoProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadMarshalInfo (provider)) : null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PointerType.cs0000664000175000017500000000337512136523632031301 0ustar00directhexdirecthex00000000000000// // PointerType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class PointerType : TypeSpecification { public override string Name { get { return base.Name + "*"; } } public override string FullName { get { return base.FullName + "*"; } } public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsPointer { get { return true; } } public PointerType (TypeReference type) : base (type) { Mixin.CheckType (type); this.etype = MD.ElementType.Ptr; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyLinkedResource.cs0000664000175000017500000000345212136523632033431 0ustar00directhexdirecthex00000000000000// // AssemblyLinkedResource.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public sealed class AssemblyLinkedResource : Resource { AssemblyNameReference reference; public AssemblyNameReference Assembly { get { return reference; } set { reference = value; } } public override ResourceType ResourceType { get { return ResourceType.AssemblyLinked; } } public AssemblyLinkedResource (string name, ManifestResourceAttributes flags) : base (name, flags) { } public AssemblyLinkedResource (string name, ManifestResourceAttributes flags, AssemblyNameReference reference) : base (name, flags) { this.reference = reference; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IMethodSignature.cs0000664000175000017500000000417012136523632032224 0ustar00directhexdirecthex00000000000000// // IMethodSignature.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Text; using Mono.Collections.Generic; namespace Mono.Cecil { public interface IMethodSignature : IMetadataTokenProvider { bool HasThis { get; set; } bool ExplicitThis { get; set; } MethodCallingConvention CallingConvention { get; set; } bool HasParameters { get; } Collection Parameters { get; } TypeReference ReturnType { get; set; } MethodReturnType MethodReturnType { get; } } static partial class Mixin { public static void MethodSignatureFullName (this IMethodSignature self, StringBuilder builder) { builder.Append ("("); if (self.HasParameters) { var parameters = self.Parameters; for (int i = 0; i < parameters.Count; i++) { var parameter = parameters [i]; if (i > 0) builder.Append (","); if (parameter.ParameterType.IsSentinel) builder.Append ("...,"); builder.Append (parameter.ParameterType.FullName); } } builder.Append (")"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IMetadataScope.cs0000664000175000017500000000266412136523632031642 0ustar00directhexdirecthex00000000000000// // IMetadataScope.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum MetadataScopeType { AssemblyNameReference, ModuleReference, ModuleDefinition, } public interface IMetadataScope : IMetadataTokenProvider { MetadataScopeType MetadataScopeType { get; } string Name { get; set; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeAttributes.cs0000664000175000017500000000677712136523632032020 0ustar00directhexdirecthex00000000000000// // TypeAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum TypeAttributes : uint { // Visibility attributes VisibilityMask = 0x00000007, // Use this mask to retrieve visibility information NotPublic = 0x00000000, // Class has no public scope Public = 0x00000001, // Class has public scope NestedPublic = 0x00000002, // Class is nested with public visibility NestedPrivate = 0x00000003, // Class is nested with private visibility NestedFamily = 0x00000004, // Class is nested with family visibility NestedAssembly = 0x00000005, // Class is nested with assembly visibility NestedFamANDAssem = 0x00000006, // Class is nested with family and assembly visibility NestedFamORAssem = 0x00000007, // Class is nested with family or assembly visibility // Class layout attributes LayoutMask = 0x00000018, // Use this mask to retrieve class layout information AutoLayout = 0x00000000, // Class fields are auto-laid out SequentialLayout = 0x00000008, // Class fields are laid out sequentially ExplicitLayout = 0x00000010, // Layout is supplied explicitly // Class semantics attributes ClassSemanticMask = 0x00000020, // Use this mask to retrieve class semantics information Class = 0x00000000, // Type is a class Interface = 0x00000020, // Type is an interface // Special semantics in addition to class semantics Abstract = 0x00000080, // Class is abstract Sealed = 0x00000100, // Class cannot be extended SpecialName = 0x00000400, // Class name is special // Implementation attributes Import = 0x00001000, // Class/Interface is imported Serializable = 0x00002000, // Class is serializable // String formatting attributes StringFormatMask = 0x00030000, // Use this mask to retrieve string information for native interop AnsiClass = 0x00000000, // LPSTR is interpreted as ANSI UnicodeClass = 0x00010000, // LPSTR is interpreted as Unicode AutoClass = 0x00020000, // LPSTR is interpreted automatically // Class initialization attributes BeforeFieldInit = 0x00100000, // Initialize the class before first static field access // Additional flags RTSpecialName = 0x00000800, // CLI provides 'special' behavior, depending upon the name of the Type HasSecurity = 0x00040000, // Type has security associate with it Forwarder = 0x00200000, // Exported type is a type forwarder } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/FieldReference.cs0000664000175000017500000000462412136523632031657 0ustar00directhexdirecthex00000000000000// // FieldReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { public class FieldReference : MemberReference { TypeReference field_type; public TypeReference FieldType { get { return field_type; } set { field_type = value; } } public override string FullName { get { return field_type.FullName + " " + MemberFullName (); } } internal override bool ContainsGenericParameter { get { return field_type.ContainsGenericParameter || base.ContainsGenericParameter; } } internal FieldReference () { this.token = new MetadataToken (TokenType.MemberRef); } public FieldReference (string name, TypeReference fieldType) : base (name) { if (fieldType == null) throw new ArgumentNullException ("fieldType"); this.field_type = fieldType; this.token = new MetadataToken (TokenType.MemberRef); } public FieldReference (string name, TypeReference fieldType, TypeReference declaringType) : this (name, fieldType) { if (declaringType == null) throw new ArgumentNullException("declaringType"); this.DeclaringType = declaringType; } public virtual FieldDefinition Resolve () { var module = this.Module; if (module == null) throw new NotSupportedException (); return module.Resolve (this); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/IConstantProvider.cs0000664000175000017500000000334012136523632032424 0ustar00directhexdirecthex00000000000000// // IConstantProvider.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public interface IConstantProvider : IMetadataTokenProvider { bool HasConstant { get; set; } object Constant { get; set; } } static partial class Mixin { internal static object NoValue = new object (); internal static object NotResolved = new object (); public static void ResolveConstant ( this IConstantProvider self, ref object constant, ModuleDefinition module) { constant = module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadConstant (provider)) : Mixin.NoValue; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/PropertyReference.cs0000664000175000017500000000335012136523632032453 0ustar00directhexdirecthex00000000000000// // PropertyReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public abstract class PropertyReference : MemberReference { TypeReference property_type; public TypeReference PropertyType { get { return property_type; } set { property_type = value; } } public abstract Collection Parameters { get; } internal PropertyReference (string name, TypeReference propertyType) : base (name) { if (propertyType == null) throw new ArgumentNullException ("propertyType"); property_type = propertyType; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ICustomAttributeProvider.cs0000664000175000017500000000375612136523632034004 0ustar00directhexdirecthex00000000000000// // ICustomAttributeProvider.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public interface ICustomAttributeProvider : IMetadataTokenProvider { Collection CustomAttributes { get; } bool HasCustomAttributes { get; } } static partial class Mixin { public static bool GetHasCustomAttributes ( this ICustomAttributeProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.HasCustomAttributes (provider)) : false; } public static Collection GetCustomAttributes ( this ICustomAttributeProvider self, ModuleDefinition module) { return module.HasImage () ? module.Read (self, (provider, reader) => reader.ReadCustomAttributes (provider)) : new Collection (); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ParameterDefinition.cs0000664000175000017500000001136012136523632032741 0ustar00directhexdirecthex00000000000000// // ParameterDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class ParameterDefinition : ParameterReference, ICustomAttributeProvider, IConstantProvider, IMarshalInfoProvider { ushort attributes; internal IMethodSignature method; object constant = Mixin.NotResolved; Collection custom_attributes; MarshalInfo marshal_info; public ParameterAttributes Attributes { get { return (ParameterAttributes) attributes; } set { attributes = (ushort) value; } } public IMethodSignature Method { get { return method; } } public bool HasConstant { get { ResolveConstant (); return constant != Mixin.NoValue; } set { if (!value) constant = Mixin.NoValue; } } public object Constant { get { return HasConstant ? constant : null; } set { constant = value; } } void ResolveConstant () { if (constant != Mixin.NotResolved) return; this.ResolveConstant (ref constant, parameter_type.Module); } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (parameter_type.Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (parameter_type.Module)); } } public bool HasMarshalInfo { get { if (marshal_info != null) return true; return this.GetHasMarshalInfo (parameter_type.Module); } } public MarshalInfo MarshalInfo { get { return marshal_info ?? (marshal_info = this.GetMarshalInfo (parameter_type.Module)); } set { marshal_info = value; } } #region ParameterAttributes public bool IsIn { get { return attributes.GetAttributes ((ushort) ParameterAttributes.In); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.In, value); } } public bool IsOut { get { return attributes.GetAttributes ((ushort) ParameterAttributes.Out); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.Out, value); } } public bool IsLcid { get { return attributes.GetAttributes ((ushort) ParameterAttributes.Lcid); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.Lcid, value); } } public bool IsReturnValue { get { return attributes.GetAttributes ((ushort) ParameterAttributes.Retval); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.Retval, value); } } public bool IsOptional { get { return attributes.GetAttributes ((ushort) ParameterAttributes.Optional); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.Optional, value); } } public bool HasDefault { get { return attributes.GetAttributes ((ushort) ParameterAttributes.HasDefault); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.HasDefault, value); } } public bool HasFieldMarshal { get { return attributes.GetAttributes ((ushort) ParameterAttributes.HasFieldMarshal); } set { attributes = attributes.SetAttributes ((ushort) ParameterAttributes.HasFieldMarshal, value); } } #endregion public ParameterDefinition (TypeReference parameterType) : this (string.Empty, ParameterAttributes.None, parameterType) { } public ParameterDefinition (string name, ParameterAttributes attributes, TypeReference parameterType) : base (name, parameterType) { this.attributes = (ushort) attributes; this.token = new MetadataToken (TokenType.Param); } public override ParameterDefinition Resolve () { return this; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/Resource.cs0000664000175000017500000000471212136523632030602 0ustar00directhexdirecthex00000000000000// // ResourceType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum ResourceType { Linked, Embedded, AssemblyLinked, } public abstract class Resource { string name; uint attributes; public string Name { get { return name; } set { name = value; } } public ManifestResourceAttributes Attributes { get { return (ManifestResourceAttributes) attributes; } set { attributes = (uint) value; } } public abstract ResourceType ResourceType { get; } #region ManifestResourceAttributes public bool IsPublic { get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public); } set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Public, value); } } public bool IsPrivate { get { return attributes.GetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private); } set { attributes = attributes.SetMaskedAttributes ((uint) ManifestResourceAttributes.VisibilityMask, (uint) ManifestResourceAttributes.Private, value); } } #endregion internal Resource (string name, ManifestResourceAttributes attributes) { this.name = name; this.attributes = (uint) attributes; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/CustomAttribute.cs0000664000175000017500000001172612136523632032154 0ustar00directhexdirecthex00000000000000// // CustomAttribute.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil { public struct CustomAttributeArgument { readonly TypeReference type; readonly object value; public TypeReference Type { get { return type; } } public object Value { get { return value; } } public CustomAttributeArgument (TypeReference type, object value) { Mixin.CheckType (type); this.type = type; this.value = value; } } public struct CustomAttributeNamedArgument { readonly string name; readonly CustomAttributeArgument argument; public string Name { get { return name; } } public CustomAttributeArgument Argument { get { return argument; } } public CustomAttributeNamedArgument (string name, CustomAttributeArgument argument) { Mixin.CheckName (name); this.name = name; this.argument = argument; } } public interface ICustomAttribute { TypeReference AttributeType { get; } bool HasFields { get; } bool HasProperties { get; } Collection Fields { get; } Collection Properties { get; } } public sealed class CustomAttribute : ICustomAttribute { readonly internal uint signature; internal bool resolved; MethodReference constructor; byte [] blob; internal Collection arguments; internal Collection fields; internal Collection properties; public MethodReference Constructor { get { return constructor; } set { constructor = value; } } public TypeReference AttributeType { get { return constructor.DeclaringType; } } public bool HasConstructorArguments { get { Resolve (); return !arguments.IsNullOrEmpty (); } } public Collection ConstructorArguments { get { Resolve (); return arguments ?? (arguments = new Collection ()); } } public bool HasFields { get { Resolve (); return !fields.IsNullOrEmpty (); } } public Collection Fields { get { Resolve (); return fields ?? (fields = new Collection ()); } } public bool HasProperties { get { Resolve (); return !properties.IsNullOrEmpty (); } } public Collection Properties { get { Resolve (); return properties ?? (properties = new Collection ()); } } internal bool HasImage { get { return constructor != null && constructor.HasImage; } } internal ModuleDefinition Module { get { return constructor.Module; } } internal CustomAttribute (uint signature, MethodReference constructor) { this.signature = signature; this.constructor = constructor; this.resolved = false; } public CustomAttribute (MethodReference constructor) { this.constructor = constructor; this.resolved = true; } public CustomAttribute (MethodReference constructor, byte [] blob) { this.constructor = constructor; this.resolved = false; this.blob = blob; } public byte [] GetBlob () { if (blob != null) return blob; if (!HasImage || signature == 0) throw new NotSupportedException (); return blob = Module.Read (this, (attribute, reader) => reader.ReadCustomAttributeBlob (attribute.signature)); } void Resolve () { if (resolved || !HasImage) return; Module.Read (this, (attribute, reader) => { reader.ReadCustomAttributeSignature (attribute); return this; }); resolved = true; } } static partial class Mixin { public static void CheckName (string name) { if (name == null) throw new ArgumentNullException ("name"); if (name.Length == 0) throw new ArgumentException ("Empty name"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyHashAlgorithm.cs0000664000175000017500000000247212136523632033246 0ustar00directhexdirecthex00000000000000// // AssemblyHashAlgorithm.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum AssemblyHashAlgorithm : uint { None = 0x0000, Reserved = 0x8003, // MD5 SHA1 = 0x8004 } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/FieldAttributes.cs0000664000175000017500000000475612136523632032115 0ustar00directhexdirecthex00000000000000// // FieldAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum FieldAttributes : ushort { FieldAccessMask = 0x0007, CompilerControlled = 0x0000, // Member not referenceable Private = 0x0001, // Accessible only by the parent type FamANDAssem = 0x0002, // Accessible by sub-types only in this assembly Assembly = 0x0003, // Accessible by anyone in the Assembly Family = 0x0004, // Accessible only by type and sub-types FamORAssem = 0x0005, // Accessible by sub-types anywhere, plus anyone in the assembly Public = 0x0006, // Accessible by anyone who has visibility to this scope field contract attributes Static = 0x0010, // Defined on type, else per instance InitOnly = 0x0020, // Field may only be initialized, not written after init Literal = 0x0040, // Value is compile time constant NotSerialized = 0x0080, // Field does not have to be serialized when type is remoted SpecialName = 0x0200, // Field is special // Interop Attributes PInvokeImpl = 0x2000, // Implementation is forwarded through PInvoke // Additional flags RTSpecialName = 0x0400, // CLI provides 'special' behavior, depending upon the name of the field HasFieldMarshal = 0x1000, // Field has marshalling information HasDefault = 0x8000, // Field has default HasFieldRVA = 0x0100 // Field has RVA } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodDefinition.cs0000664000175000017500000004045312136523632032246 0ustar00directhexdirecthex00000000000000// // MethodDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Cecil.Cil; using Mono.Collections.Generic; using RVA = System.UInt32; namespace Mono.Cecil { public sealed class MethodDefinition : MethodReference, IMemberDefinition, ISecurityDeclarationProvider { ushort attributes; ushort impl_attributes; internal MethodSemanticsAttributes? sem_attrs; Collection custom_attributes; Collection security_declarations; internal RVA rva; internal PInvokeInfo pinvoke; Collection overrides; internal MethodBody body; public MethodAttributes Attributes { get { return (MethodAttributes) attributes; } set { attributes = (ushort) value; } } public MethodImplAttributes ImplAttributes { get { return (MethodImplAttributes) impl_attributes; } set { impl_attributes = (ushort) value; } } public MethodSemanticsAttributes SemanticsAttributes { get { if (sem_attrs.HasValue) return sem_attrs.Value; if (HasImage) { ReadSemantics (); return sem_attrs.Value; } sem_attrs = MethodSemanticsAttributes.None; return sem_attrs.Value; } set { sem_attrs = value; } } internal void ReadSemantics () { if (sem_attrs.HasValue) return; var module = this.Module; if (module == null) return; if (!module.HasImage) return; module.Read (this, (method, reader) => reader.ReadAllSemantics (method)); } public bool HasSecurityDeclarations { get { if (security_declarations != null) return security_declarations.Count > 0; return this.GetHasSecurityDeclarations (Module); } } public Collection SecurityDeclarations { get { return security_declarations ?? (security_declarations = this.GetSecurityDeclarations (Module)); } } public bool HasCustomAttributes { get { if (custom_attributes != null) return custom_attributes.Count > 0; return this.GetHasCustomAttributes (Module); } } public Collection CustomAttributes { get { return custom_attributes ?? (custom_attributes = this.GetCustomAttributes (Module)); } } public int RVA { get { return (int) rva; } } public bool HasBody { get { return (attributes & (ushort) MethodAttributes.Abstract) == 0 && (attributes & (ushort) MethodAttributes.PInvokeImpl) == 0 && (impl_attributes & (ushort) MethodImplAttributes.InternalCall) == 0 && (impl_attributes & (ushort) MethodImplAttributes.Native) == 0 && (impl_attributes & (ushort) MethodImplAttributes.Unmanaged) == 0 && (impl_attributes & (ushort) MethodImplAttributes.Runtime) == 0; } } public MethodBody Body { get { if (body != null) return body; if (!HasBody) return null; if (HasImage && rva != 0) return body = Module.Read (this, (method, reader) => reader.ReadMethodBody (method)); return body = new MethodBody (this); } set { body = value; } } public bool HasPInvokeInfo { get { if (pinvoke != null) return true; return IsPInvokeImpl; } } public PInvokeInfo PInvokeInfo { get { if (pinvoke != null) return pinvoke; if (HasImage && IsPInvokeImpl) return pinvoke = Module.Read (this, (method, reader) => reader.ReadPInvokeInfo (method)); return null; } set { IsPInvokeImpl = true; pinvoke = value; } } public bool HasOverrides { get { if (overrides != null) return overrides.Count > 0; if (HasImage) return Module.Read (this, (method, reader) => reader.HasOverrides (method)); return false; } } public Collection Overrides { get { if (overrides != null) return overrides; if (HasImage) return overrides = Module.Read (this, (method, reader) => reader.ReadOverrides (method)); return overrides = new Collection (); } } public override bool HasGenericParameters { get { if (generic_parameters != null) return generic_parameters.Count > 0; return this.GetHasGenericParameters (Module); } } public override Collection GenericParameters { get { return generic_parameters ?? (generic_parameters = this.GetGenericParameters (Module)); } } #region MethodAttributes public bool IsCompilerControlled { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.CompilerControlled); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.CompilerControlled, value); } } public bool IsPrivate { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Private); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Private, value); } } public bool IsFamilyAndAssembly { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.FamANDAssem); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.FamANDAssem, value); } } public bool IsAssembly { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Assembly); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Assembly, value); } } public bool IsFamily { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Family); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Family, value); } } public bool IsFamilyOrAssembly { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.FamORAssem); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.FamORAssem, value); } } public bool IsPublic { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Public); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.MemberAccessMask, (ushort) MethodAttributes.Public, value); } } public bool IsStatic { get { return attributes.GetAttributes ((ushort) MethodAttributes.Static); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.Static, value); } } public bool IsFinal { get { return attributes.GetAttributes ((ushort) MethodAttributes.Final); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.Final, value); } } public bool IsVirtual { get { return attributes.GetAttributes ((ushort) MethodAttributes.Virtual); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.Virtual, value); } } public bool IsHideBySig { get { return attributes.GetAttributes ((ushort) MethodAttributes.HideBySig); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.HideBySig, value); } } public bool IsReuseSlot { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.VtableLayoutMask, (ushort) MethodAttributes.ReuseSlot); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.VtableLayoutMask, (ushort) MethodAttributes.ReuseSlot, value); } } public bool IsNewSlot { get { return attributes.GetMaskedAttributes ((ushort) MethodAttributes.VtableLayoutMask, (ushort) MethodAttributes.NewSlot); } set { attributes = attributes.SetMaskedAttributes ((ushort) MethodAttributes.VtableLayoutMask, (ushort) MethodAttributes.NewSlot, value); } } public bool IsCheckAccessOnOverride { get { return attributes.GetAttributes ((ushort) MethodAttributes.CheckAccessOnOverride); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.CheckAccessOnOverride, value); } } public bool IsAbstract { get { return attributes.GetAttributes ((ushort) MethodAttributes.Abstract); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.Abstract, value); } } public bool IsSpecialName { get { return attributes.GetAttributes ((ushort) MethodAttributes.SpecialName); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.SpecialName, value); } } public bool IsPInvokeImpl { get { return attributes.GetAttributes ((ushort) MethodAttributes.PInvokeImpl); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.PInvokeImpl, value); } } public bool IsUnmanagedExport { get { return attributes.GetAttributes ((ushort) MethodAttributes.UnmanagedExport); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.UnmanagedExport, value); } } public bool IsRuntimeSpecialName { get { return attributes.GetAttributes ((ushort) MethodAttributes.RTSpecialName); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.RTSpecialName, value); } } public bool HasSecurity { get { return attributes.GetAttributes ((ushort) MethodAttributes.HasSecurity); } set { attributes = attributes.SetAttributes ((ushort) MethodAttributes.HasSecurity, value); } } #endregion #region MethodImplAttributes public bool IsIL { get { return impl_attributes.GetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.IL); } set { impl_attributes = impl_attributes.SetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.IL, value); } } public bool IsNative { get { return impl_attributes.GetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.Native); } set { impl_attributes = impl_attributes.SetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.Native, value); } } public bool IsRuntime { get { return impl_attributes.GetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.Runtime); } set { impl_attributes = impl_attributes.SetMaskedAttributes ((ushort) MethodImplAttributes.CodeTypeMask, (ushort) MethodImplAttributes.Runtime, value); } } public bool IsUnmanaged { get { return impl_attributes.GetMaskedAttributes ((ushort) MethodImplAttributes.ManagedMask, (ushort) MethodImplAttributes.Unmanaged); } set { impl_attributes = impl_attributes.SetMaskedAttributes ((ushort) MethodImplAttributes.ManagedMask, (ushort) MethodImplAttributes.Unmanaged, value); } } public bool IsManaged { get { return impl_attributes.GetMaskedAttributes ((ushort) MethodImplAttributes.ManagedMask, (ushort) MethodImplAttributes.Managed); } set { impl_attributes = impl_attributes.SetMaskedAttributes ((ushort) MethodImplAttributes.ManagedMask, (ushort) MethodImplAttributes.Managed, value); } } public bool IsForwardRef { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.ForwardRef); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.ForwardRef, value); } } public bool IsPreserveSig { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.PreserveSig); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.PreserveSig, value); } } public bool IsInternalCall { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.InternalCall); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.InternalCall, value); } } public bool IsSynchronized { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.Synchronized); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.Synchronized, value); } } public bool NoInlining { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.NoInlining); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.NoInlining, value); } } public bool NoOptimization { get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.NoOptimization); } set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.NoOptimization, value); } } #endregion #region MethodSemanticsAttributes public bool IsSetter { get { return this.GetSemantics (MethodSemanticsAttributes.Setter); } set { this.SetSemantics (MethodSemanticsAttributes.Setter, value); } } public bool IsGetter { get { return this.GetSemantics (MethodSemanticsAttributes.Getter); } set { this.SetSemantics (MethodSemanticsAttributes.Getter, value); } } public bool IsOther { get { return this.GetSemantics (MethodSemanticsAttributes.Other); } set { this.SetSemantics (MethodSemanticsAttributes.Other, value); } } public bool IsAddOn { get { return this.GetSemantics (MethodSemanticsAttributes.AddOn); } set { this.SetSemantics (MethodSemanticsAttributes.AddOn, value); } } public bool IsRemoveOn { get { return this.GetSemantics (MethodSemanticsAttributes.RemoveOn); } set { this.SetSemantics (MethodSemanticsAttributes.RemoveOn, value); } } public bool IsFire { get { return this.GetSemantics (MethodSemanticsAttributes.Fire); } set { this.SetSemantics (MethodSemanticsAttributes.Fire, value); } } #endregion public new TypeDefinition DeclaringType { get { return (TypeDefinition) base.DeclaringType; } set { base.DeclaringType = value; } } public bool IsConstructor { get { return this.IsRuntimeSpecialName && this.IsSpecialName && (this.Name == ".cctor" || this.Name == ".ctor"); } } public override bool IsDefinition { get { return true; } } internal MethodDefinition () { this.token = new MetadataToken (TokenType.Method); } public MethodDefinition (string name, MethodAttributes attributes, TypeReference returnType) : base (name, returnType) { this.attributes = (ushort) attributes; this.HasThis = !this.IsStatic; this.token = new MetadataToken (TokenType.Method); } public override MethodDefinition Resolve () { return this; } } static partial class Mixin { public static ParameterDefinition GetParameter (this MethodBody self, int index) { var method = self.method; if (method.HasThis) { if (index == 0) return self.ThisParameter; index--; } var parameters = method.Parameters; if (index < 0 || index >= parameters.size) return null; return parameters [index]; } public static VariableDefinition GetVariable (this MethodBody self, int index) { var variables = self.Variables; if (index < 0 || index >= variables.size) return null; return variables [index]; } public static bool GetSemantics (this MethodDefinition self, MethodSemanticsAttributes semantics) { return (self.SemanticsAttributes & semantics) != 0; } public static void SetSemantics (this MethodDefinition self, MethodSemanticsAttributes semantics, bool value) { if (value) self.SemanticsAttributes |= semantics; else self.SemanticsAttributes &= ~semantics; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodAttributes.cs0000664000175000017500000000554012136523632032302 0ustar00directhexdirecthex00000000000000// // MethodAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum MethodAttributes : ushort { MemberAccessMask = 0x0007, CompilerControlled = 0x0000, // Member not referenceable Private = 0x0001, // Accessible only by the parent type FamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly Assembly = 0x0003, // Accessibly by anyone in the Assembly Family = 0x0004, // Accessible only by type and sub-types FamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly Public = 0x0006, // Accessibly by anyone who has visibility to this scope Static = 0x0010, // Defined on type, else per instance Final = 0x0020, // Method may not be overridden Virtual = 0x0040, // Method is virtual HideBySig = 0x0080, // Method hides by name+sig, else just by name VtableLayoutMask = 0x0100, // Use this mask to retrieve vtable attributes ReuseSlot = 0x0000, // Method reuses existing slot in vtable NewSlot = 0x0100, // Method always gets a new slot in the vtable CheckAccessOnOverride = 0x0200, // Method can only be overriden if also accessible Abstract = 0x0400, // Method does not provide an implementation SpecialName = 0x0800, // Method is special // Interop Attributes PInvokeImpl = 0x2000, // Implementation is forwarded through PInvoke UnmanagedExport = 0x0008, // Reserved: shall be zero for conforming implementations // Additional flags RTSpecialName = 0x1000, // CLI provides 'special' behavior, depending upon the name of the method HasSecurity = 0x4000, // Method has security associate with it RequireSecObject = 0x8000 // Method calls another method containing security code } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/AssemblyReader.cs0000664000175000017500000022677412136523632031733 0ustar00directhexdirecthex00000000000000// // AssemblyReader.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.IO; using System.Text; using Mono.Collections.Generic; using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using Mono.Cecil.PE; using RVA = System.UInt32; namespace Mono.Cecil { abstract class ModuleReader { readonly protected Image image; readonly protected ModuleDefinition module; protected ModuleReader (Image image, ReadingMode mode) { this.image = image; this.module = new ModuleDefinition (image); this.module.ReadingMode = mode; } protected abstract void ReadModule (); protected void ReadModuleManifest (MetadataReader reader) { reader.Populate (module); ReadAssembly (reader); } void ReadAssembly (MetadataReader reader) { var name = reader.ReadAssemblyNameDefinition (); if (name == null) { module.kind = ModuleKind.NetModule; return; } var assembly = new AssemblyDefinition (); assembly.Name = name; module.assembly = assembly; assembly.main_module = module; } public static ModuleDefinition CreateModuleFrom (Image image, ReaderParameters parameters) { var module = ReadModule (image, parameters); ReadSymbols (module, parameters); if (parameters.AssemblyResolver != null) module.assembly_resolver = parameters.AssemblyResolver; return module; } static void ReadSymbols (ModuleDefinition module, ReaderParameters parameters) { var symbol_reader_provider = parameters.SymbolReaderProvider; if (symbol_reader_provider == null && parameters.ReadSymbols) symbol_reader_provider = SymbolProvider.GetPlatformReaderProvider (); if (symbol_reader_provider != null) { module.SymbolReaderProvider = symbol_reader_provider; var reader = parameters.SymbolStream != null ? symbol_reader_provider.GetSymbolReader (module, parameters.SymbolStream) : symbol_reader_provider.GetSymbolReader (module, module.FullyQualifiedName); module.ReadSymbols (reader); } } static ModuleDefinition ReadModule (Image image, ReaderParameters parameters) { var reader = CreateModuleReader (image, parameters.ReadingMode); reader.ReadModule (); return reader.module; } static ModuleReader CreateModuleReader (Image image, ReadingMode mode) { switch (mode) { case ReadingMode.Immediate: return new ImmediateModuleReader (image); case ReadingMode.Deferred: return new DeferredModuleReader (image); default: throw new ArgumentException (); } } } sealed class ImmediateModuleReader : ModuleReader { public ImmediateModuleReader (Image image) : base (image, ReadingMode.Immediate) { } protected override void ReadModule () { this.module.Read (this.module, (module, reader) => { ReadModuleManifest (reader); ReadModule (module); return module; }); } public static void ReadModule (ModuleDefinition module) { if (module.HasAssemblyReferences) Read (module.AssemblyReferences); if (module.HasResources) Read (module.Resources); if (module.HasModuleReferences) Read (module.ModuleReferences); if (module.HasTypes) ReadTypes (module.Types); if (module.HasExportedTypes) Read (module.ExportedTypes); if (module.HasCustomAttributes) Read (module.CustomAttributes); var assembly = module.Assembly; if (assembly == null) return; if (assembly.HasCustomAttributes) Read (assembly.CustomAttributes); if (assembly.HasSecurityDeclarations) Read (assembly.SecurityDeclarations); } static void ReadTypes (Collection types) { for (int i = 0; i < types.Count; i++) ReadType (types [i]); } static void ReadType (TypeDefinition type) { ReadGenericParameters (type); if (type.HasInterfaces) Read (type.Interfaces); if (type.HasNestedTypes) ReadTypes (type.NestedTypes); if (type.HasLayoutInfo) Read (type.ClassSize); if (type.HasFields) ReadFields (type); if (type.HasMethods) ReadMethods (type); if (type.HasProperties) ReadProperties (type); if (type.HasEvents) ReadEvents (type); ReadSecurityDeclarations (type); ReadCustomAttributes (type); } static void ReadGenericParameters (IGenericParameterProvider provider) { if (!provider.HasGenericParameters) return; var parameters = provider.GenericParameters; for (int i = 0; i < parameters.Count; i++) { var parameter = parameters [i]; if (parameter.HasConstraints) Read (parameter.Constraints); if (parameter.HasCustomAttributes) Read (parameter.CustomAttributes); } } static void ReadSecurityDeclarations (ISecurityDeclarationProvider provider) { if (provider.HasSecurityDeclarations) Read (provider.SecurityDeclarations); } static void ReadCustomAttributes (ICustomAttributeProvider provider) { if (provider.HasCustomAttributes) Read (provider.CustomAttributes); } static void ReadFields (TypeDefinition type) { var fields = type.Fields; for (int i = 0; i < fields.Count; i++) { var field = fields [i]; if (field.HasConstant) Read (field.Constant); if (field.HasLayoutInfo) Read (field.Offset); if (field.RVA > 0) Read (field.InitialValue); if (field.HasMarshalInfo) Read (field.MarshalInfo); ReadCustomAttributes (field); } } static void ReadMethods (TypeDefinition type) { var methods = type.Methods; for (int i = 0; i < methods.Count; i++) { var method = methods [i]; ReadGenericParameters (method); if (method.HasParameters) ReadParameters (method); if (method.HasOverrides) Read (method.Overrides); if (method.IsPInvokeImpl) Read (method.PInvokeInfo); ReadSecurityDeclarations (method); ReadCustomAttributes (method); var return_type = method.MethodReturnType; if (return_type.HasConstant) Read (return_type.Constant); if (return_type.HasMarshalInfo) Read (return_type.MarshalInfo); ReadCustomAttributes (return_type); } } static void ReadParameters (MethodDefinition method) { var parameters = method.Parameters; for (int i = 0; i < parameters.Count; i++) { var parameter = parameters [i]; if (parameter.HasConstant) Read (parameter.Constant); if (parameter.HasMarshalInfo) Read (parameter.MarshalInfo); ReadCustomAttributes (parameter); } } static void ReadProperties (TypeDefinition type) { var properties = type.Properties; for (int i = 0; i < properties.Count; i++) { var property = properties [i]; Read (property.GetMethod); if (property.HasConstant) Read (property.Constant); ReadCustomAttributes (property); } } static void ReadEvents (TypeDefinition type) { var events = type.Events; for (int i = 0; i < events.Count; i++) { var @event = events [i]; Read (@event.AddMethod); ReadCustomAttributes (@event); } } static void Read (object collection) { } } sealed class DeferredModuleReader : ModuleReader { public DeferredModuleReader (Image image) : base (image, ReadingMode.Deferred) { } protected override void ReadModule () { this.module.Read (this.module, (module, reader) => { ReadModuleManifest (reader); return module; }); } } sealed class MetadataReader : ByteBuffer { readonly internal Image image; readonly internal ModuleDefinition module; readonly internal MetadataSystem metadata; internal IGenericContext context; internal CodeReader code; uint Position { get { return (uint) base.position; } set { base.position = (int) value; } } public MetadataReader (ModuleDefinition module) : base (module.Image.MetadataSection.Data) { this.image = module.Image; this.module = module; this.metadata = module.MetadataSystem; this.code = CodeReader.CreateCodeReader (this); } int GetCodedIndexSize (CodedIndex index) { return image.GetCodedIndexSize (index); } uint ReadByIndexSize (int size) { if (size == 4) return ReadUInt32 (); else return ReadUInt16 (); } byte [] ReadBlob () { var blob_heap = image.BlobHeap; if (blob_heap == null) { position += 2; return Empty.Array; } return blob_heap.Read (ReadBlobIndex ()); } byte [] ReadBlob (uint signature) { var blob_heap = image.BlobHeap; if (blob_heap == null) return Empty.Array; return blob_heap.Read (signature); } uint ReadBlobIndex () { var blob_heap = image.BlobHeap; return ReadByIndexSize (blob_heap != null ? blob_heap.IndexSize : 2); } string ReadString () { return image.StringHeap.Read (ReadByIndexSize (image.StringHeap.IndexSize)); } uint ReadStringIndex () { return ReadByIndexSize (image.StringHeap.IndexSize); } uint ReadTableIndex (Table table) { return ReadByIndexSize (image.GetTableIndexSize (table)); } MetadataToken ReadMetadataToken (CodedIndex index) { return index.GetMetadataToken (ReadByIndexSize (GetCodedIndexSize (index))); } int MoveTo (Table table) { var info = image.TableHeap [table]; if (info.Length != 0) Position = info.Offset; return (int) info.Length; } bool MoveTo (Table table, uint row) { var info = image.TableHeap [table]; var length = info.Length; if (length == 0 || row > length) return false; Position = info.Offset + (info.RowSize * (row - 1)); return true; } public AssemblyNameDefinition ReadAssemblyNameDefinition () { if (MoveTo (Table.Assembly) == 0) return null; var name = new AssemblyNameDefinition (); name.HashAlgorithm = (AssemblyHashAlgorithm) ReadUInt32 (); PopulateVersionAndFlags (name); name.PublicKey = ReadBlob (); PopulateNameAndCulture (name); return name; } public ModuleDefinition Populate (ModuleDefinition module) { if (MoveTo (Table.Module) == 0) return module; Advance (2); // Generation module.Name = ReadString (); module.Mvid = image.GuidHeap.Read (ReadByIndexSize (image.GuidHeap.IndexSize)); return module; } public Collection ReadAssemblyReferences () { int length = MoveTo (Table.AssemblyRef); var references = new Collection (length); for (uint i = 1; i <= length; i++) { var reference = new AssemblyNameReference (); reference.token = new MetadataToken (TokenType.AssemblyRef, i); PopulateVersionAndFlags (reference); reference.PublicKeyToken = ReadBlob (); PopulateNameAndCulture (reference); reference.Hash = ReadBlob (); references.Add (reference); } return references; } public MethodDefinition ReadEntryPoint () { if (module.Kind != ModuleKind.Console && module.Kind != ModuleKind.Windows) return null; var token = new MetadataToken (module.Image.EntryPointToken); return GetMethodDefinition (token.RID); } public Collection ReadModules () { var modules = new Collection (1); modules.Add (this.module); int length = MoveTo (Table.File); for (uint i = 1; i <= length; i++) { var attributes = (FileAttributes) ReadUInt32 (); var name = ReadString (); ReadBlobIndex (); if (attributes != FileAttributes.ContainsMetaData) continue; var parameters = new ReaderParameters { ReadingMode = module.ReadingMode, SymbolReaderProvider = module.SymbolReaderProvider, }; modules.Add (ModuleDefinition.ReadModule ( GetModuleFileName (name), parameters)); } return modules; } string GetModuleFileName (string name) { if (module.FullyQualifiedName == null) throw new NotSupportedException (); var path = Path.GetDirectoryName (module.FullyQualifiedName); return Path.Combine (path, name); } public Collection ReadModuleReferences () { int length = MoveTo (Table.ModuleRef); var references = new Collection (length); for (uint i = 1; i <= length; i++) { var reference = new ModuleReference (ReadString ()); reference.token = new MetadataToken (TokenType.ModuleRef, i); references.Add (reference); } return references; } public bool HasFileResource () { int length = MoveTo (Table.File); if (length == 0) return false; for (uint i = 1; i <= length; i++) if (ReadFileRecord (i).Col1 == FileAttributes.ContainsNoMetaData) return true; return false; } public Collection ReadResources () { int length = MoveTo (Table.ManifestResource); var resources = new Collection (length); for (int i = 1; i <= length; i++) { var offset = ReadUInt32 (); var flags = (ManifestResourceAttributes) ReadUInt32 (); var name = ReadString (); var implementation = ReadMetadataToken (CodedIndex.Implementation); Resource resource; if (implementation.RID == 0) { resource = new EmbeddedResource (name, flags, offset, this); } else if (implementation.TokenType == TokenType.AssemblyRef) { resource = new AssemblyLinkedResource (name, flags) { Assembly = (AssemblyNameReference) GetTypeReferenceScope (implementation), }; } else if (implementation.TokenType == TokenType.File) { var file_record = ReadFileRecord (implementation.RID); resource = new LinkedResource (name, flags) { File = file_record.Col2, hash = ReadBlob (file_record.Col3) }; } else throw new NotSupportedException (); resources.Add (resource); } return resources; } Row ReadFileRecord (uint rid) { var position = this.position; if (!MoveTo (Table.File, rid)) throw new ArgumentException (); var record = new Row ( (FileAttributes) ReadUInt32 (), ReadString (), ReadBlobIndex ()); this.position = position; return record; } public MemoryStream GetManagedResourceStream (uint offset) { var rva = image.Resources.VirtualAddress; var section = image.GetSectionAtVirtualAddress (rva); var position = (rva - section.VirtualAddress) + offset; var buffer = section.Data; var length = buffer [position] | (buffer [position + 1] << 8) | (buffer [position + 2] << 16) | (buffer [position + 3] << 24); return new MemoryStream (buffer, (int) position + 4, length); } void PopulateVersionAndFlags (AssemblyNameReference name) { name.Version = new Version ( ReadUInt16 (), ReadUInt16 (), ReadUInt16 (), ReadUInt16 ()); name.Attributes = (AssemblyAttributes) ReadUInt32 (); } void PopulateNameAndCulture (AssemblyNameReference name) { name.Name = ReadString (); name.Culture = ReadString (); } public TypeDefinitionCollection ReadTypes () { InitializeTypeDefinitions (); var mtypes = metadata.Types; var type_count = mtypes.Length - metadata.NestedTypes.Count; var types = new TypeDefinitionCollection (module, type_count); for (int i = 0; i < mtypes.Length; i++) { var type = mtypes [i]; if (IsNested (type.Attributes)) continue; types.Add (type); } return types; } void InitializeTypeDefinitions () { if (metadata.Types != null) return; InitializeNestedTypes (); InitializeFields (); InitializeMethods (); int length = MoveTo (Table.TypeDef); var types = metadata.Types = new TypeDefinition [length]; for (uint i = 0; i < length; i++) { if (types [i] != null) continue; types [i] = ReadType (i + 1); } } static bool IsNested (TypeAttributes attributes) { switch (attributes & TypeAttributes.VisibilityMask) { case TypeAttributes.NestedAssembly: case TypeAttributes.NestedFamANDAssem: case TypeAttributes.NestedFamily: case TypeAttributes.NestedFamORAssem: case TypeAttributes.NestedPrivate: case TypeAttributes.NestedPublic: return true; default: return false; } } public bool HasNestedTypes (TypeDefinition type) { uint [] mapping; InitializeNestedTypes (); if (!metadata.TryGetNestedTypeMapping (type, out mapping)) return false; return mapping.Length > 0; } public Collection ReadNestedTypes (TypeDefinition type) { InitializeNestedTypes (); uint [] mapping; if (!metadata.TryGetNestedTypeMapping (type, out mapping)) return new MemberDefinitionCollection (type); var nested_types = new MemberDefinitionCollection (type, mapping.Length); for (int i = 0; i < mapping.Length; i++) nested_types.Add (GetTypeDefinition (mapping [i])); metadata.RemoveNestedTypeMapping (type); return nested_types; } void InitializeNestedTypes () { if (metadata.NestedTypes != null) return; var length = MoveTo (Table.NestedClass); metadata.NestedTypes = new Dictionary (length); metadata.ReverseNestedTypes = new Dictionary (length); if (length == 0) return; for (int i = 1; i <= length; i++) { var nested = ReadTableIndex (Table.TypeDef); var declaring = ReadTableIndex (Table.TypeDef); AddNestedMapping (declaring, nested); } } void AddNestedMapping (uint declaring, uint nested) { metadata.SetNestedTypeMapping (declaring, AddMapping (metadata.NestedTypes, declaring, nested)); metadata.SetReverseNestedTypeMapping (nested, declaring); } static TValue [] AddMapping (Dictionary cache, TKey key, TValue value) { TValue [] mapped; if (!cache.TryGetValue (key, out mapped)) { mapped = new [] { value }; return mapped; } var new_mapped = new TValue [mapped.Length + 1]; Array.Copy (mapped, new_mapped, mapped.Length); new_mapped [mapped.Length] = value; return new_mapped; } TypeDefinition ReadType (uint rid) { if (!MoveTo (Table.TypeDef, rid)) return null; var attributes = (TypeAttributes) ReadUInt32 (); var name = ReadString (); var @namespace = ReadString (); var type = new TypeDefinition (@namespace, name, attributes); type.token = new MetadataToken (TokenType.TypeDef, rid); type.scope = module; type.module = module; metadata.AddTypeDefinition (type); this.context = type; type.BaseType = GetTypeDefOrRef (ReadMetadataToken (CodedIndex.TypeDefOrRef)); type.fields_range = ReadFieldsRange (rid); type.methods_range = ReadMethodsRange (rid); if (IsNested (attributes)) type.DeclaringType = GetNestedTypeDeclaringType (type); return type; } TypeDefinition GetNestedTypeDeclaringType (TypeDefinition type) { uint declaring_rid; if (!metadata.TryGetReverseNestedTypeMapping (type, out declaring_rid)) return null; metadata.RemoveReverseNestedTypeMapping (type); return GetTypeDefinition (declaring_rid); } Range ReadFieldsRange (uint type_index) { return ReadListRange (type_index, Table.TypeDef, Table.Field); } Range ReadMethodsRange (uint type_index) { return ReadListRange (type_index, Table.TypeDef, Table.Method); } Range ReadListRange (uint current_index, Table current, Table target) { var list = new Range (); list.Start = ReadTableIndex (target); uint next_index; var current_table = image.TableHeap [current]; if (current_index == current_table.Length) next_index = image.TableHeap [target].Length + 1; else { var position = Position; Position += (uint) (current_table.RowSize - image.GetTableIndexSize (target)); next_index = ReadTableIndex (target); Position = position; } list.Length = next_index - list.Start; return list; } public Row ReadTypeLayout (TypeDefinition type) { InitializeTypeLayouts (); Row class_layout; var rid = type.token.RID; if (!metadata.ClassLayouts.TryGetValue (rid, out class_layout)) return new Row (Mixin.NoDataMarker, Mixin.NoDataMarker); type.PackingSize = (short) class_layout.Col1; type.ClassSize = (int) class_layout.Col2; metadata.ClassLayouts.Remove (rid); return new Row ((short) class_layout.Col1, (int) class_layout.Col2); } void InitializeTypeLayouts () { if (metadata.ClassLayouts != null) return; int length = MoveTo (Table.ClassLayout); var class_layouts = metadata.ClassLayouts = new Dictionary> (length); for (uint i = 0; i < length; i++) { var packing_size = ReadUInt16 (); var class_size = ReadUInt32 (); var parent = ReadTableIndex (Table.TypeDef); class_layouts.Add (parent, new Row (packing_size, class_size)); } } public TypeReference GetTypeDefOrRef (MetadataToken token) { return (TypeReference) LookupToken (token); } public TypeDefinition GetTypeDefinition (uint rid) { InitializeTypeDefinitions (); var type = metadata.GetTypeDefinition (rid); if (type != null) return type; return ReadTypeDefinition (rid); } TypeDefinition ReadTypeDefinition (uint rid) { if (!MoveTo (Table.TypeDef, rid)) return null; return ReadType (rid); } void InitializeTypeReferences () { if (metadata.TypeReferences != null) return; metadata.TypeReferences = new TypeReference [image.GetTableLength (Table.TypeRef)]; } public TypeReference GetTypeReference (string scope, string full_name) { InitializeTypeReferences (); var length = metadata.TypeReferences.Length; for (uint i = 1; i <= length; i++) { var type = GetTypeReference (i); if (type.FullName != full_name) continue; if (string.IsNullOrEmpty (scope)) return type; if (type.Scope.Name == scope) return type; } return null; } TypeReference GetTypeReference (uint rid) { InitializeTypeReferences (); var type = metadata.GetTypeReference (rid); if (type != null) return type; return ReadTypeReference (rid); } TypeReference ReadTypeReference (uint rid) { if (!MoveTo (Table.TypeRef, rid)) return null; TypeReference declaring_type = null; IMetadataScope scope; var scope_token = ReadMetadataToken (CodedIndex.ResolutionScope); var name = ReadString (); var @namespace = ReadString (); var type = new TypeReference ( @namespace, name, module, null); type.token = new MetadataToken (TokenType.TypeRef, rid); metadata.AddTypeReference (type); if (scope_token.TokenType == TokenType.TypeRef) { declaring_type = GetTypeDefOrRef (scope_token); scope = declaring_type != null ? declaring_type.Scope : module; } else scope = GetTypeReferenceScope (scope_token); type.scope = scope; type.DeclaringType = declaring_type; MetadataSystem.TryProcessPrimitiveType (type); return type; } IMetadataScope GetTypeReferenceScope (MetadataToken scope) { switch (scope.TokenType) { // FIXME: both assembly refs and module refs should be in their // own arrays, in case of someone modify the collections before // this code is called case TokenType.AssemblyRef: return module.AssemblyReferences [(int) scope.RID - 1]; case TokenType.ModuleRef: return module.ModuleReferences [(int) scope.RID - 1]; case TokenType.Module: return module; default: throw new NotSupportedException (); } } public IEnumerable GetTypeReferences () { InitializeTypeReferences (); var length = image.GetTableLength (Table.TypeRef); var type_references = new TypeReference [length]; for (uint i = 1; i <= length; i++) type_references [i - 1] = GetTypeReference (i); return type_references; } TypeReference GetTypeSpecification (uint rid) { if (!MoveTo (Table.TypeSpec, rid)) return null; var reader = ReadSignature (ReadBlobIndex ()); var type = reader.ReadTypeSignature (); if (type.token.RID == 0) type.token = new MetadataToken (TokenType.TypeSpec, rid); return type; } SignatureReader ReadSignature (uint signature) { return new SignatureReader (signature, this); } public bool HasInterfaces (TypeDefinition type) { InitializeInterfaces (); MetadataToken [] mapping; return metadata.TryGetInterfaceMapping (type, out mapping); } public Collection ReadInterfaces (TypeDefinition type) { InitializeInterfaces (); MetadataToken [] mapping; if (!metadata.TryGetInterfaceMapping (type, out mapping)) return new Collection (); var interfaces = new Collection (mapping.Length); this.context = type; for (int i = 0; i < mapping.Length; i++) interfaces.Add (GetTypeDefOrRef (mapping [i])); metadata.RemoveInterfaceMapping (type); return interfaces; } void InitializeInterfaces () { if (metadata.Interfaces != null) return; int length = MoveTo (Table.InterfaceImpl); metadata.Interfaces = new Dictionary (length); for (int i = 0; i < length; i++) { var type = ReadTableIndex (Table.TypeDef); var @interface = ReadMetadataToken (CodedIndex.TypeDefOrRef); AddInterfaceMapping (type, @interface); } } void AddInterfaceMapping (uint type, MetadataToken @interface) { metadata.SetInterfaceMapping (type, AddMapping (metadata.Interfaces, type, @interface)); } public Collection ReadFields (TypeDefinition type) { var fields_range = type.fields_range; if (fields_range.Length == 0) return new MemberDefinitionCollection (type); var fields = new MemberDefinitionCollection (type, (int) fields_range.Length); this.context = type; MoveTo (Table.Field, fields_range.Start); for (uint i = 0; i < fields_range.Length; i++) fields.Add (ReadField (fields_range.Start + i)); return fields; } FieldDefinition ReadField (uint field_rid) { var attributes = (FieldAttributes) ReadUInt16 (); var name = ReadString (); var signature = ReadBlobIndex (); var field = new FieldDefinition (name, attributes, ReadFieldType (signature)); field.token = new MetadataToken (TokenType.Field, field_rid); metadata.AddFieldDefinition (field); return field; } void InitializeFields () { if (metadata.Fields != null) return; metadata.Fields = new FieldDefinition [image.GetTableLength (Table.Field)]; } TypeReference ReadFieldType (uint signature) { var reader = ReadSignature (signature); const byte field_sig = 0x6; if (reader.ReadByte () != field_sig) throw new NotSupportedException (); return reader.ReadTypeSignature (); } public int ReadFieldRVA (FieldDefinition field) { InitializeFieldRVAs (); var rid = field.token.RID; RVA rva; if (!metadata.FieldRVAs.TryGetValue (rid, out rva)) return 0; var size = GetFieldTypeSize (field.FieldType); if (size == 0 || rva == 0) return 0; metadata.FieldRVAs.Remove (rid); field.InitialValue = GetFieldInitializeValue (size, rva); return (int) rva; } byte [] GetFieldInitializeValue (int size, RVA rva) { var section = image.GetSectionAtVirtualAddress (rva); if (section == null) return Empty.Array; var value = new byte [size]; Buffer.BlockCopy (section.Data, (int) (rva - section.VirtualAddress), value, 0, size); return value; } static int GetFieldTypeSize (TypeReference type) { int size = 0; switch (type.etype) { case ElementType.Boolean: case ElementType.U1: case ElementType.I1: size = 1; break; case ElementType.U2: case ElementType.I2: case ElementType.Char: size = 2; break; case ElementType.U4: case ElementType.I4: case ElementType.R4: size = 4; break; case ElementType.U8: case ElementType.I8: case ElementType.R8: size = 8; break; case ElementType.Ptr: case ElementType.FnPtr: size = IntPtr.Size; break; case ElementType.CModOpt: case ElementType.CModReqD: return GetFieldTypeSize (((IModifierType) type).ElementType); default: var field_type = type.CheckedResolve (); if (field_type.HasLayoutInfo) size = field_type.ClassSize; break; } return size; } void InitializeFieldRVAs () { if (metadata.FieldRVAs != null) return; int length = MoveTo (Table.FieldRVA); var field_rvas = metadata.FieldRVAs = new Dictionary (length); for (int i = 0; i < length; i++) { var rva = ReadUInt32 (); var field = ReadTableIndex (Table.Field); field_rvas.Add (field, rva); } } public int ReadFieldLayout (FieldDefinition field) { InitializeFieldLayouts (); var rid = field.token.RID; uint offset; if (!metadata.FieldLayouts.TryGetValue (rid, out offset)) return Mixin.NoDataMarker; metadata.FieldLayouts.Remove (rid); return (int) offset; } void InitializeFieldLayouts () { if (metadata.FieldLayouts != null) return; int length = MoveTo (Table.FieldLayout); var field_layouts = metadata.FieldLayouts = new Dictionary (length); for (int i = 0; i < length; i++) { var offset = ReadUInt32 (); var field = ReadTableIndex (Table.Field); field_layouts.Add (field, offset); } } public bool HasEvents (TypeDefinition type) { InitializeEvents (); Range range; if (!metadata.TryGetEventsRange (type, out range)) return false; return range.Length > 0; } public Collection ReadEvents (TypeDefinition type) { InitializeEvents (); Range range; if (!metadata.TryGetEventsRange (type, out range)) return new MemberDefinitionCollection (type); var events = new MemberDefinitionCollection (type, (int) range.Length); metadata.RemoveEventsRange (type); if (range.Length == 0 || !MoveTo (Table.Event, range.Start)) return events; this.context = type; for (uint i = 0; i < range.Length; i++) events.Add (ReadEvent (range.Start + i)); return events; } EventDefinition ReadEvent (uint event_rid) { var attributes = (EventAttributes) ReadUInt16 (); var name = ReadString (); var event_type = GetTypeDefOrRef (ReadMetadataToken (CodedIndex.TypeDefOrRef)); var @event = new EventDefinition (name, attributes, event_type); @event.token = new MetadataToken (TokenType.Event, event_rid); return @event; } void InitializeEvents () { if (metadata.Events != null) return; int length = MoveTo (Table.EventMap); metadata.Events = new Dictionary (length); for (uint i = 1; i <= length; i++) { var type_rid = ReadTableIndex (Table.TypeDef); Range events_range = ReadEventsRange (i); metadata.AddEventsRange (type_rid, events_range); } } Range ReadEventsRange (uint rid) { return ReadListRange (rid, Table.EventMap, Table.Event); } public bool HasProperties (TypeDefinition type) { InitializeProperties (); Range range; if (!metadata.TryGetPropertiesRange (type, out range)) return false; return range.Length > 0; } public Collection ReadProperties (TypeDefinition type) { InitializeProperties (); Range range; if (!metadata.TryGetPropertiesRange (type, out range)) return new MemberDefinitionCollection (type); metadata.RemovePropertiesRange (type); var properties = new MemberDefinitionCollection (type, (int) range.Length); if (range.Length == 0 || !MoveTo (Table.Property, range.Start)) return properties; this.context = type; for (uint i = 0; i < range.Length; i++) properties.Add (ReadProperty (range.Start + i)); return properties; } PropertyDefinition ReadProperty (uint property_rid) { var attributes = (PropertyAttributes) ReadUInt16 (); var name = ReadString (); var signature = ReadBlobIndex (); var reader = ReadSignature (signature); const byte property_signature = 0x8; var calling_convention = reader.ReadByte (); if ((calling_convention & property_signature) == 0) throw new NotSupportedException (); var has_this = (calling_convention & 0x20) != 0; reader.ReadCompressedUInt32 (); // count var property = new PropertyDefinition (name, attributes, reader.ReadTypeSignature ()); property.HasThis = has_this; property.token = new MetadataToken (TokenType.Property, property_rid); return property; } void InitializeProperties () { if (metadata.Properties != null) return; int length = MoveTo (Table.PropertyMap); metadata.Properties = new Dictionary (length); for (uint i = 1; i <= length; i++) { var type_rid = ReadTableIndex (Table.TypeDef); var properties_range = ReadPropertiesRange (i); metadata.AddPropertiesRange (type_rid, properties_range); } } Range ReadPropertiesRange (uint rid) { return ReadListRange (rid, Table.PropertyMap, Table.Property); } MethodSemanticsAttributes ReadMethodSemantics (MethodDefinition method) { InitializeMethodSemantics (); Row row; if (!metadata.Semantics.TryGetValue (method.token.RID, out row)) return MethodSemanticsAttributes.None; var type = method.DeclaringType; switch (row.Col1) { case MethodSemanticsAttributes.AddOn: GetEvent (type, row.Col2).add_method = method; break; case MethodSemanticsAttributes.Fire: GetEvent (type, row.Col2).invoke_method = method; break; case MethodSemanticsAttributes.RemoveOn: GetEvent (type, row.Col2).remove_method = method; break; case MethodSemanticsAttributes.Getter: GetProperty (type, row.Col2).get_method = method; break; case MethodSemanticsAttributes.Setter: GetProperty (type, row.Col2).set_method = method; break; case MethodSemanticsAttributes.Other: switch (row.Col2.TokenType) { case TokenType.Event: { var @event = GetEvent (type, row.Col2); if (@event.other_methods == null) @event.other_methods = new Collection (); @event.other_methods.Add (method); break; } case TokenType.Property: { var property = GetProperty (type, row.Col2); if (property.other_methods == null) property.other_methods = new Collection (); property.other_methods.Add (method); break; } default: throw new NotSupportedException (); } break; default: throw new NotSupportedException (); } metadata.Semantics.Remove (method.token.RID); return row.Col1; } static EventDefinition GetEvent (TypeDefinition type, MetadataToken token) { if (token.TokenType != TokenType.Event) throw new ArgumentException (); return GetMember (type.Events, token); } static PropertyDefinition GetProperty (TypeDefinition type, MetadataToken token) { if (token.TokenType != TokenType.Property) throw new ArgumentException (); return GetMember (type.Properties, token); } static TMember GetMember (Collection members, MetadataToken token) where TMember : IMemberDefinition { for (int i = 0; i < members.Count; i++) { var member = members [i]; if (member.MetadataToken == token) return member; } throw new ArgumentException (); } void InitializeMethodSemantics () { if (metadata.Semantics != null) return; int length = MoveTo (Table.MethodSemantics); var semantics = metadata.Semantics = new Dictionary> (0); for (uint i = 0; i < length; i++) { var attributes = (MethodSemanticsAttributes) ReadUInt16 (); var method_rid = ReadTableIndex (Table.Method); var association = ReadMetadataToken (CodedIndex.HasSemantics); semantics [method_rid] = new Row (attributes, association); } } public PropertyDefinition ReadMethods (PropertyDefinition property) { ReadAllSemantics (property.DeclaringType); return property; } public EventDefinition ReadMethods (EventDefinition @event) { ReadAllSemantics (@event.DeclaringType); return @event; } public MethodSemanticsAttributes ReadAllSemantics (MethodDefinition method) { ReadAllSemantics (method.DeclaringType); return method.SemanticsAttributes; } void ReadAllSemantics (TypeDefinition type) { var methods = type.Methods; for (int i = 0; i < methods.Count; i++) { var method = methods [i]; if (method.sem_attrs.HasValue) continue; method.sem_attrs = ReadMethodSemantics (method); } } Range ReadParametersRange (uint method_rid) { return ReadListRange (method_rid, Table.Method, Table.Param); } public Collection ReadMethods (TypeDefinition type) { var methods_range = type.methods_range; if (methods_range.Length == 0) return new MemberDefinitionCollection (type); var methods = new MemberDefinitionCollection (type, (int) methods_range.Length); MoveTo (Table.Method, methods_range.Start); for (uint i = 0; i < methods_range.Length; i++) ReadMethod (methods_range.Start + i, methods); return methods; } void InitializeMethods () { if (metadata.Methods != null) return; metadata.Methods = new MethodDefinition [image.GetTableLength (Table.Method)]; } void ReadMethod (uint method_rid, Collection methods) { var method = new MethodDefinition (); method.rva = ReadUInt32 (); method.ImplAttributes = (MethodImplAttributes) ReadUInt16 (); method.Attributes = (MethodAttributes) ReadUInt16 (); method.Name = ReadString (); method.token = new MetadataToken (TokenType.Method, method_rid); methods.Add (method); // attach method var signature = ReadBlobIndex (); var param_range = ReadParametersRange (method_rid); this.context = method; ReadMethodSignature (signature, method); metadata.AddMethodDefinition (method); if (param_range.Length == 0) return; var position = base.position; ReadParameters (method, param_range); base.position = position; } void ReadParameters (MethodDefinition method, Range param_range) { MoveTo (Table.Param, param_range.Start); for (uint i = 0; i < param_range.Length; i++) { var attributes = (ParameterAttributes) ReadUInt16 (); var sequence = ReadUInt16 (); var name = ReadString (); var parameter = sequence == 0 ? method.MethodReturnType.Parameter : method.Parameters [sequence - 1]; parameter.token = new MetadataToken (TokenType.Param, param_range.Start + i); parameter.Name = name; parameter.Attributes = attributes; } } void ReadMethodSignature (uint signature, IMethodSignature method) { var reader = ReadSignature (signature); reader.ReadMethodSignature (method); } public PInvokeInfo ReadPInvokeInfo (MethodDefinition method) { InitializePInvokes (); Row row; var rid = method.token.RID; if (!metadata.PInvokes.TryGetValue (rid, out row)) return null; metadata.PInvokes.Remove (rid); return new PInvokeInfo ( row.Col1, image.StringHeap.Read (row.Col2), module.ModuleReferences [(int) row.Col3 - 1]); } void InitializePInvokes () { if (metadata.PInvokes != null) return; int length = MoveTo (Table.ImplMap); var pinvokes = metadata.PInvokes = new Dictionary> (length); for (int i = 1; i <= length; i++) { var attributes = (PInvokeAttributes) ReadUInt16 (); var method = ReadMetadataToken (CodedIndex.MemberForwarded); var name = ReadStringIndex (); var scope = ReadTableIndex (Table.File); if (method.TokenType != TokenType.Method) continue; pinvokes.Add (method.RID, new Row (attributes, name, scope)); } } public bool HasGenericParameters (IGenericParameterProvider provider) { InitializeGenericParameters (); Range range; if (!metadata.TryGetGenericParameterRange (provider, out range)) return false; return range.Length > 0; } public Collection ReadGenericParameters (IGenericParameterProvider provider) { InitializeGenericParameters (); Range range; if (!metadata.TryGetGenericParameterRange (provider, out range) || !MoveTo (Table.GenericParam, range.Start)) return new Collection (); metadata.RemoveGenericParameterRange (provider); var generic_parameters = new Collection ((int) range.Length); for (uint i = 0; i < range.Length; i++) { ReadUInt16 (); // index var flags = (GenericParameterAttributes) ReadUInt16 (); ReadMetadataToken (CodedIndex.TypeOrMethodDef); var name = ReadString (); var parameter = new GenericParameter (name, provider); parameter.token = new MetadataToken (TokenType.GenericParam, range.Start + i); parameter.Attributes = flags; generic_parameters.Add (parameter); } return generic_parameters; } void InitializeGenericParameters () { if (metadata.GenericParameters != null) return; metadata.GenericParameters = InitializeRanges ( Table.GenericParam, () => { Advance (4); var next = ReadMetadataToken (CodedIndex.TypeOrMethodDef); ReadStringIndex (); return next; }); } Dictionary InitializeRanges (Table table, Func get_next) { int length = MoveTo (table); var ranges = new Dictionary (length); if (length == 0) return ranges; MetadataToken owner = MetadataToken.Zero; Range range = new Range (1, 0); for (uint i = 1; i <= length; i++) { var next = get_next (); if (i == 1) { owner = next; range.Length++; } else if (next != owner) { if (owner.RID != 0) ranges.Add (owner, range); range = new Range (i, 1); owner = next; } else range.Length++; } if (owner != MetadataToken.Zero) ranges.Add (owner, range); return ranges; } public bool HasGenericConstraints (GenericParameter generic_parameter) { InitializeGenericConstraints (); MetadataToken [] mapping; if (!metadata.TryGetGenericConstraintMapping (generic_parameter, out mapping)) return false; return mapping.Length > 0; } public Collection ReadGenericConstraints (GenericParameter generic_parameter) { InitializeGenericConstraints (); MetadataToken [] mapping; if (!metadata.TryGetGenericConstraintMapping (generic_parameter, out mapping)) return new Collection (); var constraints = new Collection (mapping.Length); this.context = (IGenericContext) generic_parameter.Owner; for (int i = 0; i < mapping.Length; i++) constraints.Add (GetTypeDefOrRef (mapping [i])); metadata.RemoveGenericConstraintMapping (generic_parameter); return constraints; } void InitializeGenericConstraints () { if (metadata.GenericConstraints != null) return; var length = MoveTo (Table.GenericParamConstraint); metadata.GenericConstraints = new Dictionary (length); for (int i = 1; i <= length; i++) AddGenericConstraintMapping ( ReadTableIndex (Table.GenericParam), ReadMetadataToken (CodedIndex.TypeDefOrRef)); } void AddGenericConstraintMapping (uint generic_parameter, MetadataToken constraint) { metadata.SetGenericConstraintMapping ( generic_parameter, AddMapping (metadata.GenericConstraints, generic_parameter, constraint)); } public bool HasOverrides (MethodDefinition method) { InitializeOverrides (); MetadataToken [] mapping; if (!metadata.TryGetOverrideMapping (method, out mapping)) return false; return mapping.Length > 0; } public Collection ReadOverrides (MethodDefinition method) { InitializeOverrides (); MetadataToken [] mapping; if (!metadata.TryGetOverrideMapping (method, out mapping)) return new Collection (); var overrides = new Collection (mapping.Length); this.context = method; for (int i = 0; i < mapping.Length; i++) overrides.Add ((MethodReference) LookupToken (mapping [i])); metadata.RemoveOverrideMapping (method); return overrides; } void InitializeOverrides () { if (metadata.Overrides != null) return; var length = MoveTo (Table.MethodImpl); metadata.Overrides = new Dictionary (length); for (int i = 1; i <= length; i++) { ReadTableIndex (Table.TypeDef); var method = ReadMetadataToken (CodedIndex.MethodDefOrRef); if (method.TokenType != TokenType.Method) throw new NotSupportedException (); var @override = ReadMetadataToken (CodedIndex.MethodDefOrRef); AddOverrideMapping (method.RID, @override); } } void AddOverrideMapping (uint method_rid, MetadataToken @override) { metadata.SetOverrideMapping ( method_rid, AddMapping (metadata.Overrides, method_rid, @override)); } public MethodBody ReadMethodBody (MethodDefinition method) { return code.ReadMethodBody (method); } public CallSite ReadCallSite (MetadataToken token) { if (!MoveTo (Table.StandAloneSig, token.RID)) return null; var signature = ReadBlobIndex (); var call_site = new CallSite (); ReadMethodSignature (signature, call_site); return call_site; } public VariableDefinitionCollection ReadVariables (MetadataToken local_var_token) { if (!MoveTo (Table.StandAloneSig, local_var_token.RID)) return null; var reader = ReadSignature (ReadBlobIndex ()); const byte local_sig = 0x7; if (reader.ReadByte () != local_sig) throw new NotSupportedException (); var count = reader.ReadCompressedUInt32 (); if (count == 0) return null; var variables = new VariableDefinitionCollection ((int) count); for (int i = 0; i < count; i++) variables.Add (new VariableDefinition (reader.ReadTypeSignature ())); return variables; } public IMetadataTokenProvider LookupToken (MetadataToken token) { var rid = token.RID; if (rid == 0) return null; IMetadataTokenProvider element; var position = this.position; var context = this.context; switch (token.TokenType) { case TokenType.TypeDef: element = GetTypeDefinition (rid); break; case TokenType.TypeRef: element = GetTypeReference (rid); break; case TokenType.TypeSpec: element = GetTypeSpecification (rid); break; case TokenType.Field: element = GetFieldDefinition (rid); break; case TokenType.Method: element = GetMethodDefinition (rid); break; case TokenType.MemberRef: element = GetMemberReference (rid); break; case TokenType.MethodSpec: element = GetMethodSpecification (rid); break; default: return null; } this.position = position; this.context = context; return element; } public FieldDefinition GetFieldDefinition (uint rid) { InitializeTypeDefinitions (); var field = metadata.GetFieldDefinition (rid); if (field != null) return field; return LookupField (rid); } FieldDefinition LookupField (uint rid) { var type = metadata.GetFieldDeclaringType (rid); if (type == null) return null; InitializeCollection (type.Fields); return metadata.GetFieldDefinition (rid); } public MethodDefinition GetMethodDefinition (uint rid) { InitializeTypeDefinitions (); var method = metadata.GetMethodDefinition (rid); if (method != null) return method; return LookupMethod (rid); } MethodDefinition LookupMethod (uint rid) { var type = metadata.GetMethodDeclaringType (rid); if (type == null) return null; InitializeCollection (type.Methods); return metadata.GetMethodDefinition (rid); } MethodSpecification GetMethodSpecification (uint rid) { if (!MoveTo (Table.MethodSpec, rid)) return null; var element_method = (MethodReference) LookupToken ( ReadMetadataToken (CodedIndex.MethodDefOrRef)); var signature = ReadBlobIndex (); var method_spec = ReadMethodSpecSignature (signature, element_method); method_spec.token = new MetadataToken (TokenType.MethodSpec, rid); return method_spec; } MethodSpecification ReadMethodSpecSignature (uint signature, MethodReference method) { var reader = ReadSignature (signature); const byte methodspec_sig = 0x0a; var call_conv = reader.ReadByte (); if (call_conv != methodspec_sig) throw new NotSupportedException (); var instance = new GenericInstanceMethod (method); reader.ReadGenericInstanceSignature (method, instance); return instance; } MemberReference GetMemberReference (uint rid) { InitializeMemberReferences (); var member = metadata.GetMemberReference (rid); if (member != null) return member; member = ReadMemberReference (rid); if (member != null && !member.ContainsGenericParameter) metadata.AddMemberReference (member); return member; } MemberReference ReadMemberReference (uint rid) { if (!MoveTo (Table.MemberRef, rid)) return null; var token = ReadMetadataToken (CodedIndex.MemberRefParent); var name = ReadString (); var signature = ReadBlobIndex (); MemberReference member; switch (token.TokenType) { case TokenType.TypeDef: case TokenType.TypeRef: case TokenType.TypeSpec: member = ReadTypeMemberReference (token, name, signature); break; case TokenType.Method: member = ReadMethodMemberReference (token, name, signature); break; default: throw new NotSupportedException (); } member.token = new MetadataToken (TokenType.MemberRef, rid); return member; } MemberReference ReadTypeMemberReference (MetadataToken type, string name, uint signature) { var declaring_type = GetTypeDefOrRef (type); this.context = declaring_type; var member = ReadMemberReferenceSignature (signature, declaring_type); member.Name = name; return member; } MemberReference ReadMemberReferenceSignature (uint signature, TypeReference declaring_type) { var reader = ReadSignature (signature); const byte field_sig = 0x6; if (reader.buffer [reader.position] == field_sig) { reader.position++; var field = new FieldReference (); field.DeclaringType = declaring_type; field.FieldType = reader.ReadTypeSignature (); return field; } else { var method = new MethodReference (); method.DeclaringType = declaring_type; reader.ReadMethodSignature (method); return method; } } MemberReference ReadMethodMemberReference (MetadataToken token, string name, uint signature) { var method = GetMethodDefinition (token.RID); this.context = method; var member = ReadMemberReferenceSignature (signature, method.DeclaringType); member.Name = name; return member; } void InitializeMemberReferences () { if (metadata.MemberReferences != null) return; metadata.MemberReferences = new MemberReference [image.GetTableLength (Table.MemberRef)]; } public IEnumerable GetMemberReferences () { InitializeMemberReferences (); var length = image.GetTableLength (Table.MemberRef); var type_system = module.TypeSystem; var context = new MethodReference (string.Empty, type_system.Void); context.DeclaringType = new TypeReference (string.Empty, string.Empty, module, type_system.Corlib); var member_references = new MemberReference [length]; for (uint i = 1; i <= length; i++) { this.context = context; member_references [i - 1] = GetMemberReference (i); } return member_references; } void InitializeConstants () { if (metadata.Constants != null) return; var length = MoveTo (Table.Constant); var constants = metadata.Constants = new Dictionary> (length); for (uint i = 1; i <= length; i++) { var type = (ElementType) ReadUInt16 (); var owner = ReadMetadataToken (CodedIndex.HasConstant); var signature = ReadBlobIndex (); constants.Add (owner, new Row (type, signature)); } } public object ReadConstant (IConstantProvider owner) { InitializeConstants (); Row row; if (!metadata.Constants.TryGetValue (owner.MetadataToken, out row)) return Mixin.NoValue; metadata.Constants.Remove (owner.MetadataToken); switch (row.Col1) { case ElementType.Class: case ElementType.Object: return null; case ElementType.String: return ReadConstantString (ReadBlob (row.Col2)); default: return ReadConstantPrimitive (row.Col1, row.Col2); } } static string ReadConstantString (byte [] blob) { var length = blob.Length; if ((length & 1) == 1) length--; return Encoding.Unicode.GetString (blob, 0, length); } object ReadConstantPrimitive (ElementType type, uint signature) { var reader = ReadSignature (signature); return reader.ReadConstantSignature (type); } void InitializeCustomAttributes () { if (metadata.CustomAttributes != null) return; metadata.CustomAttributes = InitializeRanges ( Table.CustomAttribute, () => { var next = ReadMetadataToken (CodedIndex.HasCustomAttribute); ReadMetadataToken (CodedIndex.CustomAttributeType); ReadBlobIndex (); return next; }); } public bool HasCustomAttributes (ICustomAttributeProvider owner) { InitializeCustomAttributes (); Range range; if (!metadata.TryGetCustomAttributeRange (owner, out range)) return false; return range.Length > 0; } public Collection ReadCustomAttributes (ICustomAttributeProvider owner) { InitializeCustomAttributes (); Range range; if (!metadata.TryGetCustomAttributeRange (owner, out range) || !MoveTo (Table.CustomAttribute, range.Start)) return new Collection (); var custom_attributes = new Collection ((int) range.Length); for (int i = 0; i < range.Length; i++) { ReadMetadataToken (CodedIndex.HasCustomAttribute); var constructor = (MethodReference) LookupToken ( ReadMetadataToken (CodedIndex.CustomAttributeType)); var signature = ReadBlobIndex (); custom_attributes.Add (new CustomAttribute (signature, constructor)); } metadata.RemoveCustomAttributeRange (owner); return custom_attributes; } public byte [] ReadCustomAttributeBlob (uint signature) { return ReadBlob (signature); } public void ReadCustomAttributeSignature (CustomAttribute attribute) { var reader = ReadSignature (attribute.signature); if (reader.ReadUInt16 () != 0x0001) throw new InvalidOperationException (); var constructor = attribute.Constructor; if (constructor.HasParameters) reader.ReadCustomAttributeConstructorArguments (attribute, constructor.Parameters); if (!reader.CanReadMore ()) return; var named = reader.ReadUInt16 (); if (named == 0) return; reader.ReadCustomAttributeNamedArguments (named, ref attribute.fields, ref attribute.properties); } void InitializeMarshalInfos () { if (metadata.FieldMarshals != null) return; var length = MoveTo (Table.FieldMarshal); var marshals = metadata.FieldMarshals = new Dictionary (length); for (int i = 0; i < length; i++) { var token = ReadMetadataToken (CodedIndex.HasFieldMarshal); var signature = ReadBlobIndex (); if (token.RID == 0) continue; marshals.Add (token, signature); } } public bool HasMarshalInfo (IMarshalInfoProvider owner) { InitializeMarshalInfos (); return metadata.FieldMarshals.ContainsKey (owner.MetadataToken); } public MarshalInfo ReadMarshalInfo (IMarshalInfoProvider owner) { InitializeMarshalInfos (); uint signature; if (!metadata.FieldMarshals.TryGetValue (owner.MetadataToken, out signature)) return null; var reader = ReadSignature (signature); metadata.FieldMarshals.Remove (owner.MetadataToken); return reader.ReadMarshalInfo (); } void InitializeSecurityDeclarations () { if (metadata.SecurityDeclarations != null) return; metadata.SecurityDeclarations = InitializeRanges ( Table.DeclSecurity, () => { ReadUInt16 (); var next = ReadMetadataToken (CodedIndex.HasDeclSecurity); ReadBlobIndex (); return next; }); } public bool HasSecurityDeclarations (ISecurityDeclarationProvider owner) { InitializeSecurityDeclarations (); Range range; if (!metadata.TryGetSecurityDeclarationRange (owner, out range)) return false; return range.Length > 0; } public Collection ReadSecurityDeclarations (ISecurityDeclarationProvider owner) { InitializeSecurityDeclarations (); Range range; if (!metadata.TryGetSecurityDeclarationRange (owner, out range) || !MoveTo (Table.DeclSecurity, range.Start)) return new Collection (); var security_declarations = new Collection ((int) range.Length); for (int i = 0; i < range.Length; i++) { var action = (SecurityAction) ReadUInt16 (); ReadMetadataToken (CodedIndex.HasDeclSecurity); var signature = ReadBlobIndex (); security_declarations.Add (new SecurityDeclaration (action, signature, module)); } metadata.RemoveSecurityDeclarationRange (owner); return security_declarations; } public byte [] ReadSecurityDeclarationBlob (uint signature) { return ReadBlob (signature); } public void ReadSecurityDeclarationSignature (SecurityDeclaration declaration) { var signature = declaration.signature; var reader = ReadSignature (signature); if (reader.buffer [reader.position] != '.') { ReadXmlSecurityDeclaration (signature, declaration); return; } reader.ReadByte (); var count = reader.ReadCompressedUInt32 (); var attributes = new Collection ((int) count); for (int i = 0; i < count; i++) attributes.Add (reader.ReadSecurityAttribute ()); declaration.security_attributes = attributes; } void ReadXmlSecurityDeclaration (uint signature, SecurityDeclaration declaration) { var blob = ReadBlob (signature); var attributes = new Collection (1); var attribute = new SecurityAttribute ( module.TypeSystem.LookupType ("System.Security.Permissions", "PermissionSetAttribute")); attribute.properties = new Collection (1); attribute.properties.Add ( new CustomAttributeNamedArgument ( "XML", new CustomAttributeArgument ( module.TypeSystem.String, Encoding.Unicode.GetString (blob, 0, blob.Length)))); attributes.Add (attribute); declaration.security_attributes = attributes; } public Collection ReadExportedTypes () { var length = MoveTo (Table.ExportedType); if (length == 0) return new Collection (); var exported_types = new Collection (length); for (int i = 1; i <= length; i++) { var attributes = (TypeAttributes) ReadUInt32 (); var identifier = ReadUInt32 (); var name = ReadString (); var @namespace = ReadString (); var implementation = ReadMetadataToken (CodedIndex.Implementation); ExportedType declaring_type = null; IMetadataScope scope = null; switch (implementation.TokenType) { case TokenType.AssemblyRef: case TokenType.File: scope = GetExportedTypeScope (implementation); break; case TokenType.ExportedType: // FIXME: if the table is not properly sorted declaring_type = exported_types [(int) implementation.RID - 1]; break; } var exported_type = new ExportedType (@namespace, name, scope) { Attributes = attributes, Identifier = (int) identifier, DeclaringType = declaring_type, }; exported_type.token = new MetadataToken (TokenType.ExportedType, i); exported_types.Add (exported_type); } return exported_types; } IMetadataScope GetExportedTypeScope (MetadataToken token) { switch (token.TokenType) { case TokenType.AssemblyRef: return module.AssemblyReferences [(int) token.RID - 1]; case TokenType.File: var position = this.position; var reference = GetModuleReferenceFromFile (token); this.position = position; if (reference == null) throw new NotSupportedException (); return reference; default: throw new NotSupportedException (); } } ModuleReference GetModuleReferenceFromFile (MetadataToken token) { if (!MoveTo (Table.File, token.RID)) return null; ReadUInt32 (); var file_name = ReadString (); var modules = module.ModuleReferences; ModuleReference reference = null; for (int i = 0; i < modules.Count; i++) { var module_reference = modules [i]; if (module_reference.Name != file_name) continue; reference = module_reference; break; } return reference; } static void InitializeCollection (object o) { } } sealed class SignatureReader : ByteBuffer { readonly MetadataReader reader; readonly uint start, sig_length; TypeSystem TypeSystem { get { return reader.module.TypeSystem; } } public SignatureReader (uint blob, MetadataReader reader) : base (reader.buffer) { this.reader = reader; MoveToBlob (blob); this.sig_length = ReadCompressedUInt32 (); this.start = (uint) position; } void MoveToBlob (uint blob) { position = (int) (reader.image.BlobHeap.Offset + blob); } MetadataToken ReadTypeTokenSignature () { return CodedIndex.TypeDefOrRef.GetMetadataToken (ReadCompressedUInt32 ()); } GenericParameter GetGenericParameter (GenericParameterType type, uint var) { var context = reader.context; if (context == null) throw new NotSupportedException (); IGenericParameterProvider provider; switch (type) { case GenericParameterType.Type: provider = context.Type; break; case GenericParameterType.Method: provider = context.Method; break; default: throw new NotSupportedException (); } int index = (int) var; if (!context.IsDefinition) CheckGenericContext (provider, index); return provider.GenericParameters [index]; } static void CheckGenericContext (IGenericParameterProvider owner, int index) { var owner_parameters = owner.GenericParameters; for (int i = owner_parameters.Count; i <= index; i++) owner_parameters.Add (new GenericParameter (owner)); } public void ReadGenericInstanceSignature (IGenericParameterProvider provider, IGenericInstance instance) { var arity = ReadCompressedUInt32 (); if (!provider.IsDefinition) CheckGenericContext (provider, (int) arity - 1); var instance_arguments = instance.GenericArguments; for (int i = 0; i < arity; i++) instance_arguments.Add (ReadTypeSignature ()); } ArrayType ReadArrayTypeSignature () { var array = new ArrayType (ReadTypeSignature ()); var rank = ReadCompressedUInt32 (); var sizes = new uint [ReadCompressedUInt32 ()]; for (int i = 0; i < sizes.Length; i++) sizes [i] = ReadCompressedUInt32 (); var low_bounds = new int [ReadCompressedUInt32 ()]; for (int i = 0; i < low_bounds.Length; i++) low_bounds [i] = ReadCompressedInt32 (); array.Dimensions.Clear (); for (int i = 0; i < rank; i++) { int? lower = null, upper = null; if (i < low_bounds.Length) lower = low_bounds [i]; if (i < sizes.Length) upper = lower + (int) sizes [i] - 1; array.Dimensions.Add (new ArrayDimension (lower, upper)); } return array; } TypeReference GetTypeDefOrRef (MetadataToken token) { return reader.GetTypeDefOrRef (token); } public TypeReference ReadTypeSignature () { return ReadTypeSignature ((ElementType) ReadByte ()); } TypeReference ReadTypeSignature (ElementType etype) { switch (etype) { case ElementType.ValueType: { var value_type = GetTypeDefOrRef (ReadTypeTokenSignature ()); value_type.IsValueType = true; return value_type; } case ElementType.Class: return GetTypeDefOrRef (ReadTypeTokenSignature ()); case ElementType.Ptr: return new PointerType (ReadTypeSignature ()); case ElementType.FnPtr: { var fptr = new FunctionPointerType (); ReadMethodSignature (fptr); return fptr; } case ElementType.ByRef: return new ByReferenceType (ReadTypeSignature ()); case ElementType.Pinned: return new PinnedType (ReadTypeSignature ()); case ElementType.SzArray: return new ArrayType (ReadTypeSignature ()); case ElementType.Array: return ReadArrayTypeSignature (); case ElementType.CModOpt: return new OptionalModifierType ( GetTypeDefOrRef (ReadTypeTokenSignature ()), ReadTypeSignature ()); case ElementType.CModReqD: return new RequiredModifierType ( GetTypeDefOrRef (ReadTypeTokenSignature ()), ReadTypeSignature ()); case ElementType.Sentinel: return new SentinelType (ReadTypeSignature ()); case ElementType.Var: return GetGenericParameter (GenericParameterType.Type, ReadCompressedUInt32 ()); case ElementType.MVar: return GetGenericParameter (GenericParameterType.Method, ReadCompressedUInt32 ()); case ElementType.GenericInst: { var is_value_type = ReadByte () == (byte) ElementType.ValueType; var element_type = GetTypeDefOrRef (ReadTypeTokenSignature ()); var generic_instance = new GenericInstanceType (element_type); ReadGenericInstanceSignature (element_type, generic_instance); if (is_value_type) { generic_instance.IsValueType = true; element_type.GetElementType ().IsValueType = true; } return generic_instance; } case ElementType.Object: return TypeSystem.Object; case ElementType.Void: return TypeSystem.Void; case ElementType.TypedByRef: return TypeSystem.TypedReference; case ElementType.I: return TypeSystem.IntPtr; case ElementType.U: return TypeSystem.UIntPtr; default: return GetPrimitiveType (etype); } } public void ReadMethodSignature (IMethodSignature method) { var calling_convention = ReadByte (); method.CallingConvention = (MethodCallingConvention) calling_convention; method.HasThis = (calling_convention & 0x20) != 0; method.ExplicitThis = (calling_convention & 0x40) != 0; var generic_context = method as MethodReference; if (generic_context != null) reader.context = generic_context; if ((calling_convention & 0x10) != 0) { var arity = ReadCompressedUInt32 (); if (generic_context != null && !generic_context.IsDefinition) CheckGenericContext (generic_context, (int) arity -1 ); } // TODO: more call_conv var param_count = ReadCompressedUInt32 (); method.MethodReturnType.ReturnType = ReadTypeSignature (); if (param_count == 0) return; Collection parameters; var method_ref = method as MethodReference; if (method_ref != null) parameters = method_ref.parameters = new ParameterDefinitionCollection (method, (int) param_count); else parameters = method.Parameters; for (int i = 0; i < param_count; i++) parameters.Add (new ParameterDefinition (ReadTypeSignature ())); } public object ReadConstantSignature (ElementType type) { return ReadPrimitiveValue (type); } public void ReadCustomAttributeConstructorArguments (CustomAttribute attribute, Collection parameters) { var count = parameters.Count; if (count == 0) return; attribute.arguments = new Collection (count); for (int i = 0; i < count; i++) attribute.arguments.Add ( ReadCustomAttributeFixedArgument (parameters [i].ParameterType)); } CustomAttributeArgument ReadCustomAttributeFixedArgument (TypeReference type) { if (type.IsArray) return ReadCustomAttributeFixedArrayArgument ((ArrayType) type); return ReadCustomAttributeElement (type); } public void ReadCustomAttributeNamedArguments (ushort count, ref Collection fields, ref Collection properties) { for (int i = 0; i < count; i++) ReadCustomAttributeNamedArgument (ref fields, ref properties); } void ReadCustomAttributeNamedArgument (ref Collection fields, ref Collection properties) { var kind = ReadByte (); var type = ReadCustomAttributeFieldOrPropType (); var name = ReadUTF8String (); Collection container; switch (kind) { case 0x53: container = GetCustomAttributeNamedArgumentCollection (ref fields); break; case 0x54: container = GetCustomAttributeNamedArgumentCollection (ref properties); break; default: throw new NotSupportedException (); } container.Add (new CustomAttributeNamedArgument (name, ReadCustomAttributeFixedArgument (type))); } static Collection GetCustomAttributeNamedArgumentCollection (ref Collection collection) { if (collection != null) return collection; return collection = new Collection (); } CustomAttributeArgument ReadCustomAttributeFixedArrayArgument (ArrayType type) { var length = ReadUInt32 (); if (length == 0xffffffff) return new CustomAttributeArgument (type, null); if (length == 0) return new CustomAttributeArgument (type, Empty.Array); var arguments = new CustomAttributeArgument [length]; var element_type = type.ElementType; for (int i = 0; i < length; i++) arguments [i] = ReadCustomAttributeElement (element_type); return new CustomAttributeArgument (type, arguments); } CustomAttributeArgument ReadCustomAttributeElement (TypeReference type) { if (type.IsArray) return ReadCustomAttributeFixedArrayArgument ((ArrayType) type); if (type.etype == ElementType.Object) return ReadCustomAttributeElement (ReadCustomAttributeFieldOrPropType ()); return new CustomAttributeArgument (type, ReadCustomAttributeElementValue (type)); } object ReadCustomAttributeElementValue (TypeReference type) { var etype = type.etype; switch (etype) { case ElementType.String: return ReadUTF8String (); case ElementType.None: if (type.IsTypeOf ("System", "Type")) return ReadTypeReference (); return ReadCustomAttributeEnum (type); default: return ReadPrimitiveValue (etype); } } object ReadPrimitiveValue (ElementType type) { switch (type) { case ElementType.Boolean: return ReadByte () == 1; case ElementType.I1: return (sbyte) ReadByte (); case ElementType.U1: return ReadByte (); case ElementType.Char: return (char) ReadUInt16 (); case ElementType.I2: return ReadInt16 (); case ElementType.U2: return ReadUInt16 (); case ElementType.I4: return ReadInt32 (); case ElementType.U4: return ReadUInt32 (); case ElementType.I8: return ReadInt64 (); case ElementType.U8: return ReadUInt64 (); case ElementType.R4: return ReadSingle (); case ElementType.R8: return ReadDouble (); default: throw new NotImplementedException (type.ToString ()); } } TypeReference GetPrimitiveType (ElementType etype) { switch (etype) { case ElementType.Boolean: return TypeSystem.Boolean; case ElementType.Char: return TypeSystem.Char; case ElementType.I1: return TypeSystem.SByte; case ElementType.U1: return TypeSystem.Byte; case ElementType.I2: return TypeSystem.Int16; case ElementType.U2: return TypeSystem.UInt16; case ElementType.I4: return TypeSystem.Int32; case ElementType.U4: return TypeSystem.UInt32; case ElementType.I8: return TypeSystem.Int64; case ElementType.U8: return TypeSystem.UInt64; case ElementType.R4: return TypeSystem.Single; case ElementType.R8: return TypeSystem.Double; case ElementType.String: return TypeSystem.String; default: throw new NotImplementedException (etype.ToString ()); } } TypeReference ReadCustomAttributeFieldOrPropType () { var etype = (ElementType) ReadByte (); switch (etype) { case ElementType.Boxed: return TypeSystem.Object; case ElementType.SzArray: return new ArrayType (ReadCustomAttributeFieldOrPropType ()); case ElementType.Enum: return ReadTypeReference (); case ElementType.Type: return TypeSystem.LookupType ("System", "Type"); default: return GetPrimitiveType (etype); } } public TypeReference ReadTypeReference () { return TypeParser.ParseType (reader.module, ReadUTF8String ()); } object ReadCustomAttributeEnum (TypeReference enum_type) { var type = enum_type.CheckedResolve (); if (!type.IsEnum) throw new ArgumentException (); return ReadCustomAttributeElementValue (type.GetEnumUnderlyingType ()); } public SecurityAttribute ReadSecurityAttribute () { var attribute = new SecurityAttribute (ReadTypeReference ()); ReadCompressedUInt32 (); ReadCustomAttributeNamedArguments ( (ushort) ReadCompressedUInt32 (), ref attribute.fields, ref attribute.properties); return attribute; } public MarshalInfo ReadMarshalInfo () { var native = ReadNativeType (); switch (native) { case NativeType.Array: { var array = new ArrayMarshalInfo (); if (CanReadMore ()) array.element_type = ReadNativeType (); if (CanReadMore ()) array.size_parameter_index = (int) ReadCompressedUInt32 (); if (CanReadMore ()) array.size = (int) ReadCompressedUInt32 (); if (CanReadMore ()) array.size_parameter_multiplier = (int) ReadCompressedUInt32 (); return array; } case NativeType.SafeArray: { var array = new SafeArrayMarshalInfo (); if (CanReadMore ()) array.element_type = ReadVariantType (); return array; } case NativeType.FixedArray: { var array = new FixedArrayMarshalInfo (); if (CanReadMore ()) array.size = (int) ReadCompressedUInt32 (); if (CanReadMore ()) array.element_type = ReadNativeType (); return array; } case NativeType.FixedSysString: { var sys_string = new FixedSysStringMarshalInfo (); if (CanReadMore ()) sys_string.size = (int) ReadCompressedUInt32 (); return sys_string; } case NativeType.CustomMarshaler: { var marshaler = new CustomMarshalInfo (); var guid_value = ReadUTF8String (); marshaler.guid = !string.IsNullOrEmpty (guid_value) ? new Guid (guid_value) : Guid.Empty; marshaler.unmanaged_type = ReadUTF8String (); marshaler.managed_type = ReadTypeReference (); marshaler.cookie = ReadUTF8String (); return marshaler; } default: return new MarshalInfo (native); } } NativeType ReadNativeType () { return (NativeType) ReadByte (); } VariantType ReadVariantType () { return (VariantType) ReadByte (); } string ReadUTF8String () { if (buffer [position] == 0xff) { position++; return null; } var length = (int) ReadCompressedUInt32 (); if (length == 0) return string.Empty; var @string = Encoding.UTF8.GetString (buffer, position, buffer [position + length - 1] == 0 ? length - 1 : length); position += length; return @string; } public bool CanReadMore () { return position - start < sig_length; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/MethodReturnType.cs0000664000175000017500000000566312136523632032303 0ustar00directhexdirecthex00000000000000// // MethodReturnType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Collections.Generic; namespace Mono.Cecil { public sealed class MethodReturnType : IConstantProvider, ICustomAttributeProvider, IMarshalInfoProvider { internal IMethodSignature method; internal ParameterDefinition parameter; TypeReference return_type; public IMethodSignature Method { get { return method; } } public TypeReference ReturnType { get { return return_type; } set { return_type = value; } } internal ParameterDefinition Parameter { get { return parameter ?? (parameter = new ParameterDefinition (return_type)); } set { parameter = value; } } public MetadataToken MetadataToken { get { return Parameter.MetadataToken; } set { Parameter.MetadataToken = value; } } public bool HasCustomAttributes { get { return parameter != null && parameter.HasCustomAttributes; } } public Collection CustomAttributes { get { return Parameter.CustomAttributes; } } public bool HasDefault { get { return parameter != null && parameter.HasDefault; } set { Parameter.HasDefault = value; } } public bool HasConstant { get { return parameter != null && parameter.HasConstant; } set { Parameter.HasConstant = value; } } public object Constant { get { return Parameter.Constant; } set { Parameter.Constant = value; } } public bool HasFieldMarshal { get { return parameter != null && parameter.HasFieldMarshal; } set { Parameter.HasFieldMarshal = value; } } public bool HasMarshalInfo { get { return parameter != null && parameter.HasMarshalInfo; } } public MarshalInfo MarshalInfo { get { return Parameter.MarshalInfo; } set { Parameter.MarshalInfo = value; } } public MethodReturnType (IMethodSignature method) { this.method = method; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/TypeParser.cs0000664000175000017500000003074212136523632031113 0ustar00directhexdirecthex00000000000000// // TypeParser.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; using Mono.Cecil.Metadata; namespace Mono.Cecil { class TypeParser { class Type { public const int Ptr = -1; public const int ByRef = -2; public const int SzArray = -3; public string type_fullname; public string [] nested_names; public int arity; public int [] specs; public Type [] generic_arguments; public string assembly; } readonly string fullname; readonly int length; int position; TypeParser (string fullname) { this.fullname = fullname; this.length = fullname.Length; } Type ParseType (bool fq_name) { var type = new Type (); type.type_fullname = ParsePart (); type.nested_names = ParseNestedNames (); if (TryGetArity (type)) type.generic_arguments = ParseGenericArguments (type.arity); type.specs = ParseSpecs (); if (fq_name) type.assembly = ParseAssemblyName (); return type; } static bool TryGetArity (Type type) { int arity = 0; TryAddArity (type.type_fullname, ref arity); var nested_names = type.nested_names; if (!nested_names.IsNullOrEmpty ()) { for (int i = 0; i < nested_names.Length; i++) TryAddArity (nested_names [i], ref arity); } type.arity = arity; return arity > 0; } static bool TryGetArity (string name, out int arity) { arity = 0; var index = name.LastIndexOf ('`'); if (index == -1) return false; return ParseInt32 (name.Substring (index + 1), out arity); } static bool ParseInt32 (string value, out int result) { #if CF try { result = int.Parse (value); return true; } catch { result = 0; return false; } #else return int.TryParse (value, out result); #endif } static void TryAddArity (string name, ref int arity) { int type_arity; if (!TryGetArity (name, out type_arity)) return; arity += type_arity; } string ParsePart () { int start = position; while (position < length && !IsDelimiter (fullname [position])) position++; return fullname.Substring (start, position - start); } static bool IsDelimiter (char chr) { return "+,[]*&".IndexOf (chr) != -1; } void TryParseWhiteSpace () { while (position < length && Char.IsWhiteSpace (fullname [position])) position++; } string [] ParseNestedNames () { string [] nested_names = null; while (TryParse ('+')) Add (ref nested_names, ParsePart ()); return nested_names; } bool TryParse (char chr) { if (position < length && fullname [position] == chr) { position++; return true; } return false; } static void Add (ref T [] array, T item) { if (array == null) { array = new [] { item }; return; } #if !CF Array.Resize (ref array, array.Length + 1); #else var copy = new T [array.Length + 1]; Array.Copy (array, copy, array.Length); array = copy; #endif array [array.Length - 1] = item; } int [] ParseSpecs () { int [] specs = null; while (position < length) { switch (fullname [position]) { case '*': position++; Add (ref specs, Type.Ptr); break; case '&': position++; Add (ref specs, Type.ByRef); break; case '[': position++; switch (fullname [position]) { case ']': position++; Add (ref specs, Type.SzArray); break; case '*': position++; Add (ref specs, 1); break; default: var rank = 1; while (TryParse (',')) rank++; Add (ref specs, rank); TryParse (']'); break; } break; default: return specs; } } return specs; } Type [] ParseGenericArguments (int arity) { Type [] generic_arguments = null; if (position == length || fullname [position] != '[') return generic_arguments; TryParse ('['); for (int i = 0; i < arity; i++) { var fq_argument = TryParse ('['); Add (ref generic_arguments, ParseType (fq_argument)); if (fq_argument) TryParse (']'); TryParse (','); TryParseWhiteSpace (); } TryParse (']'); return generic_arguments; } string ParseAssemblyName () { if (!TryParse (',')) return string.Empty; TryParseWhiteSpace (); var start = position; while (position < length) { var chr = fullname [position]; if (chr == '[' || chr == ']') break; position++; } return fullname.Substring (start, position - start); } public static TypeReference ParseType (ModuleDefinition module, string fullname) { if (fullname == null) return null; var parser = new TypeParser (fullname); return GetTypeReference (module, parser.ParseType (true)); } static TypeReference GetTypeReference (ModuleDefinition module, Type type_info) { TypeReference type; if (!TryGetDefinition (module, type_info, out type)) type = CreateReference (type_info, module, GetMetadataScope (module, type_info)); return CreateSpecs (type, type_info); } static TypeReference CreateSpecs (TypeReference type, Type type_info) { type = TryCreateGenericInstanceType (type, type_info); var specs = type_info.specs; if (specs.IsNullOrEmpty ()) return type; for (int i = 0; i < specs.Length; i++) { switch (specs [i]) { case Type.Ptr: type = new PointerType (type); break; case Type.ByRef: type = new ByReferenceType (type); break; case Type.SzArray: type = new ArrayType (type); break; default: var array = new ArrayType (type); array.Dimensions.Clear (); for (int j = 0; j < specs [i]; j++) array.Dimensions.Add (new ArrayDimension ()); type = array; break; } } return type; } static TypeReference TryCreateGenericInstanceType (TypeReference type, Type type_info) { var generic_arguments = type_info.generic_arguments; if (generic_arguments.IsNullOrEmpty ()) return type; var instance = new GenericInstanceType (type); var instance_arguments = instance.GenericArguments; for (int i = 0; i < generic_arguments.Length; i++) instance_arguments.Add (GetTypeReference (type.Module, generic_arguments [i])); return instance; } public static void SplitFullName (string fullname, out string @namespace, out string name) { var last_dot = fullname.LastIndexOf ('.'); if (last_dot == -1) { @namespace = string.Empty; name = fullname; } else { @namespace = fullname.Substring (0, last_dot); name = fullname.Substring (last_dot + 1); } } static TypeReference CreateReference (Type type_info, ModuleDefinition module, IMetadataScope scope) { string @namespace, name; SplitFullName (type_info.type_fullname, out @namespace, out name); var type = new TypeReference (@namespace, name, module, scope); AdjustGenericParameters (type); var nested_names = type_info.nested_names; if (nested_names.IsNullOrEmpty ()) return type; for (int i = 0; i < nested_names.Length; i++) { type = new TypeReference (string.Empty, nested_names [i], module, null) { DeclaringType = type, }; AdjustGenericParameters (type); } return type; } static void AdjustGenericParameters (TypeReference type) { int arity; if (!TryGetArity (type.Name, out arity)) return; for (int i = 0; i < arity; i++) type.GenericParameters.Add (new GenericParameter (type)); } static IMetadataScope GetMetadataScope (ModuleDefinition module, Type type_info) { if (string.IsNullOrEmpty (type_info.assembly)) return module.TypeSystem.Corlib; return MatchReference (module, AssemblyNameReference.Parse (type_info.assembly)); } static AssemblyNameReference MatchReference (ModuleDefinition module, AssemblyNameReference pattern) { var references = module.AssemblyReferences; for (int i = 0; i < references.Count; i++) { var reference = references [i]; if (reference.FullName == pattern.FullName) return reference; } return pattern; } static bool TryGetDefinition (ModuleDefinition module, Type type_info, out TypeReference type) { type = null; if (!TryCurrentModule (module, type_info)) return false; var typedef = module.GetType (type_info.type_fullname); if (typedef == null) return false; var nested_names = type_info.nested_names; if (!nested_names.IsNullOrEmpty ()) { for (int i = 0; i < nested_names.Length; i++) typedef = typedef.GetNestedType (nested_names [i]); } type = typedef; return true; } static bool TryCurrentModule (ModuleDefinition module, Type type_info) { if (string.IsNullOrEmpty (type_info.assembly)) return true; if (module.assembly != null && module.assembly.Name.FullName == type_info.assembly) return true; return false; } public static string ToParseable (TypeReference type) { if (type == null) return null; var name = new StringBuilder (); AppendType (type, name, true, true); return name.ToString (); } static void AppendType (TypeReference type, StringBuilder name, bool fq_name, bool top_level) { var declaring_type = type.DeclaringType; if (declaring_type != null) { AppendType (declaring_type, name, false, top_level); name.Append ('+'); } var @namespace = type.Namespace; if (!string.IsNullOrEmpty (@namespace)) { name.Append (@namespace); name.Append ('.'); } name.Append (type.GetElementType ().Name); if (!fq_name) return; if (type.IsTypeSpecification ()) AppendTypeSpecification ((TypeSpecification) type, name); if (RequiresFullyQualifiedName (type, top_level)) { name.Append (", "); name.Append (GetScopeFullName (type)); } } static string GetScopeFullName (TypeReference type) { var scope = type.Scope; switch (scope.MetadataScopeType) { case MetadataScopeType.AssemblyNameReference: return ((AssemblyNameReference) scope).FullName; case MetadataScopeType.ModuleDefinition: return ((ModuleDefinition) scope).Assembly.Name.FullName; } throw new ArgumentException (); } static void AppendTypeSpecification (TypeSpecification type, StringBuilder name) { if (type.ElementType.IsTypeSpecification ()) AppendTypeSpecification ((TypeSpecification) type.ElementType, name); switch (type.etype) { case ElementType.Ptr: name.Append ('*'); break; case ElementType.ByRef: name.Append ('&'); break; case ElementType.SzArray: case ElementType.Array: var array = (ArrayType) type; if (array.IsVector) { name.Append ("[]"); } else { name.Append ('['); for (int i = 1; i < array.Rank; i++) name.Append (','); name.Append (']'); } break; case ElementType.GenericInst: var instance = (GenericInstanceType) type; var arguments = instance.GenericArguments; name.Append ('['); for (int i = 0; i < arguments.Count; i++) { if (i > 0) name.Append (','); var argument = arguments [i]; var requires_fqname = argument.Scope != argument.Module; if (requires_fqname) name.Append ('['); AppendType (argument, name, true, false); if (requires_fqname) name.Append (']'); } name.Append (']'); break; default: return; } } static bool RequiresFullyQualifiedName (TypeReference type, bool top_level) { if (type.Scope == type.Module) return false; if (type.Scope.Name == "mscorlib" && top_level) return false; return true; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/SentinelType.cs0000664000175000017500000000315612136523632031437 0ustar00directhexdirecthex00000000000000// // SentinelType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using MD = Mono.Cecil.Metadata; namespace Mono.Cecil { public sealed class SentinelType : TypeSpecification { public override bool IsValueType { get { return false; } set { throw new InvalidOperationException (); } } public override bool IsSentinel { get { return true; } } public SentinelType (TypeReference type) : base (type) { Mixin.CheckType (type); this.etype = MD.ElementType.Sentinel; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil/ManifestResourceAttributes.cs0000664000175000017500000000267412136523632034345 0ustar00directhexdirecthex00000000000000// // ManifestResourceAttributes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil { [Flags] public enum ManifestResourceAttributes : uint { VisibilityMask = 0x0007, Public = 0x0001, // The resource is exported from the Assembly Private = 0x0002 // The resource is private to the Assembly } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Security.Cryptography/0000775000175000017500000000000012136524043031737 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Security.Cryptography/CryptoService.cs0000664000175000017500000001262412136523632035077 0ustar00directhexdirecthex00000000000000// // CryptoService.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Reflection; using System.Security.Cryptography; #if !READ_ONLY #if !SILVERLIGHT && !CF using System.Runtime.Serialization; using Mono.Security.Cryptography; #endif using Mono.Cecil.PE; namespace Mono.Cecil { // Most of this code has been adapted // from Jeroen Frijters' fantastic work // in IKVM.Reflection.Emit. Thanks! static class CryptoService { #if !SILVERLIGHT && !CF public static void StrongName (Stream stream, ImageWriter writer, StrongNameKeyPair key_pair) { int strong_name_pointer; var strong_name = CreateStrongName (key_pair, HashStream (stream, writer, out strong_name_pointer)); PatchStrongName (stream, strong_name_pointer, strong_name); } static void PatchStrongName (Stream stream, int strong_name_pointer, byte [] strong_name) { stream.Seek (strong_name_pointer, SeekOrigin.Begin); stream.Write (strong_name, 0, strong_name.Length); } static byte [] CreateStrongName (StrongNameKeyPair key_pair, byte [] hash) { const string hash_algo = "SHA1"; using (var rsa = key_pair.CreateRSA ()) { var formatter = new RSAPKCS1SignatureFormatter (rsa); formatter.SetHashAlgorithm (hash_algo); byte [] signature = formatter.CreateSignature (hash); Array.Reverse (signature); return signature; } } static byte [] HashStream (Stream stream, ImageWriter writer, out int strong_name_pointer) { const int buffer_size = 8192; var text = writer.text; var header_size = (int) writer.GetHeaderSize (); var text_section_pointer = (int) text.PointerToRawData; var strong_name_directory = writer.GetStrongNameSignatureDirectory (); if (strong_name_directory.Size == 0) throw new InvalidOperationException (); strong_name_pointer = (int) (text_section_pointer + (strong_name_directory.VirtualAddress - text.VirtualAddress)); var strong_name_length = (int) strong_name_directory.Size; var sha1 = new SHA1Managed (); var buffer = new byte [buffer_size]; using (var crypto_stream = new CryptoStream (Stream.Null, sha1, CryptoStreamMode.Write)) { stream.Seek (0, SeekOrigin.Begin); CopyStreamChunk (stream, crypto_stream, buffer, header_size); stream.Seek (text_section_pointer, SeekOrigin.Begin); CopyStreamChunk (stream, crypto_stream, buffer, (int) strong_name_pointer - text_section_pointer); stream.Seek (strong_name_length, SeekOrigin.Current); CopyStreamChunk (stream, crypto_stream, buffer, (int) (stream.Length - (strong_name_pointer + strong_name_length))); } return sha1.Hash; } #endif static void CopyStreamChunk (Stream stream, Stream dest_stream, byte [] buffer, int length) { while (length > 0) { int read = stream.Read (buffer, 0, System.Math.Min (buffer.Length, length)); dest_stream.Write (buffer, 0, read); length -= read; } } public static byte [] ComputeHash (string file) { if (!File.Exists (file)) return Empty.Array; const int buffer_size = 8192; var sha1 = new SHA1Managed (); using (var stream = new FileStream (file, FileMode.Open, FileAccess.Read, FileShare.Read)) { var buffer = new byte [buffer_size]; using (var crypto_stream = new CryptoStream (Stream.Null, sha1, CryptoStreamMode.Write)) CopyStreamChunk (stream, crypto_stream, buffer, (int) stream.Length); } return sha1.Hash; } } #if !SILVERLIGHT && !CF static partial class Mixin { public static RSA CreateRSA (this StrongNameKeyPair key_pair) { byte [] key; string key_container; if (!TryGetKeyContainer (key_pair, out key, out key_container)) return CryptoConvert.FromCapiKeyBlob (key); var parameters = new CspParameters { Flags = CspProviderFlags.UseMachineKeyStore, KeyContainerName = key_container, KeyNumber = 2, }; return new RSACryptoServiceProvider (parameters); } static bool TryGetKeyContainer (ISerializable key_pair, out byte [] key, out string key_container) { var info = new SerializationInfo (typeof (StrongNameKeyPair), new FormatterConverter ()); key_pair.GetObjectData (info, new StreamingContext ()); key = (byte []) info.GetValue ("_keyPairArray", typeof (byte [])); key_container = info.GetString ("_keyPairContainer"); return key_container != null; } } #endif } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Security.Cryptography/CryptoConvert.cs0000664000175000017500000001721212136523632035115 0ustar00directhexdirecthex00000000000000// // CryptoConvert.cs - Crypto Convertion Routines // // Author: // Sebastien Pouliot // // (C) 2003 Motus Technologies Inc. (http://www.motus.com) // Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Security.Cryptography; #if !(SILVERLIGHT || READ_ONLY) namespace Mono.Security.Cryptography { static class CryptoConvert { static private int ToInt32LE (byte [] bytes, int offset) { return (bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset]; } static private uint ToUInt32LE (byte [] bytes, int offset) { return (uint)((bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset]); } static private byte[] Trim (byte[] array) { for (int i=0; i < array.Length; i++) { if (array [i] != 0x00) { byte[] result = new byte [array.Length - i]; Buffer.BlockCopy (array, i, result, 0, result.Length); return result; } } return null; } static RSA FromCapiPrivateKeyBlob (byte[] blob, int offset) { RSAParameters rsap = new RSAParameters (); try { if ((blob [offset] != 0x07) || // PRIVATEKEYBLOB (0x07) (blob [offset+1] != 0x02) || // Version (0x02) (blob [offset+2] != 0x00) || // Reserved (word) (blob [offset+3] != 0x00) || (ToUInt32LE (blob, offset+8) != 0x32415352)) // DWORD magic = RSA2 throw new CryptographicException ("Invalid blob header"); // ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...) // int algId = ToInt32LE (blob, offset+4); // DWORD bitlen int bitLen = ToInt32LE (blob, offset+12); // DWORD public exponent byte[] exp = new byte [4]; Buffer.BlockCopy (blob, offset+16, exp, 0, 4); Array.Reverse (exp); rsap.Exponent = Trim (exp); int pos = offset+20; // BYTE modulus[rsapubkey.bitlen/8]; int byteLen = (bitLen >> 3); rsap.Modulus = new byte [byteLen]; Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen); Array.Reverse (rsap.Modulus); pos += byteLen; // BYTE prime1[rsapubkey.bitlen/16]; int byteHalfLen = (byteLen >> 1); rsap.P = new byte [byteHalfLen]; Buffer.BlockCopy (blob, pos, rsap.P, 0, byteHalfLen); Array.Reverse (rsap.P); pos += byteHalfLen; // BYTE prime2[rsapubkey.bitlen/16]; rsap.Q = new byte [byteHalfLen]; Buffer.BlockCopy (blob, pos, rsap.Q, 0, byteHalfLen); Array.Reverse (rsap.Q); pos += byteHalfLen; // BYTE exponent1[rsapubkey.bitlen/16]; rsap.DP = new byte [byteHalfLen]; Buffer.BlockCopy (blob, pos, rsap.DP, 0, byteHalfLen); Array.Reverse (rsap.DP); pos += byteHalfLen; // BYTE exponent2[rsapubkey.bitlen/16]; rsap.DQ = new byte [byteHalfLen]; Buffer.BlockCopy (blob, pos, rsap.DQ, 0, byteHalfLen); Array.Reverse (rsap.DQ); pos += byteHalfLen; // BYTE coefficient[rsapubkey.bitlen/16]; rsap.InverseQ = new byte [byteHalfLen]; Buffer.BlockCopy (blob, pos, rsap.InverseQ, 0, byteHalfLen); Array.Reverse (rsap.InverseQ); pos += byteHalfLen; // ok, this is hackish but CryptoAPI support it so... // note: only works because CRT is used by default // http://bugzilla.ximian.com/show_bug.cgi?id=57941 rsap.D = new byte [byteLen]; // must be allocated if (pos + byteLen + offset <= blob.Length) { // BYTE privateExponent[rsapubkey.bitlen/8]; Buffer.BlockCopy (blob, pos, rsap.D, 0, byteLen); Array.Reverse (rsap.D); } } catch (Exception e) { throw new CryptographicException ("Invalid blob.", e); } RSA rsa = null; try { rsa = RSA.Create (); rsa.ImportParameters (rsap); } catch (CryptographicException ce) { // this may cause problem when this code is run under // the SYSTEM identity on Windows (e.g. ASP.NET). See // http://bugzilla.ximian.com/show_bug.cgi?id=77559 try { CspParameters csp = new CspParameters (); csp.Flags = CspProviderFlags.UseMachineKeyStore; rsa = new RSACryptoServiceProvider (csp); rsa.ImportParameters (rsap); } catch { // rethrow original, not the later, exception if this fails throw ce; } } return rsa; } static RSA FromCapiPublicKeyBlob (byte[] blob, int offset) { try { if ((blob [offset] != 0x06) || // PUBLICKEYBLOB (0x06) (blob [offset+1] != 0x02) || // Version (0x02) (blob [offset+2] != 0x00) || // Reserved (word) (blob [offset+3] != 0x00) || (ToUInt32LE (blob, offset+8) != 0x31415352)) // DWORD magic = RSA1 throw new CryptographicException ("Invalid blob header"); // ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...) // int algId = ToInt32LE (blob, offset+4); // DWORD bitlen int bitLen = ToInt32LE (blob, offset+12); // DWORD public exponent RSAParameters rsap = new RSAParameters (); rsap.Exponent = new byte [3]; rsap.Exponent [0] = blob [offset+18]; rsap.Exponent [1] = blob [offset+17]; rsap.Exponent [2] = blob [offset+16]; int pos = offset+20; // BYTE modulus[rsapubkey.bitlen/8]; int byteLen = (bitLen >> 3); rsap.Modulus = new byte [byteLen]; Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen); Array.Reverse (rsap.Modulus); RSA rsa = null; try { rsa = RSA.Create (); rsa.ImportParameters (rsap); } catch (CryptographicException) { // this may cause problem when this code is run under // the SYSTEM identity on Windows (e.g. ASP.NET). See // http://bugzilla.ximian.com/show_bug.cgi?id=77559 CspParameters csp = new CspParameters (); csp.Flags = CspProviderFlags.UseMachineKeyStore; rsa = new RSACryptoServiceProvider (csp); rsa.ImportParameters (rsap); } return rsa; } catch (Exception e) { throw new CryptographicException ("Invalid blob.", e); } } // PRIVATEKEYBLOB // PUBLICKEYBLOB static public RSA FromCapiKeyBlob (byte[] blob) { return FromCapiKeyBlob (blob, 0); } static public RSA FromCapiKeyBlob (byte[] blob, int offset) { if (blob == null) throw new ArgumentNullException ("blob"); if (offset >= blob.Length) throw new ArgumentException ("blob is too small."); switch (blob [offset]) { case 0x00: // this could be a public key inside an header // like "sn -e" would produce if (blob [offset + 12] == 0x06) { return FromCapiPublicKeyBlob (blob, offset + 12); } break; case 0x06: return FromCapiPublicKeyBlob (blob, offset); case 0x07: return FromCapiPrivateKeyBlob (blob, offset); } throw new CryptographicException ("Unknown blob format."); } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/System.Runtime.CompilerServices/0000775000175000017500000000000012136524043032712 5ustar00directhexdirecthex00000000000000ExtensionAttribute.cs0000664000175000017500000000264212136523632037031 0ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/System.Runtime.CompilerServices// // ExtensionAttribute.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; #if !NET_3_5 && !NET_4_0 namespace System.Runtime.CompilerServices { [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] sealed class ExtensionAttribute : Attribute { } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/0000775000175000017500000000000012136524043027163 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/VariableReference.cs0000664000175000017500000000402112136523632033056 0ustar00directhexdirecthex00000000000000// // VariableReference.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public abstract class VariableReference { string name; internal int index = -1; protected TypeReference variable_type; public string Name { get { return name; } set { name = value; } } public TypeReference VariableType { get { return variable_type; } set { variable_type = value; } } public int Index { get { return index; } } internal VariableReference (TypeReference variable_type) : this (string.Empty, variable_type) { } internal VariableReference (string name, TypeReference variable_type) { this.name = name; this.variable_type = variable_type; } public abstract VariableDefinition Resolve (); public override string ToString () { if (!string.IsNullOrEmpty (name)) return name; if (index >= 0) return "V_" + index; return string.Empty; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/SequencePoint.cs0000664000175000017500000000354712136523632032310 0ustar00directhexdirecthex00000000000000// // SequencePoint.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public sealed class SequencePoint { Document document; int start_line; int start_column; int end_line; int end_column; public int StartLine { get { return start_line; } set { start_line = value; } } public int StartColumn { get { return start_column; } set { start_column = value; } } public int EndLine { get { return end_line; } set { end_line = value; } } public int EndColumn { get { return end_column; } set { end_column = value; } } public Document Document { get { return document; } set { document = value; } } public SequencePoint (Document document) { this.document = document; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/VariableDefinition.cs0000664000175000017500000000315012136523632033252 0ustar00directhexdirecthex00000000000000// // VariableDefinition.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public sealed class VariableDefinition : VariableReference { public bool IsPinned { get { return variable_type.IsPinned; } } public VariableDefinition (TypeReference variableType) : base (variableType) { } public VariableDefinition (string name, TypeReference variableType) : base (name, variableType) { } public override VariableDefinition Resolve () { return this; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/Instruction.cs0000664000175000017500000002105212136523632032036 0ustar00directhexdirecthex00000000000000// // Instruction.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Text; namespace Mono.Cecil.Cil { public sealed class Instruction { internal int offset; internal OpCode opcode; internal object operand; internal Instruction previous; internal Instruction next; SequencePoint sequence_point; public int Offset { get { return offset; } set { offset = value; } } public OpCode OpCode { get { return opcode; } set { opcode = value; } } public object Operand { get { return operand; } set { operand = value; } } public Instruction Previous { get { return previous; } set { previous = value; } } public Instruction Next { get { return next; } set { next = value; } } public SequencePoint SequencePoint { get { return sequence_point; } set { sequence_point = value; } } internal Instruction (int offset, OpCode opCode) { this.offset = offset; this.opcode = opCode; } internal Instruction (OpCode opcode, object operand) { this.opcode = opcode; this.operand = operand; } public int GetSize () { int size = opcode.Size; switch (opcode.OperandType) { case OperandType.InlineSwitch: return size + (1 + ((Instruction []) operand).Length) * 4; case OperandType.InlineI8: case OperandType.InlineR: return size + 8; case OperandType.InlineBrTarget: case OperandType.InlineField: case OperandType.InlineI: case OperandType.InlineMethod: case OperandType.InlineString: case OperandType.InlineTok: case OperandType.InlineType: case OperandType.ShortInlineR: case OperandType.InlineSig: return size + 4; case OperandType.InlineArg: case OperandType.InlineVar: return size + 2; case OperandType.ShortInlineBrTarget: case OperandType.ShortInlineI: case OperandType.ShortInlineArg: case OperandType.ShortInlineVar: return size + 1; default: return size; } } public override string ToString () { var instruction = new StringBuilder (); AppendLabel (instruction, this); instruction.Append (':'); instruction.Append (' '); instruction.Append (opcode.Name); if (operand == null) return instruction.ToString (); instruction.Append (' '); switch (opcode.OperandType) { case OperandType.ShortInlineBrTarget: case OperandType.InlineBrTarget: AppendLabel (instruction, (Instruction) operand); break; case OperandType.InlineSwitch: var labels = (Instruction []) operand; for (int i = 0; i < labels.Length; i++) { if (i > 0) instruction.Append (','); AppendLabel (instruction, labels [i]); } break; case OperandType.InlineString: instruction.Append ('\"'); instruction.Append (operand); instruction.Append ('\"'); break; default: instruction.Append (operand); break; } return instruction.ToString (); } static void AppendLabel (StringBuilder builder, Instruction instruction) { builder.Append ("IL_"); builder.Append (instruction.offset.ToString ("x4")); } public static Instruction Create (OpCode opcode) { if (opcode.OperandType != OperandType.InlineNone) throw new ArgumentException ("opcode"); return new Instruction (opcode, null); } public static Instruction Create (OpCode opcode, TypeReference type) { if (type == null) throw new ArgumentNullException ("type"); if (opcode.OperandType != OperandType.InlineType && opcode.OperandType != OperandType.InlineTok) throw new ArgumentException ("opcode"); return new Instruction (opcode, type); } public static Instruction Create (OpCode opcode, CallSite site) { if (site == null) throw new ArgumentNullException ("site"); if (opcode.Code != Code.Calli) throw new ArgumentException ("code"); return new Instruction (opcode, site); } public static Instruction Create (OpCode opcode, MethodReference method) { if (method == null) throw new ArgumentNullException ("method"); if (opcode.OperandType != OperandType.InlineMethod && opcode.OperandType != OperandType.InlineTok) throw new ArgumentException ("opcode"); return new Instruction (opcode, method); } public static Instruction Create (OpCode opcode, FieldReference field) { if (field == null) throw new ArgumentNullException ("field"); if (opcode.OperandType != OperandType.InlineField && opcode.OperandType != OperandType.InlineTok) throw new ArgumentException ("opcode"); return new Instruction (opcode, field); } public static Instruction Create (OpCode opcode, string value) { if (value == null) throw new ArgumentNullException ("value"); if (opcode.OperandType != OperandType.InlineString) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, sbyte value) { if (opcode.OperandType != OperandType.ShortInlineI && opcode != OpCodes.Ldc_I4_S) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, byte value) { if (opcode.OperandType != OperandType.ShortInlineI || opcode == OpCodes.Ldc_I4_S) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, int value) { if (opcode.OperandType != OperandType.InlineI) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, long value) { if (opcode.OperandType != OperandType.InlineI8) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, float value) { if (opcode.OperandType != OperandType.ShortInlineR) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, double value) { if (opcode.OperandType != OperandType.InlineR) throw new ArgumentException ("opcode"); return new Instruction (opcode, value); } public static Instruction Create (OpCode opcode, Instruction target) { if (target == null) throw new ArgumentNullException ("target"); if (opcode.OperandType != OperandType.InlineBrTarget && opcode.OperandType != OperandType.ShortInlineBrTarget) throw new ArgumentException ("opcode"); return new Instruction (opcode, target); } public static Instruction Create (OpCode opcode, Instruction [] targets) { if (targets == null) throw new ArgumentNullException ("targets"); if (opcode.OperandType != OperandType.InlineSwitch) throw new ArgumentException ("opcode"); return new Instruction (opcode, targets); } public static Instruction Create (OpCode opcode, VariableDefinition variable) { if (variable == null) throw new ArgumentNullException ("variable"); if (opcode.OperandType != OperandType.ShortInlineVar && opcode.OperandType != OperandType.InlineVar) throw new ArgumentException ("opcode"); return new Instruction (opcode, variable); } public static Instruction Create (OpCode opcode, ParameterDefinition parameter) { if (parameter == null) throw new ArgumentNullException ("parameter"); if (opcode.OperandType != OperandType.ShortInlineArg && opcode.OperandType != OperandType.InlineArg) throw new ArgumentException ("opcode"); return new Instruction (opcode, parameter); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/ILProcessor.cs0000664000175000017500000001546112136523632031730 0ustar00directhexdirecthex00000000000000// // ILProcessor.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil.Cil { public sealed class ILProcessor { readonly MethodBody body; readonly Collection instructions; public MethodBody Body { get { return body; } } internal ILProcessor (MethodBody body) { this.body = body; this.instructions = body.Instructions; } public Instruction Create (OpCode opcode) { return Instruction.Create (opcode); } public Instruction Create (OpCode opcode, TypeReference type) { return Instruction.Create (opcode, type); } public Instruction Create (OpCode opcode, CallSite site) { return Instruction.Create (opcode, site); } public Instruction Create (OpCode opcode, MethodReference method) { return Instruction.Create (opcode, method); } public Instruction Create (OpCode opcode, FieldReference field) { return Instruction.Create (opcode, field); } public Instruction Create (OpCode opcode, string value) { return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, sbyte value) { return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, byte value) { if (opcode.OperandType == OperandType.ShortInlineVar) return Instruction.Create (opcode, body.Variables [value]); if (opcode.OperandType == OperandType.ShortInlineArg) return Instruction.Create (opcode, body.GetParameter (value)); return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, int value) { if (opcode.OperandType == OperandType.InlineVar) return Instruction.Create (opcode, body.Variables [value]); if (opcode.OperandType == OperandType.InlineArg) return Instruction.Create (opcode, body.GetParameter (value)); return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, long value) { return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, float value) { return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, double value) { return Instruction.Create (opcode, value); } public Instruction Create (OpCode opcode, Instruction target) { return Instruction.Create (opcode, target); } public Instruction Create (OpCode opcode, Instruction [] targets) { return Instruction.Create (opcode, targets); } public Instruction Create (OpCode opcode, VariableDefinition variable) { return Instruction.Create (opcode, variable); } public Instruction Create (OpCode opcode, ParameterDefinition parameter) { return Instruction.Create (opcode, parameter); } public void Emit (OpCode opcode) { Append (Create (opcode)); } public void Emit (OpCode opcode, TypeReference type) { Append (Create (opcode, type)); } public void Emit (OpCode opcode, MethodReference method) { Append (Create (opcode, method)); } public void Emit (OpCode opcode, CallSite site) { Append (Create (opcode, site)); } public void Emit (OpCode opcode, FieldReference field) { Append (Create (opcode, field)); } public void Emit (OpCode opcode, string value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, byte value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, sbyte value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, int value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, long value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, float value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, double value) { Append (Create (opcode, value)); } public void Emit (OpCode opcode, Instruction target) { Append (Create (opcode, target)); } public void Emit (OpCode opcode, Instruction [] targets) { Append (Create (opcode, targets)); } public void Emit (OpCode opcode, VariableDefinition variable) { Append (Create (opcode, variable)); } public void Emit (OpCode opcode, ParameterDefinition parameter) { Append (Create (opcode, parameter)); } public void InsertBefore (Instruction target, Instruction instruction) { if (target == null) throw new ArgumentNullException ("target"); if (instruction == null) throw new ArgumentNullException ("instruction"); var index = instructions.IndexOf (target); if (index == -1) throw new ArgumentOutOfRangeException ("target"); instructions.Insert (index, instruction); } public void InsertAfter (Instruction target, Instruction instruction) { if (target == null) throw new ArgumentNullException ("target"); if (instruction == null) throw new ArgumentNullException ("instruction"); var index = instructions.IndexOf (target); if (index == -1) throw new ArgumentOutOfRangeException ("target"); instructions.Insert (index + 1, instruction); } public void Append (Instruction instruction) { if (instruction == null) throw new ArgumentNullException ("instruction"); instructions.Add (instruction); } public void Replace (Instruction target, Instruction instruction) { if (target == null) throw new ArgumentNullException ("target"); if (instruction == null) throw new ArgumentNullException ("instruction"); InsertAfter (target, instruction); Remove (target); } public void Remove (Instruction instruction) { if (instruction == null) throw new ArgumentNullException ("instruction"); if (!instructions.Remove (instruction)) throw new ArgumentOutOfRangeException ("instruction"); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/MethodBody.cs0000664000175000017500000001260612136523632031560 0ustar00directhexdirecthex00000000000000// // MethodBody.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Collections.Generic; namespace Mono.Cecil.Cil { public sealed class MethodBody : IVariableDefinitionProvider { readonly internal MethodDefinition method; internal ParameterDefinition this_parameter; internal int max_stack_size; internal int code_size; internal bool init_locals; internal MetadataToken local_var_token; internal Collection instructions; internal Collection exceptions; internal Collection variables; Scope scope; public MethodDefinition Method { get { return method; } } public int MaxStackSize { get { return max_stack_size; } set { max_stack_size = value; } } public int CodeSize { get { return code_size; } } public bool InitLocals { get { return init_locals; } set { init_locals = value; } } public MetadataToken LocalVarToken { get { return local_var_token; } set { local_var_token = value; } } public Collection Instructions { get { return instructions ?? (instructions = new InstructionCollection ()); } } public bool HasExceptionHandlers { get { return !exceptions.IsNullOrEmpty (); } } public Collection ExceptionHandlers { get { return exceptions ?? (exceptions = new Collection ()); } } public bool HasVariables { get { return !variables.IsNullOrEmpty (); } } public Collection Variables { get { return variables ?? (variables = new VariableDefinitionCollection ()); } } public Scope Scope { get { return scope; } set { scope = value; } } public ParameterDefinition ThisParameter { get { if (method == null || method.DeclaringType == null) throw new NotSupportedException (); return this_parameter ?? (this_parameter = new ParameterDefinition ("0", ParameterAttributes.None, method.DeclaringType)); } } public MethodBody (MethodDefinition method) { this.method = method; } public ILProcessor GetILProcessor () { return new ILProcessor (this); } } public interface IVariableDefinitionProvider { bool HasVariables { get; } Collection Variables { get; } } class VariableDefinitionCollection : Collection { internal VariableDefinitionCollection () { } internal VariableDefinitionCollection (int capacity) : base (capacity) { } protected override void OnAdd (VariableDefinition item, int index) { item.index = index; } protected override void OnInsert (VariableDefinition item, int index) { item.index = index; for (int i = index; i < size; i++) items [i].index = i + 1; } protected override void OnSet (VariableDefinition item, int index) { item.index = index; } protected override void OnRemove (VariableDefinition item, int index) { item.index = -1; for (int i = index + 1; i < size; i++) items [i].index = i - 1; } } class InstructionCollection : Collection { internal InstructionCollection () { } internal InstructionCollection (int capacity) : base (capacity) { } protected override void OnAdd (Instruction item, int index) { if (index == 0) return; var previous = items [index - 1]; previous.next = item; item.previous = previous; } protected override void OnInsert (Instruction item, int index) { if (size == 0) return; var current = items [index]; if (current == null) { var last = items [index - 1]; last.next = item; item.previous = last; return; } var previous = current.previous; if (previous != null) { previous.next = item; item.previous = previous; } current.previous = item; item.next = current; } protected override void OnSet (Instruction item, int index) { var current = items [index]; item.previous = current.previous; item.next = current.next; current.previous = null; current.next = null; } protected override void OnRemove (Instruction item, int index) { var previous = item.previous; if (previous != null) previous.next = item.next; var next = item.next; if (next != null) next.previous = item.previous; item.previous = null; item.next = null; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/Document.cs0000664000175000017500000000465412136523632031304 0ustar00directhexdirecthex00000000000000// // Document.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Cecil.Cil { public enum DocumentType { Other, Text, } public enum DocumentHashAlgorithm { None, MD5, SHA1, } public enum DocumentLanguage { Other, C, Cpp, CSharp, Basic, Java, Cobol, Pascal, Cil, JScript, Smc, MCpp, } public enum DocumentLanguageVendor { Other, Microsoft, } public sealed class Document { string url; byte type; byte hash_algorithm; byte language; byte language_vendor; byte [] hash; public string Url { get { return url; } set { url = value; } } public DocumentType Type { get { return (DocumentType) type; } set { type = (byte) value; } } public DocumentHashAlgorithm HashAlgorithm { get { return (DocumentHashAlgorithm) hash_algorithm; } set { hash_algorithm = (byte) value; } } public DocumentLanguage Language { get { return (DocumentLanguage) language; } set { language = (byte) value; } } public DocumentLanguageVendor LanguageVendor { get { return (DocumentLanguageVendor) language_vendor; } set { language_vendor = (byte) value; } } public byte [] Hash { get { return hash; } set { hash = value; } } public Document (string url) { this.url = url; this.hash = Empty.Array; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/OpCode.cs0000664000175000017500000002060012136523632030664 0ustar00directhexdirecthex00000000000000// // OpCode.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public enum FlowControl { Branch, Break, Call, Cond_Branch, Meta, Next, Phi, Return, Throw, } public enum OpCodeType { Annotation, Macro, Nternal, Objmodel, Prefix, Primitive, } public enum OperandType { InlineBrTarget, InlineField, InlineI, InlineI8, InlineMethod, InlineNone, InlinePhi, InlineR, InlineSig, InlineString, InlineSwitch, InlineTok, InlineType, InlineVar, InlineArg, ShortInlineBrTarget, ShortInlineI, ShortInlineR, ShortInlineVar, ShortInlineArg, } public enum StackBehaviour { Pop0, Pop1, Pop1_pop1, Popi, Popi_pop1, Popi_popi, Popi_popi8, Popi_popi_popi, Popi_popr4, Popi_popr8, Popref, Popref_pop1, Popref_popi, Popref_popi_popi, Popref_popi_popi8, Popref_popi_popr4, Popref_popi_popr8, Popref_popi_popref, PopAll, Push0, Push1, Push1_push1, Pushi, Pushi8, Pushr4, Pushr8, Pushref, Varpop, Varpush, } public struct OpCode { readonly byte op1; readonly byte op2; readonly byte code; readonly byte flow_control; readonly byte opcode_type; readonly byte operand_type; readonly byte stack_behavior_pop; readonly byte stack_behavior_push; public string Name { get { return OpCodeNames.names [op1 == 0xff ? op2 : op2 + 256]; } } public int Size { get { return op1 == 0xff ? 1 : 2; } } public byte Op1 { get { return op1; } } public byte Op2 { get { return op2; } } public short Value { get { return (short) ((op1 << 8) | op2); } } public Code Code { get { return (Code) code; } } public FlowControl FlowControl { get { return (FlowControl) flow_control; } } public OpCodeType OpCodeType { get { return (OpCodeType) opcode_type; } } public OperandType OperandType { get { return (OperandType) operand_type; } } public StackBehaviour StackBehaviourPop { get { return (StackBehaviour) stack_behavior_pop; } } public StackBehaviour StackBehaviourPush { get { return (StackBehaviour) stack_behavior_push; } } internal OpCode (int x, int y) { this.op1 = (byte) ((x >> 0) & 0xff); this.op2 = (byte) ((x >> 8) & 0xff); this.code = (byte) ((x >> 16) & 0xff); this.flow_control = (byte) ((x >> 24) & 0xff); this.opcode_type = (byte) ((y >> 0) & 0xff); this.operand_type = (byte) ((y >> 8) & 0xff); this.stack_behavior_pop = (byte) ((y >> 16) & 0xff); this.stack_behavior_push = (byte) ((y >> 24) & 0xff); if (op1 == 0xff) OpCodes.OneByteOpCode [op2] = this; else OpCodes.TwoBytesOpCode [op2] = this; } public override int GetHashCode () { return Value; } public override bool Equals (object obj) { if (!(obj is OpCode)) return false; var opcode = (OpCode) obj; return op1 == opcode.op1 && op2 == opcode.op2; } public bool Equals (OpCode opcode) { return op1 == opcode.op1 && op2 == opcode.op2; } public static bool operator == (OpCode one, OpCode other) { return one.op1 == other.op1 && one.op2 == other.op2; } public static bool operator != (OpCode one, OpCode other) { return one.op1 != other.op1 || one.op2 != other.op2; } public override string ToString () { return Name; } } static class OpCodeNames { internal static readonly string [] names = { "nop", "break", "ldarg.0", "ldarg.1", "ldarg.2", "ldarg.3", "ldloc.0", "ldloc.1", "ldloc.2", "ldloc.3", "stloc.0", "stloc.1", "stloc.2", "stloc.3", "ldarg.s", "ldarga.s", "starg.s", "ldloc.s", "ldloca.s", "stloc.s", "ldnull", "ldc.i4.m1", "ldc.i4.0", "ldc.i4.1", "ldc.i4.2", "ldc.i4.3", "ldc.i4.4", "ldc.i4.5", "ldc.i4.6", "ldc.i4.7", "ldc.i4.8", "ldc.i4.s", "ldc.i4", "ldc.i8", "ldc.r4", "ldc.r8", null, "dup", "pop", "jmp", "call", "calli", "ret", "br.s", "brfalse.s", "brtrue.s", "beq.s", "bge.s", "bgt.s", "ble.s", "blt.s", "bne.un.s", "bge.un.s", "bgt.un.s", "ble.un.s", "blt.un.s", "br", "brfalse", "brtrue", "beq", "bge", "bgt", "ble", "blt", "bne.un", "bge.un", "bgt.un", "ble.un", "blt.un", "switch", "ldind.i1", "ldind.u1", "ldind.i2", "ldind.u2", "ldind.i4", "ldind.u4", "ldind.i8", "ldind.i", "ldind.r4", "ldind.r8", "ldind.ref", "stind.ref", "stind.i1", "stind.i2", "stind.i4", "stind.i8", "stind.r4", "stind.r8", "add", "sub", "mul", "div", "div.un", "rem", "rem.un", "and", "or", "xor", "shl", "shr", "shr.un", "neg", "not", "conv.i1", "conv.i2", "conv.i4", "conv.i8", "conv.r4", "conv.r8", "conv.u4", "conv.u8", "callvirt", "cpobj", "ldobj", "ldstr", "newobj", "castclass", "isinst", "conv.r.un", null, null, "unbox", "throw", "ldfld", "ldflda", "stfld", "ldsfld", "ldsflda", "stsfld", "stobj", "conv.ovf.i1.un", "conv.ovf.i2.un", "conv.ovf.i4.un", "conv.ovf.i8.un", "conv.ovf.u1.un", "conv.ovf.u2.un", "conv.ovf.u4.un", "conv.ovf.u8.un", "conv.ovf.i.un", "conv.ovf.u.un", "box", "newarr", "ldlen", "ldelema", "ldelem.i1", "ldelem.u1", "ldelem.i2", "ldelem.u2", "ldelem.i4", "ldelem.u4", "ldelem.i8", "ldelem.i", "ldelem.r4", "ldelem.r8", "ldelem.ref", "stelem.i", "stelem.i1", "stelem.i2", "stelem.i4", "stelem.i8", "stelem.r4", "stelem.r8", "stelem.ref", "ldelem.any", "stelem.any", "unbox.any", null, null, null, null, null, null, null, null, null, null, null, null, null, "conv.ovf.i1", "conv.ovf.u1", "conv.ovf.i2", "conv.ovf.u2", "conv.ovf.i4", "conv.ovf.u4", "conv.ovf.i8", "conv.ovf.u8", null, null, null, null, null, null, null, "refanyval", "ckfinite", null, null, "mkrefany", null, null, null, null, null, null, null, null, null, "ldtoken", "conv.u2", "conv.u1", "conv.i", "conv.ovf.i", "conv.ovf.u", "add.ovf", "add.ovf.un", "mul.ovf", "mul.ovf.un", "sub.ovf", "sub.ovf.un", "endfinally", "leave", "leave.s", "stind.i", "conv.u", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, "prefix7", "prefix6", "prefix5", "prefix4", "prefix3", "prefix2", "prefix1", "prefixref", "arglist", "ceq", "cgt", "cgt.un", "clt", "clt.un", "ldftn", "ldvirtftn", null, "ldarg", "ldarga", "starg", "ldloc", "ldloca", "stloc", "localloc", null, "endfilter", "unaligned.", "volatile.", "tail.", "initobj", "constrained.", "cpblk", "initblk", "no.", // added by spouliot to match Cecil existing definitions "rethrow", null, "sizeof", "refanytype", "readonly.", // added by spouliot to match Cecil existing definitions null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, }; } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/CodeWriter.cs0000664000175000017500000004155612136523632031577 0ustar00directhexdirecthex00000000000000// // CodeWriter.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using Mono.Collections.Generic; using Mono.Cecil.Metadata; using Mono.Cecil.PE; using RVA = System.UInt32; #if !READ_ONLY namespace Mono.Cecil.Cil { sealed class CodeWriter : ByteBuffer { readonly RVA code_base; internal readonly MetadataBuilder metadata; readonly Dictionary standalone_signatures; RVA current; MethodBody body; public CodeWriter (MetadataBuilder metadata) : base (0) { this.code_base = metadata.text_map.GetNextRVA (TextSegment.CLIHeader); this.current = code_base; this.metadata = metadata; this.standalone_signatures = new Dictionary (); } public RVA WriteMethodBody (MethodDefinition method) { var rva = BeginMethod (); if (IsUnresolved (method)) { if (method.rva == 0) return 0; WriteUnresolvedMethodBody (method); } else { if (IsEmptyMethodBody (method.Body)) return 0; WriteResolvedMethodBody (method); } Align (4); EndMethod (); return rva; } static bool IsEmptyMethodBody (MethodBody body) { return body.instructions.IsNullOrEmpty () && body.variables.IsNullOrEmpty (); } static bool IsUnresolved (MethodDefinition method) { return method.HasBody && method.HasImage && method.body == null; } void WriteUnresolvedMethodBody (MethodDefinition method) { var code_reader = metadata.module.Read (method, (_, reader) => reader.code); MethodSymbols symbols; var buffer = code_reader.PatchRawMethodBody (method, this, out symbols); WriteBytes (buffer); if (symbols.instructions.IsNullOrEmpty ()) return; symbols.method_token = method.token; symbols.local_var_token = GetLocalVarToken (buffer, symbols); var symbol_writer = metadata.symbol_writer; if (symbol_writer != null) symbol_writer.Write (symbols); } static MetadataToken GetLocalVarToken (ByteBuffer buffer, MethodSymbols symbols) { if (symbols.variables.IsNullOrEmpty ()) return MetadataToken.Zero; buffer.position = 8; return new MetadataToken (buffer.ReadUInt32 ()); } void WriteResolvedMethodBody (MethodDefinition method) { body = method.Body; ComputeHeader (); if (RequiresFatHeader ()) WriteFatHeader (); else WriteByte ((byte) (0x2 | (body.CodeSize << 2))); // tiny WriteInstructions (); if (body.HasExceptionHandlers) WriteExceptionHandlers (); var symbol_writer = metadata.symbol_writer; if (symbol_writer != null) symbol_writer.Write (body); } void WriteFatHeader () { var body = this.body; byte flags = 0x3; // fat if (body.InitLocals) flags |= 0x10; // init locals if (body.HasExceptionHandlers) flags |= 0x8; // more sections WriteByte (flags); WriteByte (0x30); WriteInt16 ((short) body.max_stack_size); WriteInt32 (body.code_size); body.local_var_token = body.HasVariables ? GetStandAloneSignature (body.Variables) : MetadataToken.Zero; WriteMetadataToken (body.local_var_token); } void WriteInstructions () { var instructions = body.Instructions; var items = instructions.items; var size = instructions.size; for (int i = 0; i < size; i++) { var instruction = items [i]; WriteOpCode (instruction.opcode); WriteOperand (instruction); } } void WriteOpCode (OpCode opcode) { if (opcode.Size == 1) { WriteByte (opcode.Op2); } else { WriteByte (opcode.Op1); WriteByte (opcode.Op2); } } void WriteOperand (Instruction instruction) { var opcode = instruction.opcode; var operand_type = opcode.OperandType; if (operand_type == OperandType.InlineNone) return; var operand = instruction.operand; if (operand == null) throw new ArgumentException (); switch (operand_type) { case OperandType.InlineSwitch: { var targets = (Instruction []) operand; WriteInt32 (targets.Length); var diff = instruction.Offset + opcode.Size + (4 * (targets.Length + 1)); for (int i = 0; i < targets.Length; i++) WriteInt32 (GetTargetOffset (targets [i]) - diff); break; } case OperandType.ShortInlineBrTarget: { var target = (Instruction) operand; WriteSByte ((sbyte) (GetTargetOffset (target) - (instruction.Offset + opcode.Size + 1))); break; } case OperandType.InlineBrTarget: { var target = (Instruction) operand; WriteInt32 (GetTargetOffset (target) - (instruction.Offset + opcode.Size + 4)); break; } case OperandType.ShortInlineVar: WriteByte ((byte) GetVariableIndex ((VariableDefinition) operand)); break; case OperandType.ShortInlineArg: WriteByte ((byte) GetParameterIndex ((ParameterDefinition) operand)); break; case OperandType.InlineVar: WriteInt16 ((short) GetVariableIndex ((VariableDefinition) operand)); break; case OperandType.InlineArg: WriteInt16 ((short) GetParameterIndex ((ParameterDefinition) operand)); break; case OperandType.InlineSig: WriteMetadataToken (GetStandAloneSignature ((CallSite) operand)); break; case OperandType.ShortInlineI: if (opcode == OpCodes.Ldc_I4_S) WriteSByte ((sbyte) operand); else WriteByte ((byte) operand); break; case OperandType.InlineI: WriteInt32 ((int) operand); break; case OperandType.InlineI8: WriteInt64 ((long) operand); break; case OperandType.ShortInlineR: WriteSingle ((float) operand); break; case OperandType.InlineR: WriteDouble ((double) operand); break; case OperandType.InlineString: WriteMetadataToken ( new MetadataToken ( TokenType.String, GetUserStringIndex ((string) operand))); break; case OperandType.InlineType: case OperandType.InlineField: case OperandType.InlineMethod: case OperandType.InlineTok: WriteMetadataToken (metadata.LookupToken ((IMetadataTokenProvider) operand)); break; default: throw new ArgumentException (); } } int GetTargetOffset (Instruction instruction) { if (instruction == null) { var last = body.instructions [body.instructions.size - 1]; return last.offset + last.GetSize (); } return instruction.offset; } uint GetUserStringIndex (string @string) { if (@string == null) return 0; return metadata.user_string_heap.GetStringIndex (@string); } static int GetVariableIndex (VariableDefinition variable) { return variable.Index; } int GetParameterIndex (ParameterDefinition parameter) { if (body.method.HasThis) { if (parameter == body.this_parameter) return 0; return parameter.Index + 1; } return parameter.Index; } bool RequiresFatHeader () { var body = this.body; return body.CodeSize >= 64 || body.InitLocals || body.HasVariables || body.HasExceptionHandlers || body.MaxStackSize > 8; } void ComputeHeader () { int offset = 0; var instructions = body.instructions; var items = instructions.items; var count = instructions.size; var stack_size = 0; var max_stack = 0; Dictionary stack_sizes = null; if (body.HasExceptionHandlers) ComputeExceptionHandlerStackSize (ref stack_sizes); for (int i = 0; i < count; i++) { var instruction = items [i]; instruction.offset = offset; offset += instruction.GetSize (); ComputeStackSize (instruction, ref stack_sizes, ref stack_size, ref max_stack); } body.code_size = offset; body.max_stack_size = max_stack; } void ComputeExceptionHandlerStackSize (ref Dictionary stack_sizes) { var exception_handlers = body.ExceptionHandlers; for (int i = 0; i < exception_handlers.Count; i++) { var exception_handler = exception_handlers [i]; switch (exception_handler.HandlerType) { case ExceptionHandlerType.Catch: AddExceptionStackSize (exception_handler.HandlerStart, ref stack_sizes); break; case ExceptionHandlerType.Filter: AddExceptionStackSize (exception_handler.FilterStart, ref stack_sizes); AddExceptionStackSize (exception_handler.HandlerStart, ref stack_sizes); break; } } } static void AddExceptionStackSize (Instruction handler_start, ref Dictionary stack_sizes) { if (handler_start == null) return; if (stack_sizes == null) stack_sizes = new Dictionary (); stack_sizes [handler_start] = 1; } static void ComputeStackSize (Instruction instruction, ref Dictionary stack_sizes, ref int stack_size, ref int max_stack) { int computed_size; if (stack_sizes != null && stack_sizes.TryGetValue (instruction, out computed_size)) stack_size = computed_size; max_stack = System.Math.Max (max_stack, stack_size); ComputeStackDelta (instruction, ref stack_size); max_stack = System.Math.Max (max_stack, stack_size); CopyBranchStackSize (instruction, ref stack_sizes, stack_size); ComputeStackSize (instruction, ref stack_size); } static void CopyBranchStackSize (Instruction instruction, ref Dictionary stack_sizes, int stack_size) { if (stack_size == 0) return; switch (instruction.opcode.OperandType) { case OperandType.ShortInlineBrTarget: case OperandType.InlineBrTarget: CopyBranchStackSize (ref stack_sizes, (Instruction) instruction.operand, stack_size); break; case OperandType.InlineSwitch: var targets = (Instruction[]) instruction.operand; for (int i = 0; i < targets.Length; i++) CopyBranchStackSize (ref stack_sizes, targets [i], stack_size); break; } } static void CopyBranchStackSize (ref Dictionary stack_sizes, Instruction target, int stack_size) { if (stack_sizes == null) stack_sizes = new Dictionary (); int branch_stack_size = stack_size; int computed_size; if (stack_sizes.TryGetValue (target, out computed_size)) branch_stack_size = System.Math.Max (branch_stack_size, computed_size); stack_sizes [target] = branch_stack_size; } static void ComputeStackSize (Instruction instruction, ref int stack_size) { switch (instruction.opcode.FlowControl) { case FlowControl.Branch: case FlowControl.Break: case FlowControl.Throw: case FlowControl.Return: stack_size = 0; break; } } static void ComputeStackDelta (Instruction instruction, ref int stack_size) { switch (instruction.opcode.FlowControl) { case FlowControl.Call: { var method = (IMethodSignature) instruction.operand; stack_size -= (method.HasParameters ? method.Parameters.Count : 0) + (method.HasThis && instruction.opcode.Code != Code.Newobj ? 1 : 0); stack_size += (method.ReturnType.etype == ElementType.Void ? 0 : 1) + (method.HasThis && instruction.opcode.Code == Code.Newobj ? 1 : 0); break; } default: ComputePopDelta (instruction.opcode.StackBehaviourPop, ref stack_size); ComputePushDelta (instruction.opcode.StackBehaviourPush, ref stack_size); break; } } static void ComputePopDelta (StackBehaviour pop_behavior, ref int stack_size) { switch (pop_behavior) { case StackBehaviour.Popi: case StackBehaviour.Popref: case StackBehaviour.Pop1: stack_size--; break; case StackBehaviour.Pop1_pop1: case StackBehaviour.Popi_pop1: case StackBehaviour.Popi_popi: case StackBehaviour.Popi_popi8: case StackBehaviour.Popi_popr4: case StackBehaviour.Popi_popr8: case StackBehaviour.Popref_pop1: case StackBehaviour.Popref_popi: stack_size -= 2; break; case StackBehaviour.Popi_popi_popi: case StackBehaviour.Popref_popi_popi: case StackBehaviour.Popref_popi_popi8: case StackBehaviour.Popref_popi_popr4: case StackBehaviour.Popref_popi_popr8: case StackBehaviour.Popref_popi_popref: stack_size -= 3; break; case StackBehaviour.PopAll: stack_size = 0; break; } } static void ComputePushDelta (StackBehaviour push_behaviour, ref int stack_size) { switch (push_behaviour) { case StackBehaviour.Push1: case StackBehaviour.Pushi: case StackBehaviour.Pushi8: case StackBehaviour.Pushr4: case StackBehaviour.Pushr8: case StackBehaviour.Pushref: stack_size++; break; case StackBehaviour.Push1_push1: stack_size += 2; break; } } void WriteExceptionHandlers () { Align (4); var handlers = body.ExceptionHandlers; if (handlers.Count < 0x15 && !RequiresFatSection (handlers)) WriteSmallSection (handlers); else WriteFatSection (handlers); } static bool RequiresFatSection (Collection handlers) { for (int i = 0; i < handlers.Count; i++) { var handler = handlers [i]; if (IsFatRange (handler.TryStart, handler.TryEnd)) return true; if (IsFatRange (handler.HandlerStart, handler.HandlerEnd)) return true; if (handler.HandlerType == ExceptionHandlerType.Filter && IsFatRange (handler.FilterStart, handler.FilterEnd)) return true; } return false; } static bool IsFatRange (Instruction start, Instruction end) { if (end == null) return true; return end.Offset - start.Offset > 255 || start.Offset > 65535; } void WriteSmallSection (Collection handlers) { const byte eh_table = 0x1; WriteByte (eh_table); WriteByte ((byte) (handlers.Count * 12 + 4)); WriteBytes (2); WriteExceptionHandlers ( handlers, i => WriteUInt16 ((ushort) i), i => WriteByte ((byte) i)); } void WriteFatSection (Collection handlers) { const byte eh_table = 0x1; const byte fat_format = 0x40; WriteByte (eh_table | fat_format); int size = handlers.Count * 24 + 4; WriteByte ((byte) (size & 0xff)); WriteByte ((byte) ((size >> 8) & 0xff)); WriteByte ((byte) ((size >> 16) & 0xff)); WriteExceptionHandlers (handlers, WriteInt32, WriteInt32); } void WriteExceptionHandlers (Collection handlers, Action write_entry, Action write_length) { for (int i = 0; i < handlers.Count; i++) { var handler = handlers [i]; write_entry ((int) handler.HandlerType); write_entry (handler.TryStart.Offset); write_length (GetTargetOffset (handler.TryEnd) - handler.TryStart.Offset); write_entry (handler.HandlerStart.Offset); write_length (GetTargetOffset (handler.HandlerEnd) - handler.HandlerStart.Offset); WriteExceptionHandlerSpecific (handler); } } void WriteExceptionHandlerSpecific (ExceptionHandler handler) { switch (handler.HandlerType) { case ExceptionHandlerType.Catch: WriteMetadataToken (metadata.LookupToken (handler.CatchType)); break; case ExceptionHandlerType.Filter: WriteInt32 (handler.FilterStart.Offset); break; default: WriteInt32 (0); break; } } public MetadataToken GetStandAloneSignature (Collection variables) { var signature = metadata.GetLocalVariableBlobIndex (variables); return GetStandAloneSignatureToken (signature); } public MetadataToken GetStandAloneSignature (CallSite call_site) { var signature = metadata.GetCallSiteBlobIndex (call_site); var token = GetStandAloneSignatureToken (signature); call_site.MetadataToken = token; return token; } MetadataToken GetStandAloneSignatureToken (uint signature) { MetadataToken token; if (standalone_signatures.TryGetValue (signature, out token)) return token; token = new MetadataToken (TokenType.Signature, metadata.AddStandAloneSignature (signature)); standalone_signatures.Add (signature, token); return token; } RVA BeginMethod () { return current; } void WriteMetadataToken (MetadataToken token) { WriteUInt32 (token.ToUInt32 ()); } void Align (int align) { align--; WriteBytes (((position + align) & ~align) - position); } void EndMethod () { current = (RVA) (code_base + position); } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/Code.cs0000664000175000017500000000713712136523632030377 0ustar00directhexdirecthex00000000000000// // Code.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public enum Code { Nop, Break, Ldarg_0, Ldarg_1, Ldarg_2, Ldarg_3, Ldloc_0, Ldloc_1, Ldloc_2, Ldloc_3, Stloc_0, Stloc_1, Stloc_2, Stloc_3, Ldarg_S, Ldarga_S, Starg_S, Ldloc_S, Ldloca_S, Stloc_S, Ldnull, Ldc_I4_M1, Ldc_I4_0, Ldc_I4_1, Ldc_I4_2, Ldc_I4_3, Ldc_I4_4, Ldc_I4_5, Ldc_I4_6, Ldc_I4_7, Ldc_I4_8, Ldc_I4_S, Ldc_I4, Ldc_I8, Ldc_R4, Ldc_R8, Dup, Pop, Jmp, Call, Calli, Ret, Br_S, Brfalse_S, Brtrue_S, Beq_S, Bge_S, Bgt_S, Ble_S, Blt_S, Bne_Un_S, Bge_Un_S, Bgt_Un_S, Ble_Un_S, Blt_Un_S, Br, Brfalse, Brtrue, Beq, Bge, Bgt, Ble, Blt, Bne_Un, Bge_Un, Bgt_Un, Ble_Un, Blt_Un, Switch, Ldind_I1, Ldind_U1, Ldind_I2, Ldind_U2, Ldind_I4, Ldind_U4, Ldind_I8, Ldind_I, Ldind_R4, Ldind_R8, Ldind_Ref, Stind_Ref, Stind_I1, Stind_I2, Stind_I4, Stind_I8, Stind_R4, Stind_R8, Add, Sub, Mul, Div, Div_Un, Rem, Rem_Un, And, Or, Xor, Shl, Shr, Shr_Un, Neg, Not, Conv_I1, Conv_I2, Conv_I4, Conv_I8, Conv_R4, Conv_R8, Conv_U4, Conv_U8, Callvirt, Cpobj, Ldobj, Ldstr, Newobj, Castclass, Isinst, Conv_R_Un, Unbox, Throw, Ldfld, Ldflda, Stfld, Ldsfld, Ldsflda, Stsfld, Stobj, Conv_Ovf_I1_Un, Conv_Ovf_I2_Un, Conv_Ovf_I4_Un, Conv_Ovf_I8_Un, Conv_Ovf_U1_Un, Conv_Ovf_U2_Un, Conv_Ovf_U4_Un, Conv_Ovf_U8_Un, Conv_Ovf_I_Un, Conv_Ovf_U_Un, Box, Newarr, Ldlen, Ldelema, Ldelem_I1, Ldelem_U1, Ldelem_I2, Ldelem_U2, Ldelem_I4, Ldelem_U4, Ldelem_I8, Ldelem_I, Ldelem_R4, Ldelem_R8, Ldelem_Ref, Stelem_I, Stelem_I1, Stelem_I2, Stelem_I4, Stelem_I8, Stelem_R4, Stelem_R8, Stelem_Ref, Ldelem_Any, Stelem_Any, Unbox_Any, Conv_Ovf_I1, Conv_Ovf_U1, Conv_Ovf_I2, Conv_Ovf_U2, Conv_Ovf_I4, Conv_Ovf_U4, Conv_Ovf_I8, Conv_Ovf_U8, Refanyval, Ckfinite, Mkrefany, Ldtoken, Conv_U2, Conv_U1, Conv_I, Conv_Ovf_I, Conv_Ovf_U, Add_Ovf, Add_Ovf_Un, Mul_Ovf, Mul_Ovf_Un, Sub_Ovf, Sub_Ovf_Un, Endfinally, Leave, Leave_S, Stind_I, Conv_U, Arglist, Ceq, Cgt, Cgt_Un, Clt, Clt_Un, Ldftn, Ldvirtftn, Ldarg, Ldarga, Starg, Ldloc, Ldloca, Stloc, Localloc, Endfilter, Unaligned, Volatile, Tail, Initobj, Constrained, Cpblk, Initblk, No, Rethrow, Sizeof, Refanytype, Readonly, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/CodeReader.cs0000664000175000017500000003661612136523632031526 0ustar00directhexdirecthex00000000000000// // CodeReader.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.PE; using Mono.Collections.Generic; using RVA = System.UInt32; namespace Mono.Cecil.Cil { sealed class CodeReader : ByteBuffer { readonly internal MetadataReader reader; int start; Section code_section; MethodDefinition method; MethodBody body; int Offset { get { return base.position - start; } } CodeReader (Section section, MetadataReader reader) : base (section.Data) { this.code_section = section; this.reader = reader; } public static CodeReader CreateCodeReader (MetadataReader metadata) { return new CodeReader (metadata.image.MetadataSection, metadata); } public MethodBody ReadMethodBody (MethodDefinition method) { this.method = method; this.body = new MethodBody (method); reader.context = method; ReadMethodBody (); return this.body; } public void MoveTo (int rva) { if (!IsInSection (rva)) { code_section = reader.image.GetSectionAtVirtualAddress ((uint) rva); Reset (code_section.Data); } base.position = rva - (int) code_section.VirtualAddress; } bool IsInSection (int rva) { return code_section.VirtualAddress <= rva && rva < code_section.VirtualAddress + code_section.SizeOfRawData; } void ReadMethodBody () { MoveTo (method.RVA); var flags = ReadByte (); switch (flags & 0x3) { case 0x2: // tiny body.code_size = flags >> 2; body.MaxStackSize = 8; ReadCode (); break; case 0x3: // fat base.position--; ReadFatMethod (); break; default: throw new InvalidOperationException (); } var symbol_reader = reader.module.SymbolReader; if (symbol_reader != null) { var instructions = body.Instructions; symbol_reader.Read (body, offset => GetInstruction (instructions, offset)); } } void ReadFatMethod () { var flags = ReadUInt16 (); body.max_stack_size = ReadUInt16 (); body.code_size = (int) ReadUInt32 (); body.local_var_token = new MetadataToken (ReadUInt32 ()); body.init_locals = (flags & 0x10) != 0; if (body.local_var_token.RID != 0) body.variables = ReadVariables (body.local_var_token); ReadCode (); if ((flags & 0x8) != 0) ReadSection (); } public VariableDefinitionCollection ReadVariables (MetadataToken local_var_token) { var position = reader.position; var variables = reader.ReadVariables (local_var_token); reader.position = position; return variables; } void ReadCode () { start = position; var code_size = body.code_size; if (code_size < 0 || buffer.Length <= (uint) (code_size + position)) code_size = 0; var end = start + code_size; var instructions = body.instructions = new InstructionCollection (code_size / 3); while (position < end) { var offset = base.position - start; var opcode = ReadOpCode (); var current = new Instruction (offset, opcode); if (opcode.OperandType != OperandType.InlineNone) current.operand = ReadOperand (current); instructions.Add (current); } ResolveBranches (instructions); } OpCode ReadOpCode () { var il_opcode = ReadByte (); return il_opcode != 0xfe ? OpCodes.OneByteOpCode [il_opcode] : OpCodes.TwoBytesOpCode [ReadByte ()]; } object ReadOperand (Instruction instruction) { switch (instruction.opcode.OperandType) { case OperandType.InlineSwitch: var length = ReadInt32 (); var base_offset = Offset + (4 * length); var branches = new int [length]; for (int i = 0; i < length; i++) branches [i] = base_offset + ReadInt32 (); return branches; case OperandType.ShortInlineBrTarget: return ReadSByte () + Offset; case OperandType.InlineBrTarget: return ReadInt32 () + Offset; case OperandType.ShortInlineI: if (instruction.opcode == OpCodes.Ldc_I4_S) return ReadSByte (); return ReadByte (); case OperandType.InlineI: return ReadInt32 (); case OperandType.ShortInlineR: return ReadSingle (); case OperandType.InlineR: return ReadDouble (); case OperandType.InlineI8: return ReadInt64 (); case OperandType.ShortInlineVar: return GetVariable (ReadByte ()); case OperandType.InlineVar: return GetVariable (ReadUInt16 ()); case OperandType.ShortInlineArg: return GetParameter (ReadByte ()); case OperandType.InlineArg: return GetParameter (ReadUInt16 ()); case OperandType.InlineSig: return GetCallSite (ReadToken ()); case OperandType.InlineString: return GetString (ReadToken ()); case OperandType.InlineTok: case OperandType.InlineType: case OperandType.InlineMethod: case OperandType.InlineField: return reader.LookupToken (ReadToken ()); default: throw new NotSupportedException (); } } public string GetString (MetadataToken token) { return reader.image.UserStringHeap.Read (token.RID); } public ParameterDefinition GetParameter (int index) { return body.GetParameter (index); } public VariableDefinition GetVariable (int index) { return body.GetVariable (index); } public CallSite GetCallSite (MetadataToken token) { return reader.ReadCallSite (token); } void ResolveBranches (Collection instructions) { var items = instructions.items; var size = instructions.size; for (int i = 0; i < size; i++) { var instruction = items [i]; switch (instruction.opcode.OperandType) { case OperandType.ShortInlineBrTarget: case OperandType.InlineBrTarget: instruction.operand = GetInstruction ((int) instruction.operand); break; case OperandType.InlineSwitch: var offsets = (int []) instruction.operand; var branches = new Instruction [offsets.Length]; for (int j = 0; j < offsets.Length; j++) branches [j] = GetInstruction (offsets [j]); instruction.operand = branches; break; } } } Instruction GetInstruction (int offset) { return GetInstruction (body.Instructions, offset); } static Instruction GetInstruction (Collection instructions, int offset) { var size = instructions.size; var items = instructions.items; if (offset < 0 || offset > items [size - 1].offset) return null; int min = 0; int max = size - 1; while (min <= max) { int mid = min + ((max - min) / 2); var instruction = items [mid]; var instruction_offset = instruction.offset; if (offset == instruction_offset) return instruction; if (offset < instruction_offset) max = mid - 1; else min = mid + 1; } return null; } void ReadSection () { Align (4); const byte fat_format = 0x40; const byte more_sects = 0x80; var flags = ReadByte (); if ((flags & fat_format) == 0) ReadSmallSection (); else ReadFatSection (); if ((flags & more_sects) != 0) ReadSection (); } void ReadSmallSection () { var count = ReadByte () / 12; Advance (2); ReadExceptionHandlers ( count, () => (int) ReadUInt16 (), () => (int) ReadByte ()); } void ReadFatSection () { position--; var count = (ReadInt32 () >> 8) / 24; ReadExceptionHandlers ( count, ReadInt32, ReadInt32); } // inline ? void ReadExceptionHandlers (int count, Func read_entry, Func read_length) { for (int i = 0; i < count; i++) { var handler = new ExceptionHandler ( (ExceptionHandlerType) (read_entry () & 0x7)); handler.TryStart = GetInstruction (read_entry ()); handler.TryEnd = GetInstruction (handler.TryStart.Offset + read_length ()); handler.HandlerStart = GetInstruction (read_entry ()); handler.HandlerEnd = GetInstruction (handler.HandlerStart.Offset + read_length ()); ReadExceptionHandlerSpecific (handler); this.body.ExceptionHandlers.Add (handler); } } void ReadExceptionHandlerSpecific (ExceptionHandler handler) { switch (handler.HandlerType) { case ExceptionHandlerType.Catch: handler.CatchType = (TypeReference) reader.LookupToken (ReadToken ()); break; case ExceptionHandlerType.Filter: handler.FilterStart = GetInstruction (ReadInt32 ()); handler.FilterEnd = handler.HandlerStart.Previous; break; default: Advance (4); break; } } void Align (int align) { align--; Advance (((position + align) & ~align) - position); } public MetadataToken ReadToken () { return new MetadataToken (ReadUInt32 ()); } #if !READ_ONLY public ByteBuffer PatchRawMethodBody (MethodDefinition method, CodeWriter writer, out MethodSymbols symbols) { var buffer = new ByteBuffer (); symbols = new MethodSymbols (method.Name); this.method = method; reader.context = method; MoveTo (method.RVA); var flags = ReadByte (); MetadataToken local_var_token; switch (flags & 0x3) { case 0x2: // tiny buffer.WriteByte (flags); local_var_token = MetadataToken.Zero; symbols.code_size = flags >> 2; PatchRawCode (buffer, symbols.code_size, writer); break; case 0x3: // fat base.position--; PatchRawFatMethod (buffer, symbols, writer, out local_var_token); break; default: throw new NotSupportedException (); } var symbol_reader = reader.module.SymbolReader; if (symbol_reader != null && writer.metadata.write_symbols) { symbols.method_token = GetOriginalToken (writer.metadata, method); symbols.local_var_token = local_var_token; symbol_reader.Read (symbols); } return buffer; } void PatchRawFatMethod (ByteBuffer buffer, MethodSymbols symbols, CodeWriter writer, out MetadataToken local_var_token) { var flags = ReadUInt16 (); buffer.WriteUInt16 (flags); buffer.WriteUInt16 (ReadUInt16 ()); symbols.code_size = ReadInt32 (); buffer.WriteInt32 (symbols.code_size); local_var_token = ReadToken (); if (local_var_token.RID > 0) { var variables = symbols.variables = ReadVariables (local_var_token); buffer.WriteUInt32 (variables != null ? writer.GetStandAloneSignature (symbols.variables).ToUInt32 () : 0); } else buffer.WriteUInt32 (0); PatchRawCode (buffer, symbols.code_size, writer); if ((flags & 0x8) != 0) PatchRawSection (buffer, writer.metadata); } static MetadataToken GetOriginalToken (MetadataBuilder metadata, MethodDefinition method) { MetadataToken original; if (metadata.TryGetOriginalMethodToken (method.token, out original)) return original; return MetadataToken.Zero; } void PatchRawCode (ByteBuffer buffer, int code_size, CodeWriter writer) { var metadata = writer.metadata; buffer.WriteBytes (ReadBytes (code_size)); var end = buffer.position; buffer.position -= code_size; while (buffer.position < end) { OpCode opcode; var il_opcode = buffer.ReadByte (); if (il_opcode != 0xfe) { opcode = OpCodes.OneByteOpCode [il_opcode]; } else { var il_opcode2 = buffer.ReadByte (); opcode = OpCodes.TwoBytesOpCode [il_opcode2]; } switch (opcode.OperandType) { case OperandType.ShortInlineI: case OperandType.ShortInlineBrTarget: case OperandType.ShortInlineVar: case OperandType.ShortInlineArg: buffer.position += 1; break; case OperandType.InlineVar: case OperandType.InlineArg: buffer.position += 2; break; case OperandType.InlineBrTarget: case OperandType.ShortInlineR: case OperandType.InlineI: buffer.position += 4; break; case OperandType.InlineI8: case OperandType.InlineR: buffer.position += 8; break; case OperandType.InlineSwitch: var length = buffer.ReadInt32 (); buffer.position += length * 4; break; case OperandType.InlineString: var @string = GetString (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 ( new MetadataToken ( TokenType.String, metadata.user_string_heap.GetStringIndex (@string)).ToUInt32 ()); break; case OperandType.InlineSig: var call_site = GetCallSite (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 (writer.GetStandAloneSignature (call_site).ToUInt32 ()); break; case OperandType.InlineTok: case OperandType.InlineType: case OperandType.InlineMethod: case OperandType.InlineField: var provider = reader.LookupToken (new MetadataToken (buffer.ReadUInt32 ())); buffer.position -= 4; buffer.WriteUInt32 (metadata.LookupToken (provider).ToUInt32 ()); break; } } } void PatchRawSection (ByteBuffer buffer, MetadataBuilder metadata) { var position = base.position; Align (4); buffer.WriteBytes (base.position - position); const byte fat_format = 0x40; const byte more_sects = 0x80; var flags = ReadByte (); if ((flags & fat_format) == 0) { buffer.WriteByte (flags); PatchRawSmallSection (buffer, metadata); } else PatchRawFatSection (buffer, metadata); if ((flags & more_sects) != 0) PatchRawSection (buffer, metadata); } void PatchRawSmallSection (ByteBuffer buffer, MetadataBuilder metadata) { var length = ReadByte (); buffer.WriteByte (length); Advance (2); buffer.WriteUInt16 (0); var count = length / 12; PatchRawExceptionHandlers (buffer, metadata, count, false); } void PatchRawFatSection (ByteBuffer buffer, MetadataBuilder metadata) { position--; var length = ReadInt32 (); buffer.WriteInt32 (length); var count = (length >> 8) / 24; PatchRawExceptionHandlers (buffer, metadata, count, true); } void PatchRawExceptionHandlers (ByteBuffer buffer, MetadataBuilder metadata, int count, bool fat_entry) { const int fat_entry_size = 16; const int small_entry_size = 6; for (int i = 0; i < count; i++) { ExceptionHandlerType handler_type; if (fat_entry) { var type = ReadUInt32 (); handler_type = (ExceptionHandlerType) (type & 0x7); buffer.WriteUInt32 (type); } else { var type = ReadUInt16 (); handler_type = (ExceptionHandlerType) (type & 0x7); buffer.WriteUInt16 (type); } buffer.WriteBytes (ReadBytes (fat_entry ? fat_entry_size : small_entry_size)); switch (handler_type) { case ExceptionHandlerType.Catch: var exception = reader.LookupToken (ReadToken ()); buffer.WriteUInt32 (metadata.LookupToken (exception).ToUInt32 ()); break; default: buffer.WriteUInt32 (ReadUInt32 ()); break; } } } #endif } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/OpCodes.cs0000664000175000017500000017736312136523632031072 0ustar00directhexdirecthex00000000000000// // OpCodes.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public static class OpCodes { internal static readonly OpCode [] OneByteOpCode = new OpCode [0xe0 + 1]; internal static readonly OpCode [] TwoBytesOpCode = new OpCode [0x1e + 1]; public static readonly OpCode Nop = new OpCode ( 0xff << 0 | 0x00 << 8 | (byte) Code.Nop << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Break = new OpCode ( 0xff << 0 | 0x01 << 8 | (byte) Code.Break << 16 | (byte) FlowControl.Break << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldarg_0 = new OpCode ( 0xff << 0 | 0x02 << 8 | (byte) Code.Ldarg_0 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldarg_1 = new OpCode ( 0xff << 0 | 0x03 << 8 | (byte) Code.Ldarg_1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldarg_2 = new OpCode ( 0xff << 0 | 0x04 << 8 | (byte) Code.Ldarg_2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldarg_3 = new OpCode ( 0xff << 0 | 0x05 << 8 | (byte) Code.Ldarg_3 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloc_0 = new OpCode ( 0xff << 0 | 0x06 << 8 | (byte) Code.Ldloc_0 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloc_1 = new OpCode ( 0xff << 0 | 0x07 << 8 | (byte) Code.Ldloc_1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloc_2 = new OpCode ( 0xff << 0 | 0x08 << 8 | (byte) Code.Ldloc_2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloc_3 = new OpCode ( 0xff << 0 | 0x09 << 8 | (byte) Code.Ldloc_3 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Stloc_0 = new OpCode ( 0xff << 0 | 0x0a << 8 | (byte) Code.Stloc_0 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stloc_1 = new OpCode ( 0xff << 0 | 0x0b << 8 | (byte) Code.Stloc_1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stloc_2 = new OpCode ( 0xff << 0 | 0x0c << 8 | (byte) Code.Stloc_2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stloc_3 = new OpCode ( 0xff << 0 | 0x0d << 8 | (byte) Code.Stloc_3 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldarg_S = new OpCode ( 0xff << 0 | 0x0e << 8 | (byte) Code.Ldarg_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineArg << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldarga_S = new OpCode ( 0xff << 0 | 0x0f << 8 | (byte) Code.Ldarga_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineArg << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Starg_S = new OpCode ( 0xff << 0 | 0x10 << 8 | (byte) Code.Starg_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineArg << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldloc_S = new OpCode ( 0xff << 0 | 0x11 << 8 | (byte) Code.Ldloc_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineVar << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloca_S = new OpCode ( 0xff << 0 | 0x12 << 8 | (byte) Code.Ldloca_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineVar << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Stloc_S = new OpCode ( 0xff << 0 | 0x13 << 8 | (byte) Code.Stloc_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineVar << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldnull = new OpCode ( 0xff << 0 | 0x14 << 8 | (byte) Code.Ldnull << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Ldc_I4_M1 = new OpCode ( 0xff << 0 | 0x15 << 8 | (byte) Code.Ldc_I4_M1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_0 = new OpCode ( 0xff << 0 | 0x16 << 8 | (byte) Code.Ldc_I4_0 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_1 = new OpCode ( 0xff << 0 | 0x17 << 8 | (byte) Code.Ldc_I4_1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_2 = new OpCode ( 0xff << 0 | 0x18 << 8 | (byte) Code.Ldc_I4_2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_3 = new OpCode ( 0xff << 0 | 0x19 << 8 | (byte) Code.Ldc_I4_3 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_4 = new OpCode ( 0xff << 0 | 0x1a << 8 | (byte) Code.Ldc_I4_4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_5 = new OpCode ( 0xff << 0 | 0x1b << 8 | (byte) Code.Ldc_I4_5 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_6 = new OpCode ( 0xff << 0 | 0x1c << 8 | (byte) Code.Ldc_I4_6 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_7 = new OpCode ( 0xff << 0 | 0x1d << 8 | (byte) Code.Ldc_I4_7 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_8 = new OpCode ( 0xff << 0 | 0x1e << 8 | (byte) Code.Ldc_I4_8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4_S = new OpCode ( 0xff << 0 | 0x1f << 8 | (byte) Code.Ldc_I4_S << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineI << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I4 = new OpCode ( 0xff << 0 | 0x20 << 8 | (byte) Code.Ldc_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineI << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldc_I8 = new OpCode ( 0xff << 0 | 0x21 << 8 | (byte) Code.Ldc_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineI8 << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Ldc_R4 = new OpCode ( 0xff << 0 | 0x22 << 8 | (byte) Code.Ldc_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.ShortInlineR << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushr4 << 24); public static readonly OpCode Ldc_R8 = new OpCode ( 0xff << 0 | 0x23 << 8 | (byte) Code.Ldc_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineR << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Dup = new OpCode ( 0xff << 0 | 0x25 << 8 | (byte) Code.Dup << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push1_push1 << 24); public static readonly OpCode Pop = new OpCode ( 0xff << 0 | 0x26 << 8 | (byte) Code.Pop << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Jmp = new OpCode ( 0xff << 0 | 0x27 << 8 | (byte) Code.Jmp << 16 | (byte) FlowControl.Call << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Call = new OpCode ( 0xff << 0 | 0x28 << 8 | (byte) Code.Call << 16 | (byte) FlowControl.Call << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Varpop << 16 | (byte) StackBehaviour.Varpush << 24); public static readonly OpCode Calli = new OpCode ( 0xff << 0 | 0x29 << 8 | (byte) Code.Calli << 16 | (byte) FlowControl.Call << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineSig << 8 | (byte) StackBehaviour.Varpop << 16 | (byte) StackBehaviour.Varpush << 24); public static readonly OpCode Ret = new OpCode ( 0xff << 0 | 0x2a << 8 | (byte) Code.Ret << 16 | (byte) FlowControl.Return << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Varpop << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Br_S = new OpCode ( 0xff << 0 | 0x2b << 8 | (byte) Code.Br_S << 16 | (byte) FlowControl.Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Brfalse_S = new OpCode ( 0xff << 0 | 0x2c << 8 | (byte) Code.Brfalse_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Brtrue_S = new OpCode ( 0xff << 0 | 0x2d << 8 | (byte) Code.Brtrue_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Beq_S = new OpCode ( 0xff << 0 | 0x2e << 8 | (byte) Code.Beq_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bge_S = new OpCode ( 0xff << 0 | 0x2f << 8 | (byte) Code.Bge_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bgt_S = new OpCode ( 0xff << 0 | 0x30 << 8 | (byte) Code.Bgt_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ble_S = new OpCode ( 0xff << 0 | 0x31 << 8 | (byte) Code.Ble_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Blt_S = new OpCode ( 0xff << 0 | 0x32 << 8 | (byte) Code.Blt_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bne_Un_S = new OpCode ( 0xff << 0 | 0x33 << 8 | (byte) Code.Bne_Un_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bge_Un_S = new OpCode ( 0xff << 0 | 0x34 << 8 | (byte) Code.Bge_Un_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bgt_Un_S = new OpCode ( 0xff << 0 | 0x35 << 8 | (byte) Code.Bgt_Un_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ble_Un_S = new OpCode ( 0xff << 0 | 0x36 << 8 | (byte) Code.Ble_Un_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Blt_Un_S = new OpCode ( 0xff << 0 | 0x37 << 8 | (byte) Code.Blt_Un_S << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Br = new OpCode ( 0xff << 0 | 0x38 << 8 | (byte) Code.Br << 16 | (byte) FlowControl.Branch << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Brfalse = new OpCode ( 0xff << 0 | 0x39 << 8 | (byte) Code.Brfalse << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Brtrue = new OpCode ( 0xff << 0 | 0x3a << 8 | (byte) Code.Brtrue << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Beq = new OpCode ( 0xff << 0 | 0x3b << 8 | (byte) Code.Beq << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bge = new OpCode ( 0xff << 0 | 0x3c << 8 | (byte) Code.Bge << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bgt = new OpCode ( 0xff << 0 | 0x3d << 8 | (byte) Code.Bgt << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ble = new OpCode ( 0xff << 0 | 0x3e << 8 | (byte) Code.Ble << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Blt = new OpCode ( 0xff << 0 | 0x3f << 8 | (byte) Code.Blt << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bne_Un = new OpCode ( 0xff << 0 | 0x40 << 8 | (byte) Code.Bne_Un << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bge_Un = new OpCode ( 0xff << 0 | 0x41 << 8 | (byte) Code.Bge_Un << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Bgt_Un = new OpCode ( 0xff << 0 | 0x42 << 8 | (byte) Code.Bgt_Un << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ble_Un = new OpCode ( 0xff << 0 | 0x43 << 8 | (byte) Code.Ble_Un << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Blt_Un = new OpCode ( 0xff << 0 | 0x44 << 8 | (byte) Code.Blt_Un << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Switch = new OpCode ( 0xff << 0 | 0x45 << 8 | (byte) Code.Switch << 16 | (byte) FlowControl.Cond_Branch << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineSwitch << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldind_I1 = new OpCode ( 0xff << 0 | 0x46 << 8 | (byte) Code.Ldind_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_U1 = new OpCode ( 0xff << 0 | 0x47 << 8 | (byte) Code.Ldind_U1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_I2 = new OpCode ( 0xff << 0 | 0x48 << 8 | (byte) Code.Ldind_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_U2 = new OpCode ( 0xff << 0 | 0x49 << 8 | (byte) Code.Ldind_U2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_I4 = new OpCode ( 0xff << 0 | 0x4a << 8 | (byte) Code.Ldind_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_U4 = new OpCode ( 0xff << 0 | 0x4b << 8 | (byte) Code.Ldind_U4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_I8 = new OpCode ( 0xff << 0 | 0x4c << 8 | (byte) Code.Ldind_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Ldind_I = new OpCode ( 0xff << 0 | 0x4d << 8 | (byte) Code.Ldind_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldind_R4 = new OpCode ( 0xff << 0 | 0x4e << 8 | (byte) Code.Ldind_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushr4 << 24); public static readonly OpCode Ldind_R8 = new OpCode ( 0xff << 0 | 0x4f << 8 | (byte) Code.Ldind_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Ldind_Ref = new OpCode ( 0xff << 0 | 0x50 << 8 | (byte) Code.Ldind_Ref << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Stind_Ref = new OpCode ( 0xff << 0 | 0x51 << 8 | (byte) Code.Stind_Ref << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_I1 = new OpCode ( 0xff << 0 | 0x52 << 8 | (byte) Code.Stind_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_I2 = new OpCode ( 0xff << 0 | 0x53 << 8 | (byte) Code.Stind_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_I4 = new OpCode ( 0xff << 0 | 0x54 << 8 | (byte) Code.Stind_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_I8 = new OpCode ( 0xff << 0 | 0x55 << 8 | (byte) Code.Stind_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi8 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_R4 = new OpCode ( 0xff << 0 | 0x56 << 8 | (byte) Code.Stind_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popr4 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_R8 = new OpCode ( 0xff << 0 | 0x57 << 8 | (byte) Code.Stind_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popr8 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Add = new OpCode ( 0xff << 0 | 0x58 << 8 | (byte) Code.Add << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Sub = new OpCode ( 0xff << 0 | 0x59 << 8 | (byte) Code.Sub << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Mul = new OpCode ( 0xff << 0 | 0x5a << 8 | (byte) Code.Mul << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Div = new OpCode ( 0xff << 0 | 0x5b << 8 | (byte) Code.Div << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Div_Un = new OpCode ( 0xff << 0 | 0x5c << 8 | (byte) Code.Div_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Rem = new OpCode ( 0xff << 0 | 0x5d << 8 | (byte) Code.Rem << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Rem_Un = new OpCode ( 0xff << 0 | 0x5e << 8 | (byte) Code.Rem_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode And = new OpCode ( 0xff << 0 | 0x5f << 8 | (byte) Code.And << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Or = new OpCode ( 0xff << 0 | 0x60 << 8 | (byte) Code.Or << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Xor = new OpCode ( 0xff << 0 | 0x61 << 8 | (byte) Code.Xor << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Shl = new OpCode ( 0xff << 0 | 0x62 << 8 | (byte) Code.Shl << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Shr = new OpCode ( 0xff << 0 | 0x63 << 8 | (byte) Code.Shr << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Shr_Un = new OpCode ( 0xff << 0 | 0x64 << 8 | (byte) Code.Shr_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Neg = new OpCode ( 0xff << 0 | 0x65 << 8 | (byte) Code.Neg << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Not = new OpCode ( 0xff << 0 | 0x66 << 8 | (byte) Code.Not << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Conv_I1 = new OpCode ( 0xff << 0 | 0x67 << 8 | (byte) Code.Conv_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_I2 = new OpCode ( 0xff << 0 | 0x68 << 8 | (byte) Code.Conv_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_I4 = new OpCode ( 0xff << 0 | 0x69 << 8 | (byte) Code.Conv_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_I8 = new OpCode ( 0xff << 0 | 0x6a << 8 | (byte) Code.Conv_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Conv_R4 = new OpCode ( 0xff << 0 | 0x6b << 8 | (byte) Code.Conv_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushr4 << 24); public static readonly OpCode Conv_R8 = new OpCode ( 0xff << 0 | 0x6c << 8 | (byte) Code.Conv_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Conv_U4 = new OpCode ( 0xff << 0 | 0x6d << 8 | (byte) Code.Conv_U4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_U8 = new OpCode ( 0xff << 0 | 0x6e << 8 | (byte) Code.Conv_U8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Callvirt = new OpCode ( 0xff << 0 | 0x6f << 8 | (byte) Code.Callvirt << 16 | (byte) FlowControl.Call << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Varpop << 16 | (byte) StackBehaviour.Varpush << 24); public static readonly OpCode Cpobj = new OpCode ( 0xff << 0 | 0x70 << 8 | (byte) Code.Cpobj << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldobj = new OpCode ( 0xff << 0 | 0x71 << 8 | (byte) Code.Ldobj << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldstr = new OpCode ( 0xff << 0 | 0x72 << 8 | (byte) Code.Ldstr << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineString << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Newobj = new OpCode ( 0xff << 0 | 0x73 << 8 | (byte) Code.Newobj << 16 | (byte) FlowControl.Call << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Varpop << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Castclass = new OpCode ( 0xff << 0 | 0x74 << 8 | (byte) Code.Castclass << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Isinst = new OpCode ( 0xff << 0 | 0x75 << 8 | (byte) Code.Isinst << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_R_Un = new OpCode ( 0xff << 0 | 0x76 << 8 | (byte) Code.Conv_R_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Unbox = new OpCode ( 0xff << 0 | 0x79 << 8 | (byte) Code.Unbox << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Throw = new OpCode ( 0xff << 0 | 0x7a << 8 | (byte) Code.Throw << 16 | (byte) FlowControl.Throw << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldfld = new OpCode ( 0xff << 0 | 0x7b << 8 | (byte) Code.Ldfld << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldflda = new OpCode ( 0xff << 0 | 0x7c << 8 | (byte) Code.Ldflda << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Stfld = new OpCode ( 0xff << 0 | 0x7d << 8 | (byte) Code.Stfld << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Popref_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldsfld = new OpCode ( 0xff << 0 | 0x7e << 8 | (byte) Code.Ldsfld << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldsflda = new OpCode ( 0xff << 0 | 0x7f << 8 | (byte) Code.Ldsflda << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Stsfld = new OpCode ( 0xff << 0 | 0x80 << 8 | (byte) Code.Stsfld << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineField << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stobj = new OpCode ( 0xff << 0 | 0x81 << 8 | (byte) Code.Stobj << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi_pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Conv_Ovf_I1_Un = new OpCode ( 0xff << 0 | 0x82 << 8 | (byte) Code.Conv_Ovf_I1_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I2_Un = new OpCode ( 0xff << 0 | 0x83 << 8 | (byte) Code.Conv_Ovf_I2_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I4_Un = new OpCode ( 0xff << 0 | 0x84 << 8 | (byte) Code.Conv_Ovf_I4_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I8_Un = new OpCode ( 0xff << 0 | 0x85 << 8 | (byte) Code.Conv_Ovf_I8_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Conv_Ovf_U1_Un = new OpCode ( 0xff << 0 | 0x86 << 8 | (byte) Code.Conv_Ovf_U1_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U2_Un = new OpCode ( 0xff << 0 | 0x87 << 8 | (byte) Code.Conv_Ovf_U2_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U4_Un = new OpCode ( 0xff << 0 | 0x88 << 8 | (byte) Code.Conv_Ovf_U4_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U8_Un = new OpCode ( 0xff << 0 | 0x89 << 8 | (byte) Code.Conv_Ovf_U8_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Conv_Ovf_I_Un = new OpCode ( 0xff << 0 | 0x8a << 8 | (byte) Code.Conv_Ovf_I_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U_Un = new OpCode ( 0xff << 0 | 0x8b << 8 | (byte) Code.Conv_Ovf_U_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Box = new OpCode ( 0xff << 0 | 0x8c << 8 | (byte) Code.Box << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Newarr = new OpCode ( 0xff << 0 | 0x8d << 8 | (byte) Code.Newarr << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Ldlen = new OpCode ( 0xff << 0 | 0x8e << 8 | (byte) Code.Ldlen << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelema = new OpCode ( 0xff << 0 | 0x8f << 8 | (byte) Code.Ldelema << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_I1 = new OpCode ( 0xff << 0 | 0x90 << 8 | (byte) Code.Ldelem_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_U1 = new OpCode ( 0xff << 0 | 0x91 << 8 | (byte) Code.Ldelem_U1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_I2 = new OpCode ( 0xff << 0 | 0x92 << 8 | (byte) Code.Ldelem_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_U2 = new OpCode ( 0xff << 0 | 0x93 << 8 | (byte) Code.Ldelem_U2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_I4 = new OpCode ( 0xff << 0 | 0x94 << 8 | (byte) Code.Ldelem_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_U4 = new OpCode ( 0xff << 0 | 0x95 << 8 | (byte) Code.Ldelem_U4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_I8 = new OpCode ( 0xff << 0 | 0x96 << 8 | (byte) Code.Ldelem_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Ldelem_I = new OpCode ( 0xff << 0 | 0x97 << 8 | (byte) Code.Ldelem_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldelem_R4 = new OpCode ( 0xff << 0 | 0x98 << 8 | (byte) Code.Ldelem_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushr4 << 24); public static readonly OpCode Ldelem_R8 = new OpCode ( 0xff << 0 | 0x99 << 8 | (byte) Code.Ldelem_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Ldelem_Ref = new OpCode ( 0xff << 0 | 0x9a << 8 | (byte) Code.Ldelem_Ref << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Pushref << 24); public static readonly OpCode Stelem_I = new OpCode ( 0xff << 0 | 0x9b << 8 | (byte) Code.Stelem_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_I1 = new OpCode ( 0xff << 0 | 0x9c << 8 | (byte) Code.Stelem_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_I2 = new OpCode ( 0xff << 0 | 0x9d << 8 | (byte) Code.Stelem_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_I4 = new OpCode ( 0xff << 0 | 0x9e << 8 | (byte) Code.Stelem_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_I8 = new OpCode ( 0xff << 0 | 0x9f << 8 | (byte) Code.Stelem_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popi8 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_R4 = new OpCode ( 0xff << 0 | 0xa0 << 8 | (byte) Code.Stelem_R4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popr4 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_R8 = new OpCode ( 0xff << 0 | 0xa1 << 8 | (byte) Code.Stelem_R8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popr8 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stelem_Ref = new OpCode ( 0xff << 0 | 0xa2 << 8 | (byte) Code.Stelem_Ref << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popref_popi_popref << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldelem_Any = new OpCode ( 0xff << 0 | 0xa3 << 8 | (byte) Code.Ldelem_Any << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref_popi << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Stelem_Any = new OpCode ( 0xff << 0 | 0xa4 << 8 | (byte) Code.Stelem_Any << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref_popi_popref << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Unbox_Any = new OpCode ( 0xff << 0 | 0xa5 << 8 | (byte) Code.Unbox_Any << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Conv_Ovf_I1 = new OpCode ( 0xff << 0 | 0xb3 << 8 | (byte) Code.Conv_Ovf_I1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U1 = new OpCode ( 0xff << 0 | 0xb4 << 8 | (byte) Code.Conv_Ovf_U1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I2 = new OpCode ( 0xff << 0 | 0xb5 << 8 | (byte) Code.Conv_Ovf_I2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U2 = new OpCode ( 0xff << 0 | 0xb6 << 8 | (byte) Code.Conv_Ovf_U2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I4 = new OpCode ( 0xff << 0 | 0xb7 << 8 | (byte) Code.Conv_Ovf_I4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U4 = new OpCode ( 0xff << 0 | 0xb8 << 8 | (byte) Code.Conv_Ovf_U4 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I8 = new OpCode ( 0xff << 0 | 0xb9 << 8 | (byte) Code.Conv_Ovf_I8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Conv_Ovf_U8 = new OpCode ( 0xff << 0 | 0xba << 8 | (byte) Code.Conv_Ovf_U8 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi8 << 24); public static readonly OpCode Refanyval = new OpCode ( 0xff << 0 | 0xc2 << 8 | (byte) Code.Refanyval << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ckfinite = new OpCode ( 0xff << 0 | 0xc3 << 8 | (byte) Code.Ckfinite << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushr8 << 24); public static readonly OpCode Mkrefany = new OpCode ( 0xff << 0 | 0xc6 << 8 | (byte) Code.Mkrefany << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldtoken = new OpCode ( 0xff << 0 | 0xd0 << 8 | (byte) Code.Ldtoken << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineTok << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_U2 = new OpCode ( 0xff << 0 | 0xd1 << 8 | (byte) Code.Conv_U2 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_U1 = new OpCode ( 0xff << 0 | 0xd2 << 8 | (byte) Code.Conv_U1 << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_I = new OpCode ( 0xff << 0 | 0xd3 << 8 | (byte) Code.Conv_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_I = new OpCode ( 0xff << 0 | 0xd4 << 8 | (byte) Code.Conv_Ovf_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Conv_Ovf_U = new OpCode ( 0xff << 0 | 0xd5 << 8 | (byte) Code.Conv_Ovf_U << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Add_Ovf = new OpCode ( 0xff << 0 | 0xd6 << 8 | (byte) Code.Add_Ovf << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Add_Ovf_Un = new OpCode ( 0xff << 0 | 0xd7 << 8 | (byte) Code.Add_Ovf_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Mul_Ovf = new OpCode ( 0xff << 0 | 0xd8 << 8 | (byte) Code.Mul_Ovf << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Mul_Ovf_Un = new OpCode ( 0xff << 0 | 0xd9 << 8 | (byte) Code.Mul_Ovf_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Sub_Ovf = new OpCode ( 0xff << 0 | 0xda << 8 | (byte) Code.Sub_Ovf << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Sub_Ovf_Un = new OpCode ( 0xff << 0 | 0xdb << 8 | (byte) Code.Sub_Ovf_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Endfinally = new OpCode ( 0xff << 0 | 0xdc << 8 | (byte) Code.Endfinally << 16 | (byte) FlowControl.Return << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Leave = new OpCode ( 0xff << 0 | 0xdd << 8 | (byte) Code.Leave << 16 | (byte) FlowControl.Branch << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineBrTarget << 8 | (byte) StackBehaviour.PopAll << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Leave_S = new OpCode ( 0xff << 0 | 0xde << 8 | (byte) Code.Leave_S << 16 | (byte) FlowControl.Branch << 24, (byte) OpCodeType.Macro << 0 | (byte) OperandType.ShortInlineBrTarget << 8 | (byte) StackBehaviour.PopAll << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Stind_I = new OpCode ( 0xff << 0 | 0xdf << 8 | (byte) Code.Stind_I << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Conv_U = new OpCode ( 0xff << 0 | 0xe0 << 8 | (byte) Code.Conv_U << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Arglist = new OpCode ( 0xfe << 0 | 0x00 << 8 | (byte) Code.Arglist << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ceq = new OpCode ( 0xfe << 0 | 0x01 << 8 | (byte) Code.Ceq << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Cgt = new OpCode ( 0xfe << 0 | 0x02 << 8 | (byte) Code.Cgt << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Cgt_Un = new OpCode ( 0xfe << 0 | 0x03 << 8 | (byte) Code.Cgt_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Clt = new OpCode ( 0xfe << 0 | 0x04 << 8 | (byte) Code.Clt << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Clt_Un = new OpCode ( 0xfe << 0 | 0x05 << 8 | (byte) Code.Clt_Un << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1_pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldftn = new OpCode ( 0xfe << 0 | 0x06 << 8 | (byte) Code.Ldftn << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldvirtftn = new OpCode ( 0xfe << 0 | 0x07 << 8 | (byte) Code.Ldvirtftn << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineMethod << 8 | (byte) StackBehaviour.Popref << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Ldarg = new OpCode ( 0xfe << 0 | 0x09 << 8 | (byte) Code.Ldarg << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineArg << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldarga = new OpCode ( 0xfe << 0 | 0x0a << 8 | (byte) Code.Ldarga << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineArg << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Starg = new OpCode ( 0xfe << 0 | 0x0b << 8 | (byte) Code.Starg << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineArg << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Ldloc = new OpCode ( 0xfe << 0 | 0x0c << 8 | (byte) Code.Ldloc << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineVar << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push1 << 24); public static readonly OpCode Ldloca = new OpCode ( 0xfe << 0 | 0x0d << 8 | (byte) Code.Ldloca << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineVar << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Stloc = new OpCode ( 0xfe << 0 | 0x0e << 8 | (byte) Code.Stloc << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineVar << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Localloc = new OpCode ( 0xfe << 0 | 0x0f << 8 | (byte) Code.Localloc << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Endfilter = new OpCode ( 0xfe << 0 | 0x11 << 8 | (byte) Code.Endfilter << 16 | (byte) FlowControl.Return << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Unaligned = new OpCode ( 0xfe << 0 | 0x12 << 8 | (byte) Code.Unaligned << 16 | (byte) FlowControl.Meta << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.ShortInlineI << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Volatile = new OpCode ( 0xfe << 0 | 0x13 << 8 | (byte) Code.Volatile << 16 | (byte) FlowControl.Meta << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Tail = new OpCode ( 0xfe << 0 | 0x14 << 8 | (byte) Code.Tail << 16 | (byte) FlowControl.Meta << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Initobj = new OpCode ( 0xfe << 0 | 0x15 << 8 | (byte) Code.Initobj << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Constrained = new OpCode ( 0xfe << 0 | 0x16 << 8 | (byte) Code.Constrained << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Cpblk = new OpCode ( 0xfe << 0 | 0x17 << 8 | (byte) Code.Cpblk << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Initblk = new OpCode ( 0xfe << 0 | 0x18 << 8 | (byte) Code.Initblk << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Popi_popi_popi << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode No = new OpCode ( 0xfe << 0 | 0x19 << 8 | (byte) Code.No << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.ShortInlineI << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Rethrow = new OpCode ( 0xfe << 0 | 0x1a << 8 | (byte) Code.Rethrow << 16 | (byte) FlowControl.Throw << 24, (byte) OpCodeType.Objmodel << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); public static readonly OpCode Sizeof = new OpCode ( 0xfe << 0 | 0x1c << 8 | (byte) Code.Sizeof << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineType << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Refanytype = new OpCode ( 0xfe << 0 | 0x1d << 8 | (byte) Code.Refanytype << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Primitive << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop1 << 16 | (byte) StackBehaviour.Pushi << 24); public static readonly OpCode Readonly = new OpCode ( 0xfe << 0 | 0x1e << 8 | (byte) Code.Readonly << 16 | (byte) FlowControl.Next << 24, (byte) OpCodeType.Prefix << 0 | (byte) OperandType.InlineNone << 8 | (byte) StackBehaviour.Pop0 << 16 | (byte) StackBehaviour.Push0 << 24); } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/ExceptionHandler.cs0000664000175000017500000000471712136523632032762 0ustar00directhexdirecthex00000000000000// // ExceptionHandler.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Cil { public enum ExceptionHandlerType { Catch = 0, Filter = 1, Finally = 2, Fault = 4, } public sealed class ExceptionHandler { Instruction try_start; Instruction try_end; Instruction filter_start; Instruction filter_end; Instruction handler_start; Instruction handler_end; TypeReference catch_type; ExceptionHandlerType handler_type; public Instruction TryStart { get { return try_start; } set { try_start = value; } } public Instruction TryEnd { get { return try_end; } set { try_end = value; } } public Instruction FilterStart { get { return filter_start; } set { filter_start = value; } } public Instruction FilterEnd { get { return filter_end; } set { filter_end = value; } } public Instruction HandlerStart { get { return handler_start; } set { handler_start = value; } } public Instruction HandlerEnd { get { return handler_end; } set { handler_end = value; } } public TypeReference CatchType { get { return catch_type; } set { catch_type = value; } } public ExceptionHandlerType HandlerType { get { return handler_type; } set { handler_type = value; } } public ExceptionHandler (ExceptionHandlerType handlerType) { this.handler_type = handlerType; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Cil/Symbols.cs0000664000175000017500000001476212136523632031157 0ustar00directhexdirecthex00000000000000// // Symbols.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.IO; using System.Runtime.InteropServices; using SR = System.Reflection; using Mono.Collections.Generic; namespace Mono.Cecil.Cil { [StructLayout (LayoutKind.Sequential)] public struct ImageDebugDirectory { public int Characteristics; public int TimeDateStamp; public short MajorVersion; public short MinorVersion; public int Type; public int SizeOfData; public int AddressOfRawData; public int PointerToRawData; } public sealed class Scope : IVariableDefinitionProvider { Instruction start; Instruction end; Collection scopes; Collection variables; public Instruction Start { get { return start; } set { start = value; } } public Instruction End { get { return end; } set { end = value; } } public bool HasScopes { get { return !scopes.IsNullOrEmpty (); } } public Collection Scopes { get { if (scopes == null) scopes = new Collection (); return scopes; } } public bool HasVariables { get { return !variables.IsNullOrEmpty (); } } public Collection Variables { get { if (variables == null) variables = new Collection (); return variables; } } } public struct InstructionSymbol { public readonly int Offset; public readonly SequencePoint SequencePoint; public InstructionSymbol (int offset, SequencePoint sequencePoint) { this.Offset = offset; this.SequencePoint = sequencePoint; } } public sealed class MethodSymbols { internal int code_size; internal string method_name; internal MetadataToken method_token; internal MetadataToken local_var_token; internal Collection variables; internal Collection instructions; public bool HasVariables { get { return !variables.IsNullOrEmpty (); } } public Collection Variables { get { if (variables == null) variables = new Collection (); return variables; } } public Collection Instructions { get { if (instructions == null) instructions = new Collection (); return instructions; } } public int CodeSize { get { return code_size; } } public string MethodName { get { return method_name; } } public MetadataToken MethodToken { get { return method_token; } } public MetadataToken LocalVarToken { get { return local_var_token; } } public MethodSymbols (string methodName) { this.method_name = methodName; } } public delegate Instruction InstructionMapper (int offset); public interface ISymbolReader : IDisposable { bool ProcessDebugHeader (ImageDebugDirectory directory, byte [] header); void Read (MethodBody body, InstructionMapper mapper); void Read (MethodSymbols symbols); } public interface ISymbolReaderProvider { ISymbolReader GetSymbolReader (ModuleDefinition module, string fileName); ISymbolReader GetSymbolReader (ModuleDefinition module, Stream symbolStream); } static class SymbolProvider { static readonly string symbol_kind = Type.GetType ("Mono.Runtime") != null ? "Mdb" : "Pdb"; static SR.AssemblyName GetPlatformSymbolAssemblyName () { var cecil_name = typeof (SymbolProvider).Assembly.GetName (); var name = new SR.AssemblyName { Name = "Mono.Cecil." + symbol_kind, Version = cecil_name.Version, }; name.SetPublicKeyToken (cecil_name.GetPublicKeyToken ()); return name; } static Type GetPlatformType (string fullname) { var type = Type.GetType (fullname); if (type != null) return type; var assembly_name = GetPlatformSymbolAssemblyName (); type = Type.GetType (fullname + ", " + assembly_name.FullName); if (type != null) return type; try { var assembly = SR.Assembly.Load (assembly_name); if (assembly != null) return assembly.GetType (fullname); } catch (FileNotFoundException) { #if !CF } catch (FileLoadException) { #endif } return null; } static ISymbolReaderProvider reader_provider; public static ISymbolReaderProvider GetPlatformReaderProvider () { if (reader_provider != null) return reader_provider; var type = GetPlatformType (GetProviderTypeName ("ReaderProvider")); if (type == null) return null; return reader_provider = (ISymbolReaderProvider) Activator.CreateInstance (type); } static string GetProviderTypeName (string name) { return "Mono.Cecil." + symbol_kind + "." + symbol_kind + name; } #if !READ_ONLY static ISymbolWriterProvider writer_provider; public static ISymbolWriterProvider GetPlatformWriterProvider () { if (writer_provider != null) return writer_provider; var type = GetPlatformType (GetProviderTypeName ("WriterProvider")); if (type == null) return null; return writer_provider = (ISymbolWriterProvider) Activator.CreateInstance (type); } #endif } #if !READ_ONLY public interface ISymbolWriter : IDisposable { bool GetDebugHeader (out ImageDebugDirectory directory, out byte [] header); void Write (MethodBody body); void Write (MethodSymbols symbols); } public interface ISymbolWriterProvider { ISymbolWriter GetSymbolWriter (ModuleDefinition module, string fileName); ISymbolWriter GetSymbolWriter (ModuleDefinition module, Stream symbolStream); } #endif } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/0000775000175000017500000000000012136524043030174 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/BlobHeap.cs0000664000175000017500000000333712136523632032210 0ustar00directhexdirecthex00000000000000// // BlobHeap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { sealed class BlobHeap : Heap { public BlobHeap (Section section, uint start, uint size) : base (section, start, size) { } public byte [] Read (uint index) { if (index == 0 || index > Size - 1) return Empty.Array; var data = Section.Data; int position = (int) (index + Offset); int length = (int) data.ReadCompressedUInt32 (ref position); var buffer = new byte [length]; Buffer.BlockCopy (data, position, buffer, 0, length); return buffer; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/TableHeap.cs0000664000175000017500000000720512136523632032357 0ustar00directhexdirecthex00000000000000// // TableHeap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { enum Table : byte { Module = 0x00, TypeRef = 0x01, TypeDef = 0x02, FieldPtr = 0x03, Field = 0x04, MethodPtr = 0x05, Method = 0x06, ParamPtr = 0x07, Param = 0x08, InterfaceImpl = 0x09, MemberRef = 0x0a, Constant = 0x0b, CustomAttribute = 0x0c, FieldMarshal = 0x0d, DeclSecurity = 0x0e, ClassLayout = 0x0f, FieldLayout = 0x10, StandAloneSig = 0x11, EventMap = 0x12, EventPtr = 0x13, Event = 0x14, PropertyMap = 0x15, PropertyPtr = 0x16, Property = 0x17, MethodSemantics = 0x18, MethodImpl = 0x19, ModuleRef = 0x1a, TypeSpec = 0x1b, ImplMap = 0x1c, FieldRVA = 0x1d, Assembly = 0x20, AssemblyProcessor = 0x21, AssemblyOS = 0x22, AssemblyRef = 0x23, AssemblyRefProcessor = 0x24, AssemblyRefOS = 0x25, File = 0x26, ExportedType = 0x27, ManifestResource = 0x28, NestedClass = 0x29, GenericParam = 0x2a, MethodSpec = 0x2b, GenericParamConstraint = 0x2c, } struct TableInformation { public uint Offset; public uint Length; public uint RowSize; } sealed class TableHeap : Heap { public long Valid; public long Sorted; public static readonly Table [] TableIdentifiers = new [] { Table.Module, Table.TypeRef, Table.TypeDef, Table.FieldPtr, Table.Field, Table.MethodPtr, Table.Method, Table.ParamPtr, Table.Param, Table.InterfaceImpl, Table.MemberRef, Table.Constant, Table.CustomAttribute, Table.FieldMarshal, Table.DeclSecurity, Table.ClassLayout, Table.FieldLayout, Table.StandAloneSig, Table.EventMap, Table.EventPtr, Table.Event, Table.PropertyMap, Table.PropertyPtr, Table.Property, Table.MethodSemantics, Table.MethodImpl, Table.ModuleRef, Table.TypeSpec, Table.ImplMap, Table.FieldRVA, Table.Assembly, Table.AssemblyProcessor, Table.AssemblyOS, Table.AssemblyRef, Table.AssemblyRefProcessor, Table.AssemblyRefOS, Table.File, Table.ExportedType, Table.ManifestResource, Table.NestedClass, Table.GenericParam, Table.MethodSpec, Table.GenericParamConstraint, }; public readonly TableInformation [] Tables = new TableInformation [45]; public TableInformation this [Table table] { get { return Tables [(int) table]; } } public TableHeap (Section section, uint start, uint size) : base (section, start, size) { } public bool HasTable (Table table) { return (Valid & (1L << (int) table)) != 0; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/Buffers.cs0000664000175000017500000001730612136523632032131 0ustar00directhexdirecthex00000000000000// // TableHeapBuffer.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.Text; using Mono.Cecil.PE; using RVA = System.UInt32; #if !READ_ONLY namespace Mono.Cecil.Metadata { sealed class TableHeapBuffer : HeapBuffer { readonly ModuleDefinition module; readonly MetadataBuilder metadata; internal MetadataTable [] tables = new MetadataTable [45]; bool large_string; bool large_blob; readonly int [] coded_index_sizes = new int [13]; readonly Func counter; public override bool IsEmpty { get { return false; } } public TableHeapBuffer (ModuleDefinition module, MetadataBuilder metadata) : base (24) { this.module = module; this.metadata = metadata; this.counter = GetTableLength; } int GetTableLength (Table table) { var md_table = tables [(int) table]; return md_table != null ? md_table.Length : 0; } public TTable GetTable (Table table) where TTable : MetadataTable, new () { var md_table = (TTable) tables [(int) table]; if (md_table != null) return md_table; md_table = new TTable (); tables [(int) table] = md_table; return md_table; } public void WriteBySize (uint value, int size) { if (size == 4) WriteUInt32 (value); else WriteUInt16 ((ushort) value); } public void WriteBySize (uint value, bool large) { if (large) WriteUInt32 (value); else WriteUInt16 ((ushort) value); } public void WriteString (uint @string) { WriteBySize (@string, large_string); } public void WriteBlob (uint blob) { WriteBySize (blob, large_blob); } public void WriteRID (uint rid, Table table) { var md_table = tables [(int) table]; WriteBySize (rid, md_table == null ? false : md_table.IsLarge); } int GetCodedIndexSize (CodedIndex coded_index) { var index = (int) coded_index; var size = coded_index_sizes [index]; if (size != 0) return size; return coded_index_sizes [index] = coded_index.GetSize (counter); } public void WriteCodedRID (uint rid, CodedIndex coded_index) { WriteBySize (rid, GetCodedIndexSize (coded_index)); } public void WriteTableHeap () { WriteUInt32 (0); // Reserved WriteByte (GetTableHeapVersion ()); // MajorVersion WriteByte (0); // MinorVersion WriteByte (GetHeapSizes ()); // HeapSizes WriteByte (10); // Reserved2 WriteUInt64 (GetValid ()); // Valid WriteUInt64 (0x0016003301fa00); // Sorted WriteRowCount (); WriteTables (); } void WriteRowCount () { for (int i = 0; i < tables.Length; i++) { var table = tables [i]; if (table == null || table.Length == 0) continue; WriteUInt32 ((uint) table.Length); } } void WriteTables () { for (int i = 0; i < tables.Length; i++) { var table = tables [i]; if (table == null || table.Length == 0) continue; table.Write (this); } } ulong GetValid () { ulong valid = 0; for (int i = 0; i < tables.Length; i++) { var table = tables [i]; if (table == null || table.Length == 0) continue; table.Sort (); valid |= (1UL << i); } return valid; } byte GetHeapSizes () { byte heap_sizes = 0; if (metadata.string_heap.IsLarge) { large_string = true; heap_sizes |= 0x01; } if (metadata.blob_heap.IsLarge) { large_blob = true; heap_sizes |= 0x04; } return heap_sizes; } byte GetTableHeapVersion () { switch (module.Runtime) { case TargetRuntime.Net_1_0: case TargetRuntime.Net_1_1: return 1; default: return 2; } } public void FixupData (RVA data_rva) { var table = GetTable (Table.FieldRVA); if (table.length == 0) return; var field_idx_size = GetTable (Table.Field).IsLarge ? 4 : 2; var previous = this.position; base.position = table.position; for (int i = 0; i < table.length; i++) { var rva = ReadUInt32 (); base.position -= 4; WriteUInt32 (rva + data_rva); base.position += field_idx_size; } base.position = previous; } } sealed class ResourceBuffer : ByteBuffer { public ResourceBuffer () : base (0) { } public uint AddResource (byte [] resource) { var offset = (uint) this.position; WriteInt32 (resource.Length); WriteBytes (resource); return offset; } } sealed class DataBuffer : ByteBuffer { public DataBuffer () : base (0) { } public RVA AddData (byte [] data) { var rva = (RVA) position; WriteBytes (data); return rva; } } abstract class HeapBuffer : ByteBuffer { public bool IsLarge { get { return base.length > 65536; } } public abstract bool IsEmpty { get; } protected HeapBuffer (int length) : base (length) { } } class StringHeapBuffer : HeapBuffer { readonly Dictionary strings = new Dictionary (); public sealed override bool IsEmpty { get { return length <= 1; } } public StringHeapBuffer () : base (1) { WriteByte (0); } public uint GetStringIndex (string @string) { uint index; if (strings.TryGetValue (@string, out index)) return index; index = (uint) base.position; WriteString (@string); strings.Add (@string, index); return index; } protected virtual void WriteString (string @string) { WriteBytes (Encoding.UTF8.GetBytes (@string)); WriteByte (0); } } sealed class BlobHeapBuffer : HeapBuffer { readonly Dictionary blobs = new Dictionary (new ByteBufferEqualityComparer ()); public override bool IsEmpty { get { return length <= 1; } } public BlobHeapBuffer () : base (1) { WriteByte (0); } public uint GetBlobIndex (ByteBuffer blob) { uint index; if (blobs.TryGetValue (blob, out index)) return index; index = (uint) base.position; WriteBlob (blob); blobs.Add (blob, index); return index; } void WriteBlob (ByteBuffer blob) { WriteCompressedUInt32 ((uint) blob.length); WriteBytes (blob); } } sealed class UserStringHeapBuffer : StringHeapBuffer { protected override void WriteString (string @string) { WriteCompressedUInt32 ((uint) @string.Length * 2 + 1); byte special = 0; for (int i = 0; i < @string.Length; i++) { var @char = @string [i]; WriteUInt16 (@char); if (special == 1) continue; if (@char < 0x20 || @char > 0x7e) { if (@char > 0x7e || (@char >= 0x01 && @char <= 0x08) || (@char >= 0x0e && @char <= 0x1f) || @char == 0x27 || @char == 0x2d) { special = 1; } } } WriteByte (special); } } } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/Utilities.cs0000664000175000017500000003262512136523632032511 0ustar00directhexdirecthex00000000000000// // Utilities.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.Metadata; namespace Mono.Cecil { static partial class Mixin { public static uint ReadCompressedUInt32 (this byte [] data, ref int position) { uint integer; if ((data [position] & 0x80) == 0) { integer = data [position]; position++; } else if ((data [position] & 0x40) == 0) { integer = (uint) (data [position] & ~0x80) << 8; integer |= data [position + 1]; position += 2; } else { integer = (uint) (data [position] & ~0xc0) << 24; integer |= (uint) data [position + 1] << 16; integer |= (uint) data [position + 2] << 8; integer |= (uint) data [position + 3]; position += 4; } return integer; } public static MetadataToken GetMetadataToken (this CodedIndex self, uint data) { uint rid; TokenType token_type; switch (self) { case CodedIndex.TypeDefOrRef: rid = data >> 2; switch (data & 3) { case 0: token_type = TokenType.TypeDef; goto ret; case 1: token_type = TokenType.TypeRef; goto ret; case 2: token_type = TokenType.TypeSpec; goto ret; default: goto exit; } case CodedIndex.HasConstant: rid = data >> 2; switch (data & 3) { case 0: token_type = TokenType.Field; goto ret; case 1: token_type = TokenType.Param; goto ret; case 2: token_type = TokenType.Property; goto ret; default: goto exit; } case CodedIndex.HasCustomAttribute: rid = data >> 5; switch (data & 31) { case 0: token_type = TokenType.Method; goto ret; case 1: token_type = TokenType.Field; goto ret; case 2: token_type = TokenType.TypeRef; goto ret; case 3: token_type = TokenType.TypeDef; goto ret; case 4: token_type = TokenType.Param; goto ret; case 5: token_type = TokenType.InterfaceImpl; goto ret; case 6: token_type = TokenType.MemberRef; goto ret; case 7: token_type = TokenType.Module; goto ret; case 8: token_type = TokenType.Permission; goto ret; case 9: token_type = TokenType.Property; goto ret; case 10: token_type = TokenType.Event; goto ret; case 11: token_type = TokenType.Signature; goto ret; case 12: token_type = TokenType.ModuleRef; goto ret; case 13: token_type = TokenType.TypeSpec; goto ret; case 14: token_type = TokenType.Assembly; goto ret; case 15: token_type = TokenType.AssemblyRef; goto ret; case 16: token_type = TokenType.File; goto ret; case 17: token_type = TokenType.ExportedType; goto ret; case 18: token_type = TokenType.ManifestResource; goto ret; case 19: token_type = TokenType.GenericParam; goto ret; default: goto exit; } case CodedIndex.HasFieldMarshal: rid = data >> 1; switch (data & 1) { case 0: token_type = TokenType.Field; goto ret; case 1: token_type = TokenType.Param; goto ret; default: goto exit; } case CodedIndex.HasDeclSecurity: rid = data >> 2; switch (data & 3) { case 0: token_type = TokenType.TypeDef; goto ret; case 1: token_type = TokenType.Method; goto ret; case 2: token_type = TokenType.Assembly; goto ret; default: goto exit; } case CodedIndex.MemberRefParent: rid = data >> 3; switch (data & 7) { case 0: token_type = TokenType.TypeDef; goto ret; case 1: token_type = TokenType.TypeRef; goto ret; case 2: token_type = TokenType.ModuleRef; goto ret; case 3: token_type = TokenType.Method; goto ret; case 4: token_type = TokenType.TypeSpec; goto ret; default: goto exit; } case CodedIndex.HasSemantics: rid = data >> 1; switch (data & 1) { case 0: token_type = TokenType.Event; goto ret; case 1: token_type = TokenType.Property; goto ret; default: goto exit; } case CodedIndex.MethodDefOrRef: rid = data >> 1; switch (data & 1) { case 0: token_type = TokenType.Method; goto ret; case 1: token_type = TokenType.MemberRef; goto ret; default: goto exit; } case CodedIndex.MemberForwarded: rid = data >> 1; switch (data & 1) { case 0: token_type = TokenType.Field; goto ret; case 1: token_type = TokenType.Method; goto ret; default: goto exit; } case CodedIndex.Implementation: rid = data >> 2; switch (data & 3) { case 0: token_type = TokenType.File; goto ret; case 1: token_type = TokenType.AssemblyRef; goto ret; case 2: token_type = TokenType.ExportedType; goto ret; default: goto exit; } case CodedIndex.CustomAttributeType: rid = data >> 3; switch (data & 7) { case 2: token_type = TokenType.Method; goto ret; case 3: token_type = TokenType.MemberRef; goto ret; default: goto exit; } case CodedIndex.ResolutionScope: rid = data >> 2; switch (data & 3) { case 0: token_type = TokenType.Module; goto ret; case 1: token_type = TokenType.ModuleRef; goto ret; case 2: token_type = TokenType.AssemblyRef; goto ret; case 3: token_type = TokenType.TypeRef; goto ret; default: goto exit; } case CodedIndex.TypeOrMethodDef: rid = data >> 1; switch (data & 1) { case 0: token_type = TokenType.TypeDef; goto ret; case 1: token_type = TokenType.Method; goto ret; default: goto exit; } default: goto exit; } ret: return new MetadataToken (token_type, rid); exit: return MetadataToken.Zero; } #if !READ_ONLY public static uint CompressMetadataToken (this CodedIndex self, MetadataToken token) { uint ret = 0; if (token.RID == 0) return ret; switch (self) { case CodedIndex.TypeDefOrRef: ret = token.RID << 2; switch (token.TokenType) { case TokenType.TypeDef: return ret | 0; case TokenType.TypeRef: return ret | 1; case TokenType.TypeSpec: return ret | 2; default: goto exit; } case CodedIndex.HasConstant: ret = token.RID << 2; switch (token.TokenType) { case TokenType.Field: return ret | 0; case TokenType.Param: return ret | 1; case TokenType.Property: return ret | 2; default: goto exit; } case CodedIndex.HasCustomAttribute: ret = token.RID << 5; switch (token.TokenType) { case TokenType.Method: return ret | 0; case TokenType.Field: return ret | 1; case TokenType.TypeRef: return ret | 2; case TokenType.TypeDef: return ret | 3; case TokenType.Param: return ret | 4; case TokenType.InterfaceImpl: return ret | 5; case TokenType.MemberRef: return ret | 6; case TokenType.Module: return ret | 7; case TokenType.Permission: return ret | 8; case TokenType.Property: return ret | 9; case TokenType.Event: return ret | 10; case TokenType.Signature: return ret | 11; case TokenType.ModuleRef: return ret | 12; case TokenType.TypeSpec: return ret | 13; case TokenType.Assembly: return ret | 14; case TokenType.AssemblyRef: return ret | 15; case TokenType.File: return ret | 16; case TokenType.ExportedType: return ret | 17; case TokenType.ManifestResource: return ret | 18; case TokenType.GenericParam: return ret | 19; default: goto exit; } case CodedIndex.HasFieldMarshal: ret = token.RID << 1; switch (token.TokenType) { case TokenType.Field: return ret | 0; case TokenType.Param: return ret | 1; default: goto exit; } case CodedIndex.HasDeclSecurity: ret = token.RID << 2; switch (token.TokenType) { case TokenType.TypeDef: return ret | 0; case TokenType.Method: return ret | 1; case TokenType.Assembly: return ret | 2; default: goto exit; } case CodedIndex.MemberRefParent: ret = token.RID << 3; switch (token.TokenType) { case TokenType.TypeDef: return ret | 0; case TokenType.TypeRef: return ret | 1; case TokenType.ModuleRef: return ret | 2; case TokenType.Method: return ret | 3; case TokenType.TypeSpec: return ret | 4; default: goto exit; } case CodedIndex.HasSemantics: ret = token.RID << 1; switch (token.TokenType) { case TokenType.Event: return ret | 0; case TokenType.Property: return ret | 1; default: goto exit; } case CodedIndex.MethodDefOrRef: ret = token.RID << 1; switch (token.TokenType) { case TokenType.Method: return ret | 0; case TokenType.MemberRef: return ret | 1; default: goto exit; } case CodedIndex.MemberForwarded: ret = token.RID << 1; switch (token.TokenType) { case TokenType.Field: return ret | 0; case TokenType.Method: return ret | 1; default: goto exit; } case CodedIndex.Implementation: ret = token.RID << 2; switch (token.TokenType) { case TokenType.File: return ret | 0; case TokenType.AssemblyRef: return ret | 1; case TokenType.ExportedType: return ret | 2; default: goto exit; } case CodedIndex.CustomAttributeType: ret = token.RID << 3; switch (token.TokenType) { case TokenType.Method: return ret | 2; case TokenType.MemberRef: return ret | 3; default: goto exit; } case CodedIndex.ResolutionScope: ret = token.RID << 2; switch (token.TokenType) { case TokenType.Module: return ret | 0; case TokenType.ModuleRef: return ret | 1; case TokenType.AssemblyRef: return ret | 2; case TokenType.TypeRef: return ret | 3; default: goto exit; } case CodedIndex.TypeOrMethodDef: ret = token.RID << 1; switch (token.TokenType) { case TokenType.TypeDef: return ret | 0; case TokenType.Method: return ret | 1; default: goto exit; } default: goto exit; } exit: throw new ArgumentException (); } #endif public static int GetSize (this CodedIndex self, Func counter) { int bits; Table [] tables; switch (self) { case CodedIndex.TypeDefOrRef: bits = 2; tables = new [] { Table.TypeDef, Table.TypeRef, Table.TypeSpec }; break; case CodedIndex.HasConstant: bits = 2; tables = new [] { Table.Field, Table.Param, Table.Property }; break; case CodedIndex.HasCustomAttribute: bits = 5; tables = new [] { Table.Method, Table.Field, Table.TypeRef, Table.TypeDef, Table.Param, Table.InterfaceImpl, Table.MemberRef, Table.Module, Table.DeclSecurity, Table.Property, Table.Event, Table.StandAloneSig, Table.ModuleRef, Table.TypeSpec, Table.Assembly, Table.AssemblyRef, Table.File, Table.ExportedType, Table.ManifestResource, Table.GenericParam }; break; case CodedIndex.HasFieldMarshal: bits = 1; tables = new [] { Table.Field, Table.Param }; break; case CodedIndex.HasDeclSecurity: bits = 2; tables = new [] { Table.TypeDef, Table.Method, Table.Assembly }; break; case CodedIndex.MemberRefParent: bits = 3; tables = new [] { Table.TypeDef, Table.TypeRef, Table.ModuleRef, Table.Method, Table.TypeSpec }; break; case CodedIndex.HasSemantics: bits = 1; tables = new [] { Table.Event, Table.Property }; break; case CodedIndex.MethodDefOrRef: bits = 1; tables = new [] { Table.Method, Table.MemberRef }; break; case CodedIndex.MemberForwarded: bits = 1; tables = new [] { Table.Field, Table.Method }; break; case CodedIndex.Implementation: bits = 2; tables = new [] { Table.File, Table.AssemblyRef, Table.ExportedType }; break; case CodedIndex.CustomAttributeType: bits = 3; tables = new [] { Table.Method, Table.MemberRef }; break; case CodedIndex.ResolutionScope: bits = 2; tables = new [] { Table.Module, Table.ModuleRef, Table.AssemblyRef, Table.TypeRef }; break; case CodedIndex.TypeOrMethodDef: bits = 1; tables = new [] { Table.TypeDef, Table.Method }; break; default: throw new ArgumentException (); } int max = 0; for (int i = 0; i < tables.Length; i++) { max = System.Math.Max (counter (tables [i]), max); } return max < (1 << (16 - bits)) ? 2 : 4; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/StringHeap.cs0000664000175000017500000000417412136523632032600 0ustar00directhexdirecthex00000000000000// // StringHeap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.Text; using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { class StringHeap : Heap { readonly Dictionary strings = new Dictionary (); public StringHeap (Section section, uint start, uint size) : base (section, start, size) { } public string Read (uint index) { if (index == 0) return string.Empty; string @string; if (strings.TryGetValue (index, out @string)) return @string; if (index > Size - 1) return string.Empty; @string = ReadStringAt (index); if (@string.Length != 0) strings.Add (index, @string); return @string; } protected virtual string ReadStringAt (uint index) { int length = 0; byte [] data = Section.Data; int start = (int) (index + Offset); for (int i = start; ; i++) { if (data [i] == 0) break; length++; } return Encoding.UTF8.GetString (data, start, length); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/Row.cs0000664000175000017500000000744212136523632031304 0ustar00directhexdirecthex00000000000000// // Row.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System.Collections.Generic; namespace Mono.Cecil.Metadata { struct Row { internal T1 Col1; internal T2 Col2; public Row (T1 col1, T2 col2) { Col1 = col1; Col2 = col2; } } struct Row { internal T1 Col1; internal T2 Col2; internal T3 Col3; public Row (T1 col1, T2 col2, T3 col3) { Col1 = col1; Col2 = col2; Col3 = col3; } } struct Row { internal T1 Col1; internal T2 Col2; internal T3 Col3; internal T4 Col4; public Row (T1 col1, T2 col2, T3 col3, T4 col4) { Col1 = col1; Col2 = col2; Col3 = col3; Col4 = col4; } } struct Row { internal T1 Col1; internal T2 Col2; internal T3 Col3; internal T4 Col4; internal T5 Col5; public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5) { Col1 = col1; Col2 = col2; Col3 = col3; Col4 = col4; Col5 = col5; } } struct Row { internal T1 Col1; internal T2 Col2; internal T3 Col3; internal T4 Col4; internal T5 Col5; internal T6 Col6; public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6) { Col1 = col1; Col2 = col2; Col3 = col3; Col4 = col4; Col5 = col5; Col6 = col6; } } struct Row { internal T1 Col1; internal T2 Col2; internal T3 Col3; internal T4 Col4; internal T5 Col5; internal T6 Col6; internal T7 Col7; internal T8 Col8; internal T9 Col9; public Row (T1 col1, T2 col2, T3 col3, T4 col4, T5 col5, T6 col6, T7 col7, T8 col8, T9 col9) { Col1 = col1; Col2 = col2; Col3 = col3; Col4 = col4; Col5 = col5; Col6 = col6; Col7 = col7; Col8 = col8; Col9 = col9; } } sealed class RowEqualityComparer : IEqualityComparer>, IEqualityComparer>, IEqualityComparer> { public bool Equals (Row x, Row y) { return x.Col1 == y.Col1 && x.Col2 == y.Col2; } public int GetHashCode (Row obj) { string x = obj.Col1, y = obj.Col2; return (x != null ? x.GetHashCode () : 0) ^ (y != null ? y.GetHashCode () : 0); } public bool Equals (Row x, Row y) { return x.Col1 == y.Col1 && x.Col2 == y.Col2; } public int GetHashCode (Row obj) { return (int) (obj.Col1 ^ obj.Col2); } public bool Equals (Row x, Row y) { return x.Col1 == y.Col1 && x.Col2 == y.Col2 && x.Col3 == y.Col3; } public int GetHashCode (Row obj) { return (int) (obj.Col1 ^ obj.Col2 ^ obj.Col3); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/GuidHeap.cs0000664000175000017500000000321512136523632032215 0ustar00directhexdirecthex00000000000000// // GuidHeap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { sealed class GuidHeap : Heap { public GuidHeap (Section section, uint start, uint size) : base (section, start, size) { } public Guid Read (uint index) { if (index == 0) return new Guid (); const int guid_size = 16; var buffer = new byte [guid_size]; index--; Buffer.BlockCopy (Section.Data, (int) (Offset + index), buffer, 0, guid_size); return new Guid (buffer); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/MetadataToken.cs0000664000175000017500000000475112136523632033256 0ustar00directhexdirecthex00000000000000// // MetadataToken.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public struct MetadataToken { readonly uint token; public uint RID { get { return token & 0x00ffffff; } } public TokenType TokenType { get { return (TokenType) (token & 0xff000000); } } public static readonly MetadataToken Zero = new MetadataToken ((uint) 0); public MetadataToken (uint token) { this.token = token; } public MetadataToken (TokenType type) : this (type, 0) { } public MetadataToken (TokenType type, uint rid) { token = (uint) type | rid; } public MetadataToken (TokenType type, int rid) { token = (uint) type | (uint) rid; } public int ToInt32 () { return (int) token; } public uint ToUInt32 () { return token; } public override int GetHashCode () { return (int) token; } public override bool Equals (object obj) { if (obj is MetadataToken) { var other = (MetadataToken) obj; return other.token == token; } return false; } public static bool operator == (MetadataToken one, MetadataToken other) { return one.token == other.token; } public static bool operator != (MetadataToken one, MetadataToken other) { return one.token != other.token; } public override string ToString () { return string.Format ("[{0}:0x{1}]", TokenType, RID.ToString ("x4")); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/TokenType.cs0000664000175000017500000000346312136523632032456 0ustar00directhexdirecthex00000000000000// // TokenType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil { public enum TokenType : uint { Module = 0x00000000, TypeRef = 0x01000000, TypeDef = 0x02000000, Field = 0x04000000, Method = 0x06000000, Param = 0x08000000, InterfaceImpl = 0x09000000, MemberRef = 0x0a000000, CustomAttribute = 0x0c000000, Permission = 0x0e000000, Signature = 0x11000000, Event = 0x14000000, Property = 0x17000000, ModuleRef = 0x1a000000, TypeSpec = 0x1b000000, Assembly = 0x20000000, AssemblyRef = 0x23000000, File = 0x26000000, ExportedType = 0x27000000, ManifestResource = 0x28000000, GenericParam = 0x2a000000, MethodSpec = 0x2b000000, String = 0x70000000, } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/ElementType.cs0000664000175000017500000000512712136523632032766 0ustar00directhexdirecthex00000000000000// // ElementType.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Metadata { enum ElementType : byte { None = 0x00, Void = 0x01, Boolean = 0x02, Char = 0x03, I1 = 0x04, U1 = 0x05, I2 = 0x06, U2 = 0x07, I4 = 0x08, U4 = 0x09, I8 = 0x0a, U8 = 0x0b, R4 = 0x0c, R8 = 0x0d, String = 0x0e, Ptr = 0x0f, // Followed by token ByRef = 0x10, // Followed by token ValueType = 0x11, // Followed by token Class = 0x12, // Followed by token Var = 0x13, // Followed by generic parameter number Array = 0x14, // GenericInst = 0x15, // ... */ TypedByRef = 0x16, I = 0x18, // System.IntPtr U = 0x19, // System.UIntPtr FnPtr = 0x1b, // Followed by full method signature Object = 0x1c, // System.Object SzArray = 0x1d, // Single-dim array with 0 lower bound MVar = 0x1e, // Followed by generic parameter number CModReqD = 0x1f, // Required modifier : followed by a TypeDef or TypeRef token CModOpt = 0x20, // Optional modifier : followed by a TypeDef or TypeRef token Internal = 0x21, // Implemented within the CLI Modifier = 0x40, // Or'd with following element types Sentinel = 0x41, // Sentinel for varargs method signature Pinned = 0x45, // Denotes a local variable that points at a pinned object // special undocumented constants Type = 0x50, Boxed = 0x51, Enum = 0x55 } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/Heap.cs0000664000175000017500000000277212136523632031413 0ustar00directhexdirecthex00000000000000// // Heap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { abstract class Heap { public int IndexSize; public readonly Section Section; public readonly uint Offset; public readonly uint Size; protected Heap (Section section, uint offset, uint size) { this.Section = section; this.Offset = offset; this.Size = size; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/UserStringHeap.cs0000664000175000017500000000350212136523632033431 0ustar00directhexdirecthex00000000000000// // UserStringHeap.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Mono.Cecil.PE; namespace Mono.Cecil.Metadata { sealed class UserStringHeap : StringHeap { public UserStringHeap (Section section, uint start, uint size) : base (section, start, size) { } protected override string ReadStringAt (uint index) { byte [] data = Section.Data; int start = (int) (index + Offset); uint length = (uint) (data.ReadCompressedUInt32 (ref start) & ~1); if (length < 1) return string.Empty; var chars = new char [length / 2]; for (int i = start, j = 0; i < start + length; i += 2) chars [j++] = (char) (data [i] | (data [i + 1] << 8)); return new string (chars); } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.Metadata/CodedIndex.cs0000664000175000017500000000272112136523632032536 0ustar00directhexdirecthex00000000000000// // CodedIndex.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // namespace Mono.Cecil.Metadata { enum CodedIndex { TypeDefOrRef, HasConstant, HasCustomAttribute, HasFieldMarshal, HasDeclSecurity, MemberRefParent, HasSemantics, MethodDefOrRef, MemberForwarded, Implementation, CustomAttributeType, ResolutionScope, TypeOrMethodDef } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono/0000775000175000017500000000000012136524043025437 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono/Funcs.cs0000664000175000017500000000300712136523632027047 0ustar00directhexdirecthex00000000000000// // Funcs.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #if !NET_3_5 && !NET_4_0 namespace Mono { delegate TResult Func (); delegate TResult Func (T arg1); delegate TResult Func (T1 arg1, T2 arg2); //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3); //delegate TResult Func (T1 arg1, T2 arg2, T3 arg3, T4 arg4); } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono/Actions.cs0000664000175000017500000000267012136523632027376 0ustar00directhexdirecthex00000000000000// // Actions.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #if !NET_3_5 && !NET_4_0 namespace Mono { //delegate void Action (); //delegate void Action (T1 arg1, T2 arg2); //delegate void Action (T1 arg1, T2 arg2, T3 arg3); //delegate void Action (T1 arg1, T2 arg2, T3 arg3, T4 arg4); } #endif mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono/Empty.cs0000664000175000017500000000315412136523632027072 0ustar00directhexdirecthex00000000000000// // Empty.cs // // Author: // Jb Evain (jbevain@gmail.com) // // Copyright (c) 2008 - 2010 Jb Evain // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using System.Collections.Generic; namespace Mono { static class Empty { public static readonly T [] Array = new T [0]; } } namespace Mono.Cecil { static partial class Mixin { public static bool IsNullOrEmpty (this T [] self) { return self == null || self.Length == 0; } public static bool IsNullOrEmpty (this ICollection self) { return self == null || self.Count == 0; } } } mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/Mono.Cecil.csproj0000664000175000017500000002241012136523632027701 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 9.0.30729 2.0 {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Library Properties Mono.Cecil Mono.Cecil v2.0 512 true mono.snk true full false bin\Debug\ DEBUG;TRACE prompt 4 AllRules.ruleset pdbonly true bin\Release\ TRACE prompt 4 AllRules.ruleset mono-addins-1.0/Mono.Addins.CecilReflector/Mono.Cecil/NOTES.txt0000664000175000017500000000732512136523632026172 0ustar00directhexdirecthex00000000000000namespaces: Mono.Cecil.Binary: deleted, Mono.Cecil.Metadata: metadata table/rows: deleted. collections: * Cecil now only exposes Collection of T as a public collection API. types: Mono.Cecil - AssemblyFactory: Use static Read methods on ModuleDefinition and AssemblyDefinition to get them. + ReadingMode: specifies if the assembly is either loaded in a deffered or immediate fashion. + ReaderParameters + ReadingMode + ISymbolReaderProvider + WriterParameters + ISymbolWriterProvider * AssemblyDefinition: * Runtime, Kind: moved to ModuleDefiniton * ModuleDefinition: properties: - Image - MemberReferences - TypeReferences - ExternTypes * Main -> IsMain. (set removed) : bool + FullyQualifiedName : string + Kind : ModuleKind + Runtime : TargetRuntime + Architecture : TargetArchitecture + Attributes : ModuleAttributes + HasSymbols : bool + HasExportedTypes : bool + ExportedTypes : ExportedTypeCollection * Types: doesn't contain NestedTypes anymore. - AssemblyKind: renamed to ModuleKind. + ModuleKind: + NetModule + TargetArchitecture: + I386 + AMD64 + IA64 + ModuleAttributes: + ILOnly + Required32Bit + StrongNameSigned * FieldDefinition: * RVA : int * IMethodSignature: * ReturnType : TypeReference + MethodReturnType : MethodReturnType * TypeDefinition: - HasConstructors - Constructors * ctor: swapped namespace and name parameter. * ParameterDefinition: * Method : IMethodSignature * Sequence -> Index : int (0 based instead of 1) * ArrayType: * IsSizedArray -> IsVector : bool * IHasConstant -> IConstantProvider * IHasSecurity -> ISecurityDeclarationProvider * IHasMarshal -> IMarshalInfoProvider * MemberReference + Module : ModuleDefinition * MethodDefinition: - This: moved to MethodBody + HasPInvokeInfo : bool * PInvokeInfo: - Method * MarshalSpec -> MarshalInfo - ModType * ModifierRequiredType -> RequiredModifierType * ModifierOptionalType -> OptionalModifierType * ReferenceType -> ByReferenceType * TypeReference + IsArray : bool + IsPointer : bool + IsByReference : bool + IsRequiredModifier : bool + IsOptionalModifier : bool + IsSentinel : bool + IsGenericInstance : bool + IsGenericParameter : bool + IsPinned : bool + IsFunctionPointer : bool + IsDefinition : bool * GetOriginalType -> GetElementType * ctor: swapped namespace and name parameter. * MethodReference + IsGenericInstance : bool + IsDefinition : bool * GetOriginalMethod -> GetElementMethod * FieldReference + IsDefinition : bool + CustomAttributeArgument + Type : TypeReference + Value : object * CustomAttribute * ConstructorParameters -> ConstructorArguments : CustomAttributeArgumentCollection * Properties : CustomAttributeNamedArgumentCollection * Fields : CustomAttributeNamedArgumentCollection * SecurityDeclaration - PermissionSet + SecurityAttributes : SecurityAttributeCollection + SecurityAttribute + AttributeType : TypeReference + Fields : CustomAttributeNamedArgumentCollection + Properties : CustomAttributeNamedArgumentCollection * IMetadataScope + MetadataScopeType + MetadataScopeType + AssemblyNameReference + ModuleDefinition + ModuleReference Mono.Cecil.Cil: * ExceptionHandler * Type -> HandlerType : TypeReference * VariableDefinition - Method * Document* : from Guid to enums, the reader/writers are responsible for assigning them. * MethodBody * LocalVarToken : MetadataToken * MaxStack -> MaxStackSize : int + ThisParameter: from MethodDefinition * OperandType * ShortInlineParam : ShortInlineArg * InlineParam : InlineArg * CilWorker -> ILProcessor TODO: * Mono.Cecil.Rocks * ILGenerator * HOWTOs mono-addins-1.0/Mono.Addins.CecilReflector/policy.0.5.config0000664000175000017500000000056512136524026025577 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.CecilReflector/policy.0.3.config0000664000175000017500000000056512136524026025575 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.CecilReflector/obj/0000775000175000017500000000000012136524043023353 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/obj/Debug/0000775000175000017500000000000012136524043024401 5ustar00directhexdirecthex00000000000000Mono.Addins.CecilReflector.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000043212136524030037467 0ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.CecilReflector/obj/Debug/tmp/mono-addins/bin/Mono.Addins.CecilReflector.dll.mdb /tmp/mono-addins/bin/Mono.Addins.CecilReflector.dll /tmp/mono-addins/Mono.Addins.CecilReflector/obj/Debug/Mono.Addins.CecilReflector.dll /tmp/mono-addins/Mono.Addins.CecilReflector/obj/Debug/Mono.Addins.CecilReflector.dll.mdb mono-addins-1.0/Mono.Addins.CecilReflector/ChangeLog0000664000175000017500000000500412136523632024355 0ustar00directhexdirecthex000000000000002010-05-25 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Fix output directory for the Release configuration. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: When resolving custom attribute properties and fields look it base classes. 2010-05-20 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Added methods for getting resources from an assembly. 2010-03-30 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Make sure the solution builds on MS.NET 2.0. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Fix potential NRE. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Flush. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Implement GetRawCustomAttributes. 2009-09-01 Lluis Sanchez Gual * AssemblyInfo.cs: Bump Mono.Addins version. 2009-08-19 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Update target framework to 2.0. 2009-05-28 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Properly sign assemblies. 2009/02/06 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj: Updated. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-08-22 Lluis Sanchez Gual * Mono.Addins.CecilReflector.csproj, Mono.Addins.CecilReflector.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-07-30 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Properly convert attributes when found an attribute which is a subclass of the required type. Fixes a bug when requestion AddinAttribute, since AddinRootAttribute should be returned too. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Fix retrieval of inherited attributes. Fix code that get the list of base interfaces. 2008-02-15 Lluis Sanchez Gual * Mono.Addins.CecilReflector/Reflector.cs: Fix bug in GetCustomAttribute. 2008-02-06 Lluis Sanchez Gual * Makefile.am: Added makefile. mono-addins-1.0/Mono.Addins.CecilReflector/policy.0.6.config0000664000175000017500000000056512136524026025600 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.CecilReflector/policy.0.4.config0000664000175000017500000000056512136524026025576 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.CecilReflector/policy.0.2.config0000664000175000017500000000056512136524026025574 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/configure0000775000175000017500000037255012136523721017531 0ustar00directhexdirecthex00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for mono-addins 1.0. # # # Copyright (C) 1992-1996, 1998-2012 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. as_myself= 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 # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # 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. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} 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 test -x / || 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 : export CONFIG_SHELL # 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. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 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@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_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_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 STATUS 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=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&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; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # 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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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 as_test_x='test -x' as_executable_p=as_fn_executable_p # 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 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/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='mono-addins' PACKAGE_TARNAME='mono-addins' PACKAGE_VERSION='1.0' PACKAGE_STRING='mono-addins 1.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_subst_vars='LTLIBOBJS LIBOBJS MONO_ADDINS_MSBUILD_DEFAULT_LIB MONO_ADDINS_SETUP_DEFAULT_LIB MONO_ADDINS_GUI_DEFAULT_LIB MONO_ADDINS_DEFAULT_LIB MONODOC_LIBS MONODOC_CFLAGS MONO_NUNIT_LIBS MONO_NUNIT_CFLAGS GTK_SHARP_20_LIBS GTK_SHARP_20_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH ENABLE_DOCS_FALSE ENABLE_DOCS_TRUE ENABLE_TESTS_FALSE ENABLE_TESTS_TRUE ENABLE_GUI_FALSE ENABLE_GUI_TRUE GACUTIL_POLICY_FLAGS GACUTIL_FLAGS AL GACUTIL MCS POLICY_VERSIONS API_VERSION PKG_CONFIG MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE 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 enable_maintainer_mode enable_gui enable_tests enable_docs ' ac_precious_vars='build_alias host_alias target_alias PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR GTK_SHARP_20_CFLAGS GTK_SHARP_20_LIBS MONO_NUNIT_CFLAGS MONO_NUNIT_LIBS MONODOC_CFLAGS MONODOC_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= ;; *) 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 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 mono-addins 1.0 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/mono-addins] --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 mono-addins 1.0:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-gui enable support for GTK dependent libraries [default=yes] --enable-tests build unit tests [default=no] --enable-docs build documentation [default=no] Some influential environment variables: PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path 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_NUNIT_CFLAGS C compiler flags for MONO_NUNIT, overriding pkg-config MONO_NUNIT_LIBS linker flags for MONO_NUNIT, overriding pkg-config MONODOC_CFLAGS C compiler flags for MONODOC, overriding pkg-config MONODOC_LIBS linker flags for MONODOC, 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 mono-addins configure 1.0 generated by GNU Autoconf 2.69 Copyright (C) 2012 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 mono-addins $as_me 1.0, which was generated by GNU Autoconf 2.69. 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 $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" 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 $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" 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 $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" 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 $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" 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 # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac 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" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } 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 if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi 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 ${ac_cv_path_install+:} false; 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 as_fn_executable_p "$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 ${ac_cv_prog_STRIP+:} false; 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 as_fn_executable_p "$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 ${ac_cv_prog_ac_ct_STRIP+:} false; 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 as_fn_executable_p "$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 ${ac_cv_path_mkdir+:} false; 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 as_fn_executable_p "$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 ${ac_cv_prog_AWK+:} false; 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 as_fn_executable_p "$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 eval \${ac_cv_prog_make_${ac_make}_set+:} false; 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='mono-addins' VERSION='1.0' 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. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-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 &5 ($am__untar &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 ${am_cv_prog_tar_ustar+:} false; 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; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE # 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 ${ac_cv_path_PKG_CONFIG+:} false; 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 as_fn_executable_p "$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 API_VERSION=1.0.0.0 POLICY_VERSIONS="0.2 0.3 0.4 0.5 0.6" # Extract the first word of "gmcs", so it can be a program name with args. set dummy gmcs; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_MCS+:} false; then : $as_echo_n "(cached) " >&6 else case $MCS in [\\/]* | ?:[\\/]*) ac_cv_path_MCS="$MCS" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_MCS="$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_MCS" && ac_cv_path_MCS="no" ;; esac fi MCS=$ac_cv_path_MCS if test -n "$MCS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MCS" >&5 $as_echo "$MCS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$MCS" = "xno"; then as_fn_error $? "mcs Not found" "$LINENO" 5 fi # Extract the first word of "gacutil", so it can be a program name with args. set dummy gacutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GACUTIL+:} false; then : $as_echo_n "(cached) " >&6 else case $GACUTIL in [\\/]* | ?:[\\/]*) ac_cv_path_GACUTIL="$GACUTIL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_GACUTIL="$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_GACUTIL" && ac_cv_path_GACUTIL="no" ;; esac fi GACUTIL=$ac_cv_path_GACUTIL if test -n "$GACUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GACUTIL" >&5 $as_echo "$GACUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$GACUTIL" = "xno" ; then as_fn_error $? "No gacutil tool found" "$LINENO" 5 fi # Extract the first word of "al", so it can be a program name with args. set dummy al; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_AL+:} false; then : $as_echo_n "(cached) " >&6 else case $AL in [\\/]* | ?:[\\/]*) ac_cv_path_AL="$AL" # 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 as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_AL="$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_AL" && ac_cv_path_AL="no" ;; esac fi AL=$ac_cv_path_AL if test -n "$AL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AL" >&5 $as_echo "$AL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$AL" = "xno" ; then as_fn_error $? "No al tool found. You need to install either the mono or .Net SDK." "$LINENO" 5 fi GACUTIL_FLAGS='/package mono-addins /root $(DESTDIR)$(libdir)' GACUTIL_POLICY_FLAGS='/root $(DESTDIR)$(libdir)' # Check whether --enable-gui was given. if test "${enable_gui+set}" = set; then : enableval=$enable_gui; enable_gui=${enableval} else enable_gui=yes fi if test x$enable_gui = xyes; then ENABLE_GUI_TRUE= ENABLE_GUI_FALSE='#' else ENABLE_GUI_TRUE='#' ENABLE_GUI_FALSE= fi # Check whether --enable-tests was given. if test "${enable_tests+set}" = set; then : enableval=$enable_tests; enable_tests=${enableval} else enable_tests=no fi if test x$enable_tests = xyes; then ENABLE_TESTS_TRUE= ENABLE_TESTS_FALSE='#' else ENABLE_TESTS_TRUE='#' ENABLE_TESTS_FALSE= fi # Check whether --enable-docs was given. if test "${enable_docs+set}" = set; then : enableval=$enable_docs; enable_docs=${enableval} else enable_docs=no fi if test x$enable_docs = xyes; then ENABLE_DOCS_TRUE= ENABLE_DOCS_FALSE='#' else ENABLE_DOCS_TRUE='#' ENABLE_DOCS_FALSE= fi if test "x$enable_gui" = "xyes"; then 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 ${ac_cv_path_PKG_CONFIG+:} false; 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 as_fn_executable_p "$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 ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; 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 as_fn_executable_p "$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 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` test "x$?" != "x0" && pkg_failed=yes 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` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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 --cflags --libs "gtk-sharp-2.0" 2>&1` else GTK_SHARP_20_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "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}: result: no" >&5 $as_echo "no" >&6; } { { $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 . 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 fi if test "x$enable_tests" = "xyes"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MONO_NUNIT" >&5 $as_echo_n "checking for MONO_NUNIT... " >&6; } if test -n "$MONO_NUNIT_CFLAGS"; then pkg_cv_MONO_NUNIT_CFLAGS="$MONO_NUNIT_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-nunit\""; } >&5 ($PKG_CONFIG --exists --print-errors "mono-nunit") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_MONO_NUNIT_CFLAGS=`$PKG_CONFIG --cflags "mono-nunit" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$MONO_NUNIT_LIBS"; then pkg_cv_MONO_NUNIT_LIBS="$MONO_NUNIT_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-nunit\""; } >&5 ($PKG_CONFIG --exists --print-errors "mono-nunit") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_MONO_NUNIT_LIBS=`$PKG_CONFIG --libs "mono-nunit" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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_NUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "mono-nunit" 2>&1` else MONO_NUNIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "mono-nunit" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$MONO_NUNIT_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (mono-nunit) were not met: $MONO_NUNIT_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_NUNIT_CFLAGS and MONO_NUNIT_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}: result: no" >&5 $as_echo "no" >&6; } { { $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_NUNIT_CFLAGS and MONO_NUNIT_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else MONO_NUNIT_CFLAGS=$pkg_cv_MONO_NUNIT_CFLAGS MONO_NUNIT_LIBS=$pkg_cv_MONO_NUNIT_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi if test "x$enable_docs" = "xyes"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MONODOC" >&5 $as_echo_n "checking for MONODOC... " >&6; } if test -n "$MONODOC_CFLAGS"; then pkg_cv_MONODOC_CFLAGS="$MONODOC_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"monodoc\""; } >&5 ($PKG_CONFIG --exists --print-errors "monodoc") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_MONODOC_CFLAGS=`$PKG_CONFIG --cflags "monodoc" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$MONODOC_LIBS"; then pkg_cv_MONODOC_LIBS="$MONODOC_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"monodoc\""; } >&5 ($PKG_CONFIG --exists --print-errors "monodoc") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_MONODOC_LIBS=`$PKG_CONFIG --libs "monodoc" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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 MONODOC_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "monodoc" 2>&1` else MONODOC_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "monodoc" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$MONODOC_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (monodoc) were not met: $MONODOC_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 MONODOC_CFLAGS and MONODOC_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}: result: no" >&5 $as_echo "no" >&6; } { { $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 MONODOC_CFLAGS and MONODOC_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else MONODOC_CFLAGS=$pkg_cv_MONODOC_CFLAGS MONODOC_LIBS=$pkg_cv_MONODOC_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi MONO_ADDINS_DEFAULT_LIB='Mono.Addins.dll' MONO_ADDINS_SETUP_DEFAULT_LIB='Mono.Addins.Setup.dll' MONO_ADDINS_GUI_DEFAULT_LIB='Mono.Addins.Gui.dll' MONO_ADDINS_MSBUILD_DEFAULT_LIB='Mono.Addins.MSBuild.dll' ac_config_files="$ac_config_files ./mono-addins.spec ./Mono.Addins/mono-addins.pc ./Mono.Addins.Gui/mono-addins-gui.pc ./Mono.Addins.Setup/mono-addins-setup.pc ./Mono.Addins.MSBuild/mono-addins-msbuild.pc ./Makefile ./policy.config ./Mono.Addins.Gui/Makefile ./Mono.Addins.Setup/Makefile ./Mono.Addins/Makefile ./Mono.Addins.CecilReflector/Makefile ./Mono.Addins.MSBuild/Makefile ./mautil/Makefile ./mautil/mautil ./docs/Makefile ./Test/HelloWorldExtension/Makefile ./Test/FileContentExtension/Makefile ./Test/UnitTests/Makefile ./Test/CommandExtension/Makefile ./Test/SystemInfoExtension/Makefile ./Test/FileExtender/Makefile ./Test/Makefile" 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 if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi 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= U= 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 if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_GUI_TRUE}" && test -z "${ENABLE_GUI_FALSE}"; then as_fn_error $? "conditional \"ENABLE_GUI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_TESTS_TRUE}" && test -z "${ENABLE_TESTS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_TESTS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${ENABLE_DOCS_TRUE}" && test -z "${ENABLE_DOCS_FALSE}"; then as_fn_error $? "conditional \"ENABLE_DOCS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${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. as_myself= 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 STATUS 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=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&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 -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' 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 # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # 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 mono-addins $as_me 1.0, which was generated by GNU Autoconf 2.69. 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="\\ mono-addins config.status 1.0 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 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=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= 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"` ;; '') as_fn_error $? "missing file argument" ;; 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 "./mono-addins.spec") CONFIG_FILES="$CONFIG_FILES ./mono-addins.spec" ;; "./Mono.Addins/mono-addins.pc") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins/mono-addins.pc" ;; "./Mono.Addins.Gui/mono-addins-gui.pc") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.Gui/mono-addins-gui.pc" ;; "./Mono.Addins.Setup/mono-addins-setup.pc") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.Setup/mono-addins-setup.pc" ;; "./Mono.Addins.MSBuild/mono-addins-msbuild.pc") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.MSBuild/mono-addins-msbuild.pc" ;; "./Makefile") CONFIG_FILES="$CONFIG_FILES ./Makefile" ;; "./policy.config") CONFIG_FILES="$CONFIG_FILES ./policy.config" ;; "./Mono.Addins.Gui/Makefile") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.Gui/Makefile" ;; "./Mono.Addins.Setup/Makefile") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.Setup/Makefile" ;; "./Mono.Addins/Makefile") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins/Makefile" ;; "./Mono.Addins.CecilReflector/Makefile") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.CecilReflector/Makefile" ;; "./Mono.Addins.MSBuild/Makefile") CONFIG_FILES="$CONFIG_FILES ./Mono.Addins.MSBuild/Makefile" ;; "./mautil/Makefile") CONFIG_FILES="$CONFIG_FILES ./mautil/Makefile" ;; "./mautil/mautil") CONFIG_FILES="$CONFIG_FILES ./mautil/mautil" ;; "./docs/Makefile") CONFIG_FILES="$CONFIG_FILES ./docs/Makefile" ;; "./Test/HelloWorldExtension/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/HelloWorldExtension/Makefile" ;; "./Test/FileContentExtension/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/FileContentExtension/Makefile" ;; "./Test/UnitTests/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/UnitTests/Makefile" ;; "./Test/CommandExtension/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/CommandExtension/Makefile" ;; "./Test/SystemInfoExtension/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/SystemInfoExtension/Makefile" ;; "./Test/FileExtender/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/FileExtender/Makefile" ;; "./Test/Makefile") CONFIG_FILES="$CONFIG_FILES ./Test/Makefile" ;; *) 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= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_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 -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # 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` 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 {' >"$ac_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 >>"\$ac_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 ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_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 < "$ac_tmp/subs1.awk" > "$ac_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 sole $(srcdir), # ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// 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="$ac_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 1 "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 >"$ac_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 "$ac_tmp/subs.awk" \ >$ac_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' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_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 "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_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 1 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 echo "" echo "Configuration summary" echo "" echo " * Installation prefix = $prefix" echo " * gui support: $enable_gui" echo " * unit tests: $enable_tests" echo " * documentation: $enable_docs" echo "" mono-addins-1.0/mono-addins.snk0000664000175000017500000000112412136523632020532 0ustar00directhexdirecthex00000000000000$RSA2y™wÒÐ:Žkêz.tèѯ̓è…t•+´€¡,‘4GM$GÃ~hÀ€SoÏNF^úÙÕ—.öžŸm6pª—/³ ±‰MŒñH‹Ö±/·F_I÷ ûµ.dËÄ/^d%F+øŠŠ¥±øŒ=Q¡Ð¢YåÚ_êz³®œÏ{õ i¬sÿ9­~À \¿@9Oñ©Ïmono-addins-1.0/missing0000755000175000017500000002415212026454250017205 0ustar00directhexdirecthex00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2012-01-06.13; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 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 . # 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 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 ." 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. ;; *) 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 ;; *) 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: mono-addins-1.0/Mono.Addins.sln0000664000175000017500000003732112136523632020444 0ustar00directhexdirecthex00000000000000 Microsoft Visual Studio Solution File, Format Version 11.00 # Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Addins", "Mono.Addins\Mono.Addins.csproj", "{91DD5A2D-9FE3-4C3C-9253-876141874DAD}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mautil", "mautil\mautil.csproj", "{EA2F08DC-8289-4A89-A405-1A70D8B4C569}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Addins.Gui", "Mono.Addins.Gui\Mono.Addins.Gui.csproj", "{FEC19BDA-4904-4005-8C09-68E82E8BEF6A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{7EFC0684-310E-417D-B8BD-5584C3F34BD5}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandExtension", "Test\CommandExtension\CommandExtension.csproj", "{F109148D-849E-4044-8700-5E8EA0AB2476}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileContentExtension", "Test\FileContentExtension\FileContentExtension.csproj", "{4F29F0C0-725A-4927-9931-AAB0A595F370}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorldExtension", "Test\HelloWorldExtension\HelloWorldExtension.csproj", "{04C62888-E58A-4C6E-8688-A4F6F5459E14}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SystemInfoExtension", "Test\SystemInfoExtension\SystemInfoExtension.csproj", "{2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "Test\UnitTests\UnitTests.csproj", "{1CD51E61-1985-4D22-9BFA-D14C8FC61B46}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileExtender", "Test\FileExtender\FileExtender.csproj", "{A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MultiAssemblyAddin", "MultiAssemblyAddin", "{0CE17344-E7E3-4620-B6D4-B04778EC5739}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiAssemblyAddin", "Test\MultiAssemblyAddin\MultiAssemblyAddin.csproj", "{8C374D09-E916-4C6C-A01B-43A06A0D0499}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SecondAssembly", "Test\MultiAssemblyAddin\SecondAssembly\SecondAssembly.csproj", "{EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OptionalModule", "Test\MultiAssemblyAddin\OptionalModule\OptionalModule.csproj", "{B051C84E-48CC-448D-B00C-1525EB64E4BE}" EndProject Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "docs", "docs\docs.mdproj", "{87EADEFB-B389-4479-9C36-CDAA07839983}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Addins.Setup", "Mono.Addins.Setup\Mono.Addins.Setup.csproj", "{A85C9721-C054-4BD8-A1F3-0227615F0A36}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Addins.CecilReflector", "Mono.Addins.CecilReflector\Mono.Addins.CecilReflector.csproj", "{42D1CE65-A14B-4218-B787-58AD7AA68513}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Addins.MSBuild", "Mono.Addins.MSBuild\Mono.Addins.MSBuild.csproj", "{B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution DebugWin32|Any CPU = DebugWin32|Any CPU Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU DebugNoGui|Any CPU = DebugNoGui|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {04C62888-E58A-4C6E-8688-A4F6F5459E14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.Debug|Any CPU.Build.0 = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.Release|Any CPU.ActiveCfg = Debug|Any CPU {04C62888-E58A-4C6E-8688-A4F6F5459E14}.Release|Any CPU.Build.0 = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Debug|Any CPU.Build.0 = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Release|Any CPU.ActiveCfg = Debug|Any CPU {1CD51E61-1985-4D22-9BFA-D14C8FC61B46}.Release|Any CPU.Build.0 = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Release|Any CPU.ActiveCfg = Debug|Any CPU {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D}.Release|Any CPU.Build.0 = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.Debug|Any CPU.Build.0 = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.Release|Any CPU.ActiveCfg = Release|Any CPU {42D1CE65-A14B-4218-B787-58AD7AA68513}.Release|Any CPU.Build.0 = Release|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.Debug|Any CPU.Build.0 = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.Release|Any CPU.ActiveCfg = Debug|Any CPU {4F29F0C0-725A-4927-9931-AAB0A595F370}.Release|Any CPU.Build.0 = Debug|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.Debug|Any CPU.ActiveCfg = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.Debug|Any CPU.Build.0 = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.DebugNoGui|Any CPU.ActiveCfg = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.DebugNoGui|Any CPU.Build.0 = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.DebugWin32|Any CPU.ActiveCfg = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.Release|Any CPU.ActiveCfg = Default|Any CPU {87EADEFB-B389-4479-9C36-CDAA07839983}.Release|Any CPU.Build.0 = Default|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.Debug|Any CPU.Build.0 = Debug|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.Release|Any CPU.ActiveCfg = Release|Any CPU {8C374D09-E916-4C6C-A01B-43A06A0D0499}.Release|Any CPU.Build.0 = Release|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.Debug|Any CPU.Build.0 = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.Release|Any CPU.ActiveCfg = Release|Any CPU {91DD5A2D-9FE3-4C3C-9253-876141874DAD}.Release|Any CPU.Build.0 = Release|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.Debug|Any CPU.Build.0 = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.Release|Any CPU.ActiveCfg = Debug|Any CPU {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9}.Release|Any CPU.Build.0 = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.Debug|Any CPU.Build.0 = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.Release|Any CPU.ActiveCfg = Release|Any CPU {A85C9721-C054-4BD8-A1F3-0227615F0A36}.Release|Any CPU.Build.0 = Release|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {B051C84E-48CC-448D-B00C-1525EB64E4BE}.Release|Any CPU.Build.0 = Release|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.Debug|Any CPU.Build.0 = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.Release|Any CPU.ActiveCfg = Release|Any CPU {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3}.Release|Any CPU.Build.0 = Release|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.Debug|Any CPU.Build.0 = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.Release|Any CPU.ActiveCfg = Release|Any CPU {EA2F08DC-8289-4A89-A405-1A70D8B4C569}.Release|Any CPU.Build.0 = Release|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.Debug|Any CPU.Build.0 = Debug|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.Release|Any CPU.ActiveCfg = Release|Any CPU {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4}.Release|Any CPU.Build.0 = Release|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.Debug|Any CPU.Build.0 = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.DebugNoGui|Any CPU.Build.0 = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.Release|Any CPU.ActiveCfg = Debug|Any CPU {F109148D-849E-4044-8700-5E8EA0AB2476}.Release|Any CPU.Build.0 = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.Debug|Any CPU.Build.0 = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.DebugNoGui|Any CPU.ActiveCfg = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.Release|Any CPU.ActiveCfg = Release|Any CPU {FEC19BDA-4904-4005-8C09-68E82E8BEF6A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {F109148D-849E-4044-8700-5E8EA0AB2476} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {4F29F0C0-725A-4927-9931-AAB0A595F370} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {04C62888-E58A-4C6E-8688-A4F6F5459E14} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {2FF5459A-495C-4FDF-81EA-D0A6C07E7C0D} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {1CD51E61-1985-4D22-9BFA-D14C8FC61B46} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {A32AFFBA-4B83-4D6E-8CB3-812908BA14A9} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {0CE17344-E7E3-4620-B6D4-B04778EC5739} = {7EFC0684-310E-417D-B8BD-5584C3F34BD5} {8C374D09-E916-4C6C-A01B-43A06A0D0499} = {0CE17344-E7E3-4620-B6D4-B04778EC5739} {EB38A832-1BA5-4073-910C-7ACC5F1D1AD4} = {0CE17344-E7E3-4620-B6D4-B04778EC5739} {B051C84E-48CC-448D-B00C-1525EB64E4BE} = {0CE17344-E7E3-4620-B6D4-B04778EC5739} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution StartupItem = mautil\mautil.csproj Policies = $0 $0.DotNetNamingPolicy = $1 $1.DirectoryNamespaceAssociation = Flat $1.ResourceNamePolicy = FileName $0.StandardHeader = $2 $2.Text = @\n${FileName}\n \nAuthor:\n ${AuthorName} <${AuthorEmail}>\n\nCopyright (c) ${Year} ${CopyrightHolder}\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE. $2.IncludeInNewFiles = True $0.TextStylePolicy = $3 $3.FileWidth = 120 $3.TabWidth = 4 $3.inheritsSet = Mono $3.inheritsScope = text/plain $0.VersionControlPolicy = $4 $4.inheritsSet = Mono $0.ChangeLogPolicy = $5 $5.UpdateMode = None $5.inheritsSet = Mono name = Mono.Addins defaultDeployTarget = Directory EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal mono-addins-1.0/NEWS0000664000175000017500000000006012136523632016302 0ustar00directhexdirecthex00000000000000 Version 0.1 March 26, 2007 * Initial release mono-addins-1.0/install-sh0000755000175000017500000003325612026454250017617 0ustar00directhexdirecthex00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-01-19.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 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac 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 # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac 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 do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 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 problematic for `test' and other utilities. 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 # 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 X"$d" = X && 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: mono-addins-1.0/Test/0000775000175000017500000000000012136524044016524 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/FileExtender/0000775000175000017500000000000012136524044021102 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/FileExtender/Makefile.am0000664000175000017500000000162712136523632023146 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/extras/FileExtender.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../lib/FileContentExtension.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib/extras if ENABLE_TESTS all: $(ASSEMBLY) endif FILES = FileExtender.cs DATA_FILES = ExtraExtender.addin.xml RESOURCES = \ FileExtender.addin.xml \ FileExtender.Bis.addin.xml EXTRAS = REFERENCES = -r:System DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include endif mono-addins-1.0/Test/FileExtender/Makefile.in0000664000175000017500000002751312136523721023160 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/FileExtender 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/extras/FileExtender.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../lib/FileContentExtension.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib/extras FILES = FileExtender.cs DATA_FILES = ExtraExtender.addin.xml RESOURCES = \ FileExtender.addin.xml \ FileExtender.Bis.addin.xml EXTRAS = REFERENCES = -r:System DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/FileExtender/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/FileExtender/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/FileExtender/ChangeLog0000664000175000017500000000116512136523632022661 0ustar00directhexdirecthex000000000000002010-05-21 Lluis Sanchez Gual * FileExtender.Bis.addin.xml: Added new tests. 2010-03-29 Lluis Sanchez Gual * FileExtender.csproj: Remove import. 2010-03-26 Lluis Sanchez Gual * Makefile.am: * FileExtender.csproj: * FileExtender.addin.xml: * FileExtender.Bis.addin.xml: Updated and created new tests for testing extension definition using the new features. 2009-08-19 Lluis Sanchez Gual * FileExtender.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * FileExtender.csproj: Updated. mono-addins-1.0/Test/Makefile.am0000664000175000017500000000042312136523632020561 0ustar00directhexdirecthex00000000000000 SUBDIRS = UnitTests CommandExtension FileContentExtension HelloWorldExtension SystemInfoExtension FileExtender NUNIT_CONSOLE = `pkg-config --variable=libdir mono-nunit`/mono/2.0/nunit-console.exe test: all mono --debug $(NUNIT_CONSOLE) UnitTests/bin/Debug/UnitTests.dll mono-addins-1.0/Test/HelloWorldExtension/0000775000175000017500000000000012136524044022474 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/HelloWorldExtension/Makefile.am0000664000175000017500000000156612136523632024542 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/HelloWorldExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib if ENABLE_TESTS all: $(ASSEMBLY) endif FILES = \ AttributeExtensions.cs \ HelloSampleExtender.cs \ HelloWorldWriter.cs \ HelloWriterWithMetadata.cs DATA_FILES = RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include endif mono-addins-1.0/Test/HelloWorldExtension/Makefile.in0000664000175000017500000002747712136523721024563 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/HelloWorldExtension 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/HelloWorldExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib FILES = \ AttributeExtensions.cs \ HelloSampleExtender.cs \ HelloWorldWriter.cs \ HelloWriterWithMetadata.cs DATA_FILES = RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/HelloWorldExtension/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/HelloWorldExtension/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/HelloWorldExtension/ChangeLog0000664000175000017500000000110412136523632024244 0ustar00directhexdirecthex000000000000002010-05-21 Lluis Sanchez Gual * AttributeExtensions.cs: Reorganized tests. 2010-03-26 Lluis Sanchez Gual * Makefile.am: * HelloWorldWriter.cs: * AttributeExtensions.cs: * HelloWriterWithMetadata.cs: * HelloWorldExtension.csproj: Updated and created new tests for testing extension definition using the new features. 2009-08-19 Lluis Sanchez Gual * HelloWorldExtension.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * HelloWorldExtension.csproj: Updated. mono-addins-1.0/Test/Makefile.in0000664000175000017500000004172012136523721020576 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = ./Test DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ SUBDIRS = UnitTests CommandExtension FileContentExtension HelloWorldExtension SystemInfoExtension FileExtender NUNIT_CONSOLE = `pkg-config --variable=libdir mono-nunit`/mono/2.0/nunit-console.exe all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @fail= failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @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 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ install-am install-strip tags-recursive .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir 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 \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am test: all mono --debug $(NUNIT_CONSOLE) UnitTests/bin/Debug/UnitTests.dll # 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: mono-addins-1.0/Test/FileContentExtension/0000775000175000017500000000000012136524044022633 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/FileContentExtension/Makefile.am0000664000175000017500000000157512136523632024701 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/FileContentExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib if ENABLE_TESTS all: $(ASSEMBLY) endif FILES = \ FileContentExtensionNode.cs \ FileSampleExtender.cs \ IExtraFileContent.cs DATA_FILES = FileContentExtension.addin.xml RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include endif mono-addins-1.0/Test/FileContentExtension/Makefile.in0000664000175000017500000002751112136523721024707 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/FileContentExtension 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/FileContentExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib FILES = \ FileContentExtensionNode.cs \ FileSampleExtender.cs \ IExtraFileContent.cs DATA_FILES = FileContentExtension.addin.xml RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/FileContentExtension/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/FileContentExtension/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/FileContentExtension/ChangeLog0000664000175000017500000000056212136523632024412 0ustar00directhexdirecthex000000000000002010-03-26 Lluis Sanchez Gual * FileContentExtension.csproj: Disable makefile integration since we are not using makefiles anymore. 2009-08-19 Lluis Sanchez Gual * FileContentExtension.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * FileContentExtension.csproj: Updated. mono-addins-1.0/Test/ChangeLog0000664000175000017500000001100312136523632020273 0ustar00directhexdirecthex000000000000002010-05-21 Lluis Sanchez Gual * MultiAssemblyAddin: Added new tests. 2008-11-10 Lluis Sanchez Gual * UnitTests/Makefile.am: * FileExtender/Makefile.am: * CommandExtension/Makefile.am: * SystemInfoExtension/Makefile.am: * HelloWorldExtension/Makefile.am: * FileContentExtension/Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-08-22 Lluis Sanchez Gual * Test.mds: More project file fixes. 2008-08-22 Lluis Sanchez Gual * CommandExtension/CommandExtension.csproj, FileContentExtension/FileContentExtension.csproj, FileExtender/FileExtender.csproj, HelloWorldExtension/HelloWorldExtension.csproj, SystemInfoExtension/SystemInfoExtension.csproj, UnitTests/UnitTests.csproj, CommandExtension/CommandExtension.mdp, FileContentExtension/FileContentExtension.mdp, FileExtender/FileExtender.mdp, HelloWorldExtension/HelloWorldExtension.mdp, SystemInfoExtension/SystemInfoExtension.mdp, UnitTests/UnitTests.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-06-11 Lluis Sanchez Gual * UnitTests/TestEvents.cs: Improved Load/Unload tests. 2008-02-15 Lluis Sanchez Gual * UnitTests/UnitTests.mdp, FileContentExtension/FileContentExtension.mdp, HelloWorldExtension/HelloWorldExtension.mdp, CommandExtension/CommandExtension.mdp, FileExtender/FileExtender.mdp: Flush. 2007-12-05 Lluis Sanchez Gual * UnitTests/UnitTests.mdp, UnitTests/Makefile.am, SystemInfoExtension/Makefile.am: Flush. * UnitTests/AddinInformationTests.cs: Added tests for Addin.CompareVersion. 2007-12-03 Lluis Sanchez Gual * SystemInfoExtension/Makefile.am: Added missing files. 2007-12-03 Lluis Sanchez Gual * UnitTests/UnitTests.mdp, UnitTests/TestLoadUnload.cs, UnitTests/IWriter.cs, UnitTests/TestLocalization.cs, UnitTests/Makefile.am, UnitTests/TestBase.cs, FileContentExtension/FileContentExtensionNode.cs, FileContentExtension/FileContentExtension.addin.xml, HelloWorldExtension/HelloWorldWriter.cs, CommandExtension/CommandExtensionNode.cs, SystemInfoExtension/SystemInfoWriter.cs, SystemInfoExtension/Makefile.am, SystemInfoExtension/SystemInfoExtension.addin.xml, SystemInfoExtension/Resources.resx, SystemInfoExtension/ModuleExtensionNode.cs, SystemInfoExtension/SystemInfoExtension.mdp, SystemInfoExtension/Resources.ca.resx, FileExtender/ExtraExtender.addin.xml: Added localization tests. 2007-10-29 Lluis Sanchez Gual * CommandExtension/CommandExtension.mdp, FileContentExtension/FileContentExtension.mdp, FileExtender/FileExtender.mdp, HelloWorldExtension/HelloWorldExtension.mdp, SystemInfoExtension/SystemInfoExtension.mdp, Test.mds, UnitTests/UnitTests.mdp: Update paths. 2007-07-06 Lluis Sanchez Gual * UnitTests/TestEvents.cs, SystemInfoExtension/SystemInfoExtension.addin.xml: Minor fixes. * Makefile.am: Added new test target. 2007-07-05 Lluis Sanchez Gual * UnitTests/UnitTests.mdp, UnitTests/Makefile.am, FileContentExtension/FileContentExtension.mdp, HelloWorldExtension/HelloWorldExtension.mdp, CommandExtension/CommandExtension.mdp, SystemInfoExtension/SystemInfoExtension.mdp, FileExtender/FileExtender.mdp: More project file fixes. 2007-04-23 Lluis Sanchez Gual * UnitTests/UnitTests.mdp, UnitTests/Makefile.am, FileContentExtension/FileContentExtension.mdp, FileContentExtension/Makefile.am, HelloWorldExtension/HelloWorldExtension.mdp, HelloWorldExtension/Makefile.am, CommandExtension/Makefile.am, CommandExtension/CommandExtension.mdp, SystemInfoExtension/Makefile.am, SystemInfoExtension/SystemInfoExtension.mdp, FileExtender/Makefile.am, FileExtender/FileExtender.mdp: Enabled makefile synchronization. 2007-03-30 Lluis Sanchez Gual * UnitTests/TestExtensions.cs, UnitTests/SimpleApp.addin.xml, FileContentExtension/FileContentExtension.addin.xml, SystemInfoExtension/SystemInfoExtension.addin.xml: Test extension of child nodes. 2007-03-28 Lluis Sanchez Gual * UnitTests/TestSetup.cs, UnitTests/TestBase.cs: Use Assembly.CodeBase, since Assembly.Location will return the wrong value when the assembly is loaded using shadow copy. 2007-03-23 Lluis Sanchez Gual Added build files. mono-addins-1.0/Test/UnitTests/0000775000175000017500000000000012136524044020466 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/UnitTests/Makefile.am0000664000175000017500000000331412136523632022525 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ./bin/Debug/UnitTests.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.CecilReflector.dll \ ../../bin/Mono.Addins.dll \ ../../bin/Mono.Addins.Setup.dll BUILD_DIR = ./bin/Debug NOINSTALL=yes if ENABLE_TESTS all: $(ASSEMBLY) else all: endif FILES = \ AddinInformationTests.cs \ ExtensionModel/AttrExtensionWithManyNodes.cs \ ExtensionModel/ComplexNode.cs \ ExtensionModel/GlobalInfoCondition.cs \ ExtensionModel/ISampleExtender.cs \ ExtensionModel/IWriter.cs \ ExtensionModel/IWriterWithMetadata.cs \ ExtensionModel/MultiAssemblyTestExtensionPoint.cs \ ExtensionModel/NodeWithAttribute.cs \ ExtensionModel/ParameterInfoCondition.cs \ ExtensionModel/Properties.cs \ ExtensionModel/SimpleExtensionAttribute.cs \ TestAddinDescription.cs \ TestBase.cs \ TestConditions.cs \ TestEvents.cs \ TestExtensions.cs \ TestLoadUnload.cs \ TestLoadXmlAddinDescription.cs \ TestLocalization.cs \ TestSetup.cs \ TestSetupService.cs \ TestVerifyAddinDescription.cs \ Util.cs DATA_FILES = \ SimpleApp.addin.xml \ test.addins RESOURCES = \ TestManifest2.xml \ TestManifest2-bis.xml \ TestManifest3.xml EXTRAS = REFERENCES = \ -pkg:mono-nunit \ -r:System \ -r:System.Core \ -r:System.Xml DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include endif mono-addins-1.0/Test/UnitTests/Makefile.in0000664000175000017500000003121212136523721022533 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/UnitTests 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ./bin/Debug/UnitTests.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.CecilReflector.dll \ ../../bin/Mono.Addins.dll \ ../../bin/Mono.Addins.Setup.dll BUILD_DIR = ./bin/Debug NOINSTALL = yes FILES = \ AddinInformationTests.cs \ ExtensionModel/AttrExtensionWithManyNodes.cs \ ExtensionModel/ComplexNode.cs \ ExtensionModel/GlobalInfoCondition.cs \ ExtensionModel/ISampleExtender.cs \ ExtensionModel/IWriter.cs \ ExtensionModel/IWriterWithMetadata.cs \ ExtensionModel/MultiAssemblyTestExtensionPoint.cs \ ExtensionModel/NodeWithAttribute.cs \ ExtensionModel/ParameterInfoCondition.cs \ ExtensionModel/Properties.cs \ ExtensionModel/SimpleExtensionAttribute.cs \ TestAddinDescription.cs \ TestBase.cs \ TestConditions.cs \ TestEvents.cs \ TestExtensions.cs \ TestLoadUnload.cs \ TestLoadXmlAddinDescription.cs \ TestLocalization.cs \ TestSetup.cs \ TestSetupService.cs \ TestVerifyAddinDescription.cs \ Util.cs DATA_FILES = \ SimpleApp.addin.xml \ test.addins RESOURCES = \ TestManifest2.xml \ TestManifest2-bis.xml \ TestManifest3.xml EXTRAS = REFERENCES = \ -pkg:mono-nunit \ -r:System \ -r:System.Core \ -r:System.Xml DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/UnitTests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/UnitTests/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) @ENABLE_TESTS_FALSE@all: $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/UnitTests/ChangeLog0000664000175000017500000000267312136523632022252 0ustar00directhexdirecthex000000000000002010-05-21 Lluis Sanchez Gual * Makefile.am: * UnitTests.csproj: * TestExtensions.cs: * ExtensionModel/AttrExtensionWithManyNodes.cs: * ExtensionModel/MultiAssemblyTestExtensionPoint.cs: Added new tests. 2010-05-21 Lluis Sanchez Gual * IWriter.cs: * Makefile.am: * TestEvents.cs: * ExtensionModel: * ComplexNode.cs: * UnitTests.csproj: * TestExtensions.cs: * ISampleExtender.cs: * NodeWithAttribute.cs: * GlobalInfoCondition.cs: * IWriterWithMetadata.cs: * ParameterInfoCondition.cs: * ExtensionModel/IWriter.cs: * ExtensionModel/ComplexNode.cs: * ExtensionModel/ISampleExtender.cs: * ExtensionModel/NodeWithAttribute.cs: * ExtensionModel/IWriterWithMetadata.cs: * ExtensionModel/GlobalInfoCondition.cs: * ExtensionModel/ParameterInfoCondition.cs: * ExtensionModel/SimpleExtensionAttribute.cs: Reorganized tests. 2010-03-26 Lluis Sanchez Gual * IWriter.cs: * Makefile.am: * TestBase.cs: * TestSetup.cs: * TestEvents.cs: * UnitTests.csproj: * TestLoadUnload.cs: * TestConditions.cs: * TestExtensions.cs: * SimpleApp.addin.xml: * NodeWithAttribute.cs: * IWriterWithMetadata.cs: Updated and created new tests for testing extension definition using the new features. 2009-08-19 Lluis Sanchez Gual * UnitTests.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * UnitTests.csproj: Updated. mono-addins-1.0/Test/SystemInfoExtension/0000775000175000017500000000000012136524044022521 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/SystemInfoExtension/Makefile.am0000664000175000017500000000313212136523632024556 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = gmcs ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/SystemInfoExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../lib/CommandExtension.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib if ENABLE_TESTS all: $(ASSEMBLY) $(SATELLITE_ASSEMBLY) endif FILES = \ ModuleExtensionNode.cs \ MyClass.cs \ SystemInfoWriter.cs DATA_FILES = SystemInfoExtension.addin.xml RESOURCES = SATELLITE_ASSEMBLY = ../lib/ca/SystemInfoExtension.resources.dll MAIN_RESOURCE = Resources.resources EXTRAS = Resources.resx Resources.ca.resx REFERENCES = -r:System DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) $(MAIN_RESOURCE) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) /res:$(MAIN_RESOURCE) $(build_sources) $(build_resources_embed) $(build_references_ref) $(MAIN_RESOURCE): Resources.resx resgen /compile Resources.resx $(SATELLITE_ASSEMBLY): Resources.ca.resx resgen /compile Resources.ca.resx mkdir -p $(dir $(ASSEMBLY))/ca al /t:lib /embed:Resources.ca.resources,Resources.ca.resources /out:$(SATELLITE_ASSEMBLY) /culture:ca # Workaround to mono bug #345627 - Satellite resource assemblies not loaded from the main assembly directory mkdir -p ../UnitTests/bin/Debug/ca cp $(SATELLITE_ASSEMBLY) ../UnitTests/bin/Debug/ca if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include CLEANFILES += $(SATELLITE_ASSEMBLY) $(MAIN_RESOURCE) endif mono-addins-1.0/Test/SystemInfoExtension/Makefile.in0000664000175000017500000003107612136523721024576 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/SystemInfoExtension 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = gmcs ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/SystemInfoExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../lib/CommandExtension.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib FILES = \ ModuleExtensionNode.cs \ MyClass.cs \ SystemInfoWriter.cs DATA_FILES = SystemInfoExtension.addin.xml RESOURCES = SATELLITE_ASSEMBLY = ../lib/ca/SystemInfoExtension.resources.dll MAIN_RESOURCE = Resources.resources EXTRAS = Resources.resx Resources.ca.resx REFERENCES = -r:System DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES) $(SATELLITE_ASSEMBLY) \ @ENABLE_TESTS_TRUE@ $(MAIN_RESOURCE) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/SystemInfoExtension/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/SystemInfoExtension/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) $(SATELLITE_ASSEMBLY) $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) $(MAIN_RESOURCE) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) /res:$(MAIN_RESOURCE) $(build_sources) $(build_resources_embed) $(build_references_ref) $(MAIN_RESOURCE): Resources.resx resgen /compile Resources.resx $(SATELLITE_ASSEMBLY): Resources.ca.resx resgen /compile Resources.ca.resx mkdir -p $(dir $(ASSEMBLY))/ca al /t:lib /embed:Resources.ca.resources,Resources.ca.resources /out:$(SATELLITE_ASSEMBLY) /culture:ca # Workaround to mono bug #345627 - Satellite resource assemblies not loaded from the main assembly directory mkdir -p ../UnitTests/bin/Debug/ca cp $(SATELLITE_ASSEMBLY) ../UnitTests/bin/Debug/ca @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/SystemInfoExtension/ChangeLog0000664000175000017500000000064712136523632024304 0ustar00directhexdirecthex000000000000002010-03-26 Lluis Sanchez Gual * Makefile.am: * SystemInfoWriter.cs: * SystemInfoExtension.csproj: Updated and created new tests for testing extension definition using the new features. 2009-08-19 Lluis Sanchez Gual * SystemInfoExtension.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * SystemInfoExtension.csproj: Updated. mono-addins-1.0/Test/CommandExtension/0000775000175000017500000000000012136524044021777 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Test/CommandExtension/Makefile.am0000664000175000017500000000147412136523632024043 0ustar00directhexdirecthex00000000000000ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/CommandExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib if ENABLE_TESTS all: $(ASSEMBLY) endif FILES = CommandExtensionNode.cs DATA_FILES = CommandExtension.addin.xml RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) if ENABLE_TESTS include $(top_srcdir)/makefile-sample.include endif mono-addins-1.0/Test/CommandExtension/Makefile.in0000664000175000017500000002737412136523720024061 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/makefile-sample.include ChangeLog subdir = ./Test/CommandExtension 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY_COMPILER_COMMAND = @MCS@ ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -warn:4 -debug -d:DEBUG ASSEMBLY = ../lib/CommandExtension.dll COMPILE_TARGET = library PROJECT_REFERENCES = \ ../../bin/Mono.Addins.dll \ ../UnitTests/bin/Debug/UnitTests.dll BUILD_DIR = ../lib FILES = CommandExtensionNode.cs DATA_FILES = CommandExtension.addin.xml RESOURCES = EXTRAS = REFERENCES = -r:System DLL_REFERENCES = @ENABLE_TESTS_TRUE@build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) @ENABLE_TESTS_TRUE@build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) @ENABLE_TESTS_TRUE@build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) @ENABLE_TESTS_TRUE@build_references_ref = $(REFERENCES) $(foreach ref, \ @ENABLE_TESTS_TRUE@ $(DLL_REFERENCES), -r:$(ref)) $(foreach \ @ENABLE_TESTS_TRUE@ ref, $(PROJECT_REFERENCES), -r:$(ref)) @ENABLE_TESTS_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_TESTS_TRUE@build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) @ENABLE_TESTS_TRUE@EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) @ENABLE_TESTS_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) @ENABLE_TESTS_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/makefile-sample.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Test/CommandExtension/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Test/CommandExtension/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/makefile-sample.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_TESTS_TRUE@all: $(ASSEMBLY) $(ASSEMBLY).mdb: $(ASSEMBLY) $(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) mkdir -p $(dir $(ASSEMBLY)) $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$@ -target:$(COMPILE_TARGET) $(build_sources) $(build_resources_embed) $(build_references_ref) @ENABLE_TESTS_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_TESTS_TRUE@ mkdir -p $(dir $@) @ENABLE_TESTS_TRUE@ cp $< $@ # 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: mono-addins-1.0/Test/CommandExtension/ChangeLog0000664000175000017500000000054612136523632023560 0ustar00directhexdirecthex000000000000002010-03-26 Lluis Sanchez Gual * CommandExtension.csproj: Disable makefile integration since we are not using makefiles anymore. 2009-08-19 Lluis Sanchez Gual * CommandExtension.csproj: Update target framework to 2.0. 2009/02/06 Lluis Sanchez Gual * CommandExtension.csproj: Updated. mono-addins-1.0/ChangeLog0000664000175000017500000002533312136523632017367 0ustar00directhexdirecthex000000000000002010-06-08 Lluis Sanchez Gual * Mono.Addins.sln: Add missing projects. 2010-06-08 Lluis Sanchez Gual * Mono.Addins.sln: Add missing project. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.sln: Fix windows build. 2010-05-25 Lluis Sanchez Gual * Mono.Addins.sln: Add Debug and Release configurations. 2010-05-25 Lluis Sanchez Gual * Samples/Samples.mdw: * Samples/TextEditorSWF: Added new sample 2010-03-24 Lluis Sanchez Gual * Makefile.am: * configure.ac: * Mono.Addins.sln: * Mono.Addins.mdw: * Samples/Makefile.am: * Samples/Samples.mdw: * Samples/TextEditorLib: * Samples/TextEditor.Xml: * Samples/WriterServiceHost: * Samples/TextEditorLib/gtk-gui: * Samples/TextEditorLib/Commands: * Samples/TextEditorLib/ChangeLog: * Samples/TextEditorLib/Templates: * Samples/TextEditor.Xml/ChangeLog: * Samples/WriterServiceHost/Main.cs: * Samples/TextEditorLib/ICommand.cs: * Samples/TextEditorLib/Makefile.am: * Samples/TextEditor.CompilerService: * Samples/TextEditor.Xml/Makefile.am: * Samples/WriterServiceHost/ChangeLog: * Samples/TextEditorLib/MainWindow.cs: * Samples/TextEditor.Xml/EmptyFile.xml: * Samples/TextEditorLib/ExtensionNodes: * Samples/WriterService.SampleExtender: * Samples/TextEditorLib/AssemblyInfo.cs: * Samples/WriterServiceHost/Makefile.am: * Samples/TextEditorLib/TextEditorApp.cs: * Samples/TextEditor.Xml/AssemblyInfo.cs: * Samples/TextEditorLib/gtk-gui/gui.stetic: * Samples/TextEditor.CompilerService.CSharp: * Samples/WriterServiceHost/AssemblyInfo.cs: * Samples/TextEditorLib/TextEditorLib.csproj: * Samples/TextEditorLib/gtk-gui/generated.cs: * Samples/TextEditor.Xml/FormatXmlCommand.cs: * Samples/TextEditorLib/OpenFileCondition.cs: * Samples/TextEditorLib/gtk-gui/MainWindow.cs: * Samples/TextEditor.CompilerService/ChangeLog: * Samples/TextEditorLib/Commands/CutCommand.cs: * Samples/TextEditorLib/Commands/NewCommand.cs: * Samples/TextEditor.Xml/TextEditor.Xml.csproj: * Samples/TextEditorLib/Commands/SaveCommand.cs: * Samples/TextEditorLib/Commands/OpenCommand.cs: * Samples/TextEditorLib/Commands/ExitCommand.cs: * Samples/TextEditorLib/Commands/CopyCommand.cs: * Samples/TextEditorLib/Commands/PasteCommand.cs: * Samples/TextEditorLib/Templates/WorkReport.txt: * Samples/TextEditor.CompilerService/Makefile.am: * Samples/TextEditorLib/Commands/SetupCommand.cs: * Samples/WriterService.SampleExtender/ChangeLog: * Samples/TextEditor.CompilerService/ICompiler.cs: * Samples/TextEditor.Xml/TextEditor.Xml.addin.xml: * Samples/TextEditorLib/ExtensionNodes/MenuNode.cs: * Samples/TextEditor.CompilerService/RunCommand.cs: * Samples/WriterService.SampleExtender/Makefile.am: * Samples/WriterService.SampleExtender/MyWriter.cs: * Samples/TextEditor.CompilerService/AssemblyInfo.cs: * Samples/WriterServiceHost/WriterServiceHost.csproj: * Samples/TextEditor.CompilerService.CSharp/ChangeLog: * Samples/TextEditorLib/ExtensionNodes/ToolbarNode.cs: * Samples/TextEditorLib/ExtensionNodes/SubmenuNode.cs: * Samples/WriterService.SampleExtender/AssemblyInfo.cs: * Samples/TextEditorLib/Templates/TextEditor.addin.xml: * Samples/TextEditorLib/ExtensionNodes/MenuItemNode.cs: * Samples/TextEditorLib/Templates/DotConfigTemplate.txt: * Samples/TextEditorLib/Templates/ChangeLogTemplate.txt: * Samples/TextEditor.CompilerService/CompilerManager.cs: * Samples/TextEditor.CompilerService.CSharp/Makefile.am: * Samples/TextEditorLib/ExtensionNodes/ToolButtonNode.cs: * Samples/TextEditorLib/ExtensionNodes/FileTemplateNode.cs: * Samples/TextEditorLib/ExtensionNodes/MenuSeparatorNode.cs: * Samples/TextEditor.CompilerService.CSharp/AssemblyInfo.cs: * Samples/TextEditorLib/ExtensionNodes/ToolSeparatorNode.cs: * Samples/TextEditor.CompilerService.CSharp/CSharpCompiler.cs: * Samples/TextEditorLib/ExtensionNodes/TemplateCategoryNode.cs: * Samples/WriterService.SampleExtender/SampleExtender.addin.xml: * Samples/TextEditor.CompilerService/TextEditor.CompilerService.csproj: * Samples/TextEditor.CompilerService/TextEditor.CompilerService.addin.xml: * Samples/WriterService.SampleExtender/WriterService.SampleExtender.csproj: * Samples/TextEditor.CompilerService.CSharp/TextEditor.CompilerService.CSharp.csproj: Moved samples to its own solution in a Samples workspace. * Samples/HelloWorld: * Samples/HelloWorldWithManifest: Added new samples. 2009-09-01 Lluis Sanchez Gual * configure.ac: Bump Mono.Addins version. 2009-08-25 Lluis Sanchez Gual * Mono.Addins.sln: Disable some projects on windows. 2009-08-25 Lluis Sanchez Gual * Mono.Addins.sln: Fix configuration mapping. 2009-08-25 Lluis Sanchez Gual * Mono.Addins.sln: Added Default configuration. 2009-08-20 Lluis Sanchez Gual * Makefile.am: * configure.ac: * Mono.Addins.sln: * Mono.Addins.MSBuild: Added a new project which Implements an msbuild task for resolving add-in references. 2009-05-29 Jonathan Pobst * Mono.Addins.sln: Don't build the tests under the DebugWin32 configuration. 2009-04-15 Mike Kestner * */*.csproj: use correct keyfile element for signing. 2009-03-30 Lluis Sanchez Gual * mono-addins-docs.source: Moved to docs. * configure.ac: Added option for building the docs. * Makefile.am: Added makefile to docs which builds and installs the documentation. 2009-03-30 Jonathan Pryor * . (svn:ignore): Ignore generated files (mono-addins-docs{.tree,.zip}). * docs/**/*: Flush (output of doc-update). * Makefile.am: Add doc-update, doc-assemble, install-docs, uninstall-docs, clean-docs targets. * mono-addins-docs.source: Monodoc .source file which specifies where in the tree the Mono.Addins documentation should be inserted. 2009-03-12 Mike Kestner * Mono.Addins.sln: add new DebugWin32 configuration to disable the doc project build. 2009-03-12 Mike Kestner * Samples/*.csproj: * Mono.Addins.Gui/Mono.Addins.Gui.csproj: add SpecificVersion=false to all the gtk-sharp references. 2009-03-12 Mike Kestner * Mono.Addins/Mono.Addins.csproj: make target=exe since there's a Main method and -main: argument exposed. 2009-03-12 Mike Kestner * *.csproj: updates to support MSBuild on windows. kill a few ApplicationIcon elements and update some gtk-sharp reference versions. 2009-02-06 Lluis Sanchez Gual * Mono.Addins.sln: Updated. 2008-11-10 Lluis Sanchez Gual * configure.ac: Respect custom libdir during ./configure. Fixes bug #443205. Patch by Diego Pettenò. 2008-11-10 Lluis Sanchez Gual * Makefile.include: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-11-04 Lluis Sanchez Gual * configure.ac: Use a tar format with support for more than 99 chars in file names. 2008-08-22 Lluis Sanchez Gual * Mono.Addins.sln, Mono.Addins.mds: Use msbuild file format for projects. Removed the old MD1 projects. 2008-02-06 Lluis Sanchez Gual * Mono.Addins.mds, Mono.Addins.CecilReflector, Mono.Addins.CecilReflector/AssemblyInfo.cs, Mono.Addins.CecilReflector/Mono.Cecil, Mono.Addins.CecilReflector/Mono.Addins.CecilReflector.mdp, Mono.Addins.CecilReflector/Mono.Addins.CecilReflector, Mono.Addins.CecilReflector/Mono.Addins.CecilReflector/Reflector.cs, configure.ac, Makefile.am: Added support for pluggable add-in assembly reflectors. Implemented an add-in assembly reflector based on Cecil. 2008-01-30 Michael Hutchinson * configure.in: Bump release number to 0.3.1. 2008-01-17 Lluis Sanchez Gual * COPYING, Makefile.am: Add COPYING file. 2008-01-07 Lluis Sanchez Gual * Mono.Addins.sln: Updated VS solution files. Patch by Andrés G. Aragoneses. 2007-12-15 Lluis Sanchez Gual * Makefile.include, configure.ac: Don't install assemblies in /usr/lib/mono-addins, gacutil will install them in /usr/lib/mono/mono-addins. Also, install policy files to the gac only. 2007-12-14 Lluis Sanchez Gual * policy.config.in: Set correct public token. 2007-12-12 Lluis Sanchez Gual * Makefile.include, configure.ac, Makefile.am, policy.config.in: Generate and install policy files for old Mono.Addins versions. 2007-12-05 Lluis Sanchez Gual * Makefile.am: Don't build tests and samples by default. * README: Updated. 2007-12-05 Lluis Sanchez Gual * configure.ac: Disable tests by default. 2007-10-29 Lluis Sanchez Gual * Mono.Addins.mds, Packages.mdse: Update paths. 2007-10-19 Lluis Sanchez Gual * configure.ac: Added missing AC_SUBST. 2007-10-18 Lluis Sanchez Gual * configure.ac: Get ready for 0.3 release. 2007-07-10 Lluis Sanchez Gual * Mono.Addins.Gui/Makefile.am: Make sure this dll is not build if gui is disabled. 2007-07-05 Lluis Sanchez Gual * Mono.Addins.mds, Packages.mdse: Added packaging project. * configure.ac: Bump version to 0.2. 2007-07-03 Lluis Sanchez Gual * configure.ac, Makefile.am: Added support for signing and GAC install. 2007-04-04 Lluis Sanchez Gual * Mono.Addins.sln: Added msbuild project files. Patch by Matthijs ter Woord. 2007-03-30 Lluis Sanchez Gual * mautil/mautil.in: Don't change current directory when starting the app. 2007-03-28 Lluis Sanchez Gual * Mono.Addins/Mono.Addins.mdp, Mono.Addins/Mono.Addins/GettextCatalog.cs, Mono.Addins/Makefile.am: Removed Mono.Posix reference. * Mono.Addins/Mono.Addins/ConfigurationInfo.cs: Removed unused file. * Mono.Addins/Mono.Addins/AddinRegistry.cs, Mono.Addins/Mono.Addins.Database/Util.cs: Use a different path for the global registry in windows. * Mono.Addins/Mono.Addins.Database/AddinUpdateData.cs: Set the RootAddin property of root add-in extensions. Collect object type extensions which for extension points defined in root add-ins. 2007-03-26 Lluis Sanchez Gual * AUTHORS, README, NEWS: Added. * Makefile.am: Updated. 2007-03-23 Lluis Sanchez Gual Avoid installing assemblies generated by samples and tests. 2007-03-23 Lluis Sanchez Gual Added missing makefiles. 2007-03-23 Lluis Sanchez Gual * configure.ac: Make compilation of tests and gui libs optional. mono-addins-1.0/COPYING0000664000175000017500000000214712136523632016646 0ustar00directhexdirecthex00000000000000The MIT License Copyright (C) 2007 Novell, Inc (http://www.novell.com) Copyright (C) 2012 Xamarin Inc Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. mono-addins-1.0/docs/0000775000175000017500000000000012136524044016535 5ustar00directhexdirecthex00000000000000mono-addins-1.0/docs/Makefile.am0000664000175000017500000000151112136523632020571 0ustar00directhexdirecthex00000000000000 DOCFILES = \ $(top_builddir)/bin/Mono.Addins.dll \ $(top_builddir)/bin/Mono.Addins.Setup.dll \ $(top_builddir)/bin/Mono.Addins.Gui.dll DOC_ASSEMBLED_FILES = \ mono-addins-docs.tree \ mono-addins-docs.zip if ENABLE_DOCS all: doc-update doc-assemble doc-update: mdoc update --delete $(MDOC_OPTIONS) -o . $(DOCFILES) doc-assemble: mono-addins-docs.zip mono-addins-docs.zip : mono-addins-docs.tree mono-addins-docs.tree: mdoc assemble -o mono-addins-docs . install: install-docs install-docs: mono-addins-docs.source $(DOC_ASSEMBLED_FILES) cp $^ `pkg-config monodoc --variable sourcesdir` uninstall: uninstall-docs uninstall-docs: -rm `pkg-config monodoc --variable sourcesdir`/mono-addins-docs{.source,.tree,.zip} clean: clean-docs clean-docs: -rm -rf $(DOC_ASSEMBLED_FILES) EXTRA_DIST = mono-addins-docs.source endif mono-addins-1.0/docs/Makefile.in0000664000175000017500000002553012136523721020610 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = ./docs DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ DOCFILES = \ $(top_builddir)/bin/Mono.Addins.dll \ $(top_builddir)/bin/Mono.Addins.Setup.dll \ $(top_builddir)/bin/Mono.Addins.Gui.dll DOC_ASSEMBLED_FILES = \ mono-addins-docs.tree \ mono-addins-docs.zip @ENABLE_DOCS_TRUE@EXTRA_DIST = mono-addins-docs.source all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./docs/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile installdirs: @ENABLE_DOCS_FALSE@install: install-am install-exec: install-exec-am install-data: install-data-am @ENABLE_DOCS_FALSE@uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi 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." @ENABLE_DOCS_FALSE@clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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 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 check check-am clean clean-generic distclean \ distclean-generic distdir 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 @ENABLE_DOCS_TRUE@all: doc-update doc-assemble @ENABLE_DOCS_TRUE@doc-update: @ENABLE_DOCS_TRUE@ mdoc update --delete $(MDOC_OPTIONS) -o . $(DOCFILES) @ENABLE_DOCS_TRUE@doc-assemble: mono-addins-docs.zip @ENABLE_DOCS_TRUE@mono-addins-docs.zip : mono-addins-docs.tree @ENABLE_DOCS_TRUE@mono-addins-docs.tree: @ENABLE_DOCS_TRUE@ mdoc assemble -o mono-addins-docs . @ENABLE_DOCS_TRUE@install: install-docs @ENABLE_DOCS_TRUE@install-docs: mono-addins-docs.source $(DOC_ASSEMBLED_FILES) @ENABLE_DOCS_TRUE@ cp $^ `pkg-config monodoc --variable sourcesdir` @ENABLE_DOCS_TRUE@uninstall: uninstall-docs @ENABLE_DOCS_TRUE@uninstall-docs: @ENABLE_DOCS_TRUE@ -rm `pkg-config monodoc --variable sourcesdir`/mono-addins-docs{.source,.tree,.zip} @ENABLE_DOCS_TRUE@clean: clean-docs @ENABLE_DOCS_TRUE@clean-docs: @ENABLE_DOCS_TRUE@ -rm -rf $(DOC_ASSEMBLED_FILES) # 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: mono-addins-1.0/docs/ChangeLog0000664000175000017500000000530612136523632020315 0ustar00directhexdirecthex000000000000002010-03-26 Lluis Sanchez Gual * Mono.Addins.Setup/SetupService.xml: Flush. 2009-03-30 Lluis Sanchez Gual * Mono.Addins/Addin.xml: * Mono.Addins/NodeElement.xml: * Mono.Addins/AddinManager.xml: * Mono.Addins/RuntimeAddin.xml: * Mono.Addins/NodeAttribute.xml: * Mono.Addins/ConditionType.xml: * Mono.Addins/AddinRegistry.xml: * Mono.Addins/ExtensionNode.xml: * Mono.Addins/AddinEventArgs.xml: * Mono.Addins/IProgressStatus.xml: * Mono.Addins/ExtensionChange.xml: * Mono.Addins/ExtensionContext.xml: * Mono.Addins/ExtensionNodeList.xml: * Mono.Addins/TypeExtensionNode.xml: * Mono.Addins/AddinEventHandler.xml: * Mono.Addins/ExtensionEventArgs.xml: * Mono.Addins/AddinRootAttribute.xml: * Mono.Addins/ExtensionAttribute.xml: * Mono.Addins/AddinErrorEventArgs.xml: * Mono.Addins/ExtensionEventHandler.xml: * Mono.Addins/ConsoleProgressStatus.xml: * Mono.Addins.Description/Extension.xml: * Mono.Addins/ExtensionNodeAttribute.xml: * Mono.Addins/NodeAttributeAttribute.xml: * Mono.Addins/AddinErrorEventHandler.xml: * Mono.Addins/ExtensionPointAttribute.xml: * Mono.Addins/AddinDependencyAttribute.xml: * Mono.Addins.Description/ExtensionPoint.xml: * Mono.Addins.Description/AddinDependency.xml: * Mono.Addins/ExtensionNodeChildAttribute.xml: * Mono.Addins/TypeExtensionPointAttribute.xml: * Mono.Addins.Description/ModuleCollection.xml: * Mono.Addins.Description/ExtensionNodeSet.xml: * Mono.Addins.Description/AddinDescription.xml: * Mono.Addins.Description/ModuleDescription.xml: * Mono.Addins.Description/NodeTypeAttribute.xml: * Mono.Addins.Description/AssemblyDependency.xml: * Mono.Addins.Description/ExtensionCollection.xml: * Mono.Addins.Description/NodeSetIdCollection.xml: * Mono.Addins.Description/DependencyCollection.xml: * Mono.Addins.Description/ExtensionNodeDescription.xml: * Mono.Addins.Description/ExtensionPointCollection.xml: * Mono.Addins.Description/ConditionTypeDescription.xml: * Mono.Addins.Description/ExtensionNodeSetCollection.xml: * Mono.Addins.Description/NodeTypeAttributeCollection.xml: * Mono.Addins.Description/ObjectDescriptionCollection.xml: * Mono.Addins.Description/ExtensionNodeDescriptionCollection.xml: * Mono.Addins.Description/ConditionTypeDescriptionCollection.xml: Updated documentation. * Makefile.am: * mono-addins-docs.source: Added makefile to docs which builds and installs the documentation. 2009/02/06 Lluis Sanchez Gual * docs.mdproj: Updated. 2008-08-22 Lluis Sanchez Gual * docs.mdproj: More project file fixes. 2007-10-29 Lluis Sanchez Gual * docs.mdp: Update paths. 2007-03-30 Lluis Sanchez Gual Updated. mono-addins-1.0/Mono.Addins.MSBuild/0000775000175000017500000000000012136524044021214 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.MSBuild/AssemblyInfo.cs0000664000175000017500000000423412136523632024143 0ustar00directhexdirecthex00000000000000// // AssemblyInfo.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("Mono.Addins")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.0.0")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] mono-addins-1.0/Mono.Addins.MSBuild/Makefile.am0000664000175000017500000000047212136523632023255 0ustar00directhexdirecthex00000000000000 ASSEMBLY = ../bin/Mono.Addins.MSBuild.dll ASSEMBLY_NAME=Mono.Addins.MSBuild PC_FILES_IN = mono-addins-msbuild.pc.in install-data-local: gac-install uninstall-local: gac-uninstall include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include CLEANFILES += $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) mono-addins-1.0/Mono.Addins.MSBuild/Mono.Addins.MSBuild.csproj0000664000175000017500000000604712136524015026052 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 2.0 {B4B44F14-32C3-4D50-8C6A-06AA30E56CA3} Library Mono.Addins.MSBuild Mono.Addins.MSBuild True ..\mono-addins.snk True full False ..\bin DEBUG prompt 4 False none False ..\bin prompt 4 False {A85C9721-C054-4BD8-A1F3-0227615F0A36} Mono.Addins.Setup False {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Mono.Addins False mono-addins-1.0/Mono.Addins.MSBuild/Makefile.in0000664000175000017500000004231412136523720023265 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mono-addins-msbuild.pc.in \ $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include \ ChangeLog subdir = ./Mono.Addins.MSBuild 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mono-addins-msbuild.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/Mono.Addins.MSBuild.dll ASSEMBLY_NAME = Mono.Addins.MSBuild PC_FILES_IN = mono-addins-msbuild.pc.in pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) EXTRA_DIST = \ $(wildcard $(ALL_FILES)) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) \ $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) ALL_CSPROJ = $(wildcard *.csproj) MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_FALSE@PROFILE_NAME = DebugNotGui @ENABLE_GUI_TRUE@PROFILE_NAME = Debug XBUILD = xbuild XBUILD_VERBOSITY = quiet XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt ALL_FILES := $(EXTS) \ $(addprefix */,$(EXTS)) \ $(addprefix */*/,$(EXTS)) \ $(addprefix */*/*/,$(EXTS)) \ $(addprefix */*/*/*/,$(EXTS)) \ $(addprefix */*/*/*/*/,$(EXTS)) \ $(wildcard icons/*) \ $(wildcard templates/*) WILDCARDED_FILES := $(wildcard $(ALL_FILES)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Mono.Addins.MSBuild/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Mono.Addins.MSBuild/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mono-addins-msbuild.pc: $(top_builddir)/config.status $(srcdir)/mono-addins-msbuild.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) 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: distclean-am -rm -f Makefile 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-data-local install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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 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: uninstall-binSCRIPTS uninstall-local \ uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-data-local 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-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-local uninstall-pkgconfigDATA install-data-local: gac-install uninstall-local: gac-uninstall $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done all: csproj_build clean: csproj_clean csproj_build: $(POLICY_ASSEMBLIES) @if test x$(SKIP) != xy ; then \ echo Building $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ fi csproj_clean: @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ echo Cleaning $(ALL_CSPROJ); \ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ fi rm -f $(CLEANFILES) sln_build: @echo Building $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) sln_clean: @echo Cleaning $(MAIN_SLN) @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean print_extradist: @echo $(WILDCARDED_FILES) .PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/Mono.Addins.MSBuild/policy.0.5.config0000664000175000017500000000055612136524033024207 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.MSBuild/policy.0.3.config0000664000175000017500000000055612136524032024204 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.MSBuild/obj/0000775000175000017500000000000012136524044021766 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.MSBuild/obj/Debug/0000775000175000017500000000000012136524044023014 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.MSBuild/obj/Debug/Mono.Addins.MSBuild.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000036012136524034034576 0ustar00directhexdirecthex00000000000000/tmp/mono-addins/bin/Mono.Addins.MSBuild.dll.mdb /tmp/mono-addins/bin/Mono.Addins.MSBuild.dll /tmp/mono-addins/Mono.Addins.MSBuild/obj/Debug/Mono.Addins.MSBuild.dll /tmp/mono-addins/Mono.Addins.MSBuild/obj/Debug/Mono.Addins.MSBuild.dll.mdb mono-addins-1.0/Mono.Addins.MSBuild/ChangeLog0000664000175000017500000000306012136523632022767 0ustar00directhexdirecthex000000000000002010-05-25 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: Fix output directory for the Release configuration. 2010-05-21 Andrew Jorgensen * Makefile.am: Add Mono.Addins.targets to EXTRAS 2010-03-30 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: Make sure the solution builds on MS.NET 2.0. 2010-03-26 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: Flush. 2010-03-01 Lluis Sanchez Gual * Mono.Addins.targets: * ResolveAddinReferences.cs: The target application is now specified using the ExtensionDomain property. Addin references now use a colon as version separator. * Makefile.am: Install the .targets file to the xbuild dir. 2009-09-01 Lluis Sanchez Gual * AssemblyInfo.cs: Bump Mono.Addins version. 2009-08-25 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: Added Default configuration. 2009-08-24 Lluis Sanchez Gual * Mono.Addins.MSBuild.csproj: Fix build. 2009-08-21 Lluis Sanchez Gual * ResolveAddinReferences.cs: Track api changes. 2009-08-20 Lluis Sanchez Gual * Makefile.am: * AssemblyInfo.cs: * Mono.Addins.targets: * mono-addins-msbuild.pc.in: * ResolveAddinReferences.cs: * Mono.Addins.MSBuild.csproj: Added a new project which Implements an msbuild task for resolving add-in references. mono-addins-1.0/Mono.Addins.MSBuild/policy.0.6.config0000664000175000017500000000055612136524033024210 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.MSBuild/mono-addins-msbuild.pc.in0000664000175000017500000000043612136523632026017 0ustar00directhexdirecthex00000000000000prefix=${pcfiledir}/../.. exec_prefix=${prefix} pkglibdir=${prefix}/lib/mono/@PACKAGE@ Libraries=${pkglibdir}/@MONO_ADDINS_MSBUILD_DEFAULT_LIB@ Name: Mono.Addins.MSBuild Description: Version: @VERSION@ Requires: mono-addins Libs: -r:${pkglibdir}/@MONO_ADDINS_MSBUILD_DEFAULT_LIB@ mono-addins-1.0/Mono.Addins.MSBuild/policy.0.4.config0000664000175000017500000000055612136524032024205 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.MSBuild/policy.0.2.config0000664000175000017500000000055612136524032024203 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.MSBuild/ResolveAddinReferences.cs0000664000175000017500000000563212136523632026134 0ustar00directhexdirecthex00000000000000// // ResolveAddinReferences.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using Microsoft.Build.Utilities; using Microsoft.Build.Framework; using Mono.Addins; using Mono.Addins.Setup; using System.IO; namespace Mono.Addins.MSBuild { public class ResolveAddinReferences: Task { List references = new List (); ITaskItem[] addinReferences; string extensionDomain; public override bool Execute () { if (string.IsNullOrEmpty (extensionDomain)) { Log.LogError ("ExtensionDomain item not found"); return false; } if (addinReferences == null) { return true; } Application app = SetupService.GetExtensibleApplication (extensionDomain); if (app == null) { Log.LogError ("Extension domain '{0}' not found", extensionDomain); return false; } foreach (ITaskItem item in addinReferences) { string addinId = item.ItemSpec.Replace (':',','); Addin addin = app.Registry.GetAddin (addinId); if (addin == null) { Log.LogError ("Add-in '{0}' not found", addinId); return false; } if (addin.Description == null) { Log.LogError ("Add-in '{0}' could not be loaded", addinId); return false; } foreach (string asm in addin.Description.MainModule.Assemblies) { string file = Path.Combine (addin.Description.BasePath, asm); TaskItem ti = new TaskItem (file); references.Add (ti); } } return true; } public ITaskItem[] AddinReferences { get { return addinReferences; } set { addinReferences = value; } } public string ExtensionDomain { get { return extensionDomain; } set { extensionDomain = value; } } [Output] public ITaskItem[] References { get { return references.ToArray (); } } } } mono-addins-1.0/makefile-sample.include0000664000175000017500000000155012136523632022211 0ustar00directhexdirecthex00000000000000build_sources = $(addprefix $(srcdir)/, $(FILES) $(GENERATED_FILES)) build_resources = $(addprefix $(srcdir)/, $(RESOURCES)) build_resources_embed = $(foreach res,$(build_resources), $(addprefix -resource:,$(res)),$(RESOURCES_PREFIX)$(notdir $(res))) build_references_ref = $(REFERENCES) build_references_ref += $(foreach ref, $(DLL_REFERENCES), -r:$(ref)) build_references_ref += $(foreach ref, $(PROJECT_REFERENCES), -r:$(ref)) pc_files = $(PC_FILES_IN:.pc.in=.pc) build_datafiles = $(addprefix $(BUILD_DIR)/, $(DATA_FILES)) $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ EXTRA_DIST = $(FILES) $(GENERATED_FILES) $(RESOURCES) $(ASSEMBLY_WRAPPER_IN) $(EXTRAS) $(DATA_FILES) $(PC_FILES_IN) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) mono-addins-1.0/Makefile.include0000664000175000017500000000261512136523632020675 0ustar00directhexdirecthex00000000000000pc_files = $(PC_FILES_IN:.pc.in=.pc) POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) $(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) mkdir -p $(dir $@) cp $< $@ policy.%.config: $(top_builddir)/policy.config sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ $(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk gac-install: $(POLICY_ASSEMBLIES) $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done gac-uninstall: $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @for p in $(POLICY_ASSEMBLIES); do \ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ done EXTRA_DIST = $(ASSEMBLY_WRAPPER_IN) $(PC_FILES_IN) CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb $(DLL_REFERENCES) DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) bin_SCRIPTS = $(ASSEMBLY_WRAPPER) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = $(pc_files) mono-addins-1.0/AUTHORS0000664000175000017500000000005512136523632016657 0ustar00directhexdirecthex00000000000000 Lluis Sanchez Gual mono-addins-1.0/Mono.Addins.Gui/0000775000175000017500000000000012136524044020441 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/AssemblyInfo.cs0000664000175000017500000000116312136523632023366 0ustar00directhexdirecthex00000000000000using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following // attributes. // // change them to the information which is associated with the assembly // you compile. [assembly: AssemblyTitle("Mono.Addins.Gui")] [assembly: AssemblyCopyright("Copyright (C) 2007 Novell, Inc (http://www.novell.com)")] // The assembly version has following format : // // Major.Minor.Build.Revision // // You can specify all values by your own or you can build default build and revision // numbers with the '*' character (the default): [assembly: AssemblyVersion("1.0.0.0")] mono-addins-1.0/Mono.Addins.Gui/Makefile.am0000664000175000017500000000050312136523632022475 0ustar00directhexdirecthex00000000000000 ASSEMBLY = ../bin/Mono.Addins.Gui.dll ASSEMBLY_NAME=Mono.Addins.Gui PC_FILES_IN = mono-addins-gui.pc.in if ENABLE_GUI install-data-local: gac-install uninstall-local: gac-uninstall include $(top_srcdir)/Makefile.include include $(top_srcdir)/xbuild.include CLEANFILES += $(POLICY_ASSEMBLIES) $(POLICY_CONFIGS) endif mono-addins-1.0/Mono.Addins.Gui/gtk-gui/0000775000175000017500000000000012136524044022010 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs0000664000175000017500000004647112136523632030642 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class AddinManagerDialog { private global::Gtk.VBox vbox93; private global::Gtk.HBox hbox65; private global::Gtk.HBox hbox72; private global::Gtk.Notebook notebook; private global::Gtk.HBox hbox2; private global::Gtk.VBox vbox6; private global::Gtk.ScrolledWindow scrolledwindow13; private global::Gtk.TreeView addinTree; private global::Gtk.EventBox eventbox2; private global::Mono.Addins.Gui.AddinInfoView addininfoInstalled; private global::Gtk.Label label7; private global::Gtk.HBox boxUpdates; private global::Gtk.VBox vboxUpdates; private global::Gtk.EventBox eboxRepoUpdates; private global::Gtk.HBox hbox67; private global::Gtk.Label labelUpdates; private global::Gtk.Button buttonRefreshUpdates; private global::Gtk.Button buttonUpdateAll; private global::Gtk.ScrolledWindow scrolledUpdates; private global::Gtk.TreeView updatesTreeView; private global::Gtk.EventBox eventbox3; private global::Mono.Addins.Gui.AddinInfoView addininfoUpdates; private global::Gtk.Label label4; private global::Gtk.HBox hbox6; private global::Gtk.VBox vboxGallery; private global::Gtk.EventBox eboxRepo; private global::Gtk.HBox hbox66; private global::Gtk.Label label112; private global::Gtk.ComboBox repoCombo; private global::Gtk.Button buttonRefresh; private global::Gtk.ScrolledWindow scrolledGallery; private global::Gtk.TreeView galleryTreeView; private global::Gtk.EventBox eventbox1; private global::Mono.Addins.Gui.AddinInfoView addininfoGallery; private global::Gtk.Label label8; private global::Gtk.Button buttonInstallFromFile; private global::Gtk.Button btnClose; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.AddinManagerDialog this.Name = "Mono.Addins.Gui.AddinManagerDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Add-in Manager"); this.TypeHint = ((global::Gdk.WindowTypeHint)(1)); this.BorderWidth = ((uint)(6)); this.DefaultWidth = 700; this.DefaultHeight = 550; // Internal child Mono.Addins.Gui.AddinManagerDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog-vbox8"; w1.Spacing = 3; w1.BorderWidth = ((uint)(2)); // Container child dialog-vbox8.Gtk.Box+BoxChild this.vbox93 = new global::Gtk.VBox (); this.vbox93.Name = "vbox93"; this.vbox93.Spacing = 6; this.vbox93.BorderWidth = ((uint)(6)); // Container child vbox93.Gtk.Box+BoxChild this.hbox65 = new global::Gtk.HBox (); this.hbox65.Name = "hbox65"; this.hbox65.Spacing = 12; // Container child hbox65.Gtk.Box+BoxChild this.hbox72 = new global::Gtk.HBox (); this.hbox72.Name = "hbox72"; this.hbox72.Spacing = 12; // Container child hbox72.Gtk.Box+BoxChild this.notebook = new global::Gtk.Notebook (); this.notebook.CanFocus = true; this.notebook.Name = "notebook"; this.notebook.CurrentPage = 0; this.notebook.ShowBorder = false; // Container child notebook.Gtk.Notebook+NotebookChild this.hbox2 = new global::Gtk.HBox (); this.hbox2.Name = "hbox2"; this.hbox2.Spacing = 9; this.hbox2.BorderWidth = ((uint)(9)); // Container child hbox2.Gtk.Box+BoxChild this.vbox6 = new global::Gtk.VBox (); this.vbox6.Name = "vbox6"; this.vbox6.Spacing = 6; // Container child vbox6.Gtk.Box+BoxChild this.scrolledwindow13 = new global::Gtk.ScrolledWindow (); this.scrolledwindow13.CanFocus = true; this.scrolledwindow13.Name = "scrolledwindow13"; this.scrolledwindow13.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledwindow13.Gtk.Container+ContainerChild this.addinTree = new global::Gtk.TreeView (); this.addinTree.CanFocus = true; this.addinTree.Name = "addinTree"; this.scrolledwindow13.Add (this.addinTree); this.vbox6.Add (this.scrolledwindow13); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.scrolledwindow13])); w3.Position = 0; this.hbox2.Add (this.vbox6); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.vbox6])); w4.Position = 0; // Container child hbox2.Gtk.Box+BoxChild this.eventbox2 = new global::Gtk.EventBox (); this.eventbox2.Name = "eventbox2"; // Container child eventbox2.Gtk.Container+ContainerChild this.addininfoInstalled = new global::Mono.Addins.Gui.AddinInfoView (); this.addininfoInstalled.Events = ((global::Gdk.EventMask)(256)); this.addininfoInstalled.Name = "addininfoInstalled"; this.addininfoInstalled.AllowInstall = false; this.eventbox2.Add (this.addininfoInstalled); this.hbox2.Add (this.eventbox2); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.eventbox2])); w6.Position = 1; w6.Expand = false; w6.Fill = false; this.notebook.Add (this.hbox2); // Notebook tab this.label7 = new global::Gtk.Label (); this.label7.Name = "label7"; this.label7.LabelProp = global::Mono.Unix.Catalog.GetString ("Installed"); this.notebook.SetTabLabel (this.hbox2, this.label7); this.label7.ShowAll (); // Container child notebook.Gtk.Notebook+NotebookChild this.boxUpdates = new global::Gtk.HBox (); this.boxUpdates.Name = "boxUpdates"; this.boxUpdates.Spacing = 9; this.boxUpdates.BorderWidth = ((uint)(9)); // Container child boxUpdates.Gtk.Box+BoxChild this.vboxUpdates = new global::Gtk.VBox (); this.vboxUpdates.Name = "vboxUpdates"; // Container child vboxUpdates.Gtk.Box+BoxChild this.eboxRepoUpdates = new global::Gtk.EventBox (); this.eboxRepoUpdates.Name = "eboxRepoUpdates"; // Container child eboxRepoUpdates.Gtk.Container+ContainerChild this.hbox67 = new global::Gtk.HBox (); this.hbox67.Name = "hbox67"; this.hbox67.Spacing = 6; // Container child hbox67.Gtk.Box+BoxChild this.labelUpdates = new global::Gtk.Label (); this.labelUpdates.Name = "labelUpdates"; this.labelUpdates.LabelProp = global::Mono.Unix.Catalog.GetString ("No updates found"); this.hbox67.Add (this.labelUpdates); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.labelUpdates])); w8.Position = 0; w8.Expand = false; w8.Fill = false; // Container child hbox67.Gtk.Box+BoxChild this.buttonRefreshUpdates = new global::Gtk.Button (); this.buttonRefreshUpdates.CanFocus = true; this.buttonRefreshUpdates.Name = "buttonRefreshUpdates"; this.buttonRefreshUpdates.UseUnderline = true; this.buttonRefreshUpdates.Relief = ((global::Gtk.ReliefStyle)(2)); // Container child buttonRefreshUpdates.Gtk.Container+ContainerChild global::Gtk.Alignment w9 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w10 = new global::Gtk.HBox (); w10.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w11 = new global::Gtk.Image (); w11.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-refresh", global::Gtk.IconSize.Menu); w10.Add (w11); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w13 = new global::Gtk.Label (); w13.LabelProp = global::Mono.Unix.Catalog.GetString ("Refresh"); w13.UseUnderline = true; w10.Add (w13); w9.Add (w10); this.buttonRefreshUpdates.Add (w9); this.hbox67.Add (this.buttonRefreshUpdates); global::Gtk.Box.BoxChild w17 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.buttonRefreshUpdates])); w17.PackType = ((global::Gtk.PackType)(1)); w17.Position = 1; w17.Expand = false; w17.Fill = false; // Container child hbox67.Gtk.Box+BoxChild this.buttonUpdateAll = new global::Gtk.Button (); this.buttonUpdateAll.CanFocus = true; this.buttonUpdateAll.Name = "buttonUpdateAll"; this.buttonUpdateAll.UseUnderline = true; this.buttonUpdateAll.Relief = ((global::Gtk.ReliefStyle)(2)); // Container child buttonUpdateAll.Gtk.Container+ContainerChild global::Gtk.Alignment w18 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w19 = new global::Gtk.HBox (); w19.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w20 = new global::Gtk.Image (); w20.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download.png"); w19.Add (w20); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w22 = new global::Gtk.Label (); w22.LabelProp = global::Mono.Unix.Catalog.GetString ("Update All"); w22.UseUnderline = true; w19.Add (w22); w18.Add (w19); this.buttonUpdateAll.Add (w18); this.hbox67.Add (this.buttonUpdateAll); global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.buttonUpdateAll])); w26.PackType = ((global::Gtk.PackType)(1)); w26.Position = 2; w26.Expand = false; w26.Fill = false; this.eboxRepoUpdates.Add (this.hbox67); this.vboxUpdates.Add (this.eboxRepoUpdates); global::Gtk.Box.BoxChild w28 = ((global::Gtk.Box.BoxChild)(this.vboxUpdates [this.eboxRepoUpdates])); w28.Position = 0; w28.Expand = false; w28.Fill = false; // Container child vboxUpdates.Gtk.Box+BoxChild this.scrolledUpdates = new global::Gtk.ScrolledWindow (); this.scrolledUpdates.CanFocus = true; this.scrolledUpdates.Name = "scrolledUpdates"; this.scrolledUpdates.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledUpdates.Gtk.Container+ContainerChild this.updatesTreeView = new global::Gtk.TreeView (); this.updatesTreeView.CanFocus = true; this.updatesTreeView.Name = "updatesTreeView"; this.scrolledUpdates.Add (this.updatesTreeView); this.vboxUpdates.Add (this.scrolledUpdates); global::Gtk.Box.BoxChild w30 = ((global::Gtk.Box.BoxChild)(this.vboxUpdates [this.scrolledUpdates])); w30.Position = 1; this.boxUpdates.Add (this.vboxUpdates); global::Gtk.Box.BoxChild w31 = ((global::Gtk.Box.BoxChild)(this.boxUpdates [this.vboxUpdates])); w31.Position = 0; // Container child boxUpdates.Gtk.Box+BoxChild this.eventbox3 = new global::Gtk.EventBox (); this.eventbox3.Name = "eventbox3"; // Container child eventbox3.Gtk.Container+ContainerChild this.addininfoUpdates = new global::Mono.Addins.Gui.AddinInfoView (); this.addininfoUpdates.Events = ((global::Gdk.EventMask)(256)); this.addininfoUpdates.Name = "addininfoUpdates"; this.addininfoUpdates.AllowInstall = false; this.eventbox3.Add (this.addininfoUpdates); this.boxUpdates.Add (this.eventbox3); global::Gtk.Box.BoxChild w33 = ((global::Gtk.Box.BoxChild)(this.boxUpdates [this.eventbox3])); w33.Position = 1; w33.Expand = false; w33.Fill = false; this.notebook.Add (this.boxUpdates); global::Gtk.Notebook.NotebookChild w34 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.boxUpdates])); w34.Position = 1; // Notebook tab this.label4 = new global::Gtk.Label (); this.label4.Name = "label4"; this.label4.LabelProp = global::Mono.Unix.Catalog.GetString ("Updates"); this.notebook.SetTabLabel (this.boxUpdates, this.label4); this.label4.ShowAll (); // Container child notebook.Gtk.Notebook+NotebookChild this.hbox6 = new global::Gtk.HBox (); this.hbox6.Name = "hbox6"; this.hbox6.Spacing = 9; this.hbox6.BorderWidth = ((uint)(9)); // Container child hbox6.Gtk.Box+BoxChild this.vboxGallery = new global::Gtk.VBox (); this.vboxGallery.Name = "vboxGallery"; // Container child vboxGallery.Gtk.Box+BoxChild this.eboxRepo = new global::Gtk.EventBox (); this.eboxRepo.Name = "eboxRepo"; // Container child eboxRepo.Gtk.Container+ContainerChild this.hbox66 = new global::Gtk.HBox (); this.hbox66.Name = "hbox66"; this.hbox66.Spacing = 6; // Container child hbox66.Gtk.Box+BoxChild this.label112 = new global::Gtk.Label (); this.label112.Name = "label112"; this.label112.LabelProp = global::Mono.Unix.Catalog.GetString ("Repository:"); this.hbox66.Add (this.label112); global::Gtk.Box.BoxChild w35 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.label112])); w35.Position = 0; w35.Expand = false; w35.Fill = false; // Container child hbox66.Gtk.Box+BoxChild this.repoCombo = new global::Gtk.ComboBox (); this.repoCombo.Name = "repoCombo"; this.hbox66.Add (this.repoCombo); global::Gtk.Box.BoxChild w36 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.repoCombo])); w36.Position = 1; // Container child hbox66.Gtk.Box+BoxChild this.buttonRefresh = new global::Gtk.Button (); this.buttonRefresh.CanFocus = true; this.buttonRefresh.Name = "buttonRefresh"; this.buttonRefresh.UseUnderline = true; this.buttonRefresh.Relief = ((global::Gtk.ReliefStyle)(2)); // Container child buttonRefresh.Gtk.Container+ContainerChild global::Gtk.Alignment w37 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w38 = new global::Gtk.HBox (); w38.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w39 = new global::Gtk.Image (); w39.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-refresh", global::Gtk.IconSize.Menu); w38.Add (w39); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w41 = new global::Gtk.Label (); w38.Add (w41); w37.Add (w38); this.buttonRefresh.Add (w37); this.hbox66.Add (this.buttonRefresh); global::Gtk.Box.BoxChild w45 = ((global::Gtk.Box.BoxChild)(this.hbox66 [this.buttonRefresh])); w45.Position = 2; w45.Expand = false; w45.Fill = false; this.eboxRepo.Add (this.hbox66); this.vboxGallery.Add (this.eboxRepo); global::Gtk.Box.BoxChild w47 = ((global::Gtk.Box.BoxChild)(this.vboxGallery [this.eboxRepo])); w47.Position = 0; w47.Expand = false; w47.Fill = false; // Container child vboxGallery.Gtk.Box+BoxChild this.scrolledGallery = new global::Gtk.ScrolledWindow (); this.scrolledGallery.CanFocus = true; this.scrolledGallery.Name = "scrolledGallery"; this.scrolledGallery.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledGallery.Gtk.Container+ContainerChild this.galleryTreeView = new global::Gtk.TreeView (); this.galleryTreeView.CanFocus = true; this.galleryTreeView.Name = "galleryTreeView"; this.scrolledGallery.Add (this.galleryTreeView); this.vboxGallery.Add (this.scrolledGallery); global::Gtk.Box.BoxChild w49 = ((global::Gtk.Box.BoxChild)(this.vboxGallery [this.scrolledGallery])); w49.Position = 1; this.hbox6.Add (this.vboxGallery); global::Gtk.Box.BoxChild w50 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.vboxGallery])); w50.Position = 0; // Container child hbox6.Gtk.Box+BoxChild this.eventbox1 = new global::Gtk.EventBox (); this.eventbox1.Name = "eventbox1"; // Container child eventbox1.Gtk.Container+ContainerChild this.addininfoGallery = new global::Mono.Addins.Gui.AddinInfoView (); this.addininfoGallery.Events = ((global::Gdk.EventMask)(256)); this.addininfoGallery.Name = "addininfoGallery"; this.addininfoGallery.AllowInstall = false; this.eventbox1.Add (this.addininfoGallery); this.hbox6.Add (this.eventbox1); global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox6 [this.eventbox1])); w52.Position = 1; w52.Expand = false; w52.Fill = false; this.notebook.Add (this.hbox6); global::Gtk.Notebook.NotebookChild w53 = ((global::Gtk.Notebook.NotebookChild)(this.notebook [this.hbox6])); w53.Position = 2; // Notebook tab this.label8 = new global::Gtk.Label (); this.label8.Name = "label8"; this.label8.LabelProp = global::Mono.Unix.Catalog.GetString ("Gallery"); this.notebook.SetTabLabel (this.hbox6, this.label8); this.label8.ShowAll (); this.hbox72.Add (this.notebook); global::Gtk.Box.BoxChild w54 = ((global::Gtk.Box.BoxChild)(this.hbox72 [this.notebook])); w54.Position = 0; this.hbox65.Add (this.hbox72); global::Gtk.Box.BoxChild w55 = ((global::Gtk.Box.BoxChild)(this.hbox65 [this.hbox72])); w55.Position = 0; this.vbox93.Add (this.hbox65); global::Gtk.Box.BoxChild w56 = ((global::Gtk.Box.BoxChild)(this.vbox93 [this.hbox65])); w56.Position = 0; w1.Add (this.vbox93); global::Gtk.Box.BoxChild w57 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox93])); w57.Position = 0; // Internal child Mono.Addins.Gui.AddinManagerDialog.ActionArea global::Gtk.HButtonBox w58 = this.ActionArea; w58.Name = "dialog-action_area8"; w58.Spacing = 6; w58.BorderWidth = ((uint)(5)); w58.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(2)); // Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild this.buttonInstallFromFile = new global::Gtk.Button (); this.buttonInstallFromFile.CanFocus = true; this.buttonInstallFromFile.Name = "buttonInstallFromFile"; this.buttonInstallFromFile.UseUnderline = true; this.buttonInstallFromFile.Label = global::Mono.Unix.Catalog.GetString ("Install from file..."); w58.Add (this.buttonInstallFromFile); global::Gtk.ButtonBox.ButtonBoxChild w59 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w58 [this.buttonInstallFromFile])); w59.Expand = false; w59.Fill = false; // Container child dialog-action_area8.Gtk.ButtonBox+ButtonBoxChild this.btnClose = new global::Gtk.Button (); this.btnClose.CanDefault = true; this.btnClose.CanFocus = true; this.btnClose.Name = "btnClose"; this.btnClose.UseStock = true; this.btnClose.UseUnderline = true; this.btnClose.Label = "gtk-close"; this.AddActionWidget (this.btnClose, -7); global::Gtk.ButtonBox.ButtonBoxChild w60 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w58 [this.btnClose])); w60.Position = 1; w60.Expand = false; w60.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.Hide (); this.addininfoInstalled.InstallClicked += new global::System.EventHandler (this.OnInstallClicked); this.addininfoInstalled.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked); this.addininfoInstalled.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked); this.addininfoInstalled.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked); this.buttonUpdateAll.Clicked += new global::System.EventHandler (this.OnUpdateAll); this.buttonRefreshUpdates.Clicked += new global::System.EventHandler (this.OnButtonRefreshClicked); this.addininfoUpdates.InstallClicked += new global::System.EventHandler (this.OnInstallClicked); this.addininfoUpdates.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked); this.addininfoUpdates.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked); this.addininfoUpdates.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked); this.repoCombo.Changed += new global::System.EventHandler (this.OnRepoComboChanged); this.buttonRefresh.Clicked += new global::System.EventHandler (this.OnButtonRefreshClicked); this.addininfoGallery.InstallClicked += new global::System.EventHandler (this.OnInstallClicked); this.addininfoGallery.UninstallClicked += new global::System.EventHandler (this.OnUninstallClicked); this.addininfoGallery.UpdateClicked += new global::System.EventHandler (this.OnUpdateClicked); this.addininfoGallery.EnableDisableClicked += new global::System.EventHandler (this.OnEnableDisableClicked); this.buttonInstallFromFile.Clicked += new global::System.EventHandler (this.OnButtonInstallFromFileClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs0000664000175000017500000001210012136523632031203 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class AddinInstallerDialog { private global::Gtk.VBox vbox2; private global::Gtk.Label label1; private global::Gtk.Label label2; private global::Gtk.ScrolledWindow scrolledwindow1; private global::Gtk.Label addinList; private global::Gtk.ProgressBar progressBar; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.AddinInstallerDialog this.Name = "Mono.Addins.Gui.AddinInstallerDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Add-in Manager"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); this.BorderWidth = ((uint)(6)); // Internal child Mono.Addins.Gui.AddinInstallerDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.Spacing = 6; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.vbox2 = new global::Gtk.VBox (); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; this.vbox2.BorderWidth = ((uint)(6)); // Container child vbox2.Gtk.Box+BoxChild this.label1 = new global::Gtk.Label (); this.label1.Name = "label1"; this.label1.Xalign = 0F; this.label1.LabelProp = global::Mono.Unix.Catalog.GetString ("Additional extensions are required to perform this operation."); this.vbox2.Add (this.label1); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label1])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.label2 = new global::Gtk.Label (); this.label2.Name = "label2"; this.label2.Xalign = 0F; this.label2.LabelProp = global::Mono.Unix.Catalog.GetString ("The following add-ins will be installed:"); this.vbox2.Add (this.label2); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.label2])); w3.Position = 1; w3.Expand = false; w3.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.scrolledwindow1 = new global::Gtk.ScrolledWindow (); this.scrolledwindow1.CanFocus = true; this.scrolledwindow1.Name = "scrolledwindow1"; this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledwindow1.Gtk.Container+ContainerChild global::Gtk.Viewport w4 = new global::Gtk.Viewport (); w4.ShadowType = ((global::Gtk.ShadowType)(0)); // Container child GtkViewport.Gtk.Container+ContainerChild this.addinList = new global::Gtk.Label (); this.addinList.Name = "addinList"; this.addinList.Xpad = 6; this.addinList.Ypad = 6; this.addinList.Xalign = 0F; this.addinList.Yalign = 0F; this.addinList.LabelProp = "label3"; w4.Add (this.addinList); this.scrolledwindow1.Add (w4); this.vbox2.Add (this.scrolledwindow1); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.scrolledwindow1])); w7.Position = 2; // Container child vbox2.Gtk.Box+BoxChild this.progressBar = new global::Gtk.ProgressBar (); this.progressBar.Name = "progressBar"; this.progressBar.Text = ""; this.vbox2.Add (this.progressBar); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.progressBar])); w8.Position = 3; w8.Expand = false; w8.Fill = false; w1.Add (this.vbox2); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2])); w9.Position = 0; // Internal child Mono.Addins.Gui.AddinInstallerDialog.ActionArea global::Gtk.HButtonBox w10 = this.ActionArea; w10.Name = "dialog1_ActionArea"; w10.Spacing = 10; w10.BorderWidth = ((uint)(6)); w10.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new global::Gtk.Button (); this.buttonCancel.CanDefault = true; this.buttonCancel.CanFocus = true; this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.UseStock = true; this.buttonCancel.UseUnderline = true; this.buttonCancel.Label = "gtk-cancel"; this.AddActionWidget (this.buttonCancel, -6); global::Gtk.ButtonBox.ButtonBoxChild w11 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.buttonCancel])); w11.Expand = false; w11.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new global::Gtk.Button (); this.buttonOk.CanDefault = true; this.buttonOk.CanFocus = true; this.buttonOk.Name = "buttonOk"; this.buttonOk.UseStock = true; this.buttonOk.UseUnderline = true; this.buttonOk.Label = "gtk-ok"; w10.Add (this.buttonOk); global::Gtk.ButtonBox.ButtonBoxChild w12 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.buttonOk])); w12.Position = 1; w12.Expand = false; w12.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 593; this.DefaultHeight = 433; this.progressBar.Hide (); this.Show (); this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.InstallDialog.cs0000664000175000017500000001353612136523632027732 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class InstallDialog { private global::Gtk.VBox vbox3; private global::Gtk.ScrolledWindow scrolledwindow1; private global::Gtk.VBox vbox4; private global::Gtk.Label labelInfo; private global::Gtk.HSeparator insSeparator; private global::Gtk.VBox boxProgress; private global::Gtk.Label globalProgressLabel; private global::Gtk.ProgressBar mainProgressBar; private global::Gtk.Button buttonCancel; private global::Gtk.Button buttonOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.InstallDialog this.Name = "Mono.Addins.Gui.InstallDialog"; this.WindowPosition = ((global::Gtk.WindowPosition)(4)); // Internal child Mono.Addins.Gui.InstallDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.vbox3 = new global::Gtk.VBox (); this.vbox3.Name = "vbox3"; this.vbox3.Spacing = 9; this.vbox3.BorderWidth = ((uint)(9)); // Container child vbox3.Gtk.Box+BoxChild this.scrolledwindow1 = new global::Gtk.ScrolledWindow (); this.scrolledwindow1.CanFocus = true; this.scrolledwindow1.Name = "scrolledwindow1"; this.scrolledwindow1.VscrollbarPolicy = ((global::Gtk.PolicyType)(2)); this.scrolledwindow1.HscrollbarPolicy = ((global::Gtk.PolicyType)(2)); // Container child scrolledwindow1.Gtk.Container+ContainerChild global::Gtk.Viewport w2 = new global::Gtk.Viewport (); w2.ShadowType = ((global::Gtk.ShadowType)(0)); // Container child GtkViewport.Gtk.Container+ContainerChild this.vbox4 = new global::Gtk.VBox (); this.vbox4.Name = "vbox4"; this.vbox4.Spacing = 6; // Container child vbox4.Gtk.Box+BoxChild this.labelInfo = new global::Gtk.Label (); this.labelInfo.WidthRequest = 400; this.labelInfo.Name = "labelInfo"; this.labelInfo.Xalign = 0F; this.labelInfo.Yalign = 0F; this.labelInfo.LabelProp = global::Mono.Unix.Catalog.GetString ("label3"); this.labelInfo.Wrap = true; this.vbox4.Add (this.labelInfo); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelInfo])); w3.Position = 0; w3.Expand = false; w3.Fill = false; w2.Add (this.vbox4); this.scrolledwindow1.Add (w2); this.vbox3.Add (this.scrolledwindow1); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.scrolledwindow1])); w6.Position = 0; // Container child vbox3.Gtk.Box+BoxChild this.insSeparator = new global::Gtk.HSeparator (); this.insSeparator.Name = "insSeparator"; this.vbox3.Add (this.insSeparator); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.insSeparator])); w7.Position = 1; w7.Expand = false; w7.Fill = false; // Container child vbox3.Gtk.Box+BoxChild this.boxProgress = new global::Gtk.VBox (); this.boxProgress.Name = "boxProgress"; this.boxProgress.Spacing = 6; // Container child boxProgress.Gtk.Box+BoxChild this.globalProgressLabel = new global::Gtk.Label (); this.globalProgressLabel.Name = "globalProgressLabel"; this.globalProgressLabel.Xalign = 0F; this.globalProgressLabel.Ellipsize = ((global::Pango.EllipsizeMode)(3)); this.boxProgress.Add (this.globalProgressLabel); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.boxProgress [this.globalProgressLabel])); w8.Position = 0; w8.Expand = false; w8.Fill = false; // Container child boxProgress.Gtk.Box+BoxChild this.mainProgressBar = new global::Gtk.ProgressBar (); this.mainProgressBar.Name = "mainProgressBar"; this.boxProgress.Add (this.mainProgressBar); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.boxProgress [this.mainProgressBar])); w9.Position = 1; w9.Expand = false; w9.Fill = false; this.vbox3.Add (this.boxProgress); global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.boxProgress])); w10.Position = 2; w10.Expand = false; w10.Fill = false; w1.Add (this.vbox3); global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox3])); w11.Position = 0; // Internal child Mono.Addins.Gui.InstallDialog.ActionArea global::Gtk.HButtonBox w12 = this.ActionArea; w12.Name = "dialog1_ActionArea"; w12.Spacing = 10; w12.BorderWidth = ((uint)(5)); w12.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new global::Gtk.Button (); this.buttonCancel.CanDefault = true; this.buttonCancel.CanFocus = true; this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.UseStock = true; this.buttonCancel.UseUnderline = true; this.buttonCancel.Label = "gtk-cancel"; w12.Add (this.buttonCancel); global::Gtk.ButtonBox.ButtonBoxChild w13 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonCancel])); w13.Expand = false; w13.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new global::Gtk.Button (); this.buttonOk.CanDefault = true; this.buttonOk.CanFocus = true; this.buttonOk.Name = "buttonOk"; this.buttonOk.UseUnderline = true; this.buttonOk.Label = global::Mono.Unix.Catalog.GetString ("Install"); w12.Add (this.buttonOk); global::Gtk.ButtonBox.ButtonBoxChild w14 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w12 [this.buttonOk])); w14.Position = 1; w14.Expand = false; w14.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 494; this.DefaultHeight = 239; this.insSeparator.Hide (); this.Hide (); this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked); this.buttonOk.Clicked += new global::System.EventHandler (this.OnButtonOkClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.AddinInfoView.cs0000664000175000017500000003153112136523632027665 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class AddinInfoView { private global::Gtk.EventBox ebox; private global::Gtk.VBox vbox6; private global::Gtk.EventBox boxHeader; private global::Gtk.HBox hbox2; private global::Gtk.Image imageHeader; private global::Gtk.Label labelHeader; private global::Gtk.VBox vbox3; private global::Gtk.HBox headerBox; private global::Gtk.HBox boxTitle; private global::Gtk.VBox vbox4; private global::Gtk.Label labelName; private global::Gtk.Label labelVersion; private global::Gtk.ScrolledWindow scrolledwindow; private global::Gtk.EventBox ebox2; private global::Gtk.VBox vboxDesc; private global::Gtk.Label labelDesc; private global::Gtk.HBox hbox3; private global::Gtk.Button urlButton; private global::Gtk.EventBox eboxButs; private global::Gtk.HBox hbox1; private global::Gtk.Button btnInstall; private global::Gtk.Button btnUpdate; private global::Gtk.Button btnDisable; private global::Gtk.Button btnUninstall; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.AddinInfoView global::Stetic.BinContainer.Attach (this); this.Name = "Mono.Addins.Gui.AddinInfoView"; // Container child Mono.Addins.Gui.AddinInfoView.Gtk.Container+ContainerChild this.ebox = new global::Gtk.EventBox (); this.ebox.Name = "ebox"; // Container child ebox.Gtk.Container+ContainerChild this.vbox6 = new global::Gtk.VBox (); this.vbox6.Name = "vbox6"; // Container child vbox6.Gtk.Box+BoxChild this.boxHeader = new global::Gtk.EventBox (); this.boxHeader.Name = "boxHeader"; // Container child boxHeader.Gtk.Container+ContainerChild this.hbox2 = new global::Gtk.HBox (); this.hbox2.Name = "hbox2"; this.hbox2.Spacing = 6; // Container child hbox2.Gtk.Box+BoxChild this.imageHeader = new global::Gtk.Image (); this.imageHeader.Name = "imageHeader"; this.imageHeader.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-dialog-warning", global::Gtk.IconSize.Menu); this.hbox2.Add (this.imageHeader); global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.imageHeader])); w1.Position = 0; w1.Expand = false; w1.Fill = false; // Container child hbox2.Gtk.Box+BoxChild this.labelHeader = new global::Gtk.Label (); this.labelHeader.WidthRequest = 250; this.labelHeader.Name = "labelHeader"; this.labelHeader.Xalign = 0F; this.labelHeader.LabelProp = global::Mono.Unix.Catalog.GetString ("label1"); this.labelHeader.Wrap = true; this.hbox2.Add (this.labelHeader); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.hbox2 [this.labelHeader])); w2.Position = 1; w2.Expand = false; w2.Fill = false; this.boxHeader.Add (this.hbox2); this.vbox6.Add (this.boxHeader); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.boxHeader])); w4.Position = 0; w4.Expand = false; w4.Fill = false; // Container child vbox6.Gtk.Box+BoxChild this.vbox3 = new global::Gtk.VBox (); this.vbox3.Name = "vbox3"; this.vbox3.Spacing = 6; this.vbox3.BorderWidth = ((uint)(12)); // Container child vbox3.Gtk.Box+BoxChild this.headerBox = new global::Gtk.HBox (); this.headerBox.Name = "headerBox"; this.headerBox.Spacing = 6; // Container child headerBox.Gtk.Box+BoxChild this.boxTitle = new global::Gtk.HBox (); this.boxTitle.Name = "boxTitle"; this.boxTitle.Spacing = 6; // Container child boxTitle.Gtk.Box+BoxChild this.vbox4 = new global::Gtk.VBox (); this.vbox4.Name = "vbox4"; this.vbox4.Spacing = 3; // Container child vbox4.Gtk.Box+BoxChild this.labelName = new global::Gtk.Label (); this.labelName.WidthRequest = 280; this.labelName.Name = "labelName"; this.labelName.Xalign = 0F; this.labelName.LabelProp = global::Mono.Unix.Catalog.GetString ("Some Addin"); this.labelName.UseMarkup = true; this.labelName.Wrap = true; this.vbox4.Add (this.labelName); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelName])); w5.Position = 0; w5.Expand = false; w5.Fill = false; // Container child vbox4.Gtk.Box+BoxChild this.labelVersion = new global::Gtk.Label (); this.labelVersion.WidthRequest = 280; this.labelVersion.Name = "labelVersion"; this.labelVersion.Xalign = 0F; this.labelVersion.LabelProp = global::Mono.Unix.Catalog.GetString ("Version 2.6"); this.labelVersion.Wrap = true; this.vbox4.Add (this.labelVersion); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox4 [this.labelVersion])); w6.Position = 1; w6.Expand = false; w6.Fill = false; this.boxTitle.Add (this.vbox4); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.boxTitle [this.vbox4])); w7.Position = 0; w7.Expand = false; w7.Fill = false; this.headerBox.Add (this.boxTitle); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.headerBox [this.boxTitle])); w8.Position = 0; this.vbox3.Add (this.headerBox); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.headerBox])); w9.Position = 0; w9.Expand = false; w9.Fill = false; // Container child vbox3.Gtk.Box+BoxChild this.scrolledwindow = new global::Gtk.ScrolledWindow (); this.scrolledwindow.CanFocus = true; this.scrolledwindow.Name = "scrolledwindow"; this.scrolledwindow.HscrollbarPolicy = ((global::Gtk.PolicyType)(2)); // Container child scrolledwindow.Gtk.Container+ContainerChild global::Gtk.Viewport w10 = new global::Gtk.Viewport (); w10.ShadowType = ((global::Gtk.ShadowType)(0)); // Container child GtkViewport.Gtk.Container+ContainerChild this.ebox2 = new global::Gtk.EventBox (); this.ebox2.Name = "ebox2"; // Container child ebox2.Gtk.Container+ContainerChild this.vboxDesc = new global::Gtk.VBox (); this.vboxDesc.Name = "vboxDesc"; this.vboxDesc.Spacing = 6; // Container child vboxDesc.Gtk.Box+BoxChild this.labelDesc = new global::Gtk.Label (); this.labelDesc.WidthRequest = 250; this.labelDesc.Name = "labelDesc"; this.labelDesc.Xalign = 0F; this.labelDesc.LabelProp = global::Mono.Unix.Catalog.GetString ("Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. "); this.labelDesc.Wrap = true; this.vboxDesc.Add (this.labelDesc); global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.vboxDesc [this.labelDesc])); w11.Position = 0; w11.Expand = false; w11.Fill = false; // Container child vboxDesc.Gtk.Box+BoxChild this.hbox3 = new global::Gtk.HBox (); this.hbox3.Name = "hbox3"; this.hbox3.Spacing = 6; // Container child hbox3.Gtk.Box+BoxChild this.urlButton = new global::Gtk.Button (); this.urlButton.CanFocus = true; this.urlButton.Name = "urlButton"; this.urlButton.UseUnderline = true; this.urlButton.Relief = ((global::Gtk.ReliefStyle)(2)); // Container child urlButton.Gtk.Container+ContainerChild global::Gtk.Alignment w12 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w13 = new global::Gtk.HBox (); w13.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w14 = new global::Gtk.Image (); w14.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("web.png"); w13.Add (w14); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w16 = new global::Gtk.Label (); w16.LabelProp = global::Mono.Unix.Catalog.GetString ("More information"); w16.UseUnderline = true; w13.Add (w16); w12.Add (w13); this.urlButton.Add (w12); this.hbox3.Add (this.urlButton); global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.hbox3 [this.urlButton])); w20.Position = 0; w20.Expand = false; w20.Fill = false; this.vboxDesc.Add (this.hbox3); global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vboxDesc [this.hbox3])); w21.PackType = ((global::Gtk.PackType)(1)); w21.Position = 2; w21.Expand = false; w21.Fill = false; this.ebox2.Add (this.vboxDesc); w10.Add (this.ebox2); this.scrolledwindow.Add (w10); this.vbox3.Add (this.scrolledwindow); global::Gtk.Box.BoxChild w25 = ((global::Gtk.Box.BoxChild)(this.vbox3 [this.scrolledwindow])); w25.Position = 1; this.vbox6.Add (this.vbox3); global::Gtk.Box.BoxChild w26 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.vbox3])); w26.Position = 1; // Container child vbox6.Gtk.Box+BoxChild this.eboxButs = new global::Gtk.EventBox (); this.eboxButs.Name = "eboxButs"; // Container child eboxButs.Gtk.Container+ContainerChild this.hbox1 = new global::Gtk.HBox (); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild this.btnInstall = new global::Gtk.Button (); this.btnInstall.CanFocus = true; this.btnInstall.Name = "btnInstall"; this.btnInstall.UseUnderline = true; // Container child btnInstall.Gtk.Container+ContainerChild global::Gtk.Alignment w27 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w28 = new global::Gtk.HBox (); w28.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w29 = new global::Gtk.Image (); w29.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download.png"); w28.Add (w29); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w31 = new global::Gtk.Label (); w31.LabelProp = global::Mono.Unix.Catalog.GetString ("Install..."); w31.UseUnderline = true; w28.Add (w31); w27.Add (w28); this.btnInstall.Add (w27); this.hbox1.Add (this.btnInstall); global::Gtk.Box.BoxChild w35 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnInstall])); w35.Position = 0; w35.Expand = false; w35.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnUpdate = new global::Gtk.Button (); this.btnUpdate.CanFocus = true; this.btnUpdate.Name = "btnUpdate"; this.btnUpdate.UseUnderline = true; // Container child btnUpdate.Gtk.Container+ContainerChild global::Gtk.Alignment w36 = new global::Gtk.Alignment (0.5F, 0.5F, 0F, 0F); // Container child GtkAlignment.Gtk.Container+ContainerChild global::Gtk.HBox w37 = new global::Gtk.HBox (); w37.Spacing = 2; // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Image w38 = new global::Gtk.Image (); w38.Pixbuf = global::Gdk.Pixbuf.LoadFromResource ("download.png"); w37.Add (w38); // Container child GtkHBox.Gtk.Container+ContainerChild global::Gtk.Label w40 = new global::Gtk.Label (); w40.LabelProp = global::Mono.Unix.Catalog.GetString ("Update"); w40.UseUnderline = true; w37.Add (w40); w36.Add (w37); this.btnUpdate.Add (w36); this.hbox1.Add (this.btnUpdate); global::Gtk.Box.BoxChild w44 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnUpdate])); w44.Position = 1; w44.Expand = false; w44.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnDisable = new global::Gtk.Button (); this.btnDisable.CanFocus = true; this.btnDisable.Name = "btnDisable"; this.btnDisable.UseUnderline = true; this.btnDisable.Label = global::Mono.Unix.Catalog.GetString ("Disable"); this.hbox1.Add (this.btnDisable); global::Gtk.Box.BoxChild w45 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnDisable])); w45.Position = 2; w45.Expand = false; w45.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnUninstall = new global::Gtk.Button (); this.btnUninstall.CanFocus = true; this.btnUninstall.Name = "btnUninstall"; this.btnUninstall.UseUnderline = true; this.btnUninstall.Label = global::Mono.Unix.Catalog.GetString ("_Uninstall..."); this.hbox1.Add (this.btnUninstall); global::Gtk.Box.BoxChild w46 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.btnUninstall])); w46.Position = 3; w46.Expand = false; w46.Fill = false; this.eboxButs.Add (this.hbox1); this.vbox6.Add (this.eboxButs); global::Gtk.Box.BoxChild w48 = ((global::Gtk.Box.BoxChild)(this.vbox6 [this.eboxButs])); w48.Position = 2; w48.Expand = false; w48.Fill = false; this.ebox.Add (this.vbox6); this.Add (this.ebox); if ((this.Child != null)) { this.Child.ShowAll (); } this.Hide (); this.urlButton.Clicked += new global::System.EventHandler (this.OnUrlButtonClicked); this.btnInstall.Clicked += new global::System.EventHandler (this.OnBtnInstallClicked); this.btnUpdate.Clicked += new global::System.EventHandler (this.OnBtnUpdateClicked); this.btnDisable.Clicked += new global::System.EventHandler (this.OnBtnDisableClicked); this.btnUninstall.Clicked += new global::System.EventHandler (this.OnBtnUninstallClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs0000664000175000017500000002142212136523632027673 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class NewSiteDialog { private global::Gtk.VBox vbox89; private global::Gtk.Label label121; private global::Gtk.RadioButton btnOnlineRep; private global::Gtk.HBox hbox68; private global::Gtk.Label label122; private global::Gtk.Label label119; private global::Gtk.Entry urlText; private global::Gtk.RadioButton btnLocalRep; private global::Gtk.HBox hbox69; private global::Gtk.Label label123; private global::Gtk.Label label120; private global::Gtk.HBox hbox1; private global::Gtk.Entry pathEntry; private global::Gtk.Button buttonBrowse; private global::Gtk.Button cancelbutton1; private global::Gtk.Button btnOk; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.NewSiteDialog this.Name = "Mono.Addins.Gui.NewSiteDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Add New Repository"); this.TypeHint = ((global::Gdk.WindowTypeHint)(1)); this.BorderWidth = ((uint)(6)); this.DefaultWidth = 550; // Internal child Mono.Addins.Gui.NewSiteDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog-vbox11"; w1.Spacing = 6; w1.BorderWidth = ((uint)(2)); // Container child dialog-vbox11.Gtk.Box+BoxChild this.vbox89 = new global::Gtk.VBox (); this.vbox89.Name = "vbox89"; this.vbox89.Spacing = 6; this.vbox89.BorderWidth = ((uint)(6)); // Container child vbox89.Gtk.Box+BoxChild this.label121 = new global::Gtk.Label (); this.label121.Name = "label121"; this.label121.Xalign = 0F; this.label121.LabelProp = global::Mono.Unix.Catalog.GetString ("Select the location of the repository you want to register:"); this.vbox89.Add (this.label121); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.label121])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox89.Gtk.Box+BoxChild this.btnOnlineRep = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Register an on-line repository")); this.btnOnlineRep.CanFocus = true; this.btnOnlineRep.Name = "btnOnlineRep"; this.btnOnlineRep.Active = true; this.btnOnlineRep.DrawIndicator = true; this.btnOnlineRep.UseUnderline = true; this.btnOnlineRep.Group = new global::GLib.SList (global::System.IntPtr.Zero); this.vbox89.Add (this.btnOnlineRep); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.btnOnlineRep])); w3.Position = 1; w3.Expand = false; w3.Fill = false; // Container child vbox89.Gtk.Box+BoxChild this.hbox68 = new global::Gtk.HBox (); this.hbox68.Name = "hbox68"; this.hbox68.Spacing = 6; // Container child hbox68.Gtk.Box+BoxChild this.label122 = new global::Gtk.Label (); this.label122.WidthRequest = 32; this.label122.Name = "label122"; this.hbox68.Add (this.label122); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.label122])); w4.Position = 0; w4.Expand = false; w4.Fill = false; // Container child hbox68.Gtk.Box+BoxChild this.label119 = new global::Gtk.Label (); this.label119.Name = "label119"; this.label119.LabelProp = global::Mono.Unix.Catalog.GetString ("Url:"); this.hbox68.Add (this.label119); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.label119])); w5.Position = 1; w5.Expand = false; w5.Fill = false; // Container child hbox68.Gtk.Box+BoxChild this.urlText = new global::Gtk.Entry (); this.urlText.CanFocus = true; this.urlText.Name = "urlText"; this.urlText.IsEditable = true; this.urlText.InvisibleChar = 'â—'; this.hbox68.Add (this.urlText); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox68 [this.urlText])); w6.Position = 2; this.vbox89.Add (this.hbox68); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.hbox68])); w7.Position = 2; w7.Expand = false; w7.Fill = false; // Container child vbox89.Gtk.Box+BoxChild this.btnLocalRep = new global::Gtk.RadioButton (global::Mono.Unix.Catalog.GetString ("Register a local repository")); this.btnLocalRep.CanFocus = true; this.btnLocalRep.Name = "btnLocalRep"; this.btnLocalRep.DrawIndicator = true; this.btnLocalRep.UseUnderline = true; this.btnLocalRep.Group = this.btnOnlineRep.Group; this.vbox89.Add (this.btnLocalRep); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.btnLocalRep])); w8.Position = 3; w8.Expand = false; w8.Fill = false; // Container child vbox89.Gtk.Box+BoxChild this.hbox69 = new global::Gtk.HBox (); this.hbox69.Name = "hbox69"; this.hbox69.Spacing = 6; // Container child hbox69.Gtk.Box+BoxChild this.label123 = new global::Gtk.Label (); this.label123.WidthRequest = 32; this.label123.Name = "label123"; this.hbox69.Add (this.label123); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.label123])); w9.Position = 0; w9.Expand = false; w9.Fill = false; // Container child hbox69.Gtk.Box+BoxChild this.label120 = new global::Gtk.Label (); this.label120.Name = "label120"; this.label120.LabelProp = global::Mono.Unix.Catalog.GetString ("Path:"); this.hbox69.Add (this.label120); global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.label120])); w10.Position = 1; w10.Expand = false; w10.Fill = false; // Container child hbox69.Gtk.Box+BoxChild this.hbox1 = new global::Gtk.HBox (); this.hbox1.Name = "hbox1"; this.hbox1.Spacing = 6; // Container child hbox1.Gtk.Box+BoxChild this.pathEntry = new global::Gtk.Entry (); this.pathEntry.CanFocus = true; this.pathEntry.Name = "pathEntry"; this.pathEntry.IsEditable = true; this.pathEntry.InvisibleChar = 'â—'; this.hbox1.Add (this.pathEntry); global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.pathEntry])); w11.Position = 0; // Container child hbox1.Gtk.Box+BoxChild this.buttonBrowse = new global::Gtk.Button (); this.buttonBrowse.CanFocus = true; this.buttonBrowse.Name = "buttonBrowse"; this.buttonBrowse.UseUnderline = true; this.buttonBrowse.Label = global::Mono.Unix.Catalog.GetString ("Browse..."); this.hbox1.Add (this.buttonBrowse); global::Gtk.Box.BoxChild w12 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.buttonBrowse])); w12.Position = 1; w12.Expand = false; w12.Fill = false; this.hbox69.Add (this.hbox1); global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox69 [this.hbox1])); w13.Position = 2; this.vbox89.Add (this.hbox69); global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.vbox89 [this.hbox69])); w14.Position = 4; w14.Expand = false; w14.Fill = false; w1.Add (this.vbox89); global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox89])); w15.Position = 0; // Internal child Mono.Addins.Gui.NewSiteDialog.ActionArea global::Gtk.HButtonBox w16 = this.ActionArea; w16.Name = "dialog-action_area11"; w16.Spacing = 10; w16.BorderWidth = ((uint)(5)); w16.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog-action_area11.Gtk.ButtonBox+ButtonBoxChild this.cancelbutton1 = new global::Gtk.Button (); this.cancelbutton1.CanDefault = true; this.cancelbutton1.CanFocus = true; this.cancelbutton1.Name = "cancelbutton1"; this.cancelbutton1.UseStock = true; this.cancelbutton1.UseUnderline = true; this.cancelbutton1.Label = "gtk-cancel"; this.AddActionWidget (this.cancelbutton1, -6); global::Gtk.ButtonBox.ButtonBoxChild w17 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16 [this.cancelbutton1])); w17.Expand = false; w17.Fill = false; // Container child dialog-action_area11.Gtk.ButtonBox+ButtonBoxChild this.btnOk = new global::Gtk.Button (); this.btnOk.CanDefault = true; this.btnOk.CanFocus = true; this.btnOk.Name = "btnOk"; this.btnOk.UseStock = true; this.btnOk.UseUnderline = true; this.btnOk.Label = "gtk-ok"; this.AddActionWidget (this.btnOk, -5); global::Gtk.ButtonBox.ButtonBoxChild w18 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w16 [this.btnOk])); w18.Position = 1; w18.Expand = false; w18.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultHeight = 249; this.Hide (); this.btnOnlineRep.Clicked += new global::System.EventHandler (this.OnOptionClicked); this.urlText.Changed += new global::System.EventHandler (this.OnUrlTextChanged); this.btnLocalRep.Clicked += new global::System.EventHandler (this.OnOptionClicked); this.pathEntry.Changed += new global::System.EventHandler (this.OnPathEntryChanged); this.buttonBrowse.Clicked += new global::System.EventHandler (this.OnButtonBrowseClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/generated.cs0000664000175000017500000000620112136523632024276 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Stetic { internal class Gui { private static bool initialized; internal static void Initialize (Gtk.Widget iconRenderer) { if ((Stetic.Gui.initialized == false)) { Stetic.Gui.initialized = true; } } } internal class IconLoader { public static Gdk.Pixbuf LoadIcon (Gtk.Widget widget, string name, Gtk.IconSize size) { Gdk.Pixbuf res = widget.RenderIcon (name, size, null); if ((res != null)) { return res; } else { int sz; int sy; global::Gtk.Icon.SizeLookup (size, out sz, out sy); try { return Gtk.IconTheme.Default.LoadIcon (name, sz, 0); } catch (System.Exception) { if ((name != "gtk-missing-image")) { return Stetic.IconLoader.LoadIcon (widget, "gtk-missing-image", size); } else { Gdk.Pixmap pmap = new Gdk.Pixmap (Gdk.Screen.Default.RootWindow, sz, sz); Gdk.GC gc = new Gdk.GC (pmap); gc.RgbFgColor = new Gdk.Color (255, 255, 255); pmap.DrawRectangle (gc, true, 0, 0, sz, sz); gc.RgbFgColor = new Gdk.Color (0, 0, 0); pmap.DrawRectangle (gc, false, 0, 0, (sz - 1), (sz - 1)); gc.SetLineAttributes (3, Gdk.LineStyle.Solid, Gdk.CapStyle.Round, Gdk.JoinStyle.Round); gc.RgbFgColor = new Gdk.Color (255, 0, 0); pmap.DrawLine (gc, (sz / 4), (sz / 4), ((sz - 1) - (sz / 4)), ((sz - 1) - (sz / 4))); pmap.DrawLine (gc, ((sz - 1) - (sz / 4)), (sz / 4), (sz / 4), ((sz - 1) - (sz / 4))); return Gdk.Pixbuf.FromDrawable (pmap, pmap.Colormap, 0, 0, 0, 0, sz, sz); } } } } } internal class BinContainer { private Gtk.Widget child; private Gtk.UIManager uimanager; public static BinContainer Attach (Gtk.Bin bin) { BinContainer bc = new BinContainer (); bin.SizeRequested += new Gtk.SizeRequestedHandler (bc.OnSizeRequested); bin.SizeAllocated += new Gtk.SizeAllocatedHandler (bc.OnSizeAllocated); bin.Added += new Gtk.AddedHandler (bc.OnAdded); return bc; } private void OnSizeRequested (object sender, Gtk.SizeRequestedArgs args) { if ((this.child != null)) { args.Requisition = this.child.SizeRequest (); } } private void OnSizeAllocated (object sender, Gtk.SizeAllocatedArgs args) { if ((this.child != null)) { this.child.Allocation = args.Allocation; } } private void OnAdded (object sender, Gtk.AddedArgs args) { this.child = args.Widget; } public void SetUiManager (Gtk.UIManager uim) { this.uimanager = uim; this.child.Realized += new System.EventHandler (this.OnRealized); } private void OnRealized (object sender, System.EventArgs args) { if ((this.uimanager != null)) { Gtk.Widget w; w = this.child.Toplevel; if (((w != null) && typeof(Gtk.Window).IsInstanceOfType (w))) { ((Gtk.Window)(w)).AddAccelGroup (this.uimanager.AccelGroup); this.uimanager = null; } } } } internal class ActionGroups { public static Gtk.ActionGroup GetActionGroup (System.Type type) { return Stetic.ActionGroups.GetActionGroup (type.FullName); } public static Gtk.ActionGroup GetActionGroup (string name) { return null; } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/gui.stetic0000664000175000017500000024116112136523632024020 0ustar00directhexdirecthex00000000000000 .. 2.12 False Error Dialog 6 1 False 6 6 6 stock:gtk-dialog-error Dialog 0 False False False 0 False False False 12 540 True 0 An exception has been thrown 1 2 3 4 5 6 7 8 9 10 11 12 13 14 True True 0 False False False True True In 250 True 2 2 6 6 Details label_item 1 False 1 False 0 False 10 5 1 End True True True StockItem gtk-ok -5 gtk-ok False False False False Add-in Manager Dialog 6 700 550 2 False 3 2 6 6 12 12 True 0 False 9 9 6 True In True 0 True 0 True ButtonPressMask False 1 True False False Installed tab 9 9 6 No updates found 0 False False False True TextAndIcon stock:gtk-refresh Menu Refresh True None End 1 False False False True TextAndIcon resource:download.png Update All True None End 2 True False False 0 True False False True In True 1 True 0 False ButtonPressMask False 1 True False False 1 Updates tab 9 9 6 Repository: 0 False False False False 1 False True TextAndIcon stock:gtk-refresh Menu True None 2 False False False 0 True False False True In True 1 True 0 False ButtonPressMask False 1 True False False 2 Gallery tab 0 True 0 False 0 False 0 False 6 5 2 Edge True TextOnly Install from file... True -1 False False True True True StockItem gtk-close -7 gtk-close 1 False False False False Add-in Repository Management Dialog 6 600 300 1 False 6 12 6 True In True False 0 False 6 True True StockItem gtk-add gtk-add 0 False False False True True StockItem gtk-delete gtk-delete 1 False False False 1 False False False 0 False 10 6 1 End True True True StockItem gtk-close -7 gtk-close False False False False Add New Repository Dialog 6 550 2 False 6 2 6 6 0 Select the location of the repository you want to register: 0 False False False True Register an on-line repository True True True True btnOnlineRep 1 False False False 6 32 0 False False False Url: 1 False False False True True â— 2 False 2 False False False True Register a local repository True True True btnOnlineRep 3 False False False 6 32 0 False False False Path: 1 False False False 6 True True â— 0 True True TextOnly Browse... True 1 True False False 2 True 4 False False False 0 False 10 5 2 End True True True StockItem gtk-cancel -6 gtk-cancel False False True True True StockItem gtk-ok -5 gtk-ok 1 False False False Add-in Manager CenterOnParent 6 2 False 6 2 6 6 0 Additional extensions are required to perform this operation. 0 True False False 0 The following add-ins will be installed: 1 True False False True In None 6 6 0 0 label3 2 True False 3 True False False 0 True 10 6 2 End True True True StockItem gtk-cancel -6 gtk-cancel False False True True True StockItem gtk-ok -1 gtk-ok 1 False False False False Progress CenterOnParent True 1 False 2 6 9 0 0 True False False 1 True False False True In True True Details True label_item 2 True 0 True 6 5 1 End True True True StockItem gtk-cancel -6 gtk-cancel False False False False CenterOnParent 2 False 2 9 9 True Never Never None 6 400 0 0 label3 True 0 True False False 0 True False 1 True False False 6 0 End 0 True False False 1 True False False 2 True False False 0 True 10 5 2 End True True True StockItem gtk-cancel -1 gtk-cancel False False True True TextOnly Install True -1 1 False False False False 6 stock:gtk-dialog-warning Menu 0 True False False 250 0 label1 True 1 True False False 0 True False False 6 12 6 6 3 280 0 <b><big>Some Addin</big></b> True True 0 False False False 280 0 Version 2.6 True 1 False False False 0 True False False 0 True 0 True False False True Never None 6 250 0 Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. True 0 True False False 6 True TextAndIcon resource:web.png More information True None 0 True False False End 2 True False False 1 False 1 True 6 True TextAndIcon resource:download.png Install... True 0 True False False True TextAndIcon resource:download.png Update True 1 True False False True TextOnly Disable True 2 True False False True TextOnly _Uninstall... True 3 True False False 2 True False False mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.ProgressDialog.cs0000664000175000017500000001005012136523632030114 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class ProgressDialog { private global::Gtk.VBox vbox2; private global::Gtk.Label labelMessage; private global::Gtk.ProgressBar progressbar; private global::Gtk.Expander expander1; private global::Gtk.ScrolledWindow GtkScrolledWindow; private global::Gtk.TextView textview; private global::Gtk.Label GtkLabel1; private global::Gtk.Button buttonCancel; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.ProgressDialog this.Name = "Mono.Addins.Gui.ProgressDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Progress"); this.WindowPosition = ((global::Gtk.WindowPosition)(4)); this.Modal = true; // Internal child Mono.Addins.Gui.ProgressDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog1_VBox"; w1.BorderWidth = ((uint)(2)); // Container child dialog1_VBox.Gtk.Box+BoxChild this.vbox2 = new global::Gtk.VBox (); this.vbox2.Name = "vbox2"; this.vbox2.Spacing = 6; this.vbox2.BorderWidth = ((uint)(9)); // Container child vbox2.Gtk.Box+BoxChild this.labelMessage = new global::Gtk.Label (); this.labelMessage.Name = "labelMessage"; this.labelMessage.Xalign = 0F; this.vbox2.Add (this.labelMessage); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.labelMessage])); w2.Position = 0; w2.Expand = false; w2.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.progressbar = new global::Gtk.ProgressBar (); this.progressbar.Name = "progressbar"; this.vbox2.Add (this.progressbar); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.progressbar])); w3.Position = 1; w3.Expand = false; w3.Fill = false; // Container child vbox2.Gtk.Box+BoxChild this.expander1 = new global::Gtk.Expander (null); this.expander1.CanFocus = true; this.expander1.Name = "expander1"; // Container child expander1.Gtk.Container+ContainerChild this.GtkScrolledWindow = new global::Gtk.ScrolledWindow (); this.GtkScrolledWindow.Name = "GtkScrolledWindow"; this.GtkScrolledWindow.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child GtkScrolledWindow.Gtk.Container+ContainerChild this.textview = new global::Gtk.TextView (); this.textview.CanFocus = true; this.textview.Name = "textview"; this.GtkScrolledWindow.Add (this.textview); this.expander1.Add (this.GtkScrolledWindow); this.GtkLabel1 = new global::Gtk.Label (); this.GtkLabel1.Name = "GtkLabel1"; this.GtkLabel1.LabelProp = global::Mono.Unix.Catalog.GetString ("Details"); this.GtkLabel1.UseUnderline = true; this.expander1.LabelWidget = this.GtkLabel1; this.vbox2.Add (this.expander1); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.vbox2 [this.expander1])); w6.Position = 2; w1.Add (this.vbox2); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.vbox2])); w7.Position = 0; // Internal child Mono.Addins.Gui.ProgressDialog.ActionArea global::Gtk.HButtonBox w8 = this.ActionArea; w8.Name = "dialog1_ActionArea"; w8.Spacing = 6; w8.BorderWidth = ((uint)(5)); w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new global::Gtk.Button (); this.buttonCancel.CanDefault = true; this.buttonCancel.CanFocus = true; this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.UseStock = true; this.buttonCancel.UseUnderline = true; this.buttonCancel.Label = "gtk-cancel"; this.AddActionWidget (this.buttonCancel, -6); global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.buttonCancel])); w9.Expand = false; w9.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 513; this.DefaultHeight = 156; this.Hide (); this.buttonCancel.Clicked += new global::System.EventHandler (this.OnButtonCancelClicked); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs0000664000175000017500000001035212136523632030515 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class ManageSitesDialog { private global::Gtk.HBox hbox67; private global::Gtk.ScrolledWindow scrolledwindow17; private global::Gtk.TreeView repoTree; private global::Gtk.VBox vbox88; private global::Gtk.Button btnAdd; private global::Gtk.Button btnRemove; private global::Gtk.Button closebutton2; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.ManageSitesDialog this.Name = "Mono.Addins.Gui.ManageSitesDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Add-in Repository Management"); this.TypeHint = ((global::Gdk.WindowTypeHint)(1)); this.BorderWidth = ((uint)(6)); this.DefaultWidth = 600; this.DefaultHeight = 300; // Internal child Mono.Addins.Gui.ManageSitesDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog-vbox10"; w1.Spacing = 6; // Container child dialog-vbox10.Gtk.Box+BoxChild this.hbox67 = new global::Gtk.HBox (); this.hbox67.Name = "hbox67"; this.hbox67.Spacing = 12; this.hbox67.BorderWidth = ((uint)(6)); // Container child hbox67.Gtk.Box+BoxChild this.scrolledwindow17 = new global::Gtk.ScrolledWindow (); this.scrolledwindow17.CanFocus = true; this.scrolledwindow17.Name = "scrolledwindow17"; this.scrolledwindow17.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledwindow17.Gtk.Container+ContainerChild this.repoTree = new global::Gtk.TreeView (); this.repoTree.CanFocus = true; this.repoTree.Name = "repoTree"; this.repoTree.HeadersVisible = false; this.scrolledwindow17.Add (this.repoTree); this.hbox67.Add (this.scrolledwindow17); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.scrolledwindow17])); w3.Position = 0; // Container child hbox67.Gtk.Box+BoxChild this.vbox88 = new global::Gtk.VBox (); this.vbox88.Name = "vbox88"; this.vbox88.Spacing = 6; // Container child vbox88.Gtk.Box+BoxChild this.btnAdd = new global::Gtk.Button (); this.btnAdd.CanFocus = true; this.btnAdd.Name = "btnAdd"; this.btnAdd.UseStock = true; this.btnAdd.UseUnderline = true; this.btnAdd.Label = "gtk-add"; this.vbox88.Add (this.btnAdd); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox88 [this.btnAdd])); w4.Position = 0; w4.Expand = false; w4.Fill = false; // Container child vbox88.Gtk.Box+BoxChild this.btnRemove = new global::Gtk.Button (); this.btnRemove.CanFocus = true; this.btnRemove.Name = "btnRemove"; this.btnRemove.UseStock = true; this.btnRemove.UseUnderline = true; this.btnRemove.Label = "gtk-delete"; this.vbox88.Add (this.btnRemove); global::Gtk.Box.BoxChild w5 = ((global::Gtk.Box.BoxChild)(this.vbox88 [this.btnRemove])); w5.Position = 1; w5.Expand = false; w5.Fill = false; this.hbox67.Add (this.vbox88); global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hbox67 [this.vbox88])); w6.Position = 1; w6.Expand = false; w6.Fill = false; w1.Add (this.hbox67); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox67])); w7.Position = 0; // Internal child Mono.Addins.Gui.ManageSitesDialog.ActionArea global::Gtk.HButtonBox w8 = this.ActionArea; w8.Name = "dialog-action_area10"; w8.Spacing = 10; w8.BorderWidth = ((uint)(6)); w8.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog-action_area10.Gtk.ButtonBox+ButtonBoxChild this.closebutton2 = new global::Gtk.Button (); this.closebutton2.CanDefault = true; this.closebutton2.CanFocus = true; this.closebutton2.Name = "closebutton2"; this.closebutton2.UseStock = true; this.closebutton2.UseUnderline = true; this.closebutton2.Label = "gtk-close"; this.AddActionWidget (this.closebutton2, -7); global::Gtk.ButtonBox.ButtonBoxChild w9 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w8 [this.closebutton2])); w9.Expand = false; w9.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.Hide (); this.btnAdd.Clicked += new global::System.EventHandler (this.OnAdd); this.btnRemove.Clicked += new global::System.EventHandler (this.OnRemove); } } } mono-addins-1.0/Mono.Addins.Gui/gtk-gui/Mono.Addins.Gui.ErrorDialog.cs0000664000175000017500000001222112136523632027403 0ustar00directhexdirecthex00000000000000 // This file has been generated by the GUI designer. Do not modify. namespace Mono.Addins.Gui { internal partial class ErrorDialog { private global::Gtk.HBox hbox59; private global::Gtk.VBox vbox72; private global::Gtk.Image icon; private global::Gtk.VBox vbox73; private global::Gtk.Label descriptionLabel; private global::Gtk.Expander expander; private global::Gtk.ScrolledWindow scrolledwindow10; private global::Gtk.TextView detailsTextView; private global::Gtk.Label label102; private global::Gtk.Button okButton; protected virtual void Build () { global::Stetic.Gui.Initialize (this); // Widget Mono.Addins.Gui.ErrorDialog this.Name = "Mono.Addins.Gui.ErrorDialog"; this.Title = global::Mono.Unix.Catalog.GetString ("Error"); this.TypeHint = ((global::Gdk.WindowTypeHint)(1)); this.BorderWidth = ((uint)(6)); // Internal child Mono.Addins.Gui.ErrorDialog.VBox global::Gtk.VBox w1 = this.VBox; w1.Name = "dialog-vbox5"; w1.Spacing = 6; // Container child dialog-vbox5.Gtk.Box+BoxChild this.hbox59 = new global::Gtk.HBox (); this.hbox59.Name = "hbox59"; this.hbox59.Spacing = 6; this.hbox59.BorderWidth = ((uint)(6)); // Container child hbox59.Gtk.Box+BoxChild this.vbox72 = new global::Gtk.VBox (); this.vbox72.Name = "vbox72"; // Container child vbox72.Gtk.Box+BoxChild this.icon = new global::Gtk.Image (); this.icon.Name = "icon"; this.icon.Pixbuf = global::Stetic.IconLoader.LoadIcon (this, "gtk-dialog-error", global::Gtk.IconSize.Dialog); this.vbox72.Add (this.icon); global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.vbox72 [this.icon])); w2.Position = 0; w2.Expand = false; w2.Fill = false; this.hbox59.Add (this.vbox72); global::Gtk.Box.BoxChild w3 = ((global::Gtk.Box.BoxChild)(this.hbox59 [this.vbox72])); w3.Position = 0; w3.Expand = false; w3.Fill = false; // Container child hbox59.Gtk.Box+BoxChild this.vbox73 = new global::Gtk.VBox (); this.vbox73.Name = "vbox73"; this.vbox73.Spacing = 12; // Container child vbox73.Gtk.Box+BoxChild this.descriptionLabel = new global::Gtk.Label (); this.descriptionLabel.WidthRequest = 540; this.descriptionLabel.CanFocus = true; this.descriptionLabel.Name = "descriptionLabel"; this.descriptionLabel.Xalign = 0F; this.descriptionLabel.LabelProp = "An exception has been thrown 1 2 3 4 5 6 7 8 9 10 11 12 13 14"; this.descriptionLabel.Wrap = true; this.descriptionLabel.Selectable = true; this.vbox73.Add (this.descriptionLabel); global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.vbox73 [this.descriptionLabel])); w4.Position = 0; w4.Expand = false; w4.Fill = false; // Container child vbox73.Gtk.Box+BoxChild this.expander = new global::Gtk.Expander (null); this.expander.CanFocus = true; this.expander.Name = "expander"; // Container child expander.Gtk.Container+ContainerChild this.scrolledwindow10 = new global::Gtk.ScrolledWindow (); this.scrolledwindow10.CanFocus = true; this.scrolledwindow10.Name = "scrolledwindow10"; this.scrolledwindow10.ShadowType = ((global::Gtk.ShadowType)(1)); // Container child scrolledwindow10.Gtk.Container+ContainerChild this.detailsTextView = new global::Gtk.TextView (); this.detailsTextView.HeightRequest = 250; this.detailsTextView.CanFocus = true; this.detailsTextView.Name = "detailsTextView"; this.detailsTextView.PixelsAboveLines = 2; this.detailsTextView.PixelsBelowLines = 2; this.detailsTextView.LeftMargin = 6; this.detailsTextView.RightMargin = 6; this.scrolledwindow10.Add (this.detailsTextView); this.expander.Add (this.scrolledwindow10); this.label102 = new global::Gtk.Label (); this.label102.Name = "label102"; this.label102.LabelProp = global::Mono.Unix.Catalog.GetString ("Details"); this.expander.LabelWidget = this.label102; this.vbox73.Add (this.expander); global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.vbox73 [this.expander])); w7.Position = 1; this.hbox59.Add (this.vbox73); global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.hbox59 [this.vbox73])); w8.Position = 1; w1.Add (this.hbox59); global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(w1 [this.hbox59])); w9.Position = 0; // Internal child Mono.Addins.Gui.ErrorDialog.ActionArea global::Gtk.HButtonBox w10 = this.ActionArea; w10.Name = "dialog-action_area5"; w10.Spacing = 10; w10.BorderWidth = ((uint)(5)); w10.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog-action_area5.Gtk.ButtonBox+ButtonBoxChild this.okButton = new global::Gtk.Button (); this.okButton.CanDefault = true; this.okButton.CanFocus = true; this.okButton.Name = "okButton"; this.okButton.UseStock = true; this.okButton.UseUnderline = true; this.okButton.Label = "gtk-ok"; this.AddActionWidget (this.okButton, -5); global::Gtk.ButtonBox.ButtonBoxChild w11 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w10 [this.okButton])); w11.Expand = false; w11.Fill = false; if ((this.Child != null)) { this.Child.ShowAll (); } this.DefaultWidth = 632; this.DefaultHeight = 155; this.Show (); } } } mono-addins-1.0/Mono.Addins.Gui/Makefile.in0000664000175000017500000004465312136523720022522 0ustar00directhexdirecthex00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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. @SET_MAKE@ VPATH = @srcdir@ am__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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 = : DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/mono-addins-gui.pc.in $(top_srcdir)/Makefile.include \ $(top_srcdir)/xbuild.include ChangeLog subdir = ./Mono.Addins.Gui 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) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = mono-addins-gui.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AL = @AL@ AMTAR = @AMTAR@ API_VERSION = @API_VERSION@ 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@ GACUTIL = @GACUTIL@ GACUTIL_FLAGS = @GACUTIL_FLAGS@ GACUTIL_POLICY_FLAGS = @GACUTIL_POLICY_FLAGS@ 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@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MCS = @MCS@ MKDIR_P = @MKDIR_P@ MONODOC_CFLAGS = @MONODOC_CFLAGS@ MONODOC_LIBS = @MONODOC_LIBS@ MONO_ADDINS_DEFAULT_LIB = @MONO_ADDINS_DEFAULT_LIB@ MONO_ADDINS_GUI_DEFAULT_LIB = @MONO_ADDINS_GUI_DEFAULT_LIB@ MONO_ADDINS_MSBUILD_DEFAULT_LIB = @MONO_ADDINS_MSBUILD_DEFAULT_LIB@ MONO_ADDINS_SETUP_DEFAULT_LIB = @MONO_ADDINS_SETUP_DEFAULT_LIB@ MONO_NUNIT_CFLAGS = @MONO_NUNIT_CFLAGS@ MONO_NUNIT_LIBS = @MONO_NUNIT_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@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POLICY_VERSIONS = @POLICY_VERSIONS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ 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@ ASSEMBLY = ../bin/Mono.Addins.Gui.dll ASSEMBLY_NAME = Mono.Addins.Gui PC_FILES_IN = mono-addins-gui.pc.in @ENABLE_GUI_TRUE@pc_files = $(PC_FILES_IN:.pc.in=.pc) @ENABLE_GUI_TRUE@POLICY_ASSEMBLIES = $(addsuffix .$(ASSEMBLY_NAME).dll, $(addprefix policy., $(POLICY_VERSIONS))) @ENABLE_GUI_TRUE@POLICY_CONFIGS = $(addsuffix .config, $(addprefix policy., $(POLICY_VERSIONS))) @ENABLE_GUI_TRUE@EXTRA_DIST = \ @ENABLE_GUI_TRUE@ $(wildcard $(ALL_FILES)) @ENABLE_GUI_TRUE@CLEANFILES = $(ASSEMBLY) $(ASSEMBLY).mdb \ @ENABLE_GUI_TRUE@ $(DLL_REFERENCES) $(POLICY_ASSEMBLIES) \ @ENABLE_GUI_TRUE@ $(POLICY_CONFIGS) @ENABLE_GUI_TRUE@DISTCLEANFILES = $(GENERATED_FILES) $(build_datafiles) $(pc_files) @ENABLE_GUI_TRUE@bin_SCRIPTS = $(ASSEMBLY_WRAPPER) @ENABLE_GUI_TRUE@pkgconfigdir = $(libdir)/pkgconfig @ENABLE_GUI_TRUE@pkgconfig_DATA = $(pc_files) @ENABLE_GUI_TRUE@ALL_CSPROJ = $(wildcard *.csproj) @ENABLE_GUI_TRUE@MAIN_SLN = $(top_builddir)/Mono.Addins.sln @ENABLE_GUI_TRUE@PROFILE_NAME = Debug @ENABLE_GUI_TRUE@XBUILD = xbuild @ENABLE_GUI_TRUE@XBUILD_VERBOSITY = quiet @ENABLE_GUI_TRUE@XBUILD_ARGS = /verbosity:$(XBUILD_VERBOSITY) /nologo /property:CodePage=65001 @ENABLE_GUI_TRUE@XBUILD_PROFILE = /property:Configuration=$(PROFILE_NAME) # Figure out how far we are from top_builddir @ENABLE_GUI_TRUE@DEPTH = $(shell echo "$(top_builddir)" | tr '/' '\n' | grep -c '..') @ENABLE_GUI_TRUE@EXTS := *.bmp *.cs *.csproj *.html *.png *.snk *.config *.stetic *.glade *.xml *.xsd *.exe.addins *.template *.tt *.txt @ENABLE_GUI_TRUE@ALL_FILES := $(EXTS) \ @ENABLE_GUI_TRUE@ $(addprefix */,$(EXTS)) \ @ENABLE_GUI_TRUE@ $(addprefix */*/,$(EXTS)) \ @ENABLE_GUI_TRUE@ $(addprefix */*/*/,$(EXTS)) \ @ENABLE_GUI_TRUE@ $(addprefix */*/*/*/,$(EXTS)) \ @ENABLE_GUI_TRUE@ $(addprefix */*/*/*/*/,$(EXTS)) \ @ENABLE_GUI_TRUE@ $(wildcard icons/*) \ @ENABLE_GUI_TRUE@ $(wildcard templates/*) @ENABLE_GUI_TRUE@WILDCARDED_FILES := $(wildcard $(ALL_FILES)) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ./Mono.Addins.Gui/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign ./Mono.Addins.Gui/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_srcdir)/Makefile.include $(top_srcdir)/xbuild.include: $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mono-addins-gui.pc: $(top_builddir)/config.status $(srcdir)/mono-addins-gui.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @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 check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) 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) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." @ENABLE_GUI_FALSE@uninstall-local: @ENABLE_GUI_FALSE@install-data-local: @ENABLE_GUI_FALSE@clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile 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-data-local install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS 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 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: uninstall-binSCRIPTS uninstall-local \ uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-data-local 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-pkgconfigDATA 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 \ uninstall-binSCRIPTS uninstall-local uninstall-pkgconfigDATA @ENABLE_GUI_TRUE@install-data-local: gac-install @ENABLE_GUI_TRUE@uninstall-local: gac-uninstall @ENABLE_GUI_TRUE@$(build_datafiles): $(BUILD_DIR)/% : $(addprefix $(srcdir)/, %) @ENABLE_GUI_TRUE@ mkdir -p $(dir $@) @ENABLE_GUI_TRUE@ cp $< $@ @ENABLE_GUI_TRUE@policy.%.config: $(top_builddir)/policy.config @ENABLE_GUI_TRUE@ sed -e "s/@ASSEMBLY_NAME@/$(ASSEMBLY_NAME)/" -e "s/@POLICY@/$*/" $(top_builddir)/policy.config > $@ @ENABLE_GUI_TRUE@$(POLICY_ASSEMBLIES) : policy.%.$(ASSEMBLY_NAME).dll: policy.%.config $(top_srcdir)/mono-addins.snk @ENABLE_GUI_TRUE@ $(AL) -link:policy.$*.config -out:$@ -keyfile:$(top_srcdir)/mono-addins.snk @ENABLE_GUI_TRUE@gac-install: $(POLICY_ASSEMBLIES) @ENABLE_GUI_TRUE@ $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; @ENABLE_GUI_TRUE@ @for p in $(POLICY_ASSEMBLIES); do \ @ENABLE_GUI_TRUE@ echo $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ @ENABLE_GUI_TRUE@ $(GACUTIL) /i $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ @ENABLE_GUI_TRUE@ done @ENABLE_GUI_TRUE@gac-uninstall: @ENABLE_GUI_TRUE@ $(GACUTIL) /us $(ASSEMBLY) $(GACUTIL_FLAGS) || exit 1; @ENABLE_GUI_TRUE@ @for p in $(POLICY_ASSEMBLIES); do \ @ENABLE_GUI_TRUE@ echo $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ @ENABLE_GUI_TRUE@ $(GACUTIL) /us $$p /f $(GACUTIL_POLICY_FLAGS) || exit 1; \ @ENABLE_GUI_TRUE@ done @ENABLE_GUI_TRUE@all: csproj_build @ENABLE_GUI_TRUE@clean: csproj_clean @ENABLE_GUI_TRUE@csproj_build: $(POLICY_ASSEMBLIES) @ENABLE_GUI_TRUE@ @if test x$(SKIP) != xy ; then \ @ENABLE_GUI_TRUE@ echo Building $(ALL_CSPROJ); \ @ENABLE_GUI_TRUE@ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p; done \ @ENABLE_GUI_TRUE@ fi @ENABLE_GUI_TRUE@csproj_clean: @ENABLE_GUI_TRUE@ @if test x$(SKIP) != xy -a $(DEPTH) -gt $(MAKELEVEL); then \ @ENABLE_GUI_TRUE@ echo Cleaning $(ALL_CSPROJ); \ @ENABLE_GUI_TRUE@ for p in $(ALL_CSPROJ); do $(XBUILD) $(XBUILD_ARGS) $$p /t:Clean; done \ @ENABLE_GUI_TRUE@ fi @ENABLE_GUI_TRUE@ rm -f $(CLEANFILES) @ENABLE_GUI_TRUE@sln_build: @ENABLE_GUI_TRUE@ @echo Building $(MAIN_SLN) @ENABLE_GUI_TRUE@ @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) @ENABLE_GUI_TRUE@sln_clean: @ENABLE_GUI_TRUE@ @echo Cleaning $(MAIN_SLN) @ENABLE_GUI_TRUE@ @$(XBUILD) $(XBUILD_ARGS) $(MAIN_SLN) $(XBUILD_PROFILE) /t:Clean @ENABLE_GUI_TRUE@print_extradist: @ENABLE_GUI_TRUE@ @echo $(WILDCARDED_FILES) @ENABLE_GUI_TRUE@.PHONY: all clean csproj_build csproj_clean sln_build sln_clean # 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: mono-addins-1.0/Mono.Addins.Gui/icons/0000775000175000017500000000000012136524044021554 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/icons/software-update-available.png0000664000175000017500000000134412136523632027316 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<aIDAT8…“MhÔgÆó¾ÿÝUÖP)ˆXñ£+aÑ…^‘bzÁ…R=xðì©ôæQ{ë¡X,-x\¯-"ˆ.QÑVêŠVkMˆYÙìÇÿkÆCŒ¬â¶sžç7Ì<óˆ™1ªšuù«5lvTŒ4ë²A¼k‹­ÈwÖöü?ͺ|”kÀ-ñîDZO&g‚ò:Yš¿zY öûR­aç‚!Ø>®œqQIón–Ø|à‹P¼gùþÃÖ}Ùó•ªÃTò^çìšhpÍ…Q6>}¢”öûh–âÒ%(v™ŽÄ{ÂJ™s¿tó^ç÷÷ndÝv˜¾\"è=3ü¡ïûLQ™ ¿ø¬\]¹×û(NÎû¨¤ºÒÆ’ºü‰ªHTE—aƒòÎ2A\Êœw?5ë²@n焈œÛº=Ü´ûÓØå¬Ý͉gæH~> â±mh¼‘Å?îfK­¿rS=íV½0Å’>6èàwM½Ä3søñ¯°þ –ô¶^Ìluá ã©íµ=a”.L%Øû5ùY²ÛÑõ[iݼjÚ¿¢jßÖöÏð”ÎǵÝ>HÀ”`r0òù_W§V?âÏë· ³Mµ†-¼ëÂ^†Y ŸJµ‚ÒüEМÄU/DÉ Q)î¦ýÁçÀ¥wL5¼ïIfyŠˆcÇø–PBáñ½'©9âC'h8¸pC€Z§4M>3µu¦Å…Ÿ¾,/bJi"/žÞ3s§êàôåV–,¿1³“§Ä;ÀÚZE‚sSpø¸Z8vñKoŸ³ûÀ¯[÷G-°CŒ˜¥b ž4äýE½Tú« €ê®}´WÞ(PÙ² Ù°ú’•¼|r›“¦@³ ŸUPmÒ¯HV?áŠ1(>º9!‡žƒô d« Õ BŠjÈ}Xk`ÏÞý<˜½hÑ~pûbŒà+@åÇzP$¯½þ¦3_†F²0׌¤Q3—€ú_žA½szäÄy–ç›]©â‡¸{ë ã3Al'é£2=ñÖ®ÎGßãŸ%ˆû»˜¨¸àJ=Ø.©û]q•à{ÿ Í÷‚ü°åkÓÇÏlfü_½Áÿ°oàÒ‡Ì)¥´IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-16.png0000664000175000017500000000121612136523632024006 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasBIT|dˆtEXtSoftwarewww.inkscape.org›î< IDAT8u’9oSQ…ÏÜû^l¶LLA‰íOбȄȑ"BKÉ/pEa6E4”ôEˆѰH „EA&, ˆ@JpÞ™;±£ÄØ·»ÒùŽfÎ23ôzǯåÏzï/›Yˆž„.5j¼Ü­KzÒˆpëÈÑÃ¥b±€·oÞM5›÷8Ø­sý TãŽÑÑ”J%ì?°/°«—n‹A¥žúJ=%pÎf†YÄÜÜü 3ßè9i'ƒJ=õÞûeUÝ I’èé3Ó©ó³÷îÿ]YYlÿŠ17j¬ÝPŒ±táâ9gfˆQFk@url%@”ñ`öQ@쵂šYûoèÀ"Œ84j¼Q]21³ý¦ªžwÎår¹Ì,æYø?˜%€…‘$ž]I33$λ»4~}Û·ju|d¨<碲n›±0D2Î ˜1ÿbQƒ%¢ ïHä¾0+#[[Ãêj pD»š;ඪòù\6y²šï‹¼zö¡£}·G‰è™ÚÝ{<5=Ñfa¼~Ú4I£Æq£ÆF­RO#ca øòiI¾¶¢EÞS(ï.°´+ô*7×è˜hK@óýgO롥ş.Èzx  t’#‚uöo —,˜Á«2XxýH6q› "ˆþ<~ø¼Øž&@x"ü^xù£°~¯hôB¶€¯wÇl±IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/software-update-available-overlay.png0000664000175000017500000000134012136523632030771 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs × ×B(›xtIMEÛ 2VM„`IDATXÃí•9h”Q€¿÷Þ쮲EQñBLTB"â‚­ "Æ"„-D k+±³T; Å"Š‚…¤lÄ…¨x¡+Þš³²Ùã¿f,4vZýkµ_ý†ùæ½73ÐEªV+ù×ÓÅ䋌³5°¡féºáq¾uU Zá(P³û6 ŽyÅffòþmÉdØl Ããœðr,z± KgmP´YÇú–ïØëç˜}õtŸ6´\©lQ1i«qn>(OÖ’þÑc…¸ÝF’Ï@±nÿh`œÃ/y3q½™¶÷º!ð(iÖýøÇ ^ë-¨âöœÀ¿{T3@{úK ¸?dszÿ¥ÆšË.(ˆÌÕѨƒÌ¾ÃeLPFfß¡9ÒÆ,^XH¬³—ª–çò «ŽcÎõ­Zã/Û´9´i­×@R± ¢kÀXLßj$\Âô‹gÉLíuª"§r¹Œ4j£nãÈŸäáØ®ÿ0ÚžC£ªšoV+,5† ÆGÖ mñƒxoàÞÖ_3(}t…äÉMdá*jÕ'±Äí;"z|xœÏyÎ"ÐX?´ÉyÑ¨à ŽJ:yãWÕ啼|øXQ]6<ÎTÞ]°Õù~âIÇŦŒhFaò&HJdËg¢9‚BØŒÛ]À­¼v¨ˆÿêùÇDÓc,kûWøÆ7¼þ1–,Å8ߤ잰9 |—,;)q´SE¨dW¿~úÞ™úR5Ko«hI’x[–¤'€ÿgYSC Uõ¯Ë¨«T+ú½¤zôèÑ£G=þÊO0€òñ°7þIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-22.png0000664000175000017500000000217112136523632024004 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;sRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ 5bª¨ÐùIDAT8Ë•T[L\U]çÜ{ç33P 呸 ÆT±¬†&ÐLJÕÄükâ‡þ˜˜~Öâ«mhš¿ã¿ñÒjj$ Rc ¡ÑJ,)-VZ±3<˜¹÷ì½ý˜;vÝÉÎÙûœœµWöKa i9†JJ™ak KL˜.+v¨÷Ój£‡}'m¬øæ…öæ}Ÿ·4ªs´«RK÷—º>9ý͑䉭éú: –—±ãÕçÞªŸLœÅPô Šüè#uoà?ˆÞŒ±Ò¸~yôÛùº¢]JA£˜k0Ÿ~pþ8å¬c|í4®^<»Xy–r 3%½=ÝS¨ã„½Î_çõõ±¿Ë>’œ3q­!D@,u=^A…݈əëÄŒ—vE“ *r Â!çäÇ|³iñž Ë™·Ïƒ l’þÔgŠ˜±'~Ëþ" eaȃa~ùƒÃ}‰ßãù çeÒëÇÏ©/D¬9`ÃO ‚I@†Á$R(±ž†Rê!‚µ²RE €D ! ‹]€" 0CDÁX¿øqÔNÍ-í&†úóÆ„%`šc–gG†@$`Ã9%“À°ÁJ†­¨°¶»®uûb'Ùs©¥'í}y ±¦™~OŽ¥糞—qÉÏ1%ÊåAswAâÑ„iz¼ù»x¬¤Šm/~ãÖ¯ãíǽ6Í‚ø³Û¨TbȪo¬¬hiiv§†„(Ç–|™Ôäì{ù$^°Õv㼞ŠgxNª3Då É¿ïÑö¢§TXÅa2@±®ZMC.v”Í?i"#Pž‹·ËÙ4„lÕ´"9òÇåèâŒ~thøêtOwùó»öª™ô8ò¬5ÛÐbƒIÁø´zÏ•™ÓfèÆ•þôüJQIQytòîØ³ùTýk ù`—+‡_{ó}ðAmd§ 몉‰ 8®ƒòŠ2Ü™Ï÷ ÓqŒMÝt| ÔÑèÐ{é$×¶ç ÏdA†QlUÀ¬hu®çËk!G¿""{"áØGm­µ7ïBH؇íX±KïÒ,€¯6ìcàL׉aàÊOÂþ‹Ç9 àNÛû‹;îÍÞýÐ’²&1^Á .¸Ý<ã #ã-£(1¢P¹ºžt,Y/2 ßøq \AY¸!A}]½m[x:ºP]¾m[;)¶ra© {P[´@Òç¾ïŽå=‚¥­&€ÊfÓÕÖÎ…ª‘Ñ‹ yKòéBÛÍÅöÒXº†D”S<~pfÄ;(« –¿ T¯ñõšúJÐEy•5 øq¹K³P+‹§IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-update-16.png0000664000175000017500000000114312136523632025265 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ#ì">~ãIDAT8Ë’»k“QÆï9'MlDê`Ü%^@7‘P¬ŠÜ„oI½ ‚t¨Ðhu©›£ð©³ÿ€¤Š¨ ¢k’“s^‡\ˆñ‹øçú<Ï{U%ËÝ(œ²Ö^UÕ¢ˆ¼j·Û—ÒÄ×GqŽ1&Âbm¾Ò„Ãþ³÷=öâÌ8âV#1‚1`Gîr5gËÕœcÚ: xïoeFÚ¯A¹š³ÖÚza;€s.¬\<ý`¾öd²Ñø9ÙþcœIFk 1ÆÒãËç¾  ½ÃÒ™“›ªº P¹[›bV AUw^G:•&~ðàŽÜžºB˜3Æäóù‰V—MVç¬?°k©âŒ5«røæ–O÷/ÌNˆòÏ:È©ÿ³‹JFQŠÈÿ»[÷O¡#¯çOË!„b¡o-Ÿ¯4Æ‘A™[z8£~Öw‰ÈŠ{~¥¹Z®æž¶ÙlyUmŒ#+Ðñ¡ìImL¯åj.2_xñ²´¾öáWÔ(3»§'®=ö£WÝØ~+ÝÈTjß×Û7ï}§Žß>®o¼¦Ÿ–Q,àÿAa ¨kÚ% ×Ñe²#u[/šìÞ‰PW¥Ø‹ ²3M|à7ªgtãYyIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-32.png0000664000175000017500000000274612136523632024015 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôbKGDÿÿÿ ½§“ pHYs  šœtIMEÖ 9x,ïsIDATXÃÅW[lTU]çÜ{ÛΣ”–¶´J‹hÛB >ÄDñCýRøÐ~ Éø¡$S_áË„CLH‰1ò!‚qâDÃ+@ÁB©´…R ¥ó~ÞóØ~ôÎ0¾«è$'çì3ûܵî^gïÙÈÿçÇœ‰³/`Õ&ßË9[+¥^¤að.¥ô·ZQ èôH &nöÍe«š7ñrW% f!•I¬:üë¾– ×Oi팀/`–nly•ÿûñð=hH,.[ +Ÿ/»tóô¶ÙàÓu ú…2-ãbσ˘k4@CÊÍZÜî&%õÙÙÜ>g)Ô—g®ýœ®+mÉïÕXKp¥ûBB+úñ‘p´£ë¼Qm-Ñ•ÂŪp½çj €“ÿNP’9ÇÊy=îEûÀMÜúEô_MÃÍ—ô‘B£Áº˜Ü²¦¶TLBkB…µCñÛ€ä­[>rIA­À1Dš‚~!gD@kjØ·óÜfeñWî«ñï¡AiÖùkðÉ[‡¡´‚ÒJËüœ‘ |vè½J€,rÆiè6*qôÁÔCbŠ 5A+îø)tENŽØÎžÖr|| oƒ1"°YÕÆ8¼(g¬ äì m#µžÍ²14@˜(gç|Èñ‘ʼŸ€@„q&wl¡œN-Ÿ–îá]ÎYˆ€ni«Óœ\“žÐD²H•Íálóµ[Ë9g/iE-Œ³ ¤éå _Ü7}Ë✽¿ëµ<«²f0vsY(2¼U[H)ÕJO 4‘,BÚxba‹´ ×Ëív¹=\"…Ξ‹«Ã¡è~¯˜<`0—V¯Á™Ø!Ì™W‡¹óš Fܸ–޹xÓ’ÀÙë]ÃcóÝ);Žtv‘T/ ‚~qÀ3¾€Õ䨽¾vKHm›Å@Ð îå¨*Y‹»²c§ÑíDV¥F2 %´‹@+³2Óxû^ÏNl'BÀcê@Ð/zóRÙ£ÁÉ@[Õf„bCøéò±ÌÝîõ–§64y›ëW}‘Kˆ‹pþŒ-³¹BÄ‚~Ñ`§3¦W …ÊŽz£Ež6Ü Ý¿~—Q€#±ðŠh<¼ãÎÝþVµ­uÅÓgógliO¯MJ @ïr«¿]ù:Mšvýb¿ãvܰND⺆#÷—”^Øvx$"]XVgÞH-FÂé#ÒÀðp¨Àá"éÀ¹d* Êg†-²ÿŒ€PY(ý°&²!TέJØPÔ1»‰ðœ»Ìd6š'l‹©%˜‚€=J‚hfu5u^ÎÙëE¿[»+æTx%2Ò.Ȃ̔˜ô$³Q´Vm‚ÔR H)œ“fDô¢/`A¿PÀÛêñºÜ †Ê²z) ¤ [eLÞ°ñþ2Ƙ¯Ýê%MI᜺qL­¾}šb°q¯ù ãX7F¸ï¤nþë„NPT8ŠcÌ`9‘ÉÍÅëÂaä@9}_áã¬IDbŒD$c€vš[«@ù;ÜÏ(öÏRÅ$ˆHN*Áøý!c€…£ vŽ4‡ÿ % •àüÚ(IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-avail-16.png0000664000175000017500000000124112136523632025076 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ8,&·Š!IDAT8Ë}“»kÓQÇ¿÷ñkâ£!¶Ö‚¨ƒ ˆøŠZ"qwò1v29DTÄÅÅͽ‚ƒˆh%ÒÅm§¶*T±:XÅÒüî9ç‡&¡MÜáÂ÷óåžó=ר*ºÕé٠ιkªÚoŒ™ !ŒUJ´Ø©óèQÆàî±ãGOärýx;ÿNkµèÔÙ^"qëððNäóyìÙ»ÛØÞM·Î PN\¡œ°Ö"‚jÄìì\$¢[Ý üZØ9·("Û åÞ{Ä„¥_K¯l.”“{ÖÚŸ1Æ¡J‰¤s&Ƙ¿|åâ~UEŒ‰’€âè©ÃÄ,„ǟψÝZUmÞµ 3Zp P)Q;:æö–;"rÉZ›ÉdúRÕbÚ¼wtòz’ªÂ[gÇÍÈÍM_‹Å‘³ƒ°Ö€…×ÃM3bs@J)˜æÞÔ§¼B=‹À9‹@©'LBH ,/¯6°רcÏžNLŠH6›IGÏõ‚™ægê/cÔoã°1澟¸Ú/”“\£‘Òÿ`b“dì«”(¶c¬”H å$PbKÀç Sõê—•¨Ñ íìÜ‘;HЌе¢´[©,ĵ÷Ÿ(:Ç$Gê?làÕáÁ´ 6|&k ´ÕBS¸ ª 'B ¦Õ%Yí5ˆ0æÏ‹'¯§›¯‘æqÆàwuæûôê¾â/nAÿ+7ëp¬ùIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-update-22.png0000664000175000017500000000252012136523632025262 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;sRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ+ N)²ÐIDAT8Ë…”[lTU†¿}n3Ó™´¥¥@K)H¹Š  b5!€€ ƒF¢#/ødâ$HÔH½„|$bÂ1H„/ ´¥&J‘ b Ó–‹-¥—™¶3™sÎ>{ûÀ*…°“•½v²Ö¿Vþý¯%xÈ™·… ŽÍ8­±„`ØÐÜøê1aí`„t «ïçÖ½yÖƒŸûÄ"9,Ÿyï•—L¿Ú7E»J –•f÷]8÷…èê«*žõxÔŠDEsãžsÕz`>ð4^¼Ÿ/|r›dÁæ.™9¯JÝ<©UÝ?”†Â‘méävÃËŠšå¶0M’—/®Ñó Ð@+!3©Ýíx(#›ë[º—͘V$ÃíÌ}m^6+”ïÙ†×Kõº Ž0Mì‚mÇ ËLªÀ ¶êSûŸ­¥éhý©Âá%ñû±þÆI_ÆœÿæÂw±S-XÉ ¨lšlïÍ qLÇ'¶ú¬¬µÞïOÊ"Ã@L°£‘½‡0CaTzíçÐÃݧ•¼†C¦’X¡°xÙ¯ÏmT›ÇPasב{‘ÒÅo8Mîàa"å+VcÈ$z° ”¼›àyh¿ËŒ2cåj§·åÒ ýíñø` 7h£-Ý@©w‹h…v³h?…9g=ÖÂ7ïćÞ8†<¿Ÿ ý4šZkÆpüóÊ!^ßà%;â?k¥fXkvE­äÀð“Bôôs%P©žôQȰIðê£Tm;ð²h7ƒît lþ­5BænÖ>8‘Ÿí¤ËHÏZ»t]ãìÉO‰+ÉlfÈͺ^(çIla  ]Ma„CX*‡' Q: Üü(‰k"Lã¦1cµr‡W|Ì"KiŠU®E'ͪ²éeQMÇÐ_:'¥PX˜”^K€/imíDK! ªgOF؂뗻PDB+ÖN¨,ÿ¥çÚx A¢/ÕTNšg8ø9MD”Ñï_GjGXdƒë+§áM)F•Qq¼…®I,Ó$˜9ï­eˆîº£[‹¡ŒP·Pæä%$.u5DS7ê?/4ÝøéÌ¡ñ5‹–ŠîT¥@îÄb²ÅÈh¥5Ù©%Ä;p3.§ž*w¯;óû¿}‘V+ý¾³£1d{Äh jumH¿½aûN‚ÒLÍ×2g‰¶ö8‘HˆG*+0Í]Oˆ°¯9¶©ûã¼­ ÆÙ+€õ’­cuGóÒEúŠ˜UJ.#ÄѺƒÍRñ²€š³—b;_þÅ)}Ó!ÓFÆû9fìôö 8øÀµ©_z¨@ãØ1NývŠ”~®ésÀõšRsz=‚’>×»=W÷NðýÄ“Tä¼ ‘pT:6îŽÚÒ.eB+AšÄ4¶áQ° hŒÁú@û@VA´‰ü¥!HÀGŒIB(íR!MŒâZDÊÛ4-iª ]ºÝÝn÷î}×øÇ½»=w{»ÝÙ•¤¿d2çÎùs¾ŸùýfÎ̹b­å£lj¦|P; 0Óv`¦í$ÀLÛGÀœˆswWÞVjÇ»5 }…E… °ˆHý7(± D¬e¥[÷k• ¯ØX~¼êÃ/ž(€LåMÜÝ•Ÿ-Ê|W)½®sáùmg.Z* µ …R(ƒh¥ J»ˆrc@yhã ´ ÊAM[*ÅÛ_V†ûöDQ|Wz¨øÄÊ'¬ÿº»òÚ¸éõq®=íœeñ ¯ÎHå/ýíqÂÀk±¶ÖÝJ,Z+´€R U­ûµ­ëmR/ ”’Ú±ÎÅñÜKèþvÕ{°T(”‚X¬üúFîà8=eüçuJ…aIú©º(+Äñ°Au<‘D1(/K–%ˆ±‚U`œUñ‚e6{Ö {^~k¾P ÙýîÈ­tµÌ] 7½¯€÷võ—ÙõÚ6ÀÖÓÒÆš]þ#/…1)@°@øŒË´Íš‹ÖDƒˆ ð ‚*Åáƒôo¿›ÎÙ.FHMGǧÈÁ·þ}Ï㇖b5b_ßHÉÆöÚÕFž™ »+¿Â8©§/»þþt{ÇBJ#Ùµýqξà $=Š>Šbü $BüÂЋFŒƒRZ» ¬, ”ÁqS¸®‡›Êà:×qj€ãŠ„‘oóò–5ÌnM[a´Ò7P(qåªF¶5èîÊJïï¯úE&Ó27·n.÷¾õ\zÉocÎüHµ¿Ycêѯa<‚ɶ±ckAµŸÃÞ—Ÿåž´d½Jk.•*U#‡‹…8Ž—®}`ô€î®ü9Úx/ž{ñê–á÷Þ.îßýØÆÑÖ3-ÿÜW¯#<¼9æl6Q$$Ó¬¹È£Ûü”‡3÷|vüþ'ô½ýÒ°çe<Ñ:=Zª²è ×Þh€l¾1שo§ã9¢ôa…wûaðd.7ëÕÏ~ï±<å>lP˜‚ÈFÛ¤íDUf.¦õ,ž½wuÙ/|âå n¶Ø ð^\å“×=\8¨´qïÅBG·DAåÔU÷º'å¥×/ýòO³„âÊ6ò±q€‚zí'Jó6¦ä—¸o¢8 *¼C\â’¯ý,­Œéýô]•ØtbÕíXÉkO~`¢Ðÿ6ph͆BÐýü5g.^qikÇÇU8ø:bã£{kš¢à÷¿Böôå,¾èësÞÜúÛ‡¿¹~h%pÇ–Õ¿ r¥Îñ10f¯o•mmÙ{Õ͵j'}ŒœŸ~³Q@Ï#·”‡úvݰú¾ÑG“ç–Ú„KªÅáÖ§þù¨Ž¥E$ÑkÓi‚­-w#kmÊ8î·€€£^d›¯“–”x¹¥_ºM÷npšD×ÌdÚi;c ;ŸÛT±~±}¬=[$Xù„|'^¼v“­l¾NŒëᤦ7Œ—Âx"šºžcúïfJŒ›úðÔMÁŒã¡”ÛrLî{<¥4Æñ> ]S6ãÔ6DS!˜B4Ž;½Úu×G“ØñDcœéM!m<´žÚv}R/K-fš# ©ˆˆØI¶•MDĹr™¯.=)¤\c ÔAND|ÀoÒ " poÿ0i¤> Ms )ÇCiglu‘4µ—j`­ ’¾ã""ÔÅn9ÀA)5í)$Ž‹6¦þ͆†‡‹Hlí‘—Y2Š:) £  Mm5&&UŸF¡®ÇP[RÄõz ùiQšÏÐ?P‰tŸø2hP”Œ@’0ì ,¢†F‡œâæN%®ŽLå±ST7ùi™Ã¡^¬Òû€#½ÍÇ€µÖÖG»R*þõ—·.^vM*›?½é“m²m²mç1ÏÛ£Þ啞,÷öWîüz©•‰3QÓïB"b€Ô¢SÈ­¹<½ò”¶ô{Zâ2þD‹4‘u¬5@c^HÃíìØE‘eoï@õþõ.ý±¿H('îq šú¬D-ZN½˜DQ‰úÈWç#%±-#N”±”›”¨Õc ŸÀ˜1¡NhlvÐ á:!œDm¥D@-E ²v·Ë  P²—GG`¬NŠž`© ¿÷=×½o€ÿûÈÿÅt`¦í$ÀLÛÿ€ìЦ)IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/system-software-update_22.png0000664000175000017500000000267012136523632027230 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;bKGDÿÿÿ ½§“ pHYs × ×B(›xtIMEÕ ~>èÇEIDAT8Ëu•Yl׆¿;3¤¸H")‘²(‘梱§²o©k$°k#J‹"5Z Ð×¢@ÀÍc ÷IFûØô¥ j5 §í¢R4V­8‰X‰K¢eÙ%‹ZHÎŒ†Ãm&‘Õˆ/pûr¾óã¿ÿÏ~cx—§œÎÁ¾ Û¶{@BLï¹tá\úÛjÄöãI¸»Áûe,ÕÑw`ß^ºâ!Bê ›f‰Çk÷®19»HµfýþÒ…s¯?¼lo}tâ{ÏFOIQ©Y8k½=\ýWû~òz·lá©“ùßí9¾º·`Û`’0×0žYFrù¡¢s|¨E‘‰ø%ºâ{xÜ–øL]ÞV|<ÙSèˆ1 w®¿O¢ÿ6`Ù[`j–¢8ùñK/ðü@Œ`S€[SB X&á½ÞŸ^ÝãtÕ5ý^F§uä–›¥fÅÆ¶Á*5 CÍs°¿€–P3ÇŸëgg˜é¹&§Óø=<Œí ì€%Å)9œ µ,eÛ‰n”ÈŠlèet£Œj”0Ô5lÛþ¿ymøX\Ù µ¹‡"s¯û€øé¶Ç¸<®ª^¬(šQ¢Q^§8X\OSÛ76Ôj”T›ZÍB–wô`š&]Ñÿû„ïj¡cæ¶ ¸·Áo«k¹3ÙuÕ÷¸ÚÌáXñÝùÿºµ€ì Q­Y”Ê.~÷öG+/ìa 'Ža8d‰ôªM\5Øûpzhßi­ç Ë÷ר¯ƒÎx€€ßÇk'pé äTƒ¼VD“›PmwÒÑ4 ]×ùàæç´Gã,gó„3éünÿV2ÌÓ÷–‰7»xïÆgX–õ÷’ Z.’S‹ä´"ͤ°i²¸Q¦P( i†ar¨?ÆýGYÂËó½ÀG2@&=>N=è©÷Z‹„äm¦ª­àu×Q©T˜"[r±iVØ,–Ñ‹%\–JgKùB‚f~qøûW®&ç'»?+»>øÓû_NÝQÊA·ÛÙàwúð­®1zã6Sùf, ª5‹r¥F©\%Wõ«eªQCù÷•åÇþ:¼ÍÚ ¡Lz|6ØÞ?øè«ÇÓöò-;„ÛÇÌÒ&+º¶YÆ0+˜¦‰b—I„<„ÚbL/lP}÷rá•ë à•çáŸâ‰mÚö3?»p1‰w%÷¶Ðò³2÷1Gcbâcš’XYͳ°¸Êë¿yu§ø&üâ—ð ö$X¢@+Ðë9|(éù‰D$ÑTvœ&UFFFvâb늭Fb÷ꚟŸ'N“ÍfÉårär9¦¦¦¸víšØTøF@ÿ_?ÿXf &IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-avail-32.png0000664000175000017500000000303512136523632025077 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛw‰¨UIDATXÃÅWYlTUþι÷Ì0KéB)´B)ˆP,D¶@$JÁ1`ôII|áA#<˜¨$ã’Lq ñÁ„äC JÄDu\‘€ÙJ…²Jg:kgîY~z§ Ý[%NòçœÿÌŸó}÷ßîáÿüÙÃ1EDµeóÍœ³…J™©ŒAYoÒÚ|m4E¢aI”€eóèšg^[;oò²OJ|å°˜Ù\Zì:´õð©KG €ÆGF €iK^ÎþšüÔ¤âwa ô”Q‹sK欘}úÊÑÏGB€Õ0–ÚÖ±«÷Ï”•Y50P€» ·Ú›¡•91’àÃ1VRqüâ/ÑñÞál¬˜*Î5ŸÚc4ýøÈ Øw¶é¤U)¦h°™>VKWÏOpø‘WNЊ3(áÕ¸›¸Æ¸Ë?¼-ÿ)g?ð\#Z‹?0±¹ÀôºYÙ¤jUÆJÅ´¥nx øÌå[|½JÐ p´‘¡šhXªa0†j¶®ß]ï·Ë{ýw>õŒ&h#1sÜ‚ô‡¯ïª×FC mT÷šSi|¼óÝs jØ!ð[åØw#ú1M0†`´Asêš:wéî™1rmB5o€1"°åcõ ^ TлörϤq€®^ÏF˜„ *èrm”v@]ÀG@€ ¡O Á]]j ×…{`ùGÞ ¼Å9‹Ь}”3‹2Cê/,Jç 8+C¢žs¶Êhj`œ"C«£ayÏE„àœ½·á•MOD9µ&¯8±Žv#¥³W™\×Ńõ©<1±áEaùTÀç?èóö+dÅ…«þ%¶xɃ=­rAúxr'F²1u`Äq1í•xC {v3yÕŽkÎ:)tæÛБmAÀ®`“«g,ŽÇ~ÿ¦éá>NV«sAßÎ…E^T‰zxì¼'Pž¹hBPT"›O!•k‡ÑéÎ$M*}ªÄƆ"ÂâѰÌHä¢]?i/¬OúWúÞ rµþ)þE€f}Mƒ–åÄ’™°ô(_ã‚u¥³K*|*vEY:“ö€Ñ…hXj´4vhÜýxÕœ†R_%ÎÞÜÞ‘H·}ÝöCŠ?aáøãì±CZé[Ë;©ª²ÚöûüâJë¥ 6uWA4,/˜Šˆ:Wo 5 ©ŒÓ †£Æ_ ÏîCÖI"ÞÙŠ›‰ ÈëìC„¤ÊCKã#М¼ÊÕÞ¸{u=Ö!à³^} –-Ý J;£ã^jƒ,﬊gWÅ’m/ü|fÃÛ·y0XÒ9±¦.8¹zþžk§7§dœ „•÷ºˆEò ÀzW†Ö ¥ÎSÑ©IYÞ;±ëùï}Û¢¯ˆ°£#ŸHÅ×ݺssõ¼Y ·¤:OÃQ © @@M²†QåýíÜ—a2´1–Û\³¡ˆ8Ø‘ºßÔÞq^+ljwy@vꢶ:ü‰Hiu5"ã6ÄÚÛc»z„ŽÏd3’º«ÆÀ‘yó¯H'mtÂt>†ò²Š €%=&f?æúGù)“Otv¤3è»`ŽS\ë‰\Æ䜽Úã½õNéèÒ…¤rŠª W2˜ÌL>áŸY±,¨ŒJ(-µR™ÑŒˆžE„ K œ±çAß 壪ýRITŽqtÀÀóëëÛ1ÆB¢… ÕM$Åköò~=ÿÆQJÀÒÍö^Ʊ¨ŒøµÃfòßM€¦€`Œ ÂõLaí¹/«{p´;÷‹ìc/("’½B@D’1f÷ÒÂ^Znîp¼@ §}îI‚ˆÔ€!è{>d¬°XŠzçÃBC¸ü¹º òá ¿IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/system-software-update.png0000664000175000017500000000740012136523632026721 0ustar00directhexdirecthex00000000000000‰PNG  IHDR00Wù‡sBIT|dˆtEXtSoftwarewww.inkscape.org›î<’IDAThíšyl×}Ç?ofö$—‡xH$EQ¢-Ó²VÑeË:ùT›Æ ܵü‡ÛDµlR#( Ò¦‚Ž6=œ¤âÆ=ÔÚå&°%[”Yu­)Š7W<öš™ëõ’+‰Öa; ô? w÷ßïûþÞï÷Þ )%ÿ—‹òÛðYËÿøm—ÏD ®}›R×¾-úyù4E»™ÊuíÛBÀjààN`ðãÒ:íí/&\ר$·€l’’!HK)ûE9çÞݽûGæçE@\+ ³»ØØ: ìþ$ÝÙq~øó÷yž÷°©¦¦"ÒÐ0‡ÊÊ2b±Ù¬Îädž¡¡1r9£r—ª*;öî}åXéx½É¤Ò’JyŸš@]û¶r`C à5@øŠ6ß¾žîìË—½¬¬¬ø×á°úgÏ<ó°X¾ü**(ª ¼,†Dr4ÕM&çQÓèéàÐÁ3øíß…´o}ç;O‹¶¶9E4"›7X°°•¶æv°LQд`!–(ðlÇaÕüš*ÈLæø×ÙÃÛoµ…P¾úᇯ¼˜4Ð}-·ºÒ…æÛ¯å%àÓÀÆtgǰþùõªÊÞŸþôJA/p|@§µ>ÆØD†EmIܢəãѶê‹XŽC_O7‰ÚFжËâj—þþ>eIk‘pˆýû°cÇNXùá‡ß?h€ú$—…ÑtgÇHº³ã%àÀ½<ÿv üw~%ÞwìxRil¬§÷RžÖæzV/½…ÛškÑ”W$X±î~BšJHSiliEõŠx™>NöŒ2a–.n¦ª²×uY»v>šŒ?Ù²e‹À¹ˆ@‰•Ÿ¤ÀUy •_(? ühê÷H$üíGY³xãÆU(ŠàwÖ%M NŸ=Ç…‹ý ôv 𦢩*ª¢¢* ¦iPUæ¡Ëyäþ»¨«©&  …0M“­[¥©©lM_ß¼‚ïbÀ­½Édà ÀËÞHwvŒ¬[÷콪ªnöÙÇ.kD°,›Š¹­Ì©o@R‚ª*(Š‚¢æT×°xQ3CÃ#èºá®(¨ªŠÇqؾýa„/oØð|2 1˜‰ ½ÉäUxg‹8wàÀ^ŸúA¾¶}û#¢¬,>]Ù0LÞ~w/«Û7¡øé•%üÏ åÇNœcR›‡Ìž£ª<ÌÂù 4Ì­EQLÓdÑ¢$“sÃ'NŒ<üiÐÃE ¨V]×S -˜y(çÁϰÀ¦—_Vy×{{¹ãîM€ðgžð€çI< gúƨ¬®æÖ9.E¥GOðzg?ÿö‹Áä …îaT6ÐW¸„”²·³óÕ“%]/*!pÙ9á“ÎÄ{™Y üc Üuüx7M!_ÎÿÆqœ«×Ì©"¾DÞð×DÁ´Ð3L›î¡ º®O“Èfó¨ÒcaE„¾¾Q„àÍ©¾z“ÉÅ@u Rb³HwvŒGñ£Qs]û¶€ª*;ŽýØÖ/]¢V)²·ÛåXê4…BÓ4±mÇqø¨ë8v|þôìO»’éWp§ 躎m¹­:D.=ÁÈÈxäwKàຮYÀ&H{÷¾rLñÍ·ß>À­Ëñøá{C ‘ËåÈf³d³Y†FÉEòºo¥DtÓB×u …º®sþÂEÞé§)®qìØy¤ä…}û^í f¿x¸¼Šd®O 8y}¨0/8/×|;“)Ú»ç(K+\2&¤Ç&¦ÁÿìÍ_ðŸG2~H ¼i“(R(( ôŒ°¢¹‘ãÇÎcYήýû_ýûOâ¬bø!½/˜ÐR€tgG/¾d&ÐV×¾MÛ½ûeGJïÉ'ºÍñ¾!ÖÕI.ôN8z~S«ö0¬àé1Ì"ŽY`0#Ÿ P( D£ý—ŸTžž»7™\üq<ÎÌfîpo2¹µ7™ Áu®U¦J]û¶yøÇ» ГîìëÖmß*„ø›%KD·m{U…ÿøï½|0\­˜Îžçç ]éÚHÇB¸6«çZ”«QN¦†ž˜B<±oß+?À×oáÐ6•»úïÝ€D%0ߥFÓÞúõÏÞü¤²R]³yóÝ fœ›” æ,Ûé!=<é:„UÉܘƢʹ±IŽïƲœ]ŠÂÓß ÀÇ€øhW‚ß…ïïß0€„‚ï“ Kwv¸[¶lQûúæ½(„|¹¥en¸¥e.uójÐÏßÔÙ!!ˆ…TBB228F_ß(££9)y¡Ôç{“ÉJàÀ—K@{økñýÀö·¤RúT››"ppÓR¡¬Zµu¥¦EŸUUõ÷m[¯ô¼qb±‰D žÂu†áâyΨç¹of2}¯œ9³ë<`I)ÞdòKÀ÷ðUîöZR©â'aùT„—ÇçY¶lÙïÖÕ53™\s]±±,á°B8,èï?gtwŸzîìÙ³Gñ]¡x{$"_mn¾¯FUk$¼?GÓ´¤Rö5†¾¬ÜÔån<„ïFeÅX"‘¨õ$¥Ôu]¯7 £Î4ÍjÛ¶«Ç MNNröìYúûûoøTÉår¼óÎ;$ 4MCÓ4B¡P1‰LF£ÑK±Xl´²²r ººúœmÛ=wÜqÇÍعsçRÏó~Ïqœ/J)›ñ׌À¿t@J‰®ëÌÜCÝx±m›ááaFFFJ¿Žq!D#ਪz:‰ÑhTnÞ¼ùª>n( !T  ÿp]<+€ŠeË–=ÖØØøp]]]¨”ØõŠaÎÄÄ„¹gÏž¿ò$ͺN×9èïárÏŸû9çüÎ9\%"¬Eè5Q×¶—ú:ÔVDǯKRfÛîÏe¨R\ÊñÚ¹ÿ/Rãƒ,d/¥6­@k€¥@)…Ò Œ‚_Ä©‰ñÅ;^†+© /õá^8ËÉ#{H%%HÃúXKa[ŠšH¶¥UG‰Ý÷*Nä²c¤ÒŽì®àºïYµÑñ{‡Ñ¶C*q¯X¨¬Ð7_È‘ËåÈf/’I§H§SÌN'™øm©±_° {îÝŸèx_‡Úªöµkyþý8–äÔw°å‘Wã!bÐNÕ©Ôvè²²ñòˆ»ÀèOý„#7b;aŽì.m^rü$w<ô2&5b1øbñAL¥®ònü’\®¿mûS ® h| €]{Žñ¯‹ñ=¼BþáÓKðî~_}ùfìîd25ä]¿M¨rUé*Ëž¥˜‹Âd~Gùr™ BA‹©f×êésé¸=c½ì½Ö™Ö…´=ØJxÃf”ÄÍüA"1ßñöŸ÷À²s\Æå±o0?~lU8¨]šš 7í@¯‹Ÿ$39’˜žiiëÏ^ù SU»~UØË§1n÷ﳨÜ4~>Mæ¢7ÛÖ#¬¸Ò%8µ7¬ Ì´pûbœÍÞZÛ$SókÔ÷—Û•ˆ ”R@í¾v=ßþz’½*zøtß$·Pòxè[Ö'éÛD.Újæfæ>>ýUW×ÒŒm àÔÞ„qª¯ ÿü#¤4Y?Àü]]<|géý¿bÜ‚®¯>wë{?²DÄUJe±Ã½ûtçjiHU½G±P@)ÍÀñ3X&†ñ]ÜÅ,~ȉˆ¿x¯ZùQJ€P„`yEV¹‹ÙÞÑûuÞ•f§¦¥4£ÎÍå1^‘ÀâŒ7™í øß¢¼”W'­»žllnù+¸%AŒÑ"^1›žš8žüä…k‚ÿc°jàf`Îg€ó"’¿nxµøHî‰b­É™ÁIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-disabled-32.png0000664000175000017500000000256312136523632025557 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ¸Ý3­óIDATXÃÅWÏoEþfvìõMÜ:Ù¸A¥¢©ŠT ‘8À‰CU(8réSÕm©UœÊ0‡ ¡"Ä q*¹‰ª‡H(åÐÊmšFEŠãÈŽíØŽí­wg‡:f³q~¹,=í¼ñø}ß¼oæí3#"üŸq˜ÅŽã¼jÆWœów}ß?Åó ÃXTJý¬µ¾!¥¤—JÀ0Œ;çÏŸ?=66Ɖ8çhµZã³³³gÿ1çBàÉ“'QsÿÀßr¢Ñ(Êå2 Ãx,¥¬þ«×prrò/­õ ÎÿáÈ9ÇÉ“'›®ëBkh4Šjµ ¥Ô›“““;® ÖŒ±" K)ýCÐZOOO#†¿J¬­­A)­52™ ®]»ÖõµÖÝq»ÝÆ­[·^ fîÀu ‰ ›Ín›Û ®”B±XÄÚÚZ8LàÌ™3`ŒˆX_…ˆ1¶+8íðƒàyðbÂÁ{÷"ãûþ¾‡]ìND=wÚážd쟩©©i"šâœ—,yž÷cŒï¾™°ÈÀEÇqÆ8çk­Ï2Æþ$¢O¤”á8N„sþå¥K—’±X,].—OW*• žçyJ)s?ð½Èø¾ÑÑQ_ñmâù‡k­±´´4Q©TnøLH¶mceeƒƒƒH¥R£P(z×A¿T*!“É$ž={×u±±±Ó4122©T*ïmIà !¸ÖõzÕêó‚fY8ç/$A©TB,ƒëºh6›PJ¡Ùl"NƒˆÒŽã\JÙÐZßY^^¦ááa !“É@kT*µ/Ð^;"‚ét–eÁ4M4 0ƲRJ%:o9çöíÛ?Ù¶}6™Lbyyy£^¯§¯^½ÊzU¸°¿ÛõdŒaaa¡®”Ê !F?.‰Ddee¥AD?to”ò1€wÇy­ã?uÇSJ‰0áèÑ£H$BÀu]lnn¢T*¡Ýno#äy|ßxÛó¼ù|þ cìS"ºà›u@Jù4ôþßiضjµŠùùywuu•[–Õ²mÛ1 …Z­V7CžçuËŠ”rÀ•ެ† K*•Âúú:îÞ½Ûpƒˆ¾¯ÕjoÕëõ/òùü‡ç΋7›Ípè¿3 µF,Ãüü|‹ˆ®K)ov–ýâ8Îl­V[¬T*§"‘HWŠv»ÝÍ@_ ‰Rj‡þ¥RÉðcH:ðG£Ñض>(Aß‚‡ªÕjapp°àýPÇœ ¢âñ8\×Ýv÷“€T¥†††,Îùç¡¥×9b<Ïëyû"àº.lÛîšiš`Dô‘ã8F U»`YV‚ˆ`Yâñ8LÓìÿ2Ƙã8«333':zÒÜÜÜ댱\¾|Yçr9är¹^áš÷îÝcLPú3Ê‚>c,ÒéßDàÍè쎨Nß4¯ÇØà‘·#Dä1Æ4Ý º5V@£#ï€o¯ß"¤Â$ˆÈï™}Ú3 ‚Òüo ‰Nþ”ÒÀIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/installed-overlay.png0000664000175000017500000000124012136523632025717 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ6uqmÞ IDATXÃí•ÏkÓ`Ç?Mß&MœV»2AkÅ9/Naài2œ0¼yò_È`‚8ýð@H¾äùäyHÿ˜˜–»Ìܦ) Ý'] ÀU.[ZÂ`zdÛ–ãc»rYÇæêKAø{´%}ùtñÝÎÒÒ2À=A056’ÍÊ–kÊVß´¹wxk¶Tþ8¥Q@¥ 0=Ïûc¤Ñh`Y¦ibÛ¶I Òz:Šv»M«µöã»®Ëã¹Ãä–ÉÏ—‰ÅbÐQèRÊž„mÛH¥p]we…'P©T8²=Áéë‹ BÐ0tMÀ÷}šÍ&ó§&ù°ü™÷KŸøò­ÆÝ™ýÄãqvŸ½ n»7=1E§ÓáÌ¡J¥Oæ& 8 '"„@Áè¹;ËAb:E­å3{ë%µZ…Ùñ_ÍÏ߃T‡Žeé_A=4S›˜È¿ê5B0z±é!°œ^"©yJ" L†²ì»ö¢Ûüò e»çWUh­%5¾¡¬úA(1“ݯ`&Çè•gÉ­½±¶' eUß¼z¡ñºX •/I$!‘„ÍÃôŽWU ”ôÞ<ªàÕ º~Fiœ ;Ø3q”TfØØ'_çû×"ÏïßÄýñV‡€ ¬ÿ‹u* ADDDDDDÄÏO‚Û²,jIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/web.png0000664000175000017500000000160512136523632023043 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿabKGD)µÎŠÛ%F pHYs  d_‘tIMEÔ2—€ÀyIDATxœ]“ËoUÆó²'±óNœÔnJió@BDÅ£"j„X ŠÿTuG…°eϱ(;„‚ØP@  E4m•„¦J›†ÄNR{Ûc{î™{gØ$(â¬Îwt~ßêû þ7ƒã“™±‰â¹îl¦úmÛ°œ¸%£vãÀýËÝÙèñÉû¤(NÏ ÍÎÎ|²pi~þTa¬”N¥¬ƒf;>h´:ßßøñ—GÝ=Ÿ—×ïü$ÇŒq¼<ûÒü3Sç>½víýÙÞþLËB)ב$X(¾Z\TKKKWþÙü̯W›ÖŸuþÒ—ï^¹úLa|ÂãOj:rÙ4–msöéóæ~Í}nûу-¿Õ\ p.,\þè½>|»T*‡mω ¥´Öh¥P:&Á`h¼ÔÝòƒ¹õ»~ ´Í®ÜàÄÜ…—çóýTª‡lîÕ9hx‰çKâ$&j{nÓv˜™{±èds €c÷ærgR™ÌÔÏ7W0]Ý=8é˲±-ƒÂéa”R¤Ó)B¥h6;$˜¶aÚ¯ßÙBÈìV¹šœÁ´L:Bµ†i’M;ø£yÂ(Â"ˆh·}þÞØ$îºì0áÆævàô=ì}ýâóôå{y¼ë²½ï„^£cÁ™b ©7=*•=b­`Û‘ìÔdÇÛ Ã`( #´VGúB°úÐå æ¢•bt°HÇl—÷¨=Ù×:@YI¬…ÖzØì{Årlsxp€8ŽYYÛ êÖBÐñ}N†ÐqÂòí»ÉãÕ[å ±w¸o*ò='Æ›2ÉôLŸŠfÃãÖò BRHÉðP?BJn|ûMÔ*¯ý‘èhxb I²/UJqv¤8™»sï¾µ»ï>Ò÷Ù-oÇË¿ý$«ë7#q¸ ˆã(@Ã|käôÔ;tŽ™|Át2v¬Â8ô›mQÛrÃze#VÁÀï@ˆÿë‘I˜^.y@à° <¼£;' Žu è @‡G 8ÙÆYŽ›4%N= IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/download.png0000664000175000017500000000133612136523632024076 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿatEXtSoftwareAdobe ImageReadyqÉe<€IDATxÚŒ’¿OSQÇ¿ïG[Pß+µÒ&M¬-&ËfpSœœ4&þ°8¹ãäf ƒ‹\\d1Ƹ80u@^ý™Z~öÑ×¾÷ýôÜm5h¼ÉɹçÞs>÷›s®påé6þ²&îNe”Z=Âëòn“âòII²¾Ý¢€Ójò8,º,®×™à1¶y 0¢0êŒú~'% ®íà”ªòð*cA¡Õb`¶­QüØ2 0ÇF]ÀŸ’<×EK×!Çã Ó)üÜÚcZ¶OçAOቀ(Š…a0BÏsQslqØæ¿~u”ó‰ÜLà»^/ Ü§ô_»qk²Ðò",íù¨)iŒM M ö x¿°¤ù6+ ‚Щ‘ÔÉ;]@®´ô†Qù\Í%dz™U+]HàL¿ íÅ[ÍÑs²,—Qìòù<§ •ÕÚ­ ±bd£²–¹œÏˆ4™Úó—š[×ç$*NcƒÖWªÙl× ÓÓÓ‡ *Ñ¡Kƒø^Ä–«Ü“ê}>°¨a<Š7K9ñ;RÁ.|ßG†'O'Lb{Rª´ÓH¾ãg©±~.Òÿœ‚BM¼Î=ÒBi¹ÞÓàΖÿÊ…#ùX ù›³³³TUÍ:ôYlÛ"sH.–w=F‡eYßJ¥'ÏÚ€jµŠ¶úb±˜å@pŒ±õG7¡(©ìü¼•âËå2FGGéB‰éô¡i\—‘¹8'K@Ÿ[ǽ¥˜¦k6›í<Þƒ~Ú(…B!±¼¼¼F°ó¹Ü¥¶ ÆÜߨo¬üø°fF¢R©dxøÍY²aR0‹ÅÆñËó¼¤`•¶Õ_ V–QûËY OIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/plugin-update-32.png0000664000175000017500000000360612136523632025271 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ 1$Ac*–IDATXõWkl\Åþfîc^¿ÛµÛ±›R+‰‘(¤51)EP ÿ Bˆþ •úÑjUµ•ÓUH­ª" Q$«!U*T¥°%§7‰CblÇŽƒ_±³ïç½wfNx½ì:~$A½ÒÑ™™ï›ó9÷,ð|ú»ñýþn<»Òv'vöèušÎÅ9Û.„je BÓø”ê%é`0 ¨¼œi|à.’¢¥£7¾1®ßš—ŸxèÙ [›wóRO%4f MâðÉW³ 'NßVAg\dÿsÅúMûuO ]8ó¾’êIí¶pwôâ ßÁé5)Ôúïmü?ÿ#‘PXç~»¶<êî;Ù¡¹¼û¸éV"7ܨßñÁ4 ‘¡KQ*–Ö¼e¤˜H'~¿°ïm„|ä×ù±›·Vxê“€R½c¡š6pŽfí}O?ç¶3(Ç·C€´Ð²÷i“i ¯Wß};%Ò‰Ó ûò;‘@8òO?ÉÔº6æÇªV\éO^uãm'5ìXzô ˜É!hí?„¶ùG0ƒÐ#P™$2sÓ^gcCŸkUƺy÷1<̉áK®Ÿ^Sû5Ó­T2 ²²P‘q0³ Ì,ƒŠŒƒ²IˆDºËíp¿Ñßú»!À R°Ü²R^‡ðG½øÙˆ£W74ï]ÿð#†!" Ø`Û_¯²mPbzz ­w™þæÖGç#ýÝøñ²1°û7Æ8I¬Õxñ” Mí鸘R„r£ k•Œq‡¤‹¬ ÈI@k{úægòk\ûß…8ß 9ú åoëòA¨Õ¿zà¼zå⟼_$Þ‡’©¬ÙóÄΧ8z_öõaݦûaüô­ó9H|þ8G¡|k1zê´­ì̇¤è…Ž^L­x ¼Z%ŽÝ|ù51IPŠ ¤ÂHâ4†¢§ ß•Ø÷ß4˜Yi8ýI€ .‰,„•1@ô\G/fW½†Œq´$¸R*èWN§Á\&t•…ÍÊ HÂ}á( ,^¦1˜V¦Û•²3ÙÞ¹<À@P¡x¾M ‚1ÿdƒƒ aƒ1ŽÖ¶0ƒáú• [I¦œAyìº  E@ ^X<–ui8·Ã›5.„*Lì85 ïL Œ)þÅí#eçSqQv½b¾ ÂO8gaF„-Ïpp®H- ®äÂ8å=ruCi‘,g·ù±îØD6‹×ïåÿ¸îe?çœíU’62Îú;{èp0 fõÎÝ IŸùEI‰QY=Ýކö8Ží•u)©Š€–Ò)Y„ÎðU×nŒŸ·K~÷€ÇëõxK¸@WÆÎo‹„c¯xJP}}Õø4Þ‹²{jQqO“ƈkƒÉo ¼å$(òLnìr­„ª¾ßôÙ 3cÍ!š¾†ÝæºûŒHø?.Hà˜ÜÃI3öLe ‘ 5FLø–_ ´œg¦bCðUH[ $²!(©ÌÄÑX¾ VÝÙ£kÚXP9M]´³ñ[m-߮ܯÊô5h3‡•h*ÛŒ‘x¤RË­ KSù8–€©JQU² éPކÙÈÔå`@üIé¨ßüà×GZj¶l,÷Ta`âP4– UÿòùCì¶ô_FŸ œMH!'MÍÕXSU§{=^ctæËÞÊß‚`@ ñŽÎž¾¦\ÿZçAÝÊÖAqÔ{Ûà7`pÒv‘Ì &bW`Ét!GXŽòh‹%²k¿º1v€Oá €×oÉÁ€¸–ï ¤] NÚý]Ççðï‹Ç³ÓSSÜç+ÍÜ[ßäk®Û¦G/ áDòklaæ3) Ä€9ÃmUDŽ´ŠNÔXÒŽéðu|xò½ˆáÍh<²9–ˆ.[Ä@ R““Ó˜œœ^j¯ôø)µ€%‹*œ%˜9Ó Þ‹Û…¦å ‡ùÍÅ"s–h¾oñ€@åŒ Ú²PËÅÏ/X<\†Ðÿ9eË ¥YÂV|þÿK E‹K=ÙIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/icons/package-x-generic_22.png0000664000175000017500000000126712136523632026047 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;bKGDùC» pHYs × ×B(›xtIMEÕ %½—DIDAT8Ëí•ËkSA‡¿™;¹1IR#¦>6êR|TܸèBì²+%+_ Ý)ú(k1;¡….taQ‘–"Џ颭Р-ˆºh+ÁZbó¼wÆEÒôÖThêN<‹aæÇðÃÌïÌÀÿ¨…ð.Ò y˜Ú"«=•ÑÓ àUhòî²säsË€@ ²ºÕ „@Hð·‚[ÆÇyxãô:¸ðB/LSYþÌäÓ>²óŸª ±ø^|–@Y‚pt'ÊZZ‰ŸèÁŽî#7û‚ì÷%F†{ëp+»€Ù 3XÊfñý(Ù¯(rÒ²pœ •rÇu)• ”ŠeJZQ.ì9ÆÂÔNvõðöõóîÎCâ™H'¤9×?…¥ü¼½ÍáSÝí`ŒFÚ¡†ƒ”*°n­¦’çã«£m(;ÈÈp/ `~n€ƒ—ÑÙ7`4Æh\£1Æ£ëZ}®Ý*¹¦8ÞÅÌÄãzB06”àRßxíº¶3/×À©Œ™+mG¿M»øŒÜÑ.¼vYó£ñŒž0UÅ-¯Ð Zçj¯Ý®·þ²/®§2º£1g¯òcn¼)Zdcîʬª~ßdûƒ„"±¦À>Ûß m@d{S`éßöG°"¾@Õ$ØñÕ+ŽK€Vž>;²m·li1–d!¼W€*8tïæ™äÜ ó%sÈnƒ+Vïa økX«] 8@È+@±¦müoòÝ6ÿæ×ô éÖ×¶‹cé¢IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui.csproj0000664000175000017500000002113612136524015024520 0ustar00directhexdirecthex00000000000000 Debug AnyCPU 8.0.50727 {FEC19BDA-4904-4005-8C09-68E82E8BEF6A} Library Mono.Addins.Gui 2.0 Mono.Addins.Gui True ..\mono-addins.snk v4.0 True full True ..\bin prompt 4 True False True none True ..\bin prompt 4 True False True False False False False False {91DD5A2D-9FE3-4C3C-9253-876141874DAD} Mono.Addins False {A85C9721-C054-4BD8-A1F3-0227615F0A36} Mono.Addins.Setup False package-x-generic.png package-x-generic_16.png package-x-generic_22.png user-package.png gui.stetic system-software-update.png plugin-avail-16.png plugin-update-16.png plugin-16.png plugin-32.png plugin-avail-32.png plugin-update-32.png plugin-disabled-32.png system-software-update_22.png download.png plugin-22.png plugin-update-22.png software-update-available-overlay.png software-update-available.png installed-overlay.png web.png mono-addins-1.0/Mono.Addins.Gui/mono-addins-gui.pc.in0000664000175000017500000000042112136523632024363 0ustar00directhexdirecthex00000000000000prefix=${pcfiledir}/../.. exec_prefix=${prefix} pkglibdir=${prefix}/lib/mono/@PACKAGE@ Libraries=${pkglibdir}/@MONO_ADDINS_GUI_DEFAULT_LIB@ Name: Mono.Addins.Gui Description: Version: @VERSION@ Requires: mono-addins Libs: -r:${pkglibdir}/@MONO_ADDINS_GUI_DEFAULT_LIB@ mono-addins-1.0/Mono.Addins.Gui/policy.0.5.config0000664000175000017500000000055212136524034023431 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Gui/policy.0.3.config0000664000175000017500000000055212136524034023427 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Gui/obj/0000775000175000017500000000000012136524044021213 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/obj/Debug/0000775000175000017500000000000012136524044022241 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-update-32.png0000664000175000017500000000360612136523632031723 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ 1$Ac*–IDATXõWkl\Åþfîc^¿ÛµÛ±›R+‰‘(¤51)EP ÿ Bˆþ •úÑjUµ•ÓUH­ª" Q$«!U*T¥°%§7‰CblÇŽƒ_±³ïç½wfNx½ì:~$A½ÒÑ™™ï›ó9÷,ð|ú»ñýþn<»Òv'vöèušÎÅ9Û.„je BÓø”ê%é`0 ¨¼œi|à.’¢¥£7¾1®ßš—ŸxèÙ [›wóRO%4f MâðÉW³ 'NßVAg\dÿsÅúMûuO ]8ó¾’êIí¶pwôâ ßÁé5)Ôúïmü?ÿ#‘PXç~»¶<êî;Ù¡¹¼û¸éV"7ܨßñÁ4 ‘¡KQ*–Ö¼e¤˜H'~¿°ïm„|ä×ù±›·Vxê“€R½c¡š6pŽfí}O?ç¶3(Ç·C€´Ð²÷i“i ¯Wß};%Ò‰Ó ûò;‘@8òO?ÉÔº6æÇªV\éO^uãm'5ìXzô ˜É!hí?„¶ùG0ƒÐ#P™$2sÓ^gcCŸkUƺy÷1<̉áK®Ÿ^Sû5Ó­T2 ²²P‘q0³ Ì,ƒŠŒƒ²IˆDºËíp¿Ñßú»!À R°Ü²R^‡ðG½øÙˆ£W74ï]ÿð#†!" Ø`Û_¯²mPbzz ­w™þæÖGç#ýÝøñ²1°û7Æ8I¬Õxñ” Mí鸘R„r£ k•Œq‡¤‹¬ ÈI@k{úægòk\ûß…8ß 9ú åoëòA¨Õ¿zà¼zå⟼_$Þ‡’©¬ÙóÄΧ8z_öõaݦûaüô­ó9H|þ8G¡|k1zê´­ì̇¤è…Ž^L­x ¼Z%ŽÝ|ù51IPŠ ¤ÂHâ4†¢§ ß•Ø÷ß4˜Yi8ýI€ .‰,„•1@ô\G/fW½†Œq´$¸R*èWN§Á\&t•…ÍÊ HÂ}á( ,^¦1˜V¦Û•²3ÙÞ¹<À@P¡x¾M ‚1ÿdƒƒ aƒ1ŽÖ¶0ƒáú• [I¦œAyìº  E@ ^X<–ui8·Ã›5.„*Lì85 ïL Œ)þÅí#eçSqQv½b¾ ÂO8gaF„-Ïpp®H- ®äÂ8å=ruCi‘,g·ù±îØD6‹×ïåÿ¸îe?çœíU’62Îú;{èp0 fõÎÝ IŸùEI‰QY=Ýކö8Ží•u)©Š€–Ò)Y„ÎðU×nŒŸ·K~÷€ÇëõxK¸@WÆÎo‹„c¯xJP}}Õø4Þ‹²{jQqO“ƈkƒÉo ¼å$(òLnìr­„ª¾ßôÙ 3cÍ!š¾†ÝæºûŒHø?.Hà˜ÜÃI3öLe ‘ 5FLø–_ ´œg¦bCðUH[ $²!(©ÌÄÑX¾ VÝÙ£kÚXP9M]´³ñ[m-߮ܯÊô5h3‡•h*ÛŒ‘x¤RË­ KSù8–€©JQU² éPކÙÈÔå`@üIé¨ßüà×GZj¶l,÷Ta`âP4– UÿòùCì¶ô_FŸ œMH!'MÍÕXSU§{=^ctæËÞÊß‚`@ ñŽÎž¾¦\ÿZçAÝÊÖAqÔ{Ûà7`pÒv‘Ì &bW`Ét!GXŽòh‹%²k¿º1v€Oá €×oÉÁ€¸–ï ¤] NÚý]Ççðï‹Ç³ÓSSÜç+ÍÜ[ßäk®Û¦G/ áDòklaæ3) Ä€9ÃmUDŽ´ŠNÔXÒŽéðu|xò½ˆáÍh<²9–ˆ.[Ä@ R““Ó˜œœ^j¯ôø)µ€%‹*œ%˜9Ó Þ‹Û…¦å ‡ùÍÅ"s–h¾oñ€@åŒ Ú²PËÅÏ/X<\†Ðÿ9eË ¥YÂV|þÿK E‹K=ÙIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-16.png0000664000175000017500000000121612136523632030440 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasBIT|dˆtEXtSoftwarewww.inkscape.org›î< IDAT8u’9oSQ…ÏÜû^l¶LLA‰íOбȄȑ"BKÉ/pEa6E4”ôEˆѰH „EA&, ˆ@JpÞ™;±£ÄØ·»ÒùŽfÎ23ôzǯåÏzï/›Yˆž„.5j¼Ü­KzÒˆpëÈÑÃ¥b±€·oÞM5›÷8Ø­sý TãŽÑÑ”J%ì?°/°«—n‹A¥žúJ=%pÎf†YÄÜÜü 3ßè9i'ƒJ=õÞûeUÝ I’èé3Ó©ó³÷îÿ]YYlÿŠ17j¬ÝPŒ±táâ9gfˆQFk@url%@”ñ`öQ@쵂šYûoèÀ"Œ84j¼Q]21³ý¦ªžwÎår¹Ì,æYø?˜%€…‘$ž]I33$λ»4~}Û·ju|d¨<碲n›±0D2Î ˜1ÿbQƒ%¢ ïHä¾0+#[[Ãêj pD»š;ඪòù\6y²šï‹¼zö¡£}·G‰è™ÚÝ{<5=Ñfa¼~Ú4I£Æq£ÆF­RO#ca øòiI¾¶¢EÞS(ï.°´+ô*7×è˜hK@óýgO롥ş.Èzx  t’#‚uöo —,˜Á«2XxýH6q› "ˆþ<~ø¼Øž&@x"ü^xù£°~¯hôB¶€¯wÇl±IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.installed-overlay.png0000664000175000017500000000124012136523632032351 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ6uqmÞ IDATXÃí•ÏkÓ`Ç?Mß&MœV»2AkÅ9/Naài2œ0¼yò_È`‚8ýð@H¾äùäyHÿ˜˜–»Ìܦ) Ý'] ÀU.[ZÂ`zdÛ–ãc»rYÇæêKAø{´%}ùtñÝÎÒÒ2À=A056’ÍÊ–kÊVß´¹wxk¶Tþ8¥Q@¥ 0=Ïûc¤Ñh`Y¦ibÛ¶I Òz:Šv»M«µöã»®Ëã¹Ãä–ÉÏ—‰ÅbÐQèRÊž„mÛH¥p]we…'P©T8²=Áéë‹ BÐ0tMÀ÷}šÍ&ó§&ù°ü™÷KŸøò­ÆÝ™ýÄãqvŸ½ n»7=1E§ÓáÌ¡J¥Oæ& 8 '"„@Áè¹;ËAb:E­å3{ë%µZ…Ùñ_ÍÏ߃T‡Žeé_A=4S›˜È¿ê5B0z±é!°œ^"©yJ" L†²ì»ö¢Ûüò e»çWUh­%5¾¡¬úA(1“ݯ`&Çè•gÉ­½±¶' eUß¼z¡ñºX •/I$!‘„ÍÃôŽWU ”ôÞ<ªàÕ º~Fiœ ;Ø3q”TfØØ'_çû×"ÏïßÄýñV‡€ ¬ÿ‹u* ADDDDDDÄÏO‚Û²,jIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-disabled-32.png0000664000175000017500000000256312136523632032211 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ¸Ý3­óIDATXÃÅWÏoEþfvìõMÜ:Ù¸A¥¢©ŠT ‘8À‰CU(8réSÕm©UœÊ0‡ ¡"Ä q*¹‰ª‡H(åÐÊmšFEŠãÈŽíØŽí­wg‡:f³q~¹,=í¼ñø}ß¼oæí3#"üŸq˜ÅŽã¼jÆWœów}ß?Åó ÃXTJý¬µ¾!¥¤—JÀ0Œ;çÏŸ?=66Ɖ8çhµZã³³³gÿ1çBàÉ“'QsÿÀßr¢Ñ(Êå2 Ãx,¥¬þ«×prrò/­õ ÎÿáÈ9ÇÉ“'›®ëBkh4Šjµ ¥Ô›“““;® ÖŒ±" K)ýCÐZOOO#†¿J¬­­A)­52™ ®]»ÖõµÖÝq»ÝÆ­[·^ fîÀu ‰ ›Ín›Û ®”B±XÄÚÚZ8LàÌ™3`ŒˆX_…ˆ1¶+8íðƒàyðbÂÁ{÷"ãûþ¾‡]ìND=wÚážd쟩©©i"šâœ—,yž÷cŒï¾™°ÈÀEÇqÆ8çk­Ï2Æþ$¢O¤”á8N„sþå¥K—’±X,].—OW*• žçyJ)s?ð½Èø¾ÑÑQ_ñmâù‡k­±´´4Q©TnøLH¶mceeƒƒƒH¥R£P(z×A¿T*!“É$ž={×u±±±Ó4122©T*ïmIà !¸ÖõzÕêó‚fY8ç/$A©TB,ƒëºh6›PJ¡Ùl"NƒˆÒŽã\JÙÐZßY^^¦ááa !“É@kT*µ/Ð^;"‚ét–eÁ4M4 0ƲRJ%:o9çöíÛ?Ù¶}6™Lbyyy£^¯§¯^½ÊzU¸°¿ÛõdŒaaa¡®”Ê !F?.‰Ddee¥AD?to”ò1€wÇy­ã?uÇSJ‰0áèÑ£H$BÀu]lnn¢T*¡Ýno#äy|ßxÛó¼ù|þ cìS"ºà›u@Jù4ôþßiضjµŠùùywuu•[–Õ²mÛ1 …Z­V7CžçuËŠ”rÀ•ެ† K*•Âúú:îÞ½Ûpƒˆ¾¯ÕjoÕëõ/òùü‡ç΋7›Ípè¿3 µF,Ãüü|‹ˆ®K)ov–ýâ8Îl­V[¬T*§"‘HWŠv»ÝÍ@_ ‰Rj‡þ¥RÉðcH:ðG£Ñض>(Aß‚‡ªÕjapp°àýPÇœ ¢âñ8\×Ýv÷“€T¥†††,Îùç¡¥×9b<Ïëyû"àº.lÛîšiš`Dô‘ã8F U»`YV‚ˆ`Yâñ8LÓìÿ2Ƙã8«333':zÒÜÜÜ댱\¾|Yçr9är¹^áš÷îÝcLPú3Ê‚>c,ÒéßDàÍè쎨Nß4¯ÇØà‘·#Dä1Æ4Ý º5V@£#ï€o¯ß"¤Â$ˆÈï™}Ú3 ‚Òüo ‰Nþ”ÒÀIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.user-package.png0000664000175000017500000000170412136523632031267 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;sBIT|dˆtEXtSoftwarewww.inkscape.org›î<VIDAT8µÕ_h[UÀñï9÷æfIÿ%®kœ­Pu+ˆ:7q`uBDŸµøwXÑ-‚O}P&ÓÊ*ÈÄÉö`Qa2Ä2aXdž¤-›[Íf»¥Ò¤3KÓäÞ{~>$ͺN×9èïárÏŸû9çüÎ9\%"¬Eè5Q×¶—ú:ÔVDǯKRfÛîÏe¨R\ÊñÚ¹ÿ/Rãƒ,d/¥6­@k€¥@)…Ò Œ‚_Ä©‰ñÅ;^†+© /õá^8ËÉ#{H%%HÃúXKa[ŠšH¶¥UG‰Ý÷*Nä²c¤ÒŽì®àºïYµÑñ{‡Ñ¶C*q¯X¨¬Ð7_È‘ËåÈf/’I§H§SÌN'™øm©±_° {îÝŸèx_‡Úªöµkyþý8–äÔw°å‘Wã!bÐNÕ©Ôvè²²ñòˆ»ÀèOý„#7b;aŽì.m^rü$w<ô2&5b1øbñAL¥®ònü’\®¿mûS ® h| €]{Žñ¯‹ñ=¼BþáÓKðî~_}ùfìîd25ä]¿M¨rUé*Ëž¥˜‹Âd~Gùr™ BA‹©f×êésé¸=c½ì½Ö™Ö…´=ØJxÃf”ÄÍüA"1ßñöŸ÷À²s\Æå±o0?~lU8¨]šš 7í@¯‹Ÿ$39’˜žiiëÏ^ù SU»~UØË§1n÷ﳨÜ4~>Mæ¢7ÛÖ#¬¸Ò%8µ7¬ Ì´pûbœÍÞZÛ$SókÔ÷—Û•ˆ ”R@í¾v=ßþz’½*zøtß$·Pòxè[Ö'éÛD.Újæfæ>>ýUW×ÒŒm àÔÞ„qª¯ ÿü#¤4Y?Àü]]<|géý¿bÜ‚®¯>wë{?²DÄUJe±Ã½ûtçjiHU½G±P@)ÍÀñ3X&†ñ]ÜÅ,~ȉˆ¿x¯ZùQJ€P„`yEV¹‹ÙÞÑûuÞ•f§¦¥4£ÎÍå1^‘ÀâŒ7™í øß¢¼”W'­»žllnù+¸%AŒÑ"^1›žš8žüä…k‚ÿc°jàf`Îg€ó"’¿nxµøHî‰b­É™ÁIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.csproj.FilesWrittenAbsolute.txt0000664000175000017500000000374312136524036033262 0ustar00directhexdirecthex00000000000000/tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic_16.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic_22.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.user-package.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.system-software-update.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-avail-16.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-update-16.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-16.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-32.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-avail-32.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-update-32.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-disabled-32.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.system-software-update_22.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.download.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-22.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-update-22.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.software-update-available-overlay.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.software-update-available.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.installed-overlay.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.web.png /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.gtk-gui.gui.stetic /tmp/mono-addins/bin/Mono.Addins.Gui.dll.mdb /tmp/mono-addins/bin/Mono.Addins.Gui.dll /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.dll /tmp/mono-addins/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.dll.mdb mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-avail-32.png0000664000175000017500000000303512136523632031531 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛw‰¨UIDATXÃÅWYlTUþι÷Ì0KéB)´B)ˆP,D¶@$JÁ1`ôII|áA#<˜¨$ã’Lq ñÁ„äC JÄDu\‘€ÙJ…²Jg:kgîY~z§ Ý[%NòçœÿÌŸó}÷ßîáÿüÙÃ1EDµeóÍœ³…J™©ŒAYoÒÚ|m4E¢aI”€eóèšg^[;oò²OJ|å°˜Ù\Zì:´õð©KG €ÆGF €iK^ÎþšüÔ¤âwa ô”Q‹sK欘}úÊÑÏGB€Õ0–ÚÖ±«÷Ï”•Y50P€» ·Ú›¡•91’àÃ1VRqüâ/ÑñÞál¬˜*Î5ŸÚc4ýøÈ Øw¶é¤U)¦h°™>VKWÏOpø‘WNЊ3(áÕ¸›¸Æ¸Ë?¼-ÿ)g?ð\#Z‹?0±¹ÀôºYÙ¤jUÆJÅ´¥nx øÌå[|½JÐ p´‘¡šhXªa0†j¶®ß]ï·Ë{ýw>õŒ&h#1sÜ‚ô‡¯ïª×FC mT÷šSi|¼óÝs jØ!ð[åØw#ú1M0†`´Asêš:wéî™1rmB5o€1"°åcõ ^ TлörϤq€®^ÏF˜„ *èrm”v@]ÀG@€ ¡O Á]]j ×…{`ùGÞ ¼Å9‹Ь}”3‹2Cê/,Jç 8+C¢žs¶Êhj`œ"C«£ayÏE„àœ½·á•MOD9µ&¯8±Žv#¥³W™\×Ńõ©<1±áEaùTÀç?èóö+dÅ…«þ%¶xɃ=­rAúxr'F²1u`Äq1í•xC {v3yÕŽkÎ:)tæÛБmAÀ®`“«g,ŽÇ~ÿ¦éá>NV«sAßÎ…E^T‰zxì¼'Pž¹hBPT"›O!•k‡ÑéÎ$M*}ªÄƆ"ÂâѰÌHä¢]?i/¬OúWúÞ rµþ)þE€f}Mƒ–åÄ’™°ô(_ã‚u¥³K*|*vEY:“ö€Ñ…hXj´4vhÜýxÕœ†R_%ÎÞÜÞ‘H·}ÝöCŠ?aáøãì±CZé[Ë;©ª²ÚöûüâJë¥ 6uWA4,/˜Šˆ:Wo 5 ©ŒÓ †£Æ_ ÏîCÖI"ÞÙŠ›‰ ÈëìC„¤ÊCKã#М¼ÊÕÞ¸{u=Ö!à³^} –-Ý J;£ã^jƒ,﬊gWÅ’m/ü|fÃÛ·y0XÒ9±¦.8¹zþžk§7§dœ „•÷ºˆEò ÀzW†Ö ¥ÎSÑ©IYÞ;±ëùï}Û¢¯ˆ°£#ŸHÅ×ݺssõ¼Y ·¤:OÃQ © @@M²†QåýíÜ—a2´1–Û\³¡ˆ8Ø‘ºßÔÞq^+ljwy@vꢶ:ü‰Hiu5"ã6ÄÚÛc»z„ŽÏd3’º«ÆÀ‘yó¯H'mtÂt>†ò²Š €%=&f?æúGù)“Otv¤3è»`ŽS\ë‰\Æ䜽Úã½õNéèÒ…¤rŠª W2˜ÌL>áŸY±,¨ŒJ(-µR™ÑŒˆžE„ K œ±çAß 壪ýRITŽqtÀÀóëëÛ1ÆB¢… ÕM$Åköò~=ÿÆQJÀÒÍö^Ʊ¨ŒøµÃfòßM€¦€`Œ ÂõLaí¹/«{p´;÷‹ìc/("’½B@D’1f÷ÒÂ^Znîp¼@ §}îI‚ˆÔ€!è{>d¬°XŠzçÃBC¸ü¹º òá ¿IEND®B`‚Mono.Addins.Gui.icons.software-update-available-overlay.png0000664000175000017500000000134012136523632035344 0ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/obj/Debug‰PNG  IHDR szzôsRGB®ÎébKGDÿÿÿ ½§“ pHYs × ×B(›xtIMEÛ 2VM„`IDATXÃí•9h”Q€¿÷Þ쮲EQñBLTB"â‚­ "Æ"„-D k+±³T; Å"Š‚…¤lÄ…¨x¡+Þš³²Ùã¿f,4vZýkµ_ý†ùæ½73ÐEªV+ù×ÓÅ䋌³5°¡féºáq¾uU Zá(P³û6 ŽyÅffòþmÉdØl Ããœðr,z± KgmP´YÇú–ïØëç˜}õtŸ6´\©lQ1i«qn>(OÖ’þÑc…¸ÝF’Ï@±nÿh`œÃ/y3q½™¶÷º!ð(iÖýøÇ ^ë-¨âöœÀ¿{T3@{úK ¸?dszÿ¥ÆšË.(ˆÌÕѨƒÌ¾ÃeLPFfß¡9ÒÆ,^XH¬³—ª–çò «ŽcÎõ­Zã/Û´9´i­×@R± ¢kÀXLßj$\Âô‹gÉLíuª"§r¹Œ4j£nãÈŸäáØ®ÿ0ÚžC£ªšoV+,5† ÆGÖ mñƒxoàÞÖ_3(}t…äÉMdá*jÕ'±Äí;"z|xœÏyÎ"ÐX?´ÉyÑ¨à ŽJ:yãWÕ啼|øXQ]6<ÎTÞ]°Õù~âIÇŦŒhFaò&HJdËg¢9‚BØŒÛ]À­¼v¨ˆÿêùÇDÓc,kûWøÆ7¼þ1–,Å8ߤ잰9 |—,;)q´SE¨dW¿~úÞ™úR5Ko«hI’x[–¤'€ÿgYSC Uõ¯Ë¨«T+ú½¤zôèÑ£G=þÊO0€òñ°7þIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.software-update-available.png0000664000175000017500000000134412136523632033750 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasBIT|dˆ pHYs × ×B(›xtEXtSoftwarewww.inkscape.org›î<aIDAT8…“MhÔgÆó¾ÿÝUÖP)ˆXñ£+aÑ…^‘bzÁ…R=xðì©ôæQ{ë¡X,-x\¯-"ˆ.QÑVêŠVkMˆYÙìÇÿkÆCŒ¬â¶sžç7Ì<óˆ™1ªšuù«5lvTŒ4ë²A¼k‹­ÈwÖöü?ͺ|”kÀ-ñîDZO&g‚ò:Yš¿zY öûR­aç‚!Ø>®œqQIón–Ø|à‹P¼gùþÃÖ}Ùó•ªÃTò^çìšhpÍ…Q6>}¢”öûh–âÒ%(v™ŽÄ{ÂJ™s¿tó^ç÷÷ndÝv˜¾\"è=3ü¡ïûLQ™ ¿ø¬\]¹×û(NÎû¨¤ºÒÆ’ºü‰ªHTE—aƒòÎ2A\Êœw?5ë²@n焈œÛº=Ü´ûÓØå¬Ý͉gæH~> â±mh¼‘Å?îfK­¿rS=íV½0Å’>6èàwM½Ä3søñ¯°þ –ô¶^Ìluá ã©íµ=a”.L%Øû5ùY²ÛÑõ[iݼjÚ¿¢jßÖöÏð”ÎǵÝ>HÀ”`r0òù_W§V?âÏë· ³Mµ†-¼ëÂ^†Y ŸJµ‚ÒüEМÄU/DÉ Q)î¦ýÁçÀ¥wL5¼ïIfyŠˆcÇø–PBáñ½'©9âC'h8¸pC€Z§4M>3µu¦Å…Ÿ¾,øíß…´o}ç;O‹¶¶9E4"›7X°°•¶æv°LQд`!–(ðlÇaÕüš*ÈLæø×ÙÃÛoµ…P¾úᇯ¼˜4Ð}-·ºÒ…æÛ¯å%àÓÀÆtgǰþùõªÊÞŸþôJA/p|@§µ>ÆØD†EmIܢəãѶê‹XŽC_O7‰ÚFжËâj—þþ>eIk‘pˆýû°cÇNXùá‡ß?h€ú$—…ÑtgÇHº³ã%àÀ½<ÿv üw~%ÞwìxRil¬§÷RžÖæzV/½…ÛškÑ”W$X±î~BšJHSiliEõŠx™>NöŒ2a–.n¦ª²×uY»v>šŒ?Ù²e‹À¹ˆ@‰•Ÿ¤ÀUy •_(? ühê÷H$üíGY³xãÆU(ŠàwÖ%M NŸ=Ç…‹ý ôv 𦢩*ª¢¢* ¦iPUæ¡Ëyäþ»¨«©&  …0M“­[¥©©lM_ß¼‚ïbÀ­½Édà ÀËÞHwvŒ¬[÷콪ªnöÙÇ.kD°,›Š¹­Ì©o@R‚ª*(Š‚¢æT×°xQ3CÃ#èºá®(¨ªŠÇqؾýa„/oØð|2 1˜‰ ½ÉäUxg‹8wàÀ^ŸúA¾¶}û#¢¬,>]Ù0LÞ~w/«Û7¡øé•%üÏ åÇNœcR›‡Ìž£ª<ÌÂù 4Ì­EQLÓdÑ¢$“sÃ'NŒ<üiÐÃE ¨V]×S -˜y(çÁϰÀ¦—_Vy×{{¹ãîM€ðgžð€çI< gúƨ¬®æÖ9.E¥GOðzg?ÿö‹Áä …îaT6ÐW¸„”²·³óÕ“%]/*!pÙ9á“ÎÄ{™Y üc Üuüx7M!_ÎÿÆqœ«×Ì©"¾DÞð×DÁ´Ð3L›î¡ º®O“Èfó¨ÒcaE„¾¾Q„àÍ©¾z“ÉÅ@u Rb³HwvŒGñ£Qs]û¶€ª*;ŽýØÖ/]¢V)²·ÛåXê4…BÓ4±mÇqø¨ë8v|þôìO»’éWp§ 躎m¹­:D.=ÁÈÈxäwKàຮYÀ&H{÷¾rLñÍ·ß>À­Ëñøá{C ‘ËåÈf³d³Y†FÉEòºo¥DtÓB×u …º®sþÂEÞé§)®qìØy¤ä…}û^í f¿x¸¼Šd®O 8y}¨0/8/×|;“)Ú»ç(K+\2&¤Ç&¦ÁÿìÍ_ðŸG2~H ¼i“(R(( ôŒ°¢¹‘ãÇÎcYήýû_ýûOâ¬bø!½/˜ÐR€tgG/¾d&ÐV×¾MÛ½ûeGJïÉ'ºÍñ¾!ÖÕI.ôN8z~S«ö0¬àé1Ì"ŽY`0#Ÿ P( D£ý—ŸTžž»7™\üq<ÎÌfîpo2¹µ7™ Áu®U¦J]û¶yøÇ» ГîìëÖmß*„ø›%KD·m{U…ÿøï½|0\­˜Îžçç ]éÚHÇB¸6«çZ”«QN¦†ž˜B<±oß+?À×oáÐ6•»úïÝ€D%0ߥFÓÞúõÏÞü¤²R]³yóÝ fœ›” æ,Ûé!=<é:„UÉܘƢʹ±IŽïƲœ]ŠÂÓß ÀÇ€øhW‚ß…ïïß0€„‚ï“ Kwv¸[¶lQûúæ½(„|¹¥en¸¥e.uójÐÏßÔÙ!!ˆ…TBB228F_ß(££9)y¡Ôç{“ÉJàÀ—K@{økñýÀö·¤RúT››"ppÓR¡¬Zµu¥¦EŸUUõ÷m[¯ô¼qb±‰D žÂu†áâyΨç¹of2}¯œ9³ë<`I)ÞdòKÀ÷ðUîöZR©â'aùT„—ÇçY¶lÙïÖÕ53™\s]±±,á°B8,èï?gtwŸzîìÙ³Gñ]¡x{$"_mn¾¯FUk$¼?GÓ´¤Rö5†¾¬ÜÔån<„ïFeÅX"‘¨õ$¥Ôu]¯7 £Î4ÍjÛ¶«Ç MNNröìYúûûoøTÉår¼óÎ;$ 4MCÓ4B¡P1‰LF£ÑK±Xl´²²r ººúœmÛ=wÜqÇÍعsçRÏó~Ïqœ/J)›ñ׌À¿t@J‰®ëÌÜCÝx±m›ááaFFFJ¿Žq!D#ਪz:‰ÑhTnÞ¼ùª>n( !T  ÿp]<+€ŠeË–=ÖØØøp]]]¨”ØõŠaÎÄÄ„¹gÏž¿ò~ãIDAT8Ë’»k“QÆï9'MlDê`Ü%^@7‘P¬ŠÜ„oI½ ‚t¨Ðhu©›£ð©³ÿ€¤Š¨ ¢k’“s^‡\ˆñ‹øçú<Ï{U%ËÝ(œ²Ö^UÕ¢ˆ¼j·Û—ÒÄ×GqŽ1&Âbm¾Ò„Ãþ³÷=öâÌ8âV#1‚1`Gîr5gËÕœcÚ: xïoeFÚ¯A¹š³ÖÚza;€s.¬\<ý`¾öd²Ñø9ÙþcœIFk 1ÆÒãËç¾  ½ÃÒ™“›ªº P¹[›bV AUw^G:•&~ðàŽÜžºB˜3Æäóù‰V—MVç¬?°k©âŒ5«røæ–O÷/ÌNˆòÏ:È©ÿ³‹JFQŠÈÿ»[÷O¡#¯çOË!„b¡o-Ÿ¯4Æ‘A™[z8£~Öw‰ÈŠ{~¥¹Z®æž¶ÙlyUmŒ#+Ðñ¡ìImL¯åj.2_xñ²´¾öáWÔ(3»§'®=ö£WÝØ~+ÝÈTjß×Û7ï}§Žß>®o¼¦Ÿ–Q,àÿAa ¨kÚ% ×Ñe²#u[/šìÞ‰PW¥Ø‹ ²3M|à7ªgtãYyIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.system-software-update_22.png0000664000175000017500000000267012136523632033662 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;bKGDÿÿÿ ½§“ pHYs × ×B(›xtIMEÕ ~>èÇEIDAT8Ëu•Yl׆¿;3¤¸H")‘²(‘梱§²o©k$°k#J‹"5Z Ð×¢@ÀÍc ÷IFûØô¥ j5 §í¢R4V­8‰X‰K¢eÙ%‹ZHÎŒ†Ãm&‘Õˆ/pûr¾óã¿ÿÏ~cx—§œÎÁ¾ Û¶{@BLï¹tá\úÛjÄöãI¸»Áûe,ÕÑw`ß^ºâ!Bê ›f‰Çk÷®19»HµfýþÒ…s¯?¼lo}tâ{ÏFOIQ©Y8k½=\ýWû~òz·lá©“ùßí9¾º·`Û`’0×0žYFrù¡¢s|¨E‘‰ø%ºâ{xÜ–øL]ÞV|<ÙSèˆ1 w®¿O¢ÿ6`Ù[`j–¢8ùñK/ðü@Œ`S€[SB X&á½ÞŸ^ÝãtÕ5ý^F§uä–›¥fÅÆ¶Á*5 CÍs°¿€–P3ÇŸëgg˜é¹&§Óø=<Œí ì€%Å)9œ µ,eÛ‰n”ÈŠlèet£Œj”0Ô5lÛþ¿ymøX\Ù µ¹‡"s¯û€øé¶Ç¸<®ª^¬(šQ¢Q^§8X\OSÛ76Ôj”T›ZÍB–wô`š&]Ñÿû„ïj¡cæ¶ ¸·Áo«k¹3ÙuÕ÷¸ÚÌáXñÝùÿºµ€ì Q­Y”Ê.~÷öG+/ìa 'Ža8d‰ôªM\5Øûpzhßi­ç Ë÷ר¯ƒÎx€€ßÇk'pé äTƒ¼VD“›PmwÒÑ4 ]×ùàæç´Gã,gó„3éünÿV2ÌÓ÷–‰7»xïÆgX–õ÷’ Z.’S‹ä´"ͤ°i²¸Q¦P( i†ar¨?ÆýGYÂËó½ÀG2@&=>N=è©÷Z‹„äm¦ª­àu×Q©T˜"[r±iVØ,–Ñ‹%\–JgKùB‚f~qøûW®&ç'»?+»>øÓû_NÝQÊA·ÛÙàwúð­®1zã6Sùf, ª5‹r¥F©\%Wõ«eªQCù÷•åÇþ:¼ÍÚ ¡Lz|6ØÞ?øè«ÇÓöò-;„ÛÇÌÒ&+º¶YÆ0+˜¦‰b—I„<„ÚbL/lP}÷rá•ë à•çáŸâ‰mÚö3?»p1‰w%÷¶Ðò³2÷1Gcbâcš’XYͳ°¸Êë¿yu§ø&üâ—ð ö$X¢@+Ðë9|(éù‰D$ÑTvœ&UFFFvâb늭Fb÷ꚟŸ'N“ÍfÉårär9¦¦¦¸víšØTøF@ÿ_?ÿXf &IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic_22.png0000664000175000017500000000126712136523632032501 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;bKGDùC» pHYs × ×B(›xtIMEÕ %½—DIDAT8Ëí•ËkSA‡¿™;¹1IR#¦>6êR|TܸèBì²+%+_ Ý)ú(k1;¡….taQ‘–"Џ颭Р-ˆºh+ÁZbó¼wÆEÒôÖThêN<‹aæÇðÃÌïÌÀÿ¨…ð.Ò y˜Ú"«=•ÑÓ àUhòî²säsË€@ ²ºÕ „@Hð·‚[ÆÇyxãô:¸ðB/LSYþÌäÓ>²óŸª ±ø^|–@Y‚pt'ÊZZ‰ŸèÁŽî#7û‚ì÷%F†{ëp+»€Ù 3XÊfñý(Ù¯(rÒ²pœ •rÇu)• ”ŠeJZQ.ì9ÆÂÔNvõðöõóîÎCâ™H'¤9×?…¥ü¼½ÍáSÝí`ŒFÚ¡†ƒ”*°n­¦’çã«£m(;ÈÈp/ `~n€ƒ—ÑÙ7`4Æh\£1Æ£ëZ}®Ý*¹¦8ÞÅÌÄãzB06”àRßxíº¶3/×À©Œ™+mG¿M»øŒÜÑ.¼vYó£ñŒž0UÅ-¯Ð Zçj¯Ý®·þ²/®§2º£1g¯òcn¼)Zdcîʬª~ßdûƒ„"±¦À>Ûß m@d{S`éßöG°"¾@Õ$ØñÕ+ŽK€Vž>;²m·li1–d!¼W€*8tïæ™äÜ ó%sÈnƒ+Vïa økX«] 8@È+@±¦müoòÝ6ÿæ×ô éÖ×¶‹cé¢IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-avail-16.png0000664000175000017500000000124112136523632031530 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿasRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ8,&·Š!IDAT8Ë}“»kÓQÇ¿÷ñkâ£!¶Ö‚¨ƒ ˆøŠZ"qwò1v29DTÄÅÅͽ‚ƒˆh%ÒÅm§¶*T±:XÅÒüî9ç‡&¡MÜáÂ÷óåžó=ר*ºÕé٠ιkªÚoŒ™ !ŒUJ´Ø©óèQÆàî±ãGOärýx;ÿNkµèÔÙ^"qëððNäóyìÙ»ÛØÞM·Î PN\¡œ°Ö"‚jÄìì\$¢[Ý üZØ9·("Û åÞ{Ä„¥_K¯l.”“{ÖÚŸ1Æ¡J‰¤s&Ƙ¿|åâ~UEŒ‰’€âè©ÃÄ,„ǟψÝZUmÞµ 3Zp P)Q;:æö–;"rÉZ›ÉdúRÕbÚ¼wtòz’ªÂ[gÇÍÈÍM_‹Å‘³ƒ°Ö€…×ÃM3bs@J)˜æÞÔ§¼B=‹À9‹@©'LBH ,/¯6°רcÏžNLŠH6›IGÏõ‚™ægê/cÔoã°1澟¸Ú/”“\£‘Òÿ`b“dì«”(¶c¬”H å$PbKÀç Sõê—•¨Ñ íìÜ‘;HЌе¢´[©,ĵ÷Ÿ(:Ç$Gê?làÕáÁ´ 6|&k ´ÕBS¸ ª 'B ¦Õ%Yí5ˆ0æÏ‹'¯§›¯‘æqÆàwuæûôê¾â/nAÿ+7ëp¬ùIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.web.png0000664000175000017500000000160512136523632027475 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿabKGD)µÎŠÛ%F pHYs  d_‘tIMEÔ2—€ÀyIDATxœ]“ËoUÆó²'±óNœÔnJió@BDÅ£"j„X ŠÿTuG…°eϱ(;„‚ØP@  E4m•„¦J›†ÄNR{Ûc{î™{gØ$(â¬Îwt~ßêû þ7ƒã“™±‰â¹îl¦úmÛ°œ¸%£vãÀýËÝÙèñÉû¤(NÏ ÍÎÎ|²pi~þTa¬”N¥¬ƒf;>h´:ßßøñ—GÝ=Ÿ—×ïü$ÇŒq¼<ûÒü3Sç>½víýÙÞþLËB)ב$X(¾Z\TKKKWþÙü̯W›ÖŸuþÒ—ï^¹úLa|ÂãOj:rÙ4–msöéóæ~Í}nûу-¿Õ\ p.,\þè½>|»T*‡mω ¥´Öh¥P:&Á`h¼ÔÝòƒ¹õ»~ ´Í®ÜàÄÜ…—çóýTª‡lîÕ9hx‰çKâ$&j{nÓv˜™{±èds €c÷ærgR™ÌÔÏ7W0]Ý=8é˲±-ƒÂéa”R¤Ó)B¥h6;$˜¶aÚ¯ßÙBÈìV¹šœÁ´L:Bµ†i’M;ø£yÂ(Â"ˆh·}þÞØ$îºì0áÆævàô=ì}ýâóôå{y¼ë²½ï„^£cÁ™b ©7=*•=b­`Û‘ìÔdÇÛ Ã`( #´VGúB°úÐå æ¢•bt°HÇl—÷¨=Ù×:@YI¬…ÖzØì{Årlsxp€8ŽYYÛ êÖBÐñ}N†ÐqÂòí»ÉãÕ[å ±w¸o*ò='Æ›2ÉôLŸŠfÃãÖò BRHÉðP?BJn|ûMÔ*¯ý‘èhxb I²/UJqv¤8™»sï¾µ»ï>Ò÷Ù-oÇË¿ý$«ë7#q¸ ˆã(@Ã|käôÔ;tŽ™|Át2v¬Â8ô›mQÛrÃze#VÁÀï@ˆÿë‘I˜^.y@à° <¼£;' Žu è @‡G 8ÙÆYŽ›4%N= IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-update-22.png0000664000175000017500000000252012136523632031714 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;sRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ+ N)²ÐIDAT8Ë…”[lTU†¿}n3Ó™´¥¥@K)H¹Š  b5!€€ ƒF¢#/ødâ$HÔH½„|$bÂ1H„/ ´¥&J‘ b Ó–‹-¥—™¶3™sÎ>{ûÀ*…°“•½v²Ö¿Vþý¯%xÈ™·… ŽÍ8­±„`ØÐÜøê1aí`„t «ïçÖ½yÖƒŸûÄ"9,Ÿyï•—L¿Ú7E»J –•f÷]8÷…èê«*žõxÔŠDEsãžsÕz`>ð4^¼Ÿ/|r›dÁæ.™9¯JÝ<©UÝ?”†Â‘méävÃËŠšå¶0M’—/®Ñó Ð@+!3©Ýíx(#›ë[º—͘V$ÃíÌ}m^6+”ïÙ†×Kõº Ž0Mì‚mÇ ËLªÀ ¶êSûŸ­¥éhý©Âá%ñû±þÆI_ÆœÿæÂw±S-XÉ ¨lšlïÍ qLÇ'¶ú¬¬µÞïOÊ"Ã@L°£‘½‡0CaTzíçÐÃݧ•¼†C¦’X¡°xÙ¯ÏmT›ÇPasב{‘ÒÅo8Mîàa"å+VcÈ$z° ”¼›àyh¿ËŒ2cåj§·åÒ ýíñø` 7h£-Ý@©w‹h…v³h?…9g=ÖÂ7ïćÞ8†<¿Ÿ ý4šZkÆpüóÊ!^ßà%;â?k¥fXkvE­äÀð“Bôôs%P©žôQȰIðê£Tm;ð²h7ƒît lþ­5BænÖ>8‘Ÿí¤ËHÏZ»t]ãìÉO‰+ÉlfÈͺ^(çIla  ]Ma„CX*‡' Q: Üü(‰k"Lã¦1cµr‡W|Ì"KiŠU®E'ͪ²éeQMÇÐ_:'¥PX˜”^K€/imíDK! ªgOF؂뗻PDB+ÖN¨,ÿ¥çÚx A¢/ÕTNšg8ø9MD”Ñï_GjGXdƒë+§áM)F•Qq¼…®I,Ó$˜9ï­eˆîº£[‹¡ŒP·Pæä%$.u5DS7ê?/4ÝøéÌ¡ñ5‹–ŠîT¥@îÄb²ÅÈh¥5Ù©%Ä;p3.§ž*w¯;óû¿}‘V+ý¾³£1d{Äh jumH¿½aûN‚ÒLÍ×2g‰¶ö8‘HˆG*+0Í]Oˆ°¯9¶©ûã¼­ ÆÙ+€õ’­cuGóÒEúŠ˜UJ.#ÄѺƒÍRñ²€š³—b;_þÅ)}Ó!ÓFÆû9fìôö 8øÀµ©_z¨@ãØ1NývŠ”~®ésÀõšRsz=‚’>×»=W÷NðýÄ“Tä¼ ‘pT:6îŽ÷›s®påé6þ²&îNe”Z=Âëòn“âòII²¾Ý¢€Ójò8,º,®×™à1¶y 0¢0êŒú~'% ®íà”ªòð*cA¡Õb`¶­QüØ2 0ÇF]ÀŸ’<×EK×!Çã Ó)üÜÚcZ¶OçAOቀ(Š…a0BÏsQslqØæ¿~u”ó‰ÜLà»^/ Ü§ô_»qk²Ðò",íù¨)iŒM M ö x¿°¤ù6+ ‚Щ‘ÔÉ;]@®´ô†Qù\Í%dz™U+]HàL¿ íÅ[ÍÑs²,—Qìòù<§ •ÕÚ­ ±bd£²–¹œÏˆ4™Úó—š[×ç$*NcƒÖWªÙl× ÓÓÓ‡ *Ñ¡Kƒø^Ä–«Ü“ê}>°¨a<Š7K9ñ;RÁ.|ßG†'O'Lb{Rª´ÓH¾ãg©±~.Òÿœ‚BM¼Î=ÒBi¹ÞÓàΖÿÊ…#ùX ù›³³³TUÍ:ôYlÛ"sH.–w=F‡eYßJ¥'ÏÚ€jµŠ¶úb±˜å@pŒ±õG7¡(©ìü¼•âËå2FGGéB‰éô¡i\—‘¹8'K@Ÿ[ǽ¥˜¦k6›í<Þƒ~Ú(…B!±¼¼¼F°ó¹Ü¥¶ ÆÜߨo¬üø°fF¢R©dxøÍY²aR0‹ÅÆñËó¼¤`•¶Õ_ V–QûËY OIEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic.png0000664000175000017500000000405712136523632032176 0ustar00directhexdirecthex00000000000000‰PNG  IHDR00Wù‡sBIT|dˆtEXtSoftwarewww.inkscape.org›î<ÁIDAThí™{Œ]EÇ?¿™9çÜç>ÚÒ.eB+AšÄ4¶áQ° hŒÁú@û@VA´‰ü¥!HÀGŒIB(íR!MŒâZDÊÛ4-iª ]ºÝÝn÷î}×øÇ½»=w{»ÝÙ•¤¿d2çÎùs¾ŸùýfÎ̹b­å£lj¦|P; 0Óv`¦í$ÀLÛGÀœˆswWÞVjÇ»5 }…E… °ˆHý7(± D¬e¥[÷k• ¯ØX~¼êÃ/ž(€LåMÜÝ•Ÿ-Ê|W)½®sáùmg.Z* µ …R(ƒh¥ J»ˆrc@yhã ´ ÊAM[*ÅÛ_V†ûöDQ|Wz¨øÄÊ'¬ÿº»òÚ¸éõq®=íœeñ ¯ÎHå/ýíqÂÀk±¶ÖÝJ,Z+´€R U­ûµ­ëmR/ ”’Ú±ÎÅñÜKèþvÕ{°T(”‚X¬üúFîà8=eüçuJ…aIú©º(+Äñ°Au<‘D1(/K–%ˆ±‚U`œUñ‚e6{Ö {^~k¾P ÙýîÈ­tµÌ] 7½¯€÷võ—ÙõÚ6ÀÖÓÒÆš]þ#/…1)@°@øŒË´Íš‹ÖDƒˆ ð ‚*Åáƒôo¿›ÎÙ.FHMGǧÈÁ·þ}Ï㇖b5b_ßHÉÆöÚÕFž™ »+¿Â8©§/»þþt{ÇBJ#Ùµýqξà $=Š>Šbü $BüÂЋFŒƒRZ» ¬, ”ÁqS¸®‡›Êà:×qj€ãŠ„‘oóò–5ÌnM[a´Ò7P(qåªF¶5èîÊJïï¯úE&Ó27·n.÷¾õ\zÉocÎüHµ¿Ycêѯa<‚ɶ±ckAµŸÃÞ—Ÿåž´d½Jk.•*U#‡‹…8Ž—®}`ô€î®ü9Úx/ž{ñê–á÷Þ.îßýØÆÑÖ3-ÿÜW¯#<¼9æl6Q$$Ó¬¹È£Ûü”‡3÷|vüþ'ô½ýÒ°çe<Ñ:=Zª²è ×Þh€l¾1שo§ã9¢ôa…wûaðd.7ëÕÏ~ï±<å>lP˜‚ÈFÛ¤íDUf.¦õ,ž½wuÙ/|âå n¶Ø ð^\å“×=\8¨´qïÅBG·DAåÔU÷º'å¥×/ýòO³„âÊ6ò±q€‚zí'Jó6¦ä—¸o¢8 *¼C\â’¯ý,­Œéýô]•ØtbÕíXÉkO~`¢Ðÿ6ph͆BÐýü5g.^qikÇÇU8ø:bã£{kš¢à÷¿Böôå,¾èësÞÜúÛ‡¿¹~h%pÇ–Õ¿ r¥Îñ10f¯o•mmÙ{Õ͵j'}ŒœŸ~³Q@Ï#·”‡úvݰú¾ÑG“ç–Ú„KªÅáÖ§þù¨Ž¥E$ÑkÓi‚­-w#kmÊ8î·€€£^d›¯“–”x¹¥_ºM÷npšD×ÌdÚi;c ;ŸÛT±~±}¬=[$Xù„|'^¼v“­l¾NŒëᤦ7Œ—Âx"šºžcúïfJŒ›úðÔMÁŒã¡”ÛrLî{<¥4Æñ> ]S6ãÔ6DS!˜B4Ž;½Úu×G“ØñDcœéM!m<´žÚv}R/K-fš# ©ˆˆØI¶•MDĹr™¯.=)¤\c ÔAND|ÀoÒ " poÿ0i¤> Ms )ÇCiglu‘4µ—j`­ ’¾ã""ÔÅn9ÀA)5í)$Ž‹6¦þ͆†‡‹Hlí‘—Y2Š:) £  Mm5&&UŸF¡®ÇP[RÄõz ùiQšÏÐ?P‰tŸø2hP”Œ@’0ì ,¢†F‡œâæN%®ŽLå±ST7ùi™Ã¡^¬Òû€#½ÍÇ€µÖÖG»R*þõ—·.^vM*›?½é“m²m²mç1ÏÛ£Þ啞,÷öWîüz©•‰3QÓïB"b€Ô¢SÈ­¹<½ò”¶ô{Zâ2þD‹4‘u¬5@c^HÃíìØE‘eoï@õþõ.ý±¿H('îq šú¬D-ZN½˜DQ‰úÈWç#%±-#N”±”›”¨Õc ŸÀ˜1¡NhlvÐ á:!œDm¥D@-E ²v·Ë  P²—GG`¬NŠž`© ¿÷=×½o€ÿûÈÿÅt`¦í$ÀLÛÿ€ìЦ)IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.package-x-generic_16.png0000664000175000017500000000103412136523632032474 0ustar00directhexdirecthex00000000000000‰PNG  IHDRóÿabKGDùC» pHYs × ×B(›xtIMEÕ µÒà©IDAT8Ë­’1hTA†¿ÙÛÝwwÉ=b A®‘ I#ŠMÄÆR (‡X(– ;¯H)¤”± h,EµôšˆblŒ˜"*Q¢á]ÞÛ±x9#xQ§™Ùÿ›Ù™4hÔÌ0ðl“Ú‘ñ™Ð’FÍ4ѳWôýüc[6 #¹H>/bJi"/žÞ3s§êàôåV–,¿1³“§Ä;ÀÚZE‚sSpø¸Z8vñKoŸ³ûÀ¯[÷G-°CŒ˜¥b ž4äýE½Tú« €ê®}´WÞ(PÙ² Ù°ú’•¼|r›“¦@³ ŸUPmÒ¯HV?áŠ1(>º9!‡žƒô d« Õ BŠjÈ}Xk`ÏÞý<˜½hÑ~pûbŒà+@åÇzP$¯½þ¦3_†F²0׌¤Q3—€ú_žA½szäÄy–ç›]©â‡¸{ë ã3Al'é£2=ñÖ®ÎGßãŸ%ˆû»˜¨¸àJ=Ø.©û]q•à{ÿ Í÷‚ü°åkÓÇÏlfü_½Áÿ°oàÒ‡Ì)¥´IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-32.png0000664000175000017500000000274612136523632030447 0ustar00directhexdirecthex00000000000000‰PNG  IHDR szzôbKGDÿÿÿ ½§“ pHYs  šœtIMEÖ 9x,ïsIDATXÃÅW[lTU]çÜ{ÛΣ”–¶´J‹hÛB >ÄDñCýRøÐ~ Éø¡$S_áË„CLH‰1ò!‚qâDÃ+@ÁB©´…R ¥ó~ÞóØ~ôÎ0¾«è$'çì3ûܵî^gïÙÈÿçÇœ‰³/`Õ&ßË9[+¥^¤að.¥ô·ZQ èôH &nöÍe«š7ñrW% f!•I¬:üë¾– ×Oi팀/`–nly•ÿûñð=hH,.[ +Ÿ/»tóô¶ÙàÓu ú…2-ãbσ˘k4@CÊÍZÜî&%õÙÙÜ>g)Ô—g®ýœ®+mÉïÕXKp¥ûBB+úñ‘p´£ë¼Qm-Ñ•ÂŪp½çj €“ÿNP’9ÇÊy=îEûÀMÜúEô_MÃÍ—ô‘B£Áº˜Ü²¦¶TLBkB…µCñÛ€ä­[>rIA­À1Dš‚~!gD@kjØ·óÜfeñWî«ñï¡AiÖùkðÉ[‡¡´‚ÒJËüœ‘ |vè½J€,rÆiè6*qôÁÔCbŠ 5A+îø)tENŽØÎžÖr|| oƒ1"°YÕÆ8¼(g¬ äì m#µžÍ²14@˜(gç|Èñ‘ʼŸ€@„q&wl¡œN-Ÿ–îá]ÎYˆ€ni«Óœ\“žÐD²H•Íálóµ[Ë9g/iE-Œ³ ¤éå _Ü7}Ë✽¿ëµ<«²f0vsY(2¼U[H)ÕJO 4‘,BÚxba‹´ ×Ëív¹=\"…Ξ‹«Ã¡è~¯˜<`0—V¯Á™Ø!Ì™W‡¹óš Fܸ–޹xÓ’ÀÙë]ÃcóÝ);Žtv‘T/ ‚~qÀ3¾€Õ䨽¾vKHm›Å@Ð îå¨*Y‹»²c§ÑíDV¥F2 %´‹@+³2Óxû^ÏNl'BÀcê@Ð/zóRÙ£ÁÉ@[Õf„bCøéò±ÌÝîõ–§64y›ëW}‘Kˆ‹pþŒ-³¹BÄ‚~Ñ`§3¦W …ÊŽz£Ež6Ü Ý¿~—Q€#±ðŠh<¼ãÎÝþVµ­uÅÓgógliO¯MJ @ïr«¿]ù:Mšvýb¿ãvܰND⺆#÷—”^Øvx$"]XVgÞH-FÂé#ÒÀðp¨Àá"éÀ¹d* Êg†-²ÿŒ€PY(ý°&²!TέJØPÔ1»‰ðœ»Ìd6š'l‹©%˜‚€=J‚hfu5u^ÎÙëE¿[»+æTx%2Ò.Ȃ̔˜ô$³Q´Vm‚ÔR H)œ“fDô¢/`A¿PÀÛêñºÜ †Ê²z) ¤ [eLÞ°ñþ2Ƙ¯Ýê%MI᜺qL­¾}šb°q¯ù ãX7F¸ï¤nþë„NPT8ŠcÌ`9‘ÉÍÅëÂaä@9}_áã¬IDbŒD$c€vš[«@ù;ÜÏ(öÏRÅ$ˆHN*Áøý!c€…£ vŽ4‡ÿ % •àüÚ(IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.icons.plugin-22.png0000664000175000017500000000217112136523632030436 0ustar00directhexdirecthex00000000000000‰PNG  IHDRÄ´l;sRGB®ÎébKGDÿÿÿ ½§“ pHYs  šœtIMEÛ 5bª¨ÐùIDAT8Ë•T[L\U]çÜ{ç33P 呸 ÆT±¬†&ÐLJÕÄükâ‡þ˜˜~Öâ«mhš¿ã¿ñÒjj$ Rc ¡ÑJ,)-VZ±3<˜¹÷ì½ý˜;vÝÉÎÙûœœµWöKa i9†JJ™ak KL˜.+v¨÷Ój£‡}'m¬øæ…öæ}Ÿ·4ªs´«RK÷—º>9ý͑䉭éú: –—±ãÕçÞªŸLœÅPô Šüè#uoà?ˆÞŒ±Ò¸~yôÛùº¢]JA£˜k0Ÿ~pþ8å¬c|í4®^<»Xy–r 3%½=ÝS¨ã„½Î_çõõ±¿Ë>’œ3q­!D@,u=^A…݈əëÄŒ—vE“ *r Â!çäÇ|³iñž Ë™·Ïƒ l’þÔgŠ˜±'~Ëþ" eaȃa~ùƒÃ}‰ßãù çeÒëÇÏ©/D¬9`ÃO ‚I@†Á$R(±ž†Rê!‚µ²RE €D ! ‹]€" 0CDÁX¿øqÔNÍ-í&†úóÆ„%`šc–gG†@$`Ã9%“À°ÁJ†­¨°¶»®uûb'Ùs©¥'í}y ±¦™~OŽ¥糞—qÉÏ1%ÊåAswAâÑ„iz¼ù»x¬¤Šm/~ãÖ¯ãíǽ6Í‚ø³Û¨TbȪo¬¬hiiv§†„(Ç–|™Ôäì{ù$^°Õv㼞ŠgxNª3Då É¿ïÑö¢§TXÅa2@±®ZMC.v”Í?i"#Pž‹·ËÙ4„lÕ´"9òÇåèâŒ~thøêtOwùó»öª™ô8ò¬5ÛÐbƒIÁø´zÏ•™ÓfèÆ•þôüJQIQytòîØ³ùTýk ù`—+‡_{ó}ðAmd§ 몉‰ 8®ƒòŠ2Ü™Ï÷ ÓqŒMÝt| ÔÑèÐ{é$×¶ç ÏdA†QlUÀ¬hu®çËk!G¿""{"áØGm­µ7ïBH؇íX±KïÒ,€¯6ìcàL׉aàÊOÂþ‹Ç9 àNÛû‹;îÍÞýÐ’²&1^Á .¸Ý<ã #ã-£(1¢P¹ºžt,Y/2 ßøq \AY¸!A}]½m[x:ºP]¾m[;)¶ra© {P[´@Òç¾ïŽå=‚¥­&€ÊfÓÕÖÎ…ª‘Ñ‹ yKòéBÛÍÅöÒXº†D”S<~pfÄ;(« –¿ T¯ñõšúJÐEy•5 øq¹K³P+‹§IEND®B`‚mono-addins-1.0/Mono.Addins.Gui/obj/Debug/Mono.Addins.Gui.gtk-gui.gui.stetic0000664000175000017500000024116112136523632030452 0ustar00directhexdirecthex00000000000000 .. 2.12 False Error Dialog 6 1 False 6 6 6 stock:gtk-dialog-error Dialog 0 False False False 0 False False False 12 540 True 0 An exception has been thrown 1 2 3 4 5 6 7 8 9 10 11 12 13 14 True True 0 False False False True True In 250 True 2 2 6 6 Details label_item 1 False 1 False 0 False 10 5 1 End True True True StockItem gtk-ok -5 gtk-ok False False False False Add-in Manager Dialog 6 700 550 2 False 3 2 6 6 12 12 True 0 False 9 9 6 True In True 0 True 0 True ButtonPressMask False 1 True False False Installed tab 9 9 6 No updates found 0 False False False True TextAndIcon stock:gtk-refresh Menu Refresh True None End 1 False False False True TextAndIcon resource:download.png Update All True None End 2 True False False 0 True False False True In True 1 True 0 False ButtonPressMask False 1 True False False 1 Updates tab 9 9 6 Repository: 0 False False False False 1 False True TextAndIcon stock:gtk-refresh Menu True None 2 False False False 0 True False False True In True 1 True 0 False ButtonPressMask False 1 True False False 2 Gallery tab 0 True 0 False 0 False 0 False 6 5 2 Edge True TextOnly Install from file... True -1 False False True True True StockItem gtk-close -7 gtk-close 1 False False False False Add-in Repository Management Dialog 6 600 300 1 False 6 12 6 True In True False 0 False 6 True True StockItem gtk-add gtk-add 0 False False False True True StockItem gtk-delete gtk-delete 1 False False False 1 False False False 0 False 10 6 1 End True True True StockItem gtk-close -7 gtk-close False False False False Add New Repository Dialog 6 550 2 False 6 2 6 6 0 Select the location of the repository you want to register: 0 False False False True Register an on-line repository True True True True btnOnlineRep 1 False False False 6 32 0 False False False Url: 1 False False False True True â— 2 False 2 False False False True Register a local repository True True True btnOnlineRep 3 False False False 6 32 0 False False False Path: 1 False False False 6 True True â— 0 True True TextOnly Browse... True 1 True False False 2 True 4 False False False 0 False 10 5 2 End True True True StockItem gtk-cancel -6 gtk-cancel False False True True True StockItem gtk-ok -5 gtk-ok 1 False False False Add-in Manager CenterOnParent 6 2 False 6 2 6 6 0 Additional extensions are required to perform this operation. 0 True False False 0 The following add-ins will be installed: 1 True False False True In None 6 6 0 0 label3 2 True False 3 True False False 0 True 10 6 2 End True True True StockItem gtk-cancel -6 gtk-cancel False False True True True StockItem gtk-ok -1 gtk-ok 1 False False False False Progress CenterOnParent True 1 False 2 6 9 0 0 True False False 1 True False False True In True True Details True label_item 2 True 0 True 6 5 1 End True True True StockItem gtk-cancel -6 gtk-cancel False False False False CenterOnParent 2 False 2 9 9 True Never Never None 6 400 0 0 label3 True 0 True False False 0 True False 1 True False False 6 0 End 0 True False False 1 True False False 2 True False False 0 True 10 5 2 End True True True StockItem gtk-cancel -1 gtk-cancel False False True True TextOnly Install True -1 1 False False False False 6 stock:gtk-dialog-warning Menu 0 True False False 250 0 label1 True 1 True False False 0 True False False 6 12 6 6 3 280 0 <b><big>Some Addin</big></b> True True 0 False False False 280 0 Version 2.6 True 1 False False False 0 True False False 0 True 0 True False False True Never None 6 250 0 Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. Long description of the add-in. True 0 True False False 6 True TextAndIcon resource:web.png More information True None 0 True False False End 2 True False False 1 False 1 True 6 True TextAndIcon resource:download.png Install... True 0 True False False True TextAndIcon resource:download.png Update True 1 True False False True TextOnly Disable True 2 True False False True TextOnly _Uninstall... True 3 True False False 2 True False False mono-addins-1.0/Mono.Addins.Gui/ChangeLog0000664000175000017500000002364412136523632022226 0ustar00directhexdirecthex000000000000002010-05-25 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Add Debug and Release configurations. 2010-03-30 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: csc doesn't like iso-2. 2010-03-29 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Make sure the solution builds on MS.NET 2.0. 2010-03-26 Lluis Sanchez Gual * gtk-gui/generated.cs: * Mono.Addins.Gui.csproj: * gtk-gui/Mono.Addins.Gui.ErrorDialog.cs: * gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs: * gtk-gui/Mono.Addins.Gui.ProgressDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs: * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs: Flush. 2009-09-01 Lluis Sanchez Gual * AssemblyInfo.cs: Bump Mono.Addins version. 2009-08-20 Lluis Sanchez Gual * Makefile.am: Build using gmcs. 2009-08-19 Lluis Sanchez Gual * gtk-gui/gui.stetic: * gtk-gui/Mono.Addins.Gui.ProgressDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs: Flush. * Mono.Addins.Gui.csproj: Update target framework to 2.0. 2009-05-28 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Properly sign assemblies. 2009-05-27 Lluis Sanchez Gual * Mono.Addins.Gui/ProgressDialog.cs: The error dialog must run in the gui thread. 2009-02-06 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Updated. 2009-02-06 Lluis Sanchez Gual * gtk-gui/gui.stetic: * gtk-gui/generated.cs: * gtk-gui/Mono.Addins.Gui.ErrorDialog.cs: * gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs: * gtk-gui/Mono.Addins.Gui.ProgressDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs: * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs: * gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs: Flush. 2008-11-10 Lluis Sanchez Gual * mono-addins-gui.pc.in: Respect custom libdir during ./configure. Fixes bug #443205. Patch by Diego Pettenò. 2008-11-10 Lluis Sanchez Gual * Makefile.am: Fix building with parallel make jobs (-j8). Fixes bug #443206. Patch by Diego Pettenò. 2008-08-22 Lluis Sanchez Gual * Mono.Addins.Gui.csproj, Mono.Addins.Gui.mdp: Use msbuild file format for projects. Removed the old MD1 projects. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.Gui/AddinManagerDialog.cs: Fix build. 2008-06-11 Lluis Sanchez Gual * Mono.Addins.Gui/AddinManagerDialog.cs: Don't allow uninstalling add-ins with the CantUninstall flag. Same for CantDisable and Hidden flags. 2008-02-15 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/gui.stetic, Mono.Addins.Gui.mdp: Flush. 2008-02-06 Lluis Sanchez Gual * AssemblyInfo.cs: Added support for pluggable add-in assembly reflectors. Implemented an add-in assembly reflector based on Cecil. 2008-01-17 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.ErrorDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs: Regenerated. * gtk-gui/Mono.Addins.Gui.ProgressDialog.cs, gtk-gui/gui.stetic, Makefile.am, Mono.Addins.Gui.mdp, Mono.Addins.Gui/ProgressDialog.cs: Added new progress dialog to be used when updating registries. * Mono.Addins.Gui/ManageSitesDialog.cs: When adding a repository, update it to get the add-in list. * Mono.Addins.Gui/AddinInstallDialog.cs: Improve progress reporting. 2008-01-07 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Updated VS solution files. Patch by Andrés G. Aragoneses. 2007-12-15 Lluis Sanchez Gual * mono-addins-gui.pc.in: Update assembly paths. 2007-12-12 Lluis Sanchez Gual * Makefile.am: Generate and install policy files for old Mono.Addins versions. 2007-12-11 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs, gtk-gui/gui.stetic, Makefile.am, Mono.Addins.Gui.mdp, Mono.Addins.Gui/AddinInstallDialog.cs: Properly report warnings when installing add-ins. 2007-12-05 Lluis Sanchez Gual * gtk-gui/gui.stetic, Mono.Addins.Gui.mdp: Flush. * Mono.Addins.Gui/AddinInstallDialog.cs: When checking if an add-in is installed, don't provide the version number. This will return whatever version is installed. 2007-12-04 Geoff Norton * Mono.Addins.Gui/AddinInstallDialog.cs: Use Process.Start to launch a web browser rather than Gnome.Url.Show. * Mono.Addins.Gui.mdp: * Makefile.am: Remove dependency on gnome-sharp 2007-12-04 Lluis Sanchez Gual * mono-addins-gui.pc.in: Fix dependencies. 2007-10-29 Lluis Sanchez Gual * Mono.Addins.Gui.mdp: Update paths. 2007-10-18 Lluis Sanchez Gual * AssemblyInfo.cs: Get ready for 0.3 release. 2007-10-10 Lluis Sanchez Gual * Mono.Addins.Gui/AddinTreeWidget.cs: Make this class public. 2007-09-10 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs, gtk-gui/generated.cs, gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.ErrorDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs, gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs, gtk-gui/gui.stetic, Mono.Addins.Gui/NewSiteDialog.cs: Fix some GUI issues in the manage sites dialog. 2007-08-07 Chris Howie * gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs, gtk-gui/Mono.Addins.Gui.ErrorDialog.cs, gtk-gui/gui.stetic: Removed MonoDevelop-specific strings. * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs, gtk-gui/generated.cs, gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs: Regenerated. * Mono.Addins.Gui/AddinManagerWindow.cs: Added static property for the flag that hides install buttons. * Mono.Addins.Gui/AddinManagerDialog.cs: Implementation of the above property. * icons/system-software-update.png: Added missing icon. 2007-07-16 Lluis Sanchez Gual * Makefile.am: Don't try to install the assembly if gui is disabled. 2007-07-05 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/gui.stetic: The OK button must be hidden by default. 2007-07-03 Lluis Sanchez Gual * AssemblyInfo.cs, Makefile.am, Mono.Addins.Gui.mdp: Sign the assembly. * Mono.Addins.Gui/AddinInstallerDialog.cs: Added missing (C) header. 2007-07-02 Lluis Sanchez Gual * gtk-gui/generated.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs: Updated. * gtk-gui/Mono.Addins.Gui.AddinInstallerDialog.cs, gtk-gui/gui.stetic, Mono.Addins.Gui/AddinInstaller.cs, Mono.Addins.Gui/AddinInstallerDialog.cs: Added an implementation of IAddinInstaller. * Makefile.am, Mono.Addins.Gui.mdp: Added new files. * Mono.Addins.Gui/AddinInstallDialog.cs: Don't include markup in translatable strings. 2007-05-25 Lluis Sanchez Gual * gtk-gui/generated.cs, gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.ErrorDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/gui.stetic: Updated. * Mono.Addins.Gui/AddinManagerDialog.cs: Handle exceptions thrown when enabling/disabling add-ins. 2007-05-10 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/gui.stetic: Updated. * Mono.Addins.Gui/NewSiteDialog.cs, Mono.Addins.Gui/ManageSitesDialog.cs, Mono.Addins.Gui/AddinManagerWindow.cs, Mono.Addins.Gui/Services.cs, Mono.Addins.Gui/AddinInstallDialog.cs, Mono.Addins.Gui/ErrorDialog.cs, Mono.Addins.Gui/AddinManagerDialog.cs: Properly destroy all dialogs. 2007-05-04 Lluis Sanchez Gual * Mono.Addins.mdp: Updated. * Mono.Addins/ExtensionContext.cs: Fixed GetExtensionObjects overload which was not using the correct reuseCachedInstance value. * Mono.Addins/ExtensionTree.cs: Improved error message. When looking for a type in an assembly, avoid throwing an exception too early, since it may be found in other assemblies. * Mono.Addins.Database/AddinDatabase.cs: In the addin info cache, also store information about unsuccessful lookups, to avoid looking for an add-in again if we found that it doesn't exist. In Update(), don't use verbose output by default. 2007-04-04 Lluis Sanchez Gual * Mono.Addins.Gui.csproj: Added msbuild project files. Patch by Matthijs ter Woord. 2007-03-30 Lluis Sanchez Gual * gtk-gui/Mono.Addins.Gui.ManageSitesDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInstallDialog.cs, gtk-gui/Mono.Addins.Gui.ErrorDialog.cs, gtk-gui/Mono.Addins.Gui.AddinManagerDialog.cs, gtk-gui/Mono.Addins.Gui.AddinInfoDialog.cs, gtk-gui/Mono.Addins.Gui.NewSiteDialog.cs, gtk-gui/gui.stetic: Updated. * Mono.Addins.Gui/NewSiteDialog.cs: Implement missing bits in the dialog. * Mono.Addins.Gui/AddinInstallDialog.cs: Fixed nullref. Removed "restart" message. 2007-03-23 Lluis Sanchez Gual * Makefile.am, Mono.Addins.Gui.mdp: Enabled conditional compilation of the gui lib. mono-addins-1.0/Mono.Addins.Gui/policy.0.6.config0000664000175000017500000000055212136524034023432 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Gui/policy.0.4.config0000664000175000017500000000055212136524034023430 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Gui/policy.0.2.config0000664000175000017500000000055212136524034023426 0ustar00directhexdirecthex00000000000000 mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/0000775000175000017500000000000012136524044023275 5ustar00directhexdirecthex00000000000000mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/AddinInfoView.cs0000664000175000017500000003300412136523632026314 0ustar00directhexdirecthex00000000000000// // AddinInfoView.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.IO; using System.Collections.Generic; using Mono.Addins.Setup; using System.Text; using Mono.Unix; using System.Linq; namespace Mono.Addins.Gui { [System.ComponentModel.ToolboxItem(true)] partial class AddinInfoView : Gtk.Bin { List selectedEntry = new List (); List selectedAddin = new List (); SetupService service; HeaderBox topHeaderBox; List previewImages = new List (); ImageContainer titleIcon; int titleWidth; string infoUrl; public event EventHandler InstallClicked; public event EventHandler UninstallClicked; public event EventHandler UpdateClicked; public event EventHandler EnableDisableClicked; public AddinInfoView () { this.Build (); AllowInstall = true; titleWidth = labelName.SizeRequest ().Width; HeaderBox hb = new HeaderBox (1,1,1,1); hb.Show (); hb.Replace (this); hb = new HeaderBox (1,0,0,0); hb.SetPadding (6,6,6,6); hb.Show (); hb.GradientBackround = true; hb.Replace (eboxButs); hb = new HeaderBox (0,1,0,0); hb.SetPadding (6,6,6,6); hb.Show (); hb.GradientBackround = true; hb.Replace (boxHeader); topHeaderBox = hb; } public void Init (SetupService service) { this.service = service; } public bool AllowInstall { get; set; } public List SelectedEntries { get { return this.selectedEntry; } } public List SelectedAddins { get { return this.selectedAddin; } } public void ShowAddins (object[] data) { selectedEntry.Clear (); selectedAddin.Clear (); eboxButs.Visible = true; topHeaderBox.Hide (); urlButton.Hide (); if (titleIcon != null) { boxTitle.Remove (titleIcon); titleIcon.Destroy (); titleIcon = null; } foreach (var img in previewImages) { ((Gtk.Container)img.Parent).Remove (img); img.Destroy (); } previewImages.Clear (); if (data.Length == 1) { headerBox.Show (); ShowAddin (data[0]); } else if (data.Length > 1) { headerBox.Hide (); StringBuilder sb = new StringBuilder (); sb.Append (Catalog.GetString ("Multiple selection:\n\n")); bool allowUpdate = AllowInstall; bool allowInstall = true; bool allowUninstall = AllowInstall; bool allowEnable = true; bool allowDisable = true; foreach (object o in data) { Addin installed; if (o is Addin) { Addin a = (Addin)o; installed = a; selectedAddin.Add (a); sb.Append (a.Name); } else { AddinRepositoryEntry entry = (AddinRepositoryEntry) o; selectedEntry.Add (entry); sb.Append (entry.Addin.Name); installed = AddinManager.Registry.GetAddin (Addin.GetIdName (entry.Addin.Id)); } if (installed != null) { if (GetUpdate (installed) == null) allowUpdate = false; allowInstall = false; if (installed.Enabled) allowEnable = false; else allowDisable = false; } else allowEnable = allowDisable = allowUninstall = allowUpdate = false; sb.Append ('\n'); labelDesc.Text = sb.ToString (); if (allowEnable) { btnDisable.Visible = true; btnDisable.Label = Catalog.GetString ("Enable"); } else if (allowDisable) { btnDisable.Visible = true; btnDisable.Label = Catalog.GetString ("Disable"); } else btnDisable.Visible = false; btnInstall.Visible = allowInstall; btnUninstall.Visible = allowUninstall; btnUpdate.Visible = allowUpdate; } } else { headerBox.Hide (); btnDisable.Visible = false; btnInstall.Visible = false; btnUninstall.Visible = false; btnUpdate.Visible = false; eboxButs.Visible = false; labelDesc.Text = Catalog.GetString ("No selection"); } } void ShowAddin (object data) { AddinHeader sinfo = null; Addin installed = null; AddinHeader updateInfo = null; string repo = ""; string downloadSize = null; topHeaderBox.Hide (); if (data is Addin) { installed = (Addin) data; sinfo = SetupService.GetAddinHeader (installed); var entry = GetUpdate (installed); if (entry != null) { updateInfo = entry.Addin; selectedEntry.Add (entry); } foreach (var prop in sinfo.Properties) { if (prop.Name.StartsWith ("PreviewImage")) previewImages.Add (new ImageContainer (installed, prop.Value)); } string icon32 = sinfo.Properties.GetPropertyValue ("Icon32"); if (icon32.Length > 0) titleIcon = new ImageContainer (installed, icon32); } else if (data is AddinRepositoryEntry) { AddinRepositoryEntry entry = (AddinRepositoryEntry) data; sinfo = entry.Addin; installed = AddinManager.Registry.GetAddin (Addin.GetIdName (sinfo.Id)); if (installed != null && Addin.CompareVersions (installed.Version, sinfo.Version) > 0) updateInfo = sinfo; selectedEntry.Add (entry); string rname = !string.IsNullOrEmpty (entry.RepositoryName) ? entry.RepositoryName : entry.RepositoryUrl; repo = "" + Catalog.GetString ("Available in repository:") + "\n" + GLib.Markup.EscapeText (rname) + "\n\n"; foreach (var prop in sinfo.Properties) { if (prop.Name.StartsWith ("PreviewImage")) previewImages.Add (new ImageContainer (entry, prop.Value)); } string icon32 = sinfo.Properties.GetPropertyValue ("Icon32"); if (icon32.Length > 0) titleIcon = new ImageContainer (entry, icon32); int size; if (int.TryParse (sinfo.Properties.GetPropertyValue ("DownloadSize"), out size)) { float fs = ((float)size) / 1048576f; downloadSize = fs.ToString ("0.00 MB"); } } else selectedEntry.Clear (); if (installed != null) selectedAddin.Add (installed); string missingDepsTxt = null; if (sinfo == null) { btnDisable.Visible = false; btnUninstall.Visible = false; btnUpdate.Visible = false; } else { string version; string newVersion = null; if (installed != null) { btnInstall.Visible = false; btnUpdate.Visible = updateInfo != null && AllowInstall; btnDisable.Visible = true; btnDisable.Label = installed.Enabled ? "Disable" : "Enable"; btnDisable.Visible = installed.Description.CanDisable; btnUninstall.Visible = installed.Description.CanUninstall; version = installed.Version; var missingDeps = Services.GetMissingDependencies (installed); if (updateInfo != null) { newVersion = updateInfo.Version; labelHeader.Markup = "" + Catalog.GetString ("Update available") + ""; // topHeaderBox.BackgroundColor = new Gdk.Color (0, 132, 208); imageHeader.Pixbuf = Gdk.Pixbuf.LoadFromResource ("software-update-available.png"); topHeaderBox.BackgroundColor = new Gdk.Color (255, 176, 0); topHeaderBox.Show (); } else if (missingDeps.Any ()) { labelHeader.Markup = "" + Catalog.GetString ("This add-in can't be loaded due to missing dependencies") + ""; topHeaderBox.BackgroundColor = new Gdk.Color (255, 176, 0); imageHeader.SetFromStock (Gtk.Stock.DialogWarning, Gtk.IconSize.Menu); topHeaderBox.Show (); missingDepsTxt = ""; foreach (var mdep in missingDeps) { if (mdep.Found != null) missingDepsTxt += "\n" + string.Format (Catalog.GetString ("Required: {0} v{1}, found v{2}"), mdep.Addin, mdep.Required, mdep.Found); else missingDepsTxt += "\n" + string.Format (Catalog.GetString ("Missing: {0} v{1}"), mdep.Addin, mdep.Required); } } } else { btnInstall.Visible = AllowInstall; btnUpdate.Visible = false; btnDisable.Visible = false; btnUninstall.Visible = false; version = sinfo.Version; } labelName.Markup = "" + GLib.Markup.EscapeText(sinfo.Name) + ""; string ver; if (newVersion != null) { ver = "" + Catalog.GetString ("Installed version") + ": " + version + "\n"; ver += "" + Catalog.GetString ("Repository version") + ": " + newVersion + ""; } else ver = "" + Catalog.GetString ("Version") + " " + version + ""; if (downloadSize != null) ver += "\n" + Catalog.GetString ("Download size") + ": " + downloadSize + ""; if (missingDepsTxt != null) ver += "\n\n" + GLib.Markup.EscapeText (Catalog.GetString ("The following depedencies required by this add-in are not available:")) + missingDepsTxt; labelVersion.Markup = ver; string desc = GLib.Markup.EscapeText (sinfo.Description); labelDesc.Markup = repo + GLib.Markup.EscapeText (desc); foreach (var img in previewImages) vboxDesc.PackStart (img, false, false, 0); urlButton.Visible = !string.IsNullOrEmpty (sinfo.Url); infoUrl = sinfo.Url; if (titleIcon != null) { boxTitle.PackEnd (titleIcon, false, false, 0); labelName.WidthRequest = titleWidth - 32; labelVersion.WidthRequest = titleWidth - 32; } else { labelName.WidthRequest = titleWidth; labelVersion.WidthRequest = titleWidth; } if (IsRealized) SetComponentsBg (); } } public AddinRepositoryEntry GetUpdate (Addin a) { AddinRepositoryEntry[] updates = service.Repositories.GetAvailableAddinUpdates (Addin.GetIdName (a.Id)); AddinRepositoryEntry best = null; string bestVersion = a.Version; foreach (AddinRepositoryEntry e in updates) { if (Addin.CompareVersions (bestVersion, e.Addin.Version) > 0) { best = e; bestVersion = e.Addin.Version; } } return best; } protected virtual void OnBtnInstallClicked (object sender, System.EventArgs e) { if (InstallClicked != null) InstallClicked (this, e); } protected virtual void OnBtnDisableClicked (object sender, System.EventArgs e) { if (EnableDisableClicked != null) EnableDisableClicked (this, e); } protected virtual void OnBtnUpdateClicked (object sender, System.EventArgs e) { if (UpdateClicked != null) UpdateClicked (this, e); } protected virtual void OnBtnUninstallClicked (object sender, System.EventArgs e) { if (UninstallClicked != null) UninstallClicked (this, e); } protected override void OnRealized () { base.OnRealized (); HslColor gcol = ebox.Style.Background (Gtk.StateType.Normal); gcol.L -= 0.03; ebox.ModifyBg (Gtk.StateType.Normal, gcol); ebox2.ModifyBg (Gtk.StateType.Normal, gcol); scrolledwindow.ModifyBg (Gtk.StateType.Normal, gcol); SetComponentsBg (); } void SetComponentsBg () { HslColor gcol = ebox.Style.Background (Gtk.StateType.Normal); //gcol.L -= 0.03; if (titleIcon != null) titleIcon.ModifyBg (Gtk.StateType.Normal, gcol); foreach (var i in previewImages) i.ModifyBg (Gtk.StateType.Normal, gcol); } protected virtual void OnUrlButtonClicked (object sender, System.EventArgs e) { System.Diagnostics.Process.Start (infoUrl); } } class ImageContainer: Gtk.EventBox { AddinRepositoryEntry aentry; IAsyncResult aresult; Gtk.Image image; bool destroyed; ImageContainer () { image = new Gtk.Image (); Add (image); image.SetAlignment (0.5f, 0f); Show (); } public ImageContainer (AddinRepositoryEntry aentry, string fileName): this () { this.aentry = aentry; aresult = aentry.BeginDownloadSupportFile (fileName, ImageDownloaded, null); } public ImageContainer (Addin addin, string fileName): this () { string path = System.IO.Path.Combine (addin.Description.BasePath, fileName); LoadImage (File.OpenRead (path)); } void ImageDownloaded (object state) { Gtk.Application.Invoke (delegate { if (destroyed) return; try { LoadImage (aentry.EndDownloadSupportFile (aresult)); } catch { // ignore } }); } void LoadImage (Stream s) { using (s) { Gdk.PixbufLoader loader = new Gdk.PixbufLoader (s); Gdk.Pixbuf pix = image.Pixbuf = loader.Pixbuf; loader.Dispose (); if (pix.Width > 250) { Gdk.Pixbuf spix = pix.ScaleSimple (250, (250 * pix.Height) / pix.Width, Gdk.InterpType.Hyper); pix.Dispose (); pix = spix; } image.Pixbuf = pix; image.Show (); } } protected override void OnDestroyed () { destroyed = true; base.OnDestroyed (); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/ErrorDialog.cs0000664000175000017500000000542112136523632026041 0ustar00directhexdirecthex00000000000000// // ErrorDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; namespace Mono.Addins.Gui { partial class ErrorDialog : Dialog { TextTag tagNoWrap; TextTag tagWrap; public ErrorDialog (Window parent) { Build (); TransientFor = parent; okButton.Clicked += new EventHandler (OnClose); expander.Activated += new EventHandler (OnExpanded); descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0)); tagNoWrap = new TextTag ("nowrap"); tagNoWrap.WrapMode = WrapMode.None; detailsTextView.Buffer.TagTable.Add (tagNoWrap); tagWrap = new TextTag ("wrap"); tagWrap.WrapMode = WrapMode.Word; detailsTextView.Buffer.TagTable.Add (tagWrap); expander.Visible = false; } public string Message { get { return descriptionLabel.Text; } set { string message = value; while (message.EndsWith ("\r") || message.EndsWith ("\n")) message = message.Substring (0, message.Length - 1); if (!message.EndsWith (".")) message += "."; descriptionLabel.Text = message; } } public void AddDetails (string text, bool wrapped) { TextIter it = detailsTextView.Buffer.EndIter; if (wrapped) detailsTextView.Buffer.InsertWithTags (ref it, text, tagWrap); else detailsTextView.Buffer.InsertWithTags (ref it, text, tagNoWrap); expander.Visible = true; } void OnClose (object sender, EventArgs args) { Destroy (); } void OnExpanded (object sender, EventArgs args) { GLib.Timeout.Add (100, new GLib.TimeoutHandler (UpdateSize)); } bool UpdateSize () { int w, h; GetSize (out w, out h); Resize (w, 1); return false; } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/NewSiteDialog.cs0000664000175000017500000000577112136523632026336 0ustar00directhexdirecthex00000000000000// // NewSiteDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; namespace Mono.Addins.Gui { partial class NewSiteDialog : Dialog { public NewSiteDialog (Gtk.Window parent) { Build (); TransientFor = parent; Services.PlaceDialog (this, parent); pathEntry.Sensitive = false; CheckValues (); } public override void Dispose () { base.Dispose (); Destroy (); } public string Url { get { if (btnOnlineRep.Active) return urlText.Text; else if (pathEntry.Text.Length > 0) return "file://" + pathEntry.Text; else return string.Empty; } } void CheckValues () { btnOk.Sensitive = (Url != ""); } public new bool Run () { ShowAll (); return ((ResponseType) base.Run ()) == ResponseType.Ok; } protected void OnClose (object sender, EventArgs args) { Destroy (); } protected void OnOptionClicked (object sender, EventArgs e) { if (btnOnlineRep.Active) { urlText.Sensitive = true; pathEntry.Sensitive = false; } else { urlText.Sensitive = false; pathEntry.Sensitive = true; } CheckValues (); } protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e) { FileChooserDialog dlg = new FileChooserDialog ("Select Folder", this, FileChooserAction.SelectFolder); try { dlg.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel); dlg.AddButton (Gtk.Stock.Open, Gtk.ResponseType.Ok); dlg.SetFilename (Environment.GetFolderPath (Environment.SpecialFolder.Personal)); if (dlg.Run () == (int) ResponseType.Ok) { pathEntry.Text = dlg.Filename; } } finally { dlg.Destroy (); } } protected virtual void OnPathEntryChanged(object sender, System.EventArgs e) { CheckValues (); } protected virtual void OnUrlTextChanged (object sender, System.EventArgs e) { CheckValues (); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs0000664000175000017500000003743512136524015027270 0ustar00directhexdirecthex00000000000000// // AddinManagerDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; using Mono.Addins.Setup; using Mono.Addins; using Mono.Unix; using System.Threading; using System.Text; using System.Collections.Generic; using System.Linq; namespace Mono.Addins.Gui { partial class AddinManagerDialog : Dialog, IDisposable { AddinTreeWidget tree; AddinTreeWidget galleryTree; AddinTreeWidget updatesTree; SetupService service = new SetupService (); ListStore repoStore; int lastRepoActive; SearchEntry filterEntry; Label installedTabLabel; Label updatesTabLabel; Label galleryTabLabel; const string AllRepoMarker = "__ALL"; const string ManageRepoMarker = "__MANAGE"; internal bool AllowInstall { set { addininfoInstalled.AllowInstall = value; addininfoGallery.AllowInstall = value; addininfoUpdates.AllowInstall = value; } } public AddinManagerDialog (Window parent) { Build (); TransientFor = parent; HasSeparator = false; Services.PlaceDialog (this, parent); Show (); addininfoInstalled.Init (service); addininfoGallery.Init (service); addinTree.Selection.Mode = SelectionMode.Multiple; tree = new AddinTreeWidget (addinTree); addinTree.Selection.Changed += OnSelectionChanged; tree.VersionVisible = false; galleryTreeView.Selection.Mode = SelectionMode.Multiple; galleryTree = new AddinTreeWidget (galleryTreeView); galleryTree.VersionVisible = false; galleryTree.ShowInstalledMarkers = true; galleryTreeView.Selection.Changed += OnGallerySelectionChanged; updatesTreeView.Selection.Mode = SelectionMode.Multiple; updatesTree = new AddinTreeWidget (updatesTreeView); updatesTree.VersionVisible = false; updatesTree.ShowCategories = false; updatesTree.ShowInstalledMarkers = true; updatesTreeView.Selection.Changed += OnGallerySelectionChanged; repoStore = new ListStore (typeof(string), typeof(string)); repoCombo.Model = repoStore; CellRendererText crt = new CellRendererText (); repoCombo.PackStart (crt, true); repoCombo.AddAttribute (crt, "text", 0); repoCombo.RowSeparatorFunc = delegate(TreeModel model, TreeIter iter) { string val = (string) model.GetValue (iter, 0); return val == "---"; }; // Make sure the tree has the focus when switching tabs vboxUpdates.FocusChain = new Widget [] { scrolledUpdates, eboxRepoUpdates }; vboxGallery.FocusChain = new Widget [] { scrolledGallery, eboxRepo }; // Improve the look of the headers HBox tab = new HBox (false, 3); tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-22.png")), false, false, 0); installedTabLabel = new Label (Catalog.GetString ("Installed")); tab.PackStart (installedTabLabel, true, true, 0); tab.BorderWidth = 3; tab.ShowAll (); notebook.SetTabLabel (notebook.GetNthPage (0), tab); tab = new HBox (false, 3); tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("plugin-update-22.png")), false, false, 0); updatesTabLabel = new Label (Catalog.GetString ("Updates")); tab.PackStart (updatesTabLabel, true, true, 0); tab.BorderWidth = 3; tab.ShowAll (); notebook.SetTabLabel (notebook.GetNthPage (1), tab); tab = new HBox (false, 3); tab.PackStart (new Image (Gdk.Pixbuf.LoadFromResource ("system-software-update_22.png")), false, false, 0); galleryTabLabel = new Label (Catalog.GetString ("Gallery")); tab.PackStart (galleryTabLabel, true, true, 0); tab.BorderWidth = 3; tab.ShowAll (); notebook.SetTabLabel (notebook.GetNthPage (2), tab); // Gradient header for the updates and gallery tabs HeaderBox hb = new HeaderBox (1, 0, 1, 1); hb.SetPadding (6,6,6,6); hb.GradientBackround = true; hb.Show (); hb.Replace (eboxRepo); hb = new HeaderBox (1, 0, 1, 1); hb.SetPadding (6,6,6,6); hb.GradientBackround = true; hb.Show (); hb.Replace (eboxRepoUpdates); InsertFilterEntry (); FillRepos (); repoCombo.Active = 0; LoadAll (); } void InsertFilterEntry () { filterEntry = new SearchEntry (); filterEntry.Entry.SetSizeRequest (200, filterEntry.Entry.SizeRequest ().Height); filterEntry.Parent = notebook; filterEntry.Show (); notebook.SizeAllocated += delegate { RepositionFilter (); }; filterEntry.TextChanged += delegate { tree.SetFilter (filterEntry.Text); galleryTree.SetFilter (filterEntry.Text); updatesTree.SetFilter (filterEntry.Text); LoadAll (); addinTree.ExpandAll (); galleryTreeView.ExpandAll (); }; RepositionFilter (); } void RepositionFilter () { int w = filterEntry.SizeRequest ().Width; int h = filterEntry.SizeRequest ().Height; var alloc = notebook.Allocation; filterEntry.Allocation = new Gdk.Rectangle (alloc.Left + alloc.Width - 1 - w, alloc.Y, w, h); } public override void Dispose () { base.Dispose (); Destroy (); } internal void OnSelectionChanged (object sender, EventArgs args) { UpdateAddinInfo (); } internal void OnManageRepos (object sender, EventArgs e) { ManageSitesDialog dlg = new ManageSitesDialog (this, service); try { dlg.Run (); } finally { dlg.Destroy (); } } void LoadAll () { LoadInstalled (); LoadGallery (); LoadUpdates (); UpdateAddinInfo (); } void UpdateAddinInfo () { addininfoInstalled.ShowAddins (tree.ActiveAddinsData); addininfoGallery.ShowAddins (galleryTree.ActiveAddinsData); addininfoUpdates.ShowAddins (updatesTree.ActiveAddinsData); } void LoadInstalled () { object s = tree.SaveStatus (); int count = 0; tree.Clear (); foreach (Addin ainfo in AddinManager.Registry.GetModules (AddinSearchFlags.IncludeAddins | AddinSearchFlags.LatestVersionsOnly)) { if (Services.InApplicationNamespace (service, ainfo.Id) && !ainfo.Description.IsHidden) { AddinHeader ah = SetupService.GetAddinHeader (ainfo); if (IsFiltered (ah)) continue; AddinStatus st = AddinStatus.Installed; if (!ainfo.Enabled || Services.GetMissingDependencies (ainfo).Any()) st |= AddinStatus.Disabled; if (addininfoInstalled.GetUpdate (ainfo) != null) st |= AddinStatus.HasUpdate; tree.AddAddin (ah, ainfo, st); count++; } } if (count > 0) tree.RestoreStatus (s); else tree.ShowEmptyMessage (); UpdateAddinInfo (); installedTabLabel.Text = Catalog.GetString ("Installed"); if (filterEntry.Text.Length != 0 && count > 0) installedTabLabel.Text += " (" + count + ")"; } void FillRepos () { int i = repoCombo.Active; repoStore.Clear (); repoStore.AppendValues (Catalog.GetString ("All repositories"), AllRepoMarker); foreach (AddinRepository rep in service.Repositories.GetRepositories ()) { if (rep.Enabled) repoStore.AppendValues (rep.Title, rep.Url); } repoStore.AppendValues ("---", ""); repoStore.AppendValues (Catalog.GetString ("Manage Repositories..."), ManageRepoMarker); repoCombo.Active = i; } string GetRepoSelection () { Gtk.TreeIter iter; if (!repoCombo.GetActiveIter (out iter)) return null; return (string) repoStore.GetValue (iter, 1); } void LoadGallery () { object s = galleryTree.SaveStatus (); galleryTree.Clear (); string rep = GetRepoSelection (); AddinRepositoryEntry[] reps; if (rep == AllRepoMarker) reps = service.Repositories.GetAvailableAddins (RepositorySearchFlags.LatestVersionsOnly); else reps = service.Repositories.GetAvailableAddins (rep, RepositorySearchFlags.LatestVersionsOnly); int count = 0; foreach (AddinRepositoryEntry arep in reps) { if (!Services.InApplicationNamespace (service, arep.Addin.Id)) continue; if (IsFiltered (arep.Addin)) continue; AddinStatus status = AddinStatus.NotInstalled; // Find whatever version is installed Addin sinfo = AddinManager.Registry.GetAddin (Addin.GetIdName (arep.Addin.Id)); if (sinfo != null) { status |= AddinStatus.Installed; if (!sinfo.Enabled || Services.GetMissingDependencies (sinfo).Any()) status |= AddinStatus.Disabled; if (Addin.CompareVersions (sinfo.Version, arep.Addin.Version) > 0) status |= AddinStatus.HasUpdate; } galleryTree.AddAddin (arep.Addin, arep, status); count++; } if (count > 0) galleryTree.RestoreStatus (s); else galleryTree.ShowEmptyMessage (); galleryTabLabel.Text = Catalog.GetString ("Gallery"); if (filterEntry.Text.Length != 0 && count > 0) galleryTabLabel.Text += " (" + count + ")"; } void LoadUpdates () { object s = updatesTree.SaveStatus (); updatesTree.Clear (); AddinRepositoryEntry[] reps; reps = service.Repositories.GetAvailableAddins (RepositorySearchFlags.LatestVersionsOnly); int count = 0; foreach (AddinRepositoryEntry arep in reps) { if (!Services.InApplicationNamespace (service, arep.Addin.Id)) continue; // Find whatever version is installed Addin sinfo = AddinManager.Registry.GetAddin (Addin.GetIdName (arep.Addin.Id)); if (sinfo == null || !sinfo.Enabled || Addin.CompareVersions (sinfo.Version, arep.Addin.Version) <= 0) continue; if (IsFiltered (arep.Addin)) continue; AddinStatus status = AddinStatus.Installed; if (!sinfo.Enabled || Services.GetMissingDependencies (sinfo).Any()) status |= AddinStatus.Disabled; updatesTree.AddAddin (arep.Addin, arep, status | AddinStatus.HasUpdate); count++; } labelUpdates.Text = string.Format (Catalog.GetPluralString ("{0} update available", "{0} updates available", count), count); updatesTabLabel.Text = Catalog.GetString ("Updates"); if (count > 0) updatesTabLabel.Text += " (" + count + ")"; buttonUpdateAll.Visible = count > 0; if (count > 0) updatesTree.RestoreStatus (s); else updatesTree.ShowEmptyMessage (); } bool IsFiltered (AddinHeader ah) { if (filterEntry.Text.Length == 0) return false; if (ah.Name.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1) return false; if (ah.Description.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1) return false; if (ah.Id.IndexOf (filterEntry.Text, StringComparison.CurrentCultureIgnoreCase) != -1) return false; return true; } void ManageSites () { ManageSitesDialog dlg = new ManageSitesDialog (this, service); try { dlg.Run (); repoCombo.Active = lastRepoActive; FillRepos (); } finally { dlg.Destroy (); } } protected virtual void OnRepoComboChanged (object sender, System.EventArgs e) { if (GetRepoSelection () == ManageRepoMarker) ManageSites (); else LoadGallery (); lastRepoActive = repoCombo.Active; } protected virtual void OnGallerySelectionChanged (object sender, System.EventArgs e) { UpdateAddinInfo (); } protected virtual void OnButtonRefreshClicked (object sender, System.EventArgs e) { ProgressDialog pdlg = new ProgressDialog (this); pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Updating repository")); bool updateDone = false; Thread t = new Thread (delegate () { try { service.Repositories.UpdateAllRepositories (pdlg); } finally { updateDone = true; } }); t.Start (); while (!updateDone) { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); Thread.Sleep (50); } pdlg.Destroy (); LoadGallery (); LoadUpdates (); } protected virtual void OnInstallClicked (object sender, System.EventArgs e) { InstallDialog dlg = new InstallDialog (this, service); try { List selectedEntry = ((AddinInfoView)sender).SelectedEntries; dlg.InitForInstall (selectedEntry.ToArray ()); if (dlg.Run () == (int) Gtk.ResponseType.Ok) LoadAll (); } finally { dlg.Destroy (); } } protected virtual void OnUninstallClicked (object sender, System.EventArgs e) { List selectedAddin = ((AddinInfoView)sender).SelectedAddins; InstallDialog dlg = new InstallDialog (this, service); try { dlg.InitForUninstall (selectedAddin.ToArray ()); if (dlg.Run () == (int) Gtk.ResponseType.Ok) { LoadAll (); } } finally { dlg.Destroy (); } } protected virtual void OnUpdateClicked (object sender, System.EventArgs e) { List selectedEntry = ((AddinInfoView)sender).SelectedEntries; InstallDialog dlg = new InstallDialog (this, service); try { dlg.InitForInstall (selectedEntry.ToArray ()); if (dlg.Run () == (int) Gtk.ResponseType.Ok) LoadAll (); } finally { dlg.Destroy (); } } protected virtual void OnEnableDisableClicked (object sender, System.EventArgs e) { try { foreach (Addin a in ((AddinInfoView)sender).SelectedAddins) { a.Enabled = !a.Enabled; } LoadAll (); } catch (Exception ex) { Services.ShowError (ex, null, this, true); } } protected virtual void OnUpdateAll (object sender, System.EventArgs e) { object[] data = updatesTree.AddinsData; AddinRepositoryEntry[] entries = new AddinRepositoryEntry [data.Length]; Array.Copy (data, entries, data.Length); InstallDialog dlg = new InstallDialog (this, service); try { dlg.InitForInstall (entries); if (dlg.Run () == (int) Gtk.ResponseType.Ok) LoadAll (); } finally { dlg.Destroy (); } } static string lastFolder; protected virtual void OnButtonInstallFromFileClicked (object sender, System.EventArgs e) { string[] files; Gtk.FileChooserDialog dlg = new Gtk.FileChooserDialog (Catalog.GetString ("Install Add-in Package"), this, FileChooserAction.Open); try { if (lastFolder != null) dlg.SetCurrentFolder (lastFolder); else dlg.SetCurrentFolder (Environment.GetFolderPath (Environment.SpecialFolder.Personal)); dlg.SelectMultiple = true; Gtk.FileFilter f = new Gtk.FileFilter (); f.AddPattern ("*.mpack"); f.Name = Catalog.GetString ("Add-in packages"); dlg.AddFilter (f); f = new Gtk.FileFilter (); f.AddPattern ("*"); f.Name = Catalog.GetString ("All files"); dlg.AddFilter (f); dlg.AddButton (Gtk.Stock.Cancel, ResponseType.Cancel); dlg.AddButton (Gtk.Stock.Open, ResponseType.Ok); if (dlg.Run () != (int) Gtk.ResponseType.Ok) return; files = dlg.Filenames; lastFolder = dlg.CurrentFolder; } finally { dlg.Destroy (); } InstallDialog idlg = new InstallDialog (this, service); try { idlg.InitForInstall (files); if (idlg.Run () == (int) Gtk.ResponseType.Ok) LoadAll (); } finally { idlg.Destroy (); } } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/SearchEntry.cs0000664000175000017500000000634712136523632026067 0ustar00directhexdirecthex00000000000000// // SearchEntry.cs // // Author: // Aaron Bockover // Gabriel Burt // // Copyright 2007-2010 Novell, Inc. // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; namespace Mono.Addins.Gui { [System.ComponentModel.ToolboxItem(true)] class SearchEntry : EventBox { HBox box = new HBox (); Gtk.Entry entry = new Gtk.Entry (); HoverImageButton iconFind; HoverImageButton iconClean; const int notifyDelay = 50; bool notifying; public SearchEntry () { entry.HasFrame = false; box.PackStart (entry, true, true, 0); iconFind = new HoverImageButton (IconSize.Menu, Gtk.Stock.Find); box.PackStart (iconFind, false, false, 0); iconClean = new HoverImageButton (IconSize.Menu, Gtk.Stock.Clear); box.PackStart (iconClean, false, false, 0); box.BorderWidth = 1; HeaderBox hbox = new HeaderBox (1,1,1,1); hbox.Show (); hbox.Add (box); Add (hbox); ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal)); iconClean.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal)); iconFind.ModifyBg (StateType.Normal, entry.Style.Base (StateType.Normal)); iconClean.BorderWidth = 1; iconClean.CanFocus = false; iconFind.BorderWidth = 1; iconFind.CanFocus = false; iconClean.Clicked += delegate { entry.Text = string.Empty; }; iconFind.Clicked += delegate { FireSearch (); }; entry.Activated += delegate { FireSearch (); }; ShowAll (); UpdateIcon (); entry.Changed += delegate { UpdateIcon (); FireSearch (); }; } public event EventHandler TextChanged; public Gtk.Entry Entry { get { return this.entry; } set { entry = value; } } public string Text { get { return entry.Text; } } void UpdateIcon () { if (entry.Text.Length > 0) { iconFind.Hide (); iconClean.Show (); } else { iconFind.Show (); iconClean.Hide (); } } void FireSearch () { if (!notifying) { notifying = true; GLib.Timeout.Add (notifyDelay, delegate { notifying = false; if (TextChanged != null) TextChanged (this, EventArgs.Empty); return false; }); } } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/HslColor.cs0000664000175000017500000001047512136523632025362 0ustar00directhexdirecthex00000000000000// // HslColor.cs // // Author: // Mike Krüger // // Copyright (c) 2009 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Gdk; namespace Mono.Addins.Gui { struct HslColor { public double H { get; set; } public double S { get; set; } public double L { get; set; } static Gdk.Color black = new Gdk.Color (0, 0, 0); public static implicit operator Color (HslColor hsl) { if (hsl.L > 1) hsl.L = 1; if (hsl.L < 0) hsl.L = 0; if (hsl.H > 1) hsl.H = 1; if (hsl.H < 0) hsl.H = 0; if (hsl.S > 1) hsl.S = 1; if (hsl.S < 0) hsl.S = 0; double r = 0, g = 0, b = 0; if (hsl.L == 0) return black; if (hsl.S == 0) { r = g = b = hsl.L; } else { double temp2 = hsl.L <= 0.5 ? hsl.L * (1.0 + hsl.S) : hsl.L + hsl.S -(hsl.L * hsl.S); double temp1 = 2.0 * hsl.L - temp2; double[] t3 = new double[] { hsl.H + 1.0 / 3.0, hsl.H, hsl.H - 1.0 / 3.0}; double[] clr= new double[] { 0, 0, 0}; for (int i = 0; i < 3; i++) { if (t3[i] < 0) t3[i] += 1.0; if (t3[i] > 1) t3[i]-=1.0; if (6.0 * t3[i] < 1.0) clr[i] = temp1 + (temp2 - temp1) * t3[i] * 6.0; else if (2.0 * t3[i] < 1.0) clr[i] = temp2; else if (3.0 * t3[i] < 2.0) clr[i] = (temp1 + (temp2 - temp1) * ((2.0 / 3.0) - t3[i]) * 6.0); else clr[i] = temp1; } r = clr[0]; g = clr[1]; b = clr[2]; } return new Color ((byte)(255 * r), (byte)(255 * g), (byte)(255 * b)); } public static Cairo.Color ToCairoColor (Gdk.Color color) { return new Cairo.Color ((double)color.Red / ushort.MaxValue, (double)color.Green / ushort.MaxValue, (double)color.Blue / ushort.MaxValue); } public static implicit operator Cairo.Color (HslColor hsl) { return ToCairoColor ((Gdk.Color)hsl); } public static implicit operator HslColor (Color color) { return new HslColor (color); } public HslColor (Color color) : this () { double r = color.Red / (double)ushort.MaxValue; double g = color.Green / (double)ushort.MaxValue; double b = color.Blue / (double)ushort.MaxValue; double v = System.Math.Max (r, g); v = System.Math.Max (v, b); double m = System.Math.Min (r, g); m = System.Math.Min (m, b); this.L = (m + v) / 2.0; if (this.L <= 0.0) return; double vm = v - m; this.S = vm; if (this.S > 0.0) { this.S /= (this.L <= 0.5) ? (v + m) : (2.0 - v - m); } else { return; } double r2 = (v - r) / vm; double g2 = (v - g) / vm; double b2 = (v - b) / vm; if (r == v) { this.H = (g == m ? 5.0 + b2 : 1.0 - g2); } else if (g == v) { this.H = (b == m ? 1.0 + r2 : 3.0 - b2); } else { this.H = (r == m ? 3.0 + g2 : 5.0 - r2); } this.H /= 6.0; } public static double Brightness (Gdk.Color c) { double r = c.Red / (double)ushort.MaxValue; double g = c.Green / (double)ushort.MaxValue; double b = c.Blue / (double)ushort.MaxValue; return System.Math.Sqrt (r * .241 + g * .691 + b * .068); } public override string ToString () { return string.Format ("[HslColor: H={0}, S={1}, L={2}]", H, S, L); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerWindow.cs0000664000175000017500000000367312136523632027341 0ustar00directhexdirecthex00000000000000// // AddinManagerWindow.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace Mono.Addins.Gui { public class AddinManagerWindow { private static bool mAllowInstall = true; public static bool AllowInstall { get { return mAllowInstall; } set { mAllowInstall = value; } } private AddinManagerWindow() { } private static void InitDialog (AddinManagerDialog dlg) { dlg.AllowInstall = AllowInstall; } public static Gtk.Window Show (Gtk.Window parent) { AddinManagerDialog dlg = new AddinManagerDialog (parent); InitDialog (dlg); dlg.Show (); return dlg; } public static void Run (Gtk.Window parent) { AddinManagerDialog dlg = new AddinManagerDialog (parent); try { InitDialog (dlg); dlg.Run (); } finally { dlg.Destroy (); } } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/ProgressDialog.cs0000664000175000017500000000525112136523632026555 0ustar00directhexdirecthex00000000000000// ProgressDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Gui { internal partial class ProgressDialog : Gtk.Dialog, IProgressStatus { bool cancelled; bool hadError; public ProgressDialog (Gtk.Window parent) { this.Build(); Services.PlaceDialog (this, parent); } public bool IsCanceled { get { return cancelled; } } public int LogLevel { get { return 1; } } public bool HadError { get { return hadError; } } public void SetMessage (string msg) { Gtk.Application.Invoke (delegate { labelMessage.Text = msg; }); } public void SetProgress (double progress) { Gtk.Application.Invoke (delegate { progressbar.Fraction = progress; }); } public void Log (string msg) { Gtk.Application.Invoke (delegate { Gtk.TextIter it = textview.Buffer.EndIter; textview.Buffer.Insert (ref it, msg + "\n"); }); } public void ReportWarning (string message) { Log ("WARNING: " + message); } public void ReportError (string message, Exception exception) { Log ("Error: " + message); if (exception != null) Log (exception.ToString ()); Gtk.Application.Invoke (delegate { Services.ShowError (exception, message, null, true); }); hadError = true; } public void Cancel () { Gtk.Application.Invoke (delegate { cancelled = true; buttonCancel.Sensitive = false; }); } protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e) { Cancel (); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/HoverImageButton.cs0000664000175000017500000001766512136523632027067 0ustar00directhexdirecthex00000000000000/*************************************************************************** * HoverImageButton.cs * * Copyright (C) 2007 Novell, Inc. * Written by Aaron Bockover ****************************************************************************/ /* THIS FILE IS LICENSED UNDER THE MIT LICENSE AS OUTLINED IMMEDIATELY BELOW: * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ using System; using Gtk; namespace Mono.Addins.Gui { class HoverImageButton : EventBox { private static Gdk.Cursor hand_cursor = new Gdk.Cursor(Gdk.CursorType.Hand1); private IconSize icon_size = IconSize.Menu; private string [] icon_names = { "image-missing", Stock.MissingImage }; private Gdk.Pixbuf normal_pixbuf; private Gdk.Pixbuf active_pixbuf; private Image image; private bool is_hovering; private bool is_pressed; private bool draw_focus = true; private event EventHandler clicked; public event EventHandler Clicked { add { clicked += value; } remove { clicked -= value; } } public HoverImageButton() { CanFocus = true; image = new Image(); image.Show(); Add(image); } public HoverImageButton(IconSize size, string icon_name) : this(size, new string [] { icon_name }) { } public HoverImageButton(IconSize size, string [] icon_names) : this() { this.icon_size = size; this.icon_names = icon_names; } public new void Activate() { EventHandler handler = clicked; if(handler != null) { handler(this, EventArgs.Empty); } } private bool changing_style = false; protected override void OnStyleSet(Style previous_style) { if(changing_style) { return; } changing_style = true; if (normal_pixbuf == null) LoadPixbufs(); changing_style = false; } protected override bool OnEnterNotifyEvent(Gdk.EventCrossing evnt) { image.GdkWindow.Cursor = hand_cursor; is_hovering = true; UpdateImage(); return base.OnEnterNotifyEvent(evnt); } protected override bool OnLeaveNotifyEvent(Gdk.EventCrossing evnt) { is_hovering = false; UpdateImage(); return base.OnLeaveNotifyEvent(evnt); } protected override bool OnFocusInEvent(Gdk.EventFocus evnt) { bool ret = base.OnFocusInEvent(evnt); UpdateImage(); return ret; } protected override bool OnFocusOutEvent(Gdk.EventFocus evnt) { bool ret = base.OnFocusOutEvent(evnt); UpdateImage(); return ret; } protected override bool OnButtonPressEvent(Gdk.EventButton evnt) { if(evnt.Button != 1) { return base.OnButtonPressEvent(evnt); } HasFocus = true; is_pressed = true; QueueDraw(); return base.OnButtonPressEvent(evnt); } protected override bool OnButtonReleaseEvent(Gdk.EventButton evnt) { if(evnt.Button != 1) { return base.OnButtonReleaseEvent(evnt); } is_pressed = false; QueueDraw(); Activate(); return base.OnButtonReleaseEvent(evnt); } protected override bool OnExposeEvent(Gdk.EventExpose evnt) { base.OnExposeEvent(evnt); PropagateExpose(Child, evnt); if(HasFocus && draw_focus) { Style.PaintFocus(Style, GdkWindow, StateType.Normal, evnt.Area, this, "button", 0, 0, Allocation.Width, Allocation.Height); } return true; } private void UpdateImage() { image.Pixbuf = is_hovering || is_pressed || HasFocus ? active_pixbuf : normal_pixbuf; } private void LoadPixbufs() { int width, height; Icon.SizeLookup(icon_size, out width, out height); IconTheme theme = IconTheme.GetForScreen(Screen); if(normal_pixbuf != null) { normal_pixbuf.Dispose(); normal_pixbuf = null; } if(active_pixbuf != null) { active_pixbuf.Dispose(); active_pixbuf = null; } for(int i = 0; i < icon_names.Length; i++) { try { normal_pixbuf = RenderIcon(icon_names[i], icon_size, null) ?? theme.LoadIcon(icon_names[i], width, 0); active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30); break; } catch { } } UpdateImage(); } public Gdk.Pixbuf Pixbuf { get { return this.normal_pixbuf; } set { this.normal_pixbuf = value; active_pixbuf = ColorShiftPixbuf(normal_pixbuf, 30); UpdateImage(); } } private static byte PixelClamp(int val) { return (byte)System.Math.Max(0, System.Math.Min(255, val)); } private unsafe Gdk.Pixbuf ColorShiftPixbuf(Gdk.Pixbuf src, byte shift) { Gdk.Pixbuf dest = new Gdk.Pixbuf(src.Colorspace, src.HasAlpha, src.BitsPerSample, src.Width, src.Height); byte *src_pixels_orig = (byte *)src.Pixels; byte *dest_pixels_orig = (byte *)dest.Pixels; for(int i = 0; i < src.Height; i++) { byte *src_pixels = src_pixels_orig + i * src.Rowstride; byte *dest_pixels = dest_pixels_orig + i * dest.Rowstride; for(int j = 0; j < src.Width; j++) { *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift); *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift); *(dest_pixels++) = PixelClamp(*(src_pixels++) + shift); if(src.HasAlpha) { *(dest_pixels++) = *(src_pixels++); } } } return dest; } public string [] IconNames { get { return icon_names; } set { icon_names = value; LoadPixbufs(); } } public IconSize IconSize { get { return icon_size; } set { icon_size = value; LoadPixbufs(); } } public Image Image { get { return image; } } public bool DrawFocus { get { return draw_focus; } set { draw_focus = value; QueueDraw(); } } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/AddinInstallerDialog.cs0000664000175000017500000001124412136523632027645 0ustar00directhexdirecthex00000000000000// // AddinInstallerDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Threading; using System.Collections; using Mono.Addins.Setup; using Mono.Addins.Description; using Mono.Unix; namespace Mono.Addins.Gui { internal partial class AddinInstallerDialog : Gtk.Dialog, IProgressStatus { PackageCollection entries = new PackageCollection (); string[] addinIds; bool addinsNotFound; string errMessage; SetupService setup; public AddinInstallerDialog (AddinRegistry reg, string message, string[] addinIds) { this.Build(); this.addinIds = addinIds; setup = new SetupService (reg); if (!CheckAddins (true)) UpdateRepos (); } bool CheckAddins (bool updating) { string txt = ""; entries.Clear (); bool addinsNotFound = false; foreach (string id in addinIds) { string name = Addin.GetIdName (id); string version = Addin.GetIdVersion (id); AddinRepositoryEntry[] ares = setup.Repositories.GetAvailableAddin (name, version); if (ares.Length == 0) { addinsNotFound = true; if (updating) txt += "" + name + " " + version + " (searching add-in)\n"; else txt += "" + name + " " + version + " (not found)\n"; } else { entries.Add (Package.FromRepository (ares[0])); txt += "" + ares[0].Addin.Name + " " + ares[0].Addin.Version + "\n"; } } PackageCollection toUninstall; DependencyCollection unresolved; if (!setup.ResolveDependencies (this, entries, out toUninstall, out unresolved)) { foreach (Dependency dep in unresolved) { txt += "" + dep.Name + " (not found)\n"; } addinsNotFound = true; } addinList.Markup = txt; return !addinsNotFound; } void UpdateRepos () { progressBar.Show (); setup.Repositories.UpdateAllRepositories (this); progressBar.Hide (); addinsNotFound = CheckAddins (false); if (errMessage != null) { Services.ShowError (null, errMessage, this, true); errMessage = null; } } public int LogLevel { get { return 1; } } public bool IsCanceled { get { return false; } } public bool AddinsNotFound { get { return addinsNotFound; } } public string ErrMessage { get { return errMessage; } } public void SetMessage (string msg) { progressBar.Text = msg; while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); } public void SetProgress (double progress) { progressBar.Fraction = progress; while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); } public void Log (string msg) { } public void ReportWarning (string message) { } public void ReportError (string message, System.Exception exception) { errMessage = message; } public void Cancel () { } protected virtual void OnButtonOkClicked (object sender, System.EventArgs e) { if (addinsNotFound) { errMessage = Catalog.GetString ("Some of the required add-ins were not found"); Respond (Gtk.ResponseType.Ok); } else { errMessage = null; progressBar.Show (); progressBar.Fraction = 0; progressBar.Text = ""; bool res = setup.Install (this, entries); if (!res) { buttonCancel.Sensitive = buttonOk.Sensitive = false; if (errMessage == null) errMessage = Catalog.GetString ("Installation failed"); Services.ShowError (null, errMessage, this, true); } } Respond (Gtk.ResponseType.Ok); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/Services.cs0000664000175000017500000001217012136523632025412 0ustar00directhexdirecthex00000000000000// // Services.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; using Mono.Unix; using Mono.Addins.Setup; using Mono.Addins.Description; using System.Linq; using System.Collections.Generic; namespace Mono.Addins.Gui { internal class Services { public static bool InApplicationNamespace (SetupService service, string id) { return service.ApplicationNamespace == null || id.StartsWith (service.ApplicationNamespace + "."); } public static bool AskQuestion (string question) { MessageDialog md = new MessageDialog (null, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, question); try { int response = md.Run (); return ((ResponseType) response == ResponseType.Yes); } finally { md.Destroy (); } } public static void ShowError (Exception ex, string message, Window parent, bool modal) { ErrorDialog dlg = new ErrorDialog (parent); if (message == null) { if (ex != null) dlg.Message = string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message); else { dlg.Message = "An unknown error occurred"; dlg.AddDetails (Environment.StackTrace, false); } } else dlg.Message = message; if (ex != null) { dlg.AddDetails (string.Format (Catalog.GetString ("Exception occurred: {0}"), ex.Message) + "\n\n", true); dlg.AddDetails (ex.ToString (), false); } if (modal) { dlg.Run (); dlg.Destroy (); } else dlg.Show (); } public struct MissingDepInfo { public string Addin; public string Required; public string Found; } public static IEnumerable GetMissingDependencies (Addin addin) { IEnumerable allAddins = AddinManager.Registry.GetAddins ().Union (AddinManager.Registry.GetAddinRoots ()); foreach (var dep in addin.Description.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep != null) { if (!allAddins.Any (a => Addin.GetIdName (a.Id) == Addin.GetIdName (adep.FullAddinId) && a.SupportsVersion (adep.Version))) { Addin found = allAddins.FirstOrDefault (a => Addin.GetIdName (a.Id) == Addin.GetIdName (adep.FullAddinId)); yield return new MissingDepInfo () { Addin = Addin.GetIdName (adep.FullAddinId), Required = adep.Version, Found = found != null ? found.Version : null }; } } } } public static Gdk.Pixbuf AddIconOverlay (Gdk.Pixbuf target, Gdk.Pixbuf overlay) { Gdk.Pixbuf res = new Gdk.Pixbuf (target.Colorspace, target.HasAlpha, target.BitsPerSample, target.Width, target.Height); res.Fill (0); target.CopyArea (0, 0, target.Width, target.Height, res, 0, 0); overlay.Composite (res, 0, 0, overlay.Width, overlay.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 255); return res; } public static Gdk.Pixbuf DesaturateIcon (Gdk.Pixbuf source) { Gdk.Pixbuf dest = new Gdk.Pixbuf (source.Colorspace, source.HasAlpha, source.BitsPerSample, source.Width, source.Height); dest.Fill (0); source.SaturateAndPixelate (dest, 0, false); return dest; } public static Gdk.Pixbuf FadeIcon (Gdk.Pixbuf source) { Gdk.Pixbuf result = source.Copy (); result.Fill (0); result = result.AddAlpha (true, 0, 0, 0); source.Composite (result, 0, 0, source.Width, source.Height, 0, 0, 1, 1, Gdk.InterpType.Bilinear, 128); return result; } /// /// Positions a dialog relative to its parent on platforms where default placement is known to be poor. /// public static void PlaceDialog (Window child, Window parent) { CenterWindow (child, parent); } /// Centers a window relative to its parent. static void CenterWindow (Window child, Window parent) { child.Child.Show (); int w, h, winw, winh, x, y, winx, winy; child.GetSize (out w, out h); parent.GetSize (out winw, out winh); parent.GetPosition (out winx, out winy); x = System.Math.Max (0, (winw - w) /2) + winx; y = System.Math.Max (0, (winh - h) /2) + winy; child.Move (x, y); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/InstallDialog.cs0000664000175000017500000002064412136523632026362 0ustar00directhexdirecthex00000000000000// // InstallDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Mono.Addins.Setup; using Mono.Addins.Description; using System.Text; using Mono.Unix; using System.Threading; using System.Linq; using System.Collections.Generic; namespace Mono.Addins.Gui { internal partial class InstallDialog : Gtk.Dialog { string[] filesToInstall; AddinRepositoryEntry[] addinsToInstall; PackageCollection packagesToInstall; SetupService service; Gtk.ResponseType response = Gtk.ResponseType.None; IEnumerable uninstallIds; InstallMonitor installMonitor; bool installing; const int MaxHeight = 350; public InstallDialog (Gtk.Window parent, SetupService service) { this.Build (); this.service = service; TransientFor = parent; WindowPosition = Gtk.WindowPosition.CenterOnParent; Services.PlaceDialog (this, parent); boxProgress.Visible = false; Resizable = false; } public void InitForInstall (AddinRepositoryEntry[] addinsToInstall) { this.addinsToInstall = addinsToInstall; FillSummaryPage (); Services.PlaceDialog (this, TransientFor); } public void InitForInstall (string[] filesToInstall) { this.filesToInstall = filesToInstall; FillSummaryPage (); Services.PlaceDialog (this, TransientFor); } public void InitForUninstall (Addin[] info) { this.uninstallIds = info.Select (a => a.Id); buttonOk.Label = Catalog.GetString ("Uninstall"); HashSet sinfos = new HashSet (); StringBuilder sb = new StringBuilder (); sb.Append ("").Append (Catalog.GetString ("The following packages will be uninstalled:")).Append ("\n\n"); foreach (var a in info) { sb.Append (a.Name + "\n\n"); sinfos.UnionWith (service.GetDependentAddins (a.Id, true)); } if (sinfos.Count > 0) { sb.Append ("").Append (Catalog.GetString ("There are other add-ins that depend on the previous ones which will also be uninstalled:")).Append ("\n\n"); foreach (Addin si in sinfos) sb.Append (si.Description.Name + "\n"); } ShowMessage (sb.ToString ()); Services.PlaceDialog (this, TransientFor); } void FillSummaryPage () { PackageCollection packs = new PackageCollection (); if (filesToInstall != null) { foreach (string file in filesToInstall) { packs.Add (Package.FromFile (file)); } } else { foreach (AddinRepositoryEntry arep in addinsToInstall) { packs.Add (Package.FromRepository (arep)); } } packagesToInstall = new PackageCollection (packs); PackageCollection toUninstall; DependencyCollection unresolved; bool res; InstallMonitor m = new InstallMonitor (); res = service.ResolveDependencies (m, packs, out toUninstall, out unresolved); StringBuilder sb = new StringBuilder (); if (!res) { sb.Append ("").Append (Catalog.GetString ("The selected add-ins can't be installed because there are dependency conflicts.")).Append ("\n"); foreach (string s in m.Errors) { sb.Append ("" + s + "\n"); } sb.Append ("\n"); } if (m.Warnings.Count != 0) { foreach (string w in m.Warnings) { sb.Append ("" + w + "\n"); } sb.Append ("\n"); } sb.Append ("").Append (Catalog.GetString ("The following packages will be installed:")).Append ("\n\n"); foreach (Package p in packs) { sb.Append (p.Name); if (!p.SharedInstall) sb.Append (Catalog.GetString (" (in user directory)")); sb.Append ("\n"); } sb.Append ("\n"); if (toUninstall.Count > 0) { sb.Append ("").Append (Catalog.GetString ("The following packages need to be uninstalled:")).Append ("\n\n"); foreach (Package p in toUninstall) { sb.Append (p.Name + "\n"); } sb.Append ("\n"); } if (unresolved.Count > 0) { sb.Append ("").Append (Catalog.GetString ("The following dependencies could not be resolved:")).Append ("\n\n"); foreach (Dependency p in unresolved) { sb.Append (p.Name + "\n"); } sb.Append ("\n"); } buttonOk.Sensitive = res; ShowMessage (sb.ToString ()); } void ShowMessage (string txt) { labelInfo.Markup = txt.TrimEnd ('\n','\t',' '); if (labelInfo.SizeRequest ().Height > MaxHeight) { scrolledwindow1.VscrollbarPolicy = Gtk.PolicyType.Automatic; scrolledwindow1.HeightRequest = MaxHeight; } else { scrolledwindow1.HeightRequest = labelInfo.SizeRequest ().Height; } } protected virtual void OnButtonOkClicked (object sender, System.EventArgs e) { if (response != Gtk.ResponseType.None) { Respond (response); return; } Install (); } protected virtual void OnButtonCancelClicked (object sender, System.EventArgs e) { if (installing) { if (Services.AskQuestion (Catalog.GetString ("Are you sure you want to cancel the installation?"))) installMonitor.Cancel (); } else Respond (Gtk.ResponseType.Cancel); } void Install () { insSeparator.Visible = true; boxProgress.Visible = true; buttonOk.Sensitive = false; string txt; string errmessage; string warnmessage; ThreadStart oper; if (uninstallIds == null) { installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Installing Add-ins")); oper = new ThreadStart (RunInstall); errmessage = Catalog.GetString ("The installation failed!"); warnmessage = Catalog.GetString ("The installation has completed with warnings."); } else { installMonitor = new InstallMonitor (globalProgressLabel, mainProgressBar, Catalog.GetString ("Uninstalling Add-ins")); oper = new ThreadStart (RunUninstall); errmessage = Catalog.GetString ("The uninstallation failed!"); warnmessage = Catalog.GetString ("The uninstallation has completed with warnings."); } installing = true; oper (); installing = false; buttonCancel.Visible = false; buttonOk.Label = Gtk.Stock.Close; buttonOk.UseStock = true; if (installMonitor.Success && installMonitor.Warnings.Count == 0) { Respond (Gtk.ResponseType.Ok); return; } else if (installMonitor.Success) { txt = "" + warnmessage + "\n\n"; foreach (string s in installMonitor.Warnings) txt += GLib.Markup.EscapeText (s) + "\n"; response = Gtk.ResponseType.Ok; buttonOk.Sensitive = true; } else { buttonCancel.Label = Gtk.Stock.Close; buttonCancel.UseStock = true; txt = "" + errmessage + "\n\n"; foreach (string s in installMonitor.Errors) txt += GLib.Markup.EscapeText (s) + "\n"; response = Gtk.ResponseType.Cancel; buttonOk.Sensitive = true; } ShowMessage (txt); } void RunInstall () { try { if (filesToInstall != null) service.Install (installMonitor, filesToInstall); else service.Install (installMonitor, packagesToInstall); } catch (Exception ex) { installMonitor.Errors.Add (ex.Message); } finally { installMonitor.Dispose (); } } void RunUninstall () { try { service.Uninstall (installMonitor, uninstallIds); } catch (Exception ex) { installMonitor.Errors.Add (ex.Message); } finally { installMonitor.Dispose (); } } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/AddinTreeWidget.cs0000664000175000017500000003726312136523632026644 0ustar00directhexdirecthex00000000000000// // AddinTreeWidget.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections; using Gtk; using Gdk; using Mono.Addins; using Mono.Addins.Setup; using Mono.Unix; using System.Collections.Generic; using System.Text; using System.IO; namespace Mono.Addins.Gui { public class AddinTreeWidget { protected Gtk.TreeView treeView; protected Gtk.TreeStore treeStore; bool allowSelection; ArrayList selected = new ArrayList (); Hashtable addinData = new Hashtable (); TreeViewColumn versionColumn; string filter; Dictionary cachedIcons = new Dictionary (); bool disposed; Gdk.Pixbuf iconInstalled; Gdk.Pixbuf updateOverlay; Gdk.Pixbuf installedOverlay; public event EventHandler SelectionChanged; const int ColAddin = 0; const int ColData = 1; const int ColName = 2; const int ColVersion = 3; const int ColAllowSelection = 4; const int ColSelected = 5; const int ColImage = 6; const int ColShowImage = 7; public AddinTreeWidget (Gtk.TreeView treeView) { iconInstalled = Gdk.Pixbuf.LoadFromResource ("plugin-32.png"); updateOverlay = Gdk.Pixbuf.LoadFromResource ("software-update-available-overlay.png"); installedOverlay = Gdk.Pixbuf.LoadFromResource ("installed-overlay.png"); this.treeView = treeView; ArrayList list = new ArrayList (); AddStoreTypes (list); Type[] types = (Type[]) list.ToArray (typeof(Type)); treeStore = new Gtk.TreeStore (types); treeView.Model = treeStore; CreateColumns (); ShowCategories = true; treeView.Destroyed += HandleTreeViewDestroyed; } void HandleTreeViewDestroyed (object sender, EventArgs e) { disposed = true; foreach (var px in cachedIcons.Values) if (px != null) px.Dispose (); } internal void SetFilter (string text) { this.filter = text; } internal void ShowEmptyMessage () { treeStore.AppendValues (null, null, Catalog.GetString ("No add-ins found"), "", false, false, null, false); } protected virtual void AddStoreTypes (ArrayList list) { list.Add (typeof(object)); list.Add (typeof(object)); list.Add (typeof(string)); list.Add (typeof(string)); list.Add (typeof(bool)); list.Add (typeof(bool)); list.Add (typeof (Pixbuf)); list.Add (typeof(bool)); } protected virtual void CreateColumns () { TreeViewColumn col = new TreeViewColumn (); col.Title = Catalog.GetString ("Add-in"); CellRendererToggle crtog = new CellRendererToggle (); crtog.Activatable = true; crtog.Toggled += new ToggledHandler (OnAddinToggled); col.PackStart (crtog, false); CellRendererPixbuf pr = new CellRendererPixbuf (); col.PackStart (pr, false); col.AddAttribute (pr, "pixbuf", ColImage); col.AddAttribute (pr, "visible", ColShowImage); CellRendererText crt = new CellRendererText (); crt.Ellipsize = Pango.EllipsizeMode.End; col.PackStart (crt, true); col.AddAttribute (crt, "markup", ColName); col.AddAttribute (crtog, "visible", ColAllowSelection); col.AddAttribute (crtog, "active", ColSelected); col.Expand = true; treeView.AppendColumn (col); col = new TreeViewColumn (); col.Title = Catalog.GetString ("Version"); col.PackStart (crt, true); col.AddAttribute (crt, "markup", ColVersion); versionColumn = col; treeView.AppendColumn (col); } public bool AllowSelection { get { return allowSelection; } set { allowSelection = value; } } public bool VersionVisible { get { return versionColumn.Visible; } set { versionColumn.Visible = value; treeView.HeadersVisible = value; } } public bool ShowCategories { get; set; } void OnAddinToggled (object o, ToggledArgs args) { TreeIter it; if (treeStore.GetIter (out it, new TreePath (args.Path))) { bool sel = !(bool) treeStore.GetValue (it, 5); treeStore.SetValue (it, 5, sel); AddinHeader info = (AddinHeader) treeStore.GetValue (it, 0); if (sel) selected.Add (info); else selected.Remove (info); OnSelectionChanged (EventArgs.Empty); } } protected virtual void OnSelectionChanged (EventArgs e) { if (SelectionChanged != null) SelectionChanged (this, e); } public void Clear () { addinData.Clear (); selected.Clear (); treeStore.Clear (); } public TreeIter AddAddin (AddinHeader info, object dataItem, bool enabled) { return AddAddin (info, dataItem, enabled, true); } public TreeIter AddAddin (AddinHeader info, object dataItem, bool enabled, bool userDir) { return AddAddin (info, dataItem, enabled ? AddinStatus.Installed : AddinStatus.Disabled | AddinStatus.Installed); } public TreeIter AddAddin (AddinHeader info, object dataItem, AddinStatus status) { addinData [info] = dataItem; TreeIter iter; if (ShowCategories) { TreeIter piter = TreeIter.Zero; if (info.Category == "") { string otherCat = Catalog.GetString ("Other"); piter = FindCategory (otherCat); } else { piter = FindCategory (info.Category); } iter = treeStore.AppendNode (piter); } else { iter = treeStore.AppendNode (); } UpdateRow (iter, info, dataItem, status); return iter; } protected virtual void UpdateRow (TreeIter iter, AddinHeader info, object dataItem, AddinStatus status) { bool sel = selected.Contains (info); treeStore.SetValue (iter, ColAddin, info); treeStore.SetValue (iter, ColData, dataItem); string name = EscapeWithFilterMarker (info.Name); if (!string.IsNullOrEmpty (info.Description)) { string desc = info.Description; int i = desc.IndexOf ('\n'); if (i != -1) desc = desc.Substring (0, i); name += "\n" + EscapeWithFilterMarker (desc) + ""; } if (status != AddinStatus.Disabled) { treeStore.SetValue (iter, ColName, name); treeStore.SetValue (iter, ColVersion, info.Version); treeStore.SetValue (iter, ColAllowSelection, allowSelection); } else { treeStore.SetValue (iter, ColName, "" + name + ""); treeStore.SetValue (iter, ColVersion, "" + info.Version + ""); treeStore.SetValue (iter, ColAllowSelection, false); } treeStore.SetValue (iter, ColShowImage, true); treeStore.SetValue (iter, ColSelected, sel); SetRowIcon (iter, info, dataItem, status); } void SetRowIcon (TreeIter it, AddinHeader info, object dataItem, AddinStatus status) { string customIcom = info.Properties.GetPropertyValue ("Icon32"); string iconId = info.Id + " " + info.Version + " " + customIcom; Gdk.Pixbuf customPix; if (customIcom.Length == 0) { customPix = null; iconId = "__"; } else if (!cachedIcons.TryGetValue (iconId, out customPix)) { if (dataItem is Addin) { string file = Path.Combine (((Addin)dataItem).Description.BasePath, customIcom); if (File.Exists (file)) { try { customPix = new Gdk.Pixbuf (file); } catch (Exception ex) { Console.WriteLine (ex); } } cachedIcons [iconId] = customPix; } else if (dataItem is AddinRepositoryEntry) { AddinRepositoryEntry arep = (AddinRepositoryEntry) dataItem; string tmpId = iconId; arep.BeginDownloadSupportFile (customIcom, delegate (IAsyncResult res) { Gtk.Application.Invoke (delegate { LoadRemoteIcon (it, tmpId, arep, res, info, dataItem, status); }); }, null); iconId = "__"; } } StoreIcon (it, iconId, customPix, status); } Gdk.Pixbuf GetCachedIcon (string id, string effect, Func pixbufGenerator) { Gdk.Pixbuf pix; if (!cachedIcons.TryGetValue (id + "_" + effect, out pix)) cachedIcons [id + "_" + effect] = pix = pixbufGenerator (); return pix; } internal bool ShowInstalledMarkers = false; void StoreIcon (TreeIter it, string iconId, Gdk.Pixbuf customPix, AddinStatus status) { if (customPix == null) customPix = iconInstalled; if ((status & AddinStatus.Installed) == 0) { treeStore.SetValue (it, ColImage, customPix); return; } else if (ShowInstalledMarkers && (status & AddinStatus.HasUpdate) == 0) { customPix = GetCachedIcon (iconId, "InstalledOverlay", delegate { return Services.AddIconOverlay (customPix, installedOverlay); }); iconId = iconId + "_Installed"; } if ((status & AddinStatus.Disabled) != 0) { customPix = GetCachedIcon (iconId, "Desaturate", delegate { return Services.DesaturateIcon (customPix); }); iconId = iconId + "_Desaturate"; } if ((status & AddinStatus.HasUpdate) != 0) customPix = GetCachedIcon (iconId, "UpdateOverlay", delegate { return Services.AddIconOverlay (customPix, updateOverlay); }); treeStore.SetValue (it, ColImage, customPix); } void LoadRemoteIcon (TreeIter it, string iconId, AddinRepositoryEntry arep, IAsyncResult res, AddinHeader info, object dataItem, AddinStatus status) { if (!disposed && treeStore.IterIsValid (it)) { Gdk.Pixbuf customPix = null; try { Gdk.PixbufLoader loader = new Gdk.PixbufLoader (arep.EndDownloadSupportFile (res)); customPix = loader.Pixbuf; } catch (Exception ex) { Console.WriteLine (ex); } cachedIcons [iconId] = customPix; StoreIcon (it, iconId, customPix, status); } } string EscapeWithFilterMarker (string txt) { if (string.IsNullOrEmpty (filter)) return GLib.Markup.EscapeText (txt); StringBuilder sb = new StringBuilder (); int last = 0; int i = txt.IndexOf (filter, StringComparison.CurrentCultureIgnoreCase); while (i != -1) { sb.Append (GLib.Markup.EscapeText (txt.Substring (last, i - last))); sb.Append ("").Append (txt.Substring (i, filter.Length)).Append (""); last = i + filter.Length; i = txt.IndexOf (filter, last, StringComparison.CurrentCultureIgnoreCase); } if (last < txt.Length) sb.Append (GLib.Markup.EscapeText (txt.Substring (last, txt.Length - last))); return sb.ToString (); } public object GetAddinData (AddinHeader info) { return addinData [info]; } public AddinHeader[] GetSelectedAddins () { return (AddinHeader[]) selected.ToArray (typeof(AddinHeader)); } TreeIter FindCategory (string namePath) { TreeIter iter = TreeIter.Zero; string[] paths = namePath.Split ('/'); foreach (string name in paths) { TreeIter child; if (!FindCategory (iter, name, out child)) { if (iter.Equals (TreeIter.Zero)) iter = treeStore.AppendValues (null, null, name, "", false, false, null, false); else iter = treeStore.AppendValues (iter, null, null, name, "", false, false, null, false); } else iter = child; } return iter; } bool FindCategory (TreeIter piter, string name, out TreeIter child) { if (piter.Equals (TreeIter.Zero)) { if (!treeStore.GetIterFirst (out child)) return false; } else if (!treeStore.IterChildren (out child, piter)) return false; do { if (((string) treeStore.GetValue (child, ColName)) == name) { return true; } } while (treeStore.IterNext (ref child)); return false; } public AddinHeader ActiveAddin { get { AddinHeader[] sel = ActiveAddins; if (sel.Length > 0) return sel[0]; else return null; } } public AddinHeader[] ActiveAddins { get { List list = new List (); foreach (TreePath p in treeView.Selection.GetSelectedRows ()) { TreeIter iter; treeStore.GetIter (out iter, p); AddinHeader ah = (AddinHeader) treeStore.GetValue (iter, 0); if (ah != null) list.Add (ah); } return list.ToArray (); } } public object ActiveAddinData { get { AddinHeader ai = ActiveAddin; return ai != null ? GetAddinData (ai) : null; } } public object[] ActiveAddinsData { get { List res = new List (); foreach (AddinHeader ai in ActiveAddins) { res.Add (GetAddinData (ai)); } return res.ToArray (); } } public object[] AddinsData { get { object[] data = new object [addinData.Count]; addinData.Values.CopyTo (data, 0); return data; } } public object SaveStatus () { TreeIter iter; ArrayList list = new ArrayList (); // Save the current selection list.Add (treeView.Selection.GetSelectedRows ()); if (!treeStore.GetIterFirst (out iter)) return null; // Save the expand state do { SaveStatus (list, iter); } while (treeStore.IterNext (ref iter)); return list; } void SaveStatus (ArrayList list, TreeIter iter) { Gtk.TreePath path = treeStore.GetPath (iter); if (treeView.GetRowExpanded (path)) list.Add (path); if (treeStore.IterChildren (out iter, iter)) { do { SaveStatus (list, iter); } while (treeStore.IterNext (ref iter)); } } public void RestoreStatus (object ob) { if (ob == null) return; // The first element is the selection ArrayList list = (ArrayList) ob; TreePath[] selpaths = (TreePath[]) list [0]; list.RemoveAt (0); foreach (TreePath path in list) treeView.ExpandRow (path, false); foreach (TreePath p in selpaths) treeView.Selection.SelectPath (p); } public void SelectAll () { TreeIter iter; if (!treeStore.GetIterFirst (out iter)) return; do { SelectAll (iter); } while (treeStore.IterNext (ref iter)); OnSelectionChanged (EventArgs.Empty); } void SelectAll (TreeIter iter) { AddinHeader info = (AddinHeader) treeStore.GetValue (iter, ColAddin); if (info != null) { treeStore.SetValue (iter, ColSelected, true); if (!selected.Contains (info)) selected.Add (info); treeView.ExpandToPath (treeStore.GetPath (iter)); } else { if (treeStore.IterChildren (out iter, iter)) { do { SelectAll (iter); } while (treeStore.IterNext (ref iter)); } } } public void UnselectAll () { TreeIter iter; if (!treeStore.GetIterFirst (out iter)) return; do { UnselectAll (iter); } while (treeStore.IterNext (ref iter)); OnSelectionChanged (EventArgs.Empty); } void UnselectAll (TreeIter iter) { AddinHeader info = (AddinHeader) treeStore.GetValue (iter, ColAddin); if (info != null) { treeStore.SetValue (iter, ColSelected, false); selected.Remove (info); } else { if (treeStore.IterChildren (out iter, iter)) { do { UnselectAll (iter); } while (treeStore.IterNext (ref iter)); } } } } [Flags] public enum AddinStatus { NotInstalled = 0, Installed = 1, Disabled = 2, HasUpdate = 4 } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/InstallMonitor.cs0000664000175000017500000000634512136523632026614 0ustar00directhexdirecthex00000000000000// // AddinInstallDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Text; using System.Threading; using System.Collections; using System.Collections.Specialized; using System.Diagnostics; using Mono.Unix; using Gtk; using Mono.Addins.Setup; using Mono.Addins.Description; namespace Mono.Addins.Gui { class InstallMonitor: IProgressStatus, IDisposable { Label progressLabel; ProgressBar progressBar; StringCollection errors = new StringCollection (); StringCollection warnings = new StringCollection (); bool canceled; bool done; string mainOperation; public InstallMonitor (Label progressLabel, ProgressBar progressBar, string mainOperation) { this.progressLabel = progressLabel; this.progressBar = progressBar; this.mainOperation = mainOperation; } public InstallMonitor () { } public void SetMessage (string msg) { if (progressLabel != null) progressLabel.Markup = "" + GLib.Markup.EscapeText (mainOperation) + "\n" + GLib.Markup.EscapeText (msg); RunPendingEvents (); } public void SetProgress (double progress) { if (progressBar != null) progressBar.Fraction = progress; RunPendingEvents (); } public void Log (string msg) { Console.WriteLine (msg); } public void ReportWarning (string message) { warnings.Add (message); } public void ReportError (string message, Exception exception) { errors.Add (message); } public bool IsCanceled { get { return canceled; } } public StringCollection Errors { get { return errors; } } public StringCollection Warnings { get { return warnings; } } public void Cancel () { canceled = true; } public int LogLevel { get { return 1; } } public void Dispose () { done = true; } public void WaitForCompleted () { while (!done) { RunPendingEvents (); Thread.Sleep (50); } } public bool Success { get { return errors.Count == 0; } } void RunPendingEvents () { while (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs0000664000175000017500000001151212136523632027146 0ustar00directhexdirecthex00000000000000// // ManageSitesDialog.cs // // Author: // Lluis Sanchez Gual // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using Gtk; using Mono.Unix; using System.Threading; using Mono.Addins.Setup; namespace Mono.Addins.Gui { partial class ManageSitesDialog : Dialog { ListStore treeStore; SetupService service; public ManageSitesDialog (Gtk.Window parent, SetupService service) { Build (); TransientFor = parent; Services.PlaceDialog (this, parent); this.service = service; treeStore = new Gtk.ListStore (typeof (string), typeof (string), typeof(bool)); repoTree.Model = treeStore; repoTree.HeadersVisible = false; var crt = new Gtk.CellRendererToggle (); crt.Toggled += HandleRepoToggled; repoTree.AppendColumn ("", crt, "active", 2); repoTree.AppendColumn ("", new Gtk.CellRendererText (), "markup", 1); repoTree.Selection.Changed += new EventHandler(OnSelect); AddinRepository[] reps = service.Repositories.GetRepositories (); foreach (AddinRepository rep in reps) AppendRepository (rep); btnRemove.Sensitive = false; } public override void Dispose () { base.Dispose (); Destroy (); } void AppendRepository (AddinRepository rep) { string txt = GLib.Markup.EscapeText (rep.Title) + "\n" + GLib.Markup.EscapeText (rep.Url) + ""; treeStore.AppendValues (rep.Url, txt, rep.Enabled); } protected void OnAdd (object sender, EventArgs e) { NewSiteDialog dlg = new NewSiteDialog (this); try { if (dlg.Run ()) { string url = dlg.Url; if (!url.StartsWith ("http://") && !url.StartsWith ("https://") && !url.StartsWith ("file://")) { url = "http://" + url; } try { new Uri (url); } catch { Services.ShowError (null, "Invalid url: " + url, null, true); } if (!service.Repositories.ContainsRepository (url)) { ProgressDialog pdlg = new ProgressDialog (this); pdlg.Show (); pdlg.SetMessage (AddinManager.CurrentLocalizer.GetString ("Registering repository")); bool done = false; AddinRepository rr = null; Exception error = null; ThreadPool.QueueUserWorkItem (delegate { try { rr = service.Repositories.RegisterRepository (pdlg, url, true); } catch (System.Exception ex) { error = ex; } finally { done = true; } }); while (!done) { if (Gtk.Application.EventsPending ()) Gtk.Application.RunIteration (); else Thread.Sleep (100); } pdlg.Destroy (); if (pdlg.HadError) { if (rr != null) service.Repositories.RemoveRepository (rr.Url); return; } if (error != null) { Services.ShowError (error, "The repository could not be registered", null, true); return; } AppendRepository (rr); } } } finally { dlg.Destroy (); } } protected void OnRemove (object sender, EventArgs e) { Gtk.TreeModel foo; Gtk.TreeIter iter; if (!repoTree.Selection.GetSelected (out foo, out iter)) return; string rep = (string) treeStore.GetValue (iter, 0); service.Repositories.RemoveRepository (rep); treeStore.Remove (ref iter); } void HandleRepoToggled (object o, ToggledArgs args) { Gtk.TreeIter iter; if (!treeStore.GetIterFromString (out iter, args.Path)) return; bool newVal = !(bool) treeStore.GetValue (iter, 2); string rep = (string) treeStore.GetValue (iter, 0); service.Repositories.SetRepositoryEnabled (rep, newVal); treeStore.SetValue (iter, 2, newVal); } protected void OnSelect(object sender, EventArgs e) { btnRemove.Sensitive = repoTree.Selection.CountSelectedRows() > 0; } } } mono-addins-1.0/Mono.Addins.Gui/Mono.Addins.Gui/HeaderBox.cs0000664000175000017500000001245112136524015025466 0ustar00directhexdirecthex00000000000000// // HeaderBox.cs // // Author: // Lluis Sanchez Gual // // Copyright (c) 2011 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Gtk; namespace Mono.Addins.Gui { class HeaderBox: Bin { Gtk.Widget child; int topMargin; int bottomMargin; int leftMargin; int rightMargin; int topPadding; int bottomPadding; int leftPadding; int rightPadding; bool useCustomColor; Gdk.Color customColor; public HeaderBox () { } public HeaderBox (int topMargin, int bottomMargin, int leftMargin, int rightMargin) { SetMargins (topMargin, bottomMargin, leftMargin, rightMargin); } public void Replace (Gtk.Bin parent) { Gtk.Widget c = parent.Child; parent.Remove (c); Add (c); parent.Add (this); } public void SetMargins (int topMargin, int bottomMargin, int leftMargin, int rightMargin) { this.topMargin = topMargin; this.bottomMargin = bottomMargin; this.leftMargin = leftMargin; this.rightMargin = rightMargin; } public void SetPadding (int topPadding, int bottomPadding, int leftPadding, int rightPadding) { this.topPadding = topPadding; this.bottomPadding = bottomPadding; this.leftPadding = leftPadding; this.rightPadding = rightPadding; } public bool GradientBackround { get; set; } public Gdk.Color BackgroundColor { get { return customColor; } set { customColor = value; useCustomColor = true; } } public void ResetBackgroundColor () { useCustomColor = false; } protected override void OnAdded (Widget widget) { base.OnAdded (widget); child = widget; } protected override void OnSizeRequested (ref Requisition requisition) { if (child != null) { requisition = child.SizeRequest (); requisition.Width += leftMargin + rightMargin + leftPadding + rightPadding; requisition.Height += topMargin + bottomMargin + topPadding + bottomPadding; } else { requisition.Width = 0; requisition.Height = 0; } } protected override void OnSizeAllocated (Gdk.Rectangle allocation) { base.OnSizeAllocated (allocation); if (allocation.Width > leftMargin + rightMargin + leftPadding + rightPadding) { allocation.X += leftMargin + leftPadding; allocation.Width -= leftMargin + rightMargin + leftPadding + rightPadding; } if (allocation.Height > topMargin + bottomMargin + topPadding + bottomPadding) { allocation.Y += topMargin + topPadding; allocation.Height -= topMargin + bottomMargin + topPadding + bottomPadding; } if (child != null) child.SizeAllocate (allocation); } protected override bool OnExposeEvent (Gdk.EventExpose evnt) { Gdk.Rectangle rect; if (GradientBackround) { rect = new Gdk.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height); HslColor gcol = useCustomColor ? customColor : Parent.Style.Background (Gtk.StateType.Normal); using (Cairo.Context cr = Gdk.CairoHelper.Create (GdkWindow)) { cr.NewPath (); cr.MoveTo (rect.X, rect.Y); cr.RelLineTo (rect.Width, 0); cr.RelLineTo (0, rect.Height); cr.RelLineTo (-rect.Width, 0); cr.RelLineTo (0, -rect.Height); cr.ClosePath (); Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Y + rect.Height - 1); Cairo.Color color1 = gcol; pat.AddColorStop (0, color1); gcol.L -= 0.1; if (gcol.L < 0) gcol.L = 0; pat.AddColorStop (1, gcol); cr.Pattern = pat; cr.FillPreserve (); } } bool res = base.OnExposeEvent (evnt); Gdk.GC borderColor = Parent.Style.DarkGC (Gtk.StateType.Normal); rect = Allocation; for (int n=0; n